filters.texi 757 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632
  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}@@@var{id}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program optionally followed by "@@@var{id}".
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{FILTER_NAME} ::= @var{NAME}["@@"@var{NAME}]
  173. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  174. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  175. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  176. @var{FILTER} ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  177. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  178. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  179. @end example
  180. @anchor{filtergraph escaping}
  181. @section Notes on filtergraph escaping
  182. Filtergraph description composition entails several levels of
  183. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  184. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  185. information about the employed escaping procedure.
  186. A first level escaping affects the content of each filter option
  187. value, which may contain the special character @code{:} used to
  188. separate values, or one of the escaping characters @code{\'}.
  189. A second level escaping affects the whole filter description, which
  190. may contain the escaping characters @code{\'} or the special
  191. characters @code{[],;} used by the filtergraph description.
  192. Finally, when you specify a filtergraph on a shell commandline, you
  193. need to perform a third level escaping for the shell special
  194. characters contained within it.
  195. For example, consider the following string to be embedded in
  196. the @ref{drawtext} filter description @option{text} value:
  197. @example
  198. this is a 'string': may contain one, or more, special characters
  199. @end example
  200. This string contains the @code{'} special escaping character, and the
  201. @code{:} special character, so it needs to be escaped in this way:
  202. @example
  203. text=this is a \'string\'\: may contain one, or more, special characters
  204. @end example
  205. A second level of escaping is required when embedding the filter
  206. description in a filtergraph description, in order to escape all the
  207. filtergraph special characters. Thus the example above becomes:
  208. @example
  209. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  210. @end example
  211. (note that in addition to the @code{\'} escaping special characters,
  212. also @code{,} needs to be escaped).
  213. Finally an additional level of escaping is needed when writing the
  214. filtergraph description in a shell command, which depends on the
  215. escaping rules of the adopted shell. For example, assuming that
  216. @code{\} is special and needs to be escaped with another @code{\}, the
  217. previous string will finally result in:
  218. @example
  219. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  220. @end example
  221. @chapter Timeline editing
  222. Some filters support a generic @option{enable} option. For the filters
  223. supporting timeline editing, this option can be set to an expression which is
  224. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  225. the filter will be enabled, otherwise the frame will be sent unchanged to the
  226. next filter in the filtergraph.
  227. The expression accepts the following values:
  228. @table @samp
  229. @item t
  230. timestamp expressed in seconds, NAN if the input timestamp is unknown
  231. @item n
  232. sequential number of the input frame, starting from 0
  233. @item pos
  234. the position in the file of the input frame, NAN if unknown
  235. @item w
  236. @item h
  237. width and height of the input frame if video
  238. @end table
  239. Additionally, these filters support an @option{enable} command that can be used
  240. to re-define the expression.
  241. Like any other filtering option, the @option{enable} option follows the same
  242. rules.
  243. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  244. minutes, and a @ref{curves} filter starting at 3 seconds:
  245. @example
  246. smartblur = enable='between(t,10,3*60)',
  247. curves = enable='gte(t,3)' : preset=cross_process
  248. @end example
  249. See @code{ffmpeg -filters} to view which filters have timeline support.
  250. @c man end FILTERGRAPH DESCRIPTION
  251. @anchor{commands}
  252. @chapter Changing options at runtime with a command
  253. Some options can be changed during the operation of the filter using
  254. a command. These options are marked 'T' on the output of
  255. @command{ffmpeg} @option{-h filter=<name of filter>}.
  256. The name of the command is the name of the option and the argument is
  257. the new value.
  258. @anchor{framesync}
  259. @chapter Options for filters with several inputs (framesync)
  260. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  261. Some filters with several inputs support a common set of options.
  262. These options can only be set by name, not with the short notation.
  263. @table @option
  264. @item eof_action
  265. The action to take when EOF is encountered on the secondary input; it accepts
  266. one of the following values:
  267. @table @option
  268. @item repeat
  269. Repeat the last frame (the default).
  270. @item endall
  271. End both streams.
  272. @item pass
  273. Pass the main input through.
  274. @end table
  275. @item shortest
  276. If set to 1, force the output to terminate when the shortest input
  277. terminates. Default value is 0.
  278. @item repeatlast
  279. If set to 1, force the filter to extend the last frame of secondary streams
  280. until the end of the primary stream. A value of 0 disables this behavior.
  281. Default value is 1.
  282. @end table
  283. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  284. @chapter Audio Filters
  285. @c man begin AUDIO FILTERS
  286. When you configure your FFmpeg build, you can disable any of the
  287. existing filters using @code{--disable-filters}.
  288. The configure output will show the audio filters included in your
  289. build.
  290. Below is a description of the currently available audio filters.
  291. @section acompressor
  292. A compressor is mainly used to reduce the dynamic range of a signal.
  293. Especially modern music is mostly compressed at a high ratio to
  294. improve the overall loudness. It's done to get the highest attention
  295. of a listener, "fatten" the sound and bring more "power" to the track.
  296. If a signal is compressed too much it may sound dull or "dead"
  297. afterwards or it may start to "pump" (which could be a powerful effect
  298. but can also destroy a track completely).
  299. The right compression is the key to reach a professional sound and is
  300. the high art of mixing and mastering. Because of its complex settings
  301. it may take a long time to get the right feeling for this kind of effect.
  302. Compression is done by detecting the volume above a chosen level
  303. @code{threshold} and dividing it by the factor set with @code{ratio}.
  304. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  305. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  306. the signal would cause distortion of the waveform the reduction can be
  307. levelled over the time. This is done by setting "Attack" and "Release".
  308. @code{attack} determines how long the signal has to rise above the threshold
  309. before any reduction will occur and @code{release} sets the time the signal
  310. has to fall below the threshold to reduce the reduction again. Shorter signals
  311. than the chosen attack time will be left untouched.
  312. The overall reduction of the signal can be made up afterwards with the
  313. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  314. raising the makeup to this level results in a signal twice as loud than the
  315. source. To gain a softer entry in the compression the @code{knee} flattens the
  316. hard edge at the threshold in the range of the chosen decibels.
  317. The filter accepts the following options:
  318. @table @option
  319. @item level_in
  320. Set input gain. Default is 1. Range is between 0.015625 and 64.
  321. @item mode
  322. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  323. Default is @code{downward}.
  324. @item threshold
  325. If a signal of stream rises above this level it will affect the gain
  326. reduction.
  327. By default it is 0.125. Range is between 0.00097563 and 1.
  328. @item ratio
  329. Set a ratio by which the signal is reduced. 1:2 means that if the level
  330. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  331. Default is 2. Range is between 1 and 20.
  332. @item attack
  333. Amount of milliseconds the signal has to rise above the threshold before gain
  334. reduction starts. Default is 20. Range is between 0.01 and 2000.
  335. @item release
  336. Amount of milliseconds the signal has to fall below the threshold before
  337. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  338. @item makeup
  339. Set the amount by how much signal will be amplified after processing.
  340. Default is 1. Range is from 1 to 64.
  341. @item knee
  342. Curve the sharp knee around the threshold to enter gain reduction more softly.
  343. Default is 2.82843. Range is between 1 and 8.
  344. @item link
  345. Choose if the @code{average} level between all channels of input stream
  346. or the louder(@code{maximum}) channel of input stream affects the
  347. reduction. Default is @code{average}.
  348. @item detection
  349. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  350. of @code{rms}. Default is @code{rms} which is mostly smoother.
  351. @item mix
  352. How much to use compressed signal in output. Default is 1.
  353. Range is between 0 and 1.
  354. @end table
  355. @subsection Commands
  356. This filter supports the all above options as @ref{commands}.
  357. @section acontrast
  358. Simple audio dynamic range compression/expansion filter.
  359. The filter accepts the following options:
  360. @table @option
  361. @item contrast
  362. Set contrast. Default is 33. Allowed range is between 0 and 100.
  363. @end table
  364. @section acopy
  365. Copy the input audio source unchanged to the output. This is mainly useful for
  366. testing purposes.
  367. @section acrossfade
  368. Apply cross fade from one input audio stream to another input audio stream.
  369. The cross fade is applied for specified duration near the end of first stream.
  370. The filter accepts the following options:
  371. @table @option
  372. @item nb_samples, ns
  373. Specify the number of samples for which the cross fade effect has to last.
  374. At the end of the cross fade effect the first input audio will be completely
  375. silent. Default is 44100.
  376. @item duration, d
  377. Specify the duration of the cross fade effect. See
  378. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  379. for the accepted syntax.
  380. By default the duration is determined by @var{nb_samples}.
  381. If set this option is used instead of @var{nb_samples}.
  382. @item overlap, o
  383. Should first stream end overlap with second stream start. Default is enabled.
  384. @item curve1
  385. Set curve for cross fade transition for first stream.
  386. @item curve2
  387. Set curve for cross fade transition for second stream.
  388. For description of available curve types see @ref{afade} filter description.
  389. @end table
  390. @subsection Examples
  391. @itemize
  392. @item
  393. Cross fade from one input to another:
  394. @example
  395. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  396. @end example
  397. @item
  398. Cross fade from one input to another but without overlapping:
  399. @example
  400. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  401. @end example
  402. @end itemize
  403. @section acrossover
  404. Split audio stream into several bands.
  405. This filter splits audio stream into two or more frequency ranges.
  406. Summing all streams back will give flat output.
  407. The filter accepts the following options:
  408. @table @option
  409. @item split
  410. Set split frequencies. Those must be positive and increasing.
  411. @item order
  412. Set filter order for each band split. This controls filter roll-off or steepness
  413. of filter transfer function.
  414. Available values are:
  415. @table @samp
  416. @item 2nd
  417. 12 dB per octave.
  418. @item 4th
  419. 24 dB per octave.
  420. @item 6th
  421. 36 dB per octave.
  422. @item 8th
  423. 48 dB per octave.
  424. @item 10th
  425. 60 dB per octave.
  426. @item 12th
  427. 72 dB per octave.
  428. @item 14th
  429. 84 dB per octave.
  430. @item 16th
  431. 96 dB per octave.
  432. @item 18th
  433. 108 dB per octave.
  434. @item 20th
  435. 120 dB per octave.
  436. @end table
  437. Default is @var{4th}.
  438. @item level
  439. Set input gain level. Allowed range is from 0 to 1. Default value is 1.
  440. @item gains
  441. Set output gain for each band. Default value is 1 for all bands.
  442. @end table
  443. @subsection Examples
  444. @itemize
  445. @item
  446. Split input audio stream into two bands (low and high) with split frequency of 1500 Hz,
  447. each band will be in separate stream:
  448. @example
  449. ffmpeg -i in.flac -filter_complex 'acrossover=split=1500[LOW][HIGH]' -map '[LOW]' low.wav -map '[HIGH]' high.wav
  450. @end example
  451. @item
  452. Same as above, but with higher filter order:
  453. @example
  454. ffmpeg -i in.flac -filter_complex 'acrossover=split=1500:order=8th[LOW][HIGH]' -map '[LOW]' low.wav -map '[HIGH]' high.wav
  455. @end example
  456. @item
  457. Same as above, but also with additional middle band (frequencies between 1500 and 8000):
  458. @example
  459. ffmpeg -i in.flac -filter_complex 'acrossover=split=1500 8000:order=8th[LOW][MID][HIGH]' -map '[LOW]' low.wav -map '[MID]' mid.wav -map '[HIGH]' high.wav
  460. @end example
  461. @end itemize
  462. @section acrusher
  463. Reduce audio bit resolution.
  464. This filter is bit crusher with enhanced functionality. A bit crusher
  465. is used to audibly reduce number of bits an audio signal is sampled
  466. with. This doesn't change the bit depth at all, it just produces the
  467. effect. Material reduced in bit depth sounds more harsh and "digital".
  468. This filter is able to even round to continuous values instead of discrete
  469. bit depths.
  470. Additionally it has a D/C offset which results in different crushing of
  471. the lower and the upper half of the signal.
  472. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  473. Another feature of this filter is the logarithmic mode.
  474. This setting switches from linear distances between bits to logarithmic ones.
  475. The result is a much more "natural" sounding crusher which doesn't gate low
  476. signals for example. The human ear has a logarithmic perception,
  477. so this kind of crushing is much more pleasant.
  478. Logarithmic crushing is also able to get anti-aliased.
  479. The filter accepts the following options:
  480. @table @option
  481. @item level_in
  482. Set level in.
  483. @item level_out
  484. Set level out.
  485. @item bits
  486. Set bit reduction.
  487. @item mix
  488. Set mixing amount.
  489. @item mode
  490. Can be linear: @code{lin} or logarithmic: @code{log}.
  491. @item dc
  492. Set DC.
  493. @item aa
  494. Set anti-aliasing.
  495. @item samples
  496. Set sample reduction.
  497. @item lfo
  498. Enable LFO. By default disabled.
  499. @item lforange
  500. Set LFO range.
  501. @item lforate
  502. Set LFO rate.
  503. @end table
  504. @subsection Commands
  505. This filter supports the all above options as @ref{commands}.
  506. @section acue
  507. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  508. filter.
  509. @section adeclick
  510. Remove impulsive noise from input audio.
  511. Samples detected as impulsive noise are replaced by interpolated samples using
  512. autoregressive modelling.
  513. @table @option
  514. @item window, w
  515. Set window size, in milliseconds. Allowed range is from @code{10} to
  516. @code{100}. Default value is @code{55} milliseconds.
  517. This sets size of window which will be processed at once.
  518. @item overlap, o
  519. Set window overlap, in percentage of window size. Allowed range is from
  520. @code{50} to @code{95}. Default value is @code{75} percent.
  521. Setting this to a very high value increases impulsive noise removal but makes
  522. whole process much slower.
  523. @item arorder, a
  524. Set autoregression order, in percentage of window size. Allowed range is from
  525. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  526. controls quality of interpolated samples using neighbour good samples.
  527. @item threshold, t
  528. Set threshold value. Allowed range is from @code{1} to @code{100}.
  529. Default value is @code{2}.
  530. This controls the strength of impulsive noise which is going to be removed.
  531. The lower value, the more samples will be detected as impulsive noise.
  532. @item burst, b
  533. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  534. @code{10}. Default value is @code{2}.
  535. If any two samples detected as noise are spaced less than this value then any
  536. sample between those two samples will be also detected as noise.
  537. @item method, m
  538. Set overlap method.
  539. It accepts the following values:
  540. @table @option
  541. @item add, a
  542. Select overlap-add method. Even not interpolated samples are slightly
  543. changed with this method.
  544. @item save, s
  545. Select overlap-save method. Not interpolated samples remain unchanged.
  546. @end table
  547. Default value is @code{a}.
  548. @end table
  549. @section adeclip
  550. Remove clipped samples from input audio.
  551. Samples detected as clipped are replaced by interpolated samples using
  552. autoregressive modelling.
  553. @table @option
  554. @item window, w
  555. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  556. Default value is @code{55} milliseconds.
  557. This sets size of window which will be processed at once.
  558. @item overlap, o
  559. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  560. to @code{95}. Default value is @code{75} percent.
  561. @item arorder, a
  562. Set autoregression order, in percentage of window size. Allowed range is from
  563. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  564. quality of interpolated samples using neighbour good samples.
  565. @item threshold, t
  566. Set threshold value. Allowed range is from @code{1} to @code{100}.
  567. Default value is @code{10}. Higher values make clip detection less aggressive.
  568. @item hsize, n
  569. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  570. Default value is @code{1000}. Higher values make clip detection less aggressive.
  571. @item method, m
  572. Set overlap method.
  573. It accepts the following values:
  574. @table @option
  575. @item add, a
  576. Select overlap-add method. Even not interpolated samples are slightly changed
  577. with this method.
  578. @item save, s
  579. Select overlap-save method. Not interpolated samples remain unchanged.
  580. @end table
  581. Default value is @code{a}.
  582. @end table
  583. @section adecorrelate
  584. Apply decorrelation to input audio stream.
  585. The filter accepts the following options:
  586. @table @option
  587. @item stages
  588. Set decorrelation stages of filtering. Allowed
  589. range is from 1 to 16. Default value is 6.
  590. @item seed
  591. Set random seed used for setting delay in samples across channels.
  592. @end table
  593. @section adelay
  594. Delay one or more audio channels.
  595. Samples in delayed channel are filled with silence.
  596. The filter accepts the following option:
  597. @table @option
  598. @item delays
  599. Set list of delays in milliseconds for each channel separated by '|'.
  600. Unused delays will be silently ignored. If number of given delays is
  601. smaller than number of channels all remaining channels will not be delayed.
  602. If you want to delay exact number of samples, append 'S' to number.
  603. If you want instead to delay in seconds, append 's' to number.
  604. @item all
  605. Use last set delay for all remaining channels. By default is disabled.
  606. This option if enabled changes how option @code{delays} is interpreted.
  607. @end table
  608. @subsection Examples
  609. @itemize
  610. @item
  611. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  612. the second channel (and any other channels that may be present) unchanged.
  613. @example
  614. adelay=1500|0|500
  615. @end example
  616. @item
  617. Delay second channel by 500 samples, the third channel by 700 samples and leave
  618. the first channel (and any other channels that may be present) unchanged.
  619. @example
  620. adelay=0|500S|700S
  621. @end example
  622. @item
  623. Delay all channels by same number of samples:
  624. @example
  625. adelay=delays=64S:all=1
  626. @end example
  627. @end itemize
  628. @section adenorm
  629. Remedy denormals in audio by adding extremely low-level noise.
  630. This filter shall be placed before any filter that can produce denormals.
  631. A description of the accepted parameters follows.
  632. @table @option
  633. @item level
  634. Set level of added noise in dB. Default is @code{-351}.
  635. Allowed range is from -451 to -90.
  636. @item type
  637. Set type of added noise.
  638. @table @option
  639. @item dc
  640. Add DC signal.
  641. @item ac
  642. Add AC signal.
  643. @item square
  644. Add square signal.
  645. @item pulse
  646. Add pulse signal.
  647. @end table
  648. Default is @code{dc}.
  649. @end table
  650. @subsection Commands
  651. This filter supports the all above options as @ref{commands}.
  652. @section aderivative, aintegral
  653. Compute derivative/integral of audio stream.
  654. Applying both filters one after another produces original audio.
  655. @section adynamicequalizer
  656. Apply dynamic equalization to input audio stream.
  657. A description of the accepted options follows.
  658. @table @option
  659. @item threshold
  660. Set the detection threshold used to trigger equalization.
  661. Threshold detection is using bandpass filter.
  662. Default value is 0. Allowed range is from 0 to 100.
  663. @item dfrequency
  664. Set the detection frequency in Hz used for bandpass filter used to trigger equalization.
  665. Default value is 1000 Hz. Allowed range is between 2 and 1000000 Hz.
  666. @item dqfactor
  667. Set the detection resonance factor for bandpass filter used to trigger equalization.
  668. Default value is 1. Allowed range is from 0.001 to 1000.
  669. @item tfrequency
  670. Set the target frequency of equalization filter.
  671. Default value is 1000 Hz. Allowed range is between 2 and 1000000 Hz.
  672. @item tqfactor
  673. Set the target resonance factor for target equalization filter.
  674. Default value is 1. Allowed range is from 0.001 to 1000.
  675. @item attack
  676. Set the amount of milliseconds the signal from detection has to rise above
  677. the detection threshold before equalization starts.
  678. Default is 20. Allowed range is between 1 and 2000.
  679. @item release
  680. Set the amount of milliseconds the signal from detection has to fall below the
  681. detection threshold before equalization ends.
  682. Default is 200. Allowed range is between 1 and 2000.
  683. @item knee
  684. Curve the sharp knee around the detection threshold to calculate
  685. equalization gain more softly.
  686. Default is 1. Allowed range is between 0 and 8.
  687. @item ratio
  688. Set the ratio by which the equalization gain is raised.
  689. Default is 1. Allowed range is between 1 and 20.
  690. @item makeup
  691. Set the makeup offset in dB by which the equalization gain is raised.
  692. Default is 0. Allowed range is between 0 and 30.
  693. @item range
  694. Set the max allowed cut/boost amount in dB. Default is 0.
  695. Allowed range is from 0 to 200.
  696. @item slew
  697. Set the slew factor. Default is 1. Allowed range is from 1 to 200.
  698. @item mode
  699. Set the mode of filter operation, can be one of the following:
  700. @table @samp
  701. @item listen
  702. Output only isolated bandpass signal.
  703. @item cut
  704. Cut frequencies above detection threshold.
  705. @item boost
  706. Boost frequencies bellow detection threshold.
  707. @end table
  708. Default mode is @samp{cut}.
  709. @end table
  710. @subsection Commands
  711. This filter supports the all above options as @ref{commands}.
  712. @section adynamicsmooth
  713. Apply dynamic smoothing to input audio stream.
  714. A description of the accepted options follows.
  715. @table @option
  716. @item sensitivity
  717. Set an amount of sensitivity to frequency fluctations. Default is 2.
  718. Allowed range is from 0 to 1e+06.
  719. @item basefreq
  720. Set a base frequency for smoothing. Default value is 22050.
  721. Allowed range is from 2 to 1e+06.
  722. @end table
  723. @subsection Commands
  724. This filter supports the all above options as @ref{commands}.
  725. @section aecho
  726. Apply echoing to the input audio.
  727. Echoes are reflected sound and can occur naturally amongst mountains
  728. (and sometimes large buildings) when talking or shouting; digital echo
  729. effects emulate this behaviour and are often used to help fill out the
  730. sound of a single instrument or vocal. The time difference between the
  731. original signal and the reflection is the @code{delay}, and the
  732. loudness of the reflected signal is the @code{decay}.
  733. Multiple echoes can have different delays and decays.
  734. A description of the accepted parameters follows.
  735. @table @option
  736. @item in_gain
  737. Set input gain of reflected signal. Default is @code{0.6}.
  738. @item out_gain
  739. Set output gain of reflected signal. Default is @code{0.3}.
  740. @item delays
  741. Set list of time intervals in milliseconds between original signal and reflections
  742. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  743. Default is @code{1000}.
  744. @item decays
  745. Set list of loudness of reflected signals separated by '|'.
  746. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  747. Default is @code{0.5}.
  748. @end table
  749. @subsection Examples
  750. @itemize
  751. @item
  752. Make it sound as if there are twice as many instruments as are actually playing:
  753. @example
  754. aecho=0.8:0.88:60:0.4
  755. @end example
  756. @item
  757. If delay is very short, then it sounds like a (metallic) robot playing music:
  758. @example
  759. aecho=0.8:0.88:6:0.4
  760. @end example
  761. @item
  762. A longer delay will sound like an open air concert in the mountains:
  763. @example
  764. aecho=0.8:0.9:1000:0.3
  765. @end example
  766. @item
  767. Same as above but with one more mountain:
  768. @example
  769. aecho=0.8:0.9:1000|1800:0.3|0.25
  770. @end example
  771. @end itemize
  772. @section aemphasis
  773. Audio emphasis filter creates or restores material directly taken from LPs or
  774. emphased CDs with different filter curves. E.g. to store music on vinyl the
  775. signal has to be altered by a filter first to even out the disadvantages of
  776. this recording medium.
  777. Once the material is played back the inverse filter has to be applied to
  778. restore the distortion of the frequency response.
  779. The filter accepts the following options:
  780. @table @option
  781. @item level_in
  782. Set input gain.
  783. @item level_out
  784. Set output gain.
  785. @item mode
  786. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  787. use @code{production} mode. Default is @code{reproduction} mode.
  788. @item type
  789. Set filter type. Selects medium. Can be one of the following:
  790. @table @option
  791. @item col
  792. select Columbia.
  793. @item emi
  794. select EMI.
  795. @item bsi
  796. select BSI (78RPM).
  797. @item riaa
  798. select RIAA.
  799. @item cd
  800. select Compact Disc (CD).
  801. @item 50fm
  802. select 50µs (FM).
  803. @item 75fm
  804. select 75µs (FM).
  805. @item 50kf
  806. select 50µs (FM-KF).
  807. @item 75kf
  808. select 75µs (FM-KF).
  809. @end table
  810. @end table
  811. @subsection Commands
  812. This filter supports the all above options as @ref{commands}.
  813. @section aeval
  814. Modify an audio signal according to the specified expressions.
  815. This filter accepts one or more expressions (one for each channel),
  816. which are evaluated and used to modify a corresponding audio signal.
  817. It accepts the following parameters:
  818. @table @option
  819. @item exprs
  820. Set the '|'-separated expressions list for each separate channel. If
  821. the number of input channels is greater than the number of
  822. expressions, the last specified expression is used for the remaining
  823. output channels.
  824. @item channel_layout, c
  825. Set output channel layout. If not specified, the channel layout is
  826. specified by the number of expressions. If set to @samp{same}, it will
  827. use by default the same input channel layout.
  828. @end table
  829. Each expression in @var{exprs} can contain the following constants and functions:
  830. @table @option
  831. @item ch
  832. channel number of the current expression
  833. @item n
  834. number of the evaluated sample, starting from 0
  835. @item s
  836. sample rate
  837. @item t
  838. time of the evaluated sample expressed in seconds
  839. @item nb_in_channels
  840. @item nb_out_channels
  841. input and output number of channels
  842. @item val(CH)
  843. the value of input channel with number @var{CH}
  844. @end table
  845. Note: this filter is slow. For faster processing you should use a
  846. dedicated filter.
  847. @subsection Examples
  848. @itemize
  849. @item
  850. Half volume:
  851. @example
  852. aeval=val(ch)/2:c=same
  853. @end example
  854. @item
  855. Invert phase of the second channel:
  856. @example
  857. aeval=val(0)|-val(1)
  858. @end example
  859. @end itemize
  860. @section aexciter
  861. An exciter is used to produce high sound that is not present in the
  862. original signal. This is done by creating harmonic distortions of the
  863. signal which are restricted in range and added to the original signal.
  864. An Exciter raises the upper end of an audio signal without simply raising
  865. the higher frequencies like an equalizer would do to create a more
  866. "crisp" or "brilliant" sound.
  867. The filter accepts the following options:
  868. @table @option
  869. @item level_in
  870. Set input level prior processing of signal.
  871. Allowed range is from 0 to 64.
  872. Default value is 1.
  873. @item level_out
  874. Set output level after processing of signal.
  875. Allowed range is from 0 to 64.
  876. Default value is 1.
  877. @item amount
  878. Set the amount of harmonics added to original signal.
  879. Allowed range is from 0 to 64.
  880. Default value is 1.
  881. @item drive
  882. Set the amount of newly created harmonics.
  883. Allowed range is from 0.1 to 10.
  884. Default value is 8.5.
  885. @item blend
  886. Set the octave of newly created harmonics.
  887. Allowed range is from -10 to 10.
  888. Default value is 0.
  889. @item freq
  890. Set the lower frequency limit of producing harmonics in Hz.
  891. Allowed range is from 2000 to 12000 Hz.
  892. Default is 7500 Hz.
  893. @item ceil
  894. Set the upper frequency limit of producing harmonics.
  895. Allowed range is from 9999 to 20000 Hz.
  896. If value is lower than 10000 Hz no limit is applied.
  897. @item listen
  898. Mute the original signal and output only added harmonics.
  899. By default is disabled.
  900. @end table
  901. @subsection Commands
  902. This filter supports the all above options as @ref{commands}.
  903. @anchor{afade}
  904. @section afade
  905. Apply fade-in/out effect to input audio.
  906. A description of the accepted parameters follows.
  907. @table @option
  908. @item type, t
  909. Specify the effect type, can be either @code{in} for fade-in, or
  910. @code{out} for a fade-out effect. Default is @code{in}.
  911. @item start_sample, ss
  912. Specify the number of the start sample for starting to apply the fade
  913. effect. Default is 0.
  914. @item nb_samples, ns
  915. Specify the number of samples for which the fade effect has to last. At
  916. the end of the fade-in effect the output audio will have the same
  917. volume as the input audio, at the end of the fade-out transition
  918. the output audio will be silence. Default is 44100.
  919. @item start_time, st
  920. Specify the start time of the fade effect. Default is 0.
  921. The value must be specified as a time duration; see
  922. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  923. for the accepted syntax.
  924. If set this option is used instead of @var{start_sample}.
  925. @item duration, d
  926. Specify the duration of the fade effect. See
  927. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  928. for the accepted syntax.
  929. At the end of the fade-in effect the output audio will have the same
  930. volume as the input audio, at the end of the fade-out transition
  931. the output audio will be silence.
  932. By default the duration is determined by @var{nb_samples}.
  933. If set this option is used instead of @var{nb_samples}.
  934. @item curve
  935. Set curve for fade transition.
  936. It accepts the following values:
  937. @table @option
  938. @item tri
  939. select triangular, linear slope (default)
  940. @item qsin
  941. select quarter of sine wave
  942. @item hsin
  943. select half of sine wave
  944. @item esin
  945. select exponential sine wave
  946. @item log
  947. select logarithmic
  948. @item ipar
  949. select inverted parabola
  950. @item qua
  951. select quadratic
  952. @item cub
  953. select cubic
  954. @item squ
  955. select square root
  956. @item cbr
  957. select cubic root
  958. @item par
  959. select parabola
  960. @item exp
  961. select exponential
  962. @item iqsin
  963. select inverted quarter of sine wave
  964. @item ihsin
  965. select inverted half of sine wave
  966. @item dese
  967. select double-exponential seat
  968. @item desi
  969. select double-exponential sigmoid
  970. @item losi
  971. select logistic sigmoid
  972. @item sinc
  973. select sine cardinal function
  974. @item isinc
  975. select inverted sine cardinal function
  976. @item nofade
  977. no fade applied
  978. @end table
  979. @end table
  980. @subsection Commands
  981. This filter supports the all above options as @ref{commands}.
  982. @subsection Examples
  983. @itemize
  984. @item
  985. Fade in first 15 seconds of audio:
  986. @example
  987. afade=t=in:ss=0:d=15
  988. @end example
  989. @item
  990. Fade out last 25 seconds of a 900 seconds audio:
  991. @example
  992. afade=t=out:st=875:d=25
  993. @end example
  994. @end itemize
  995. @section afftdn
  996. Denoise audio samples with FFT.
  997. A description of the accepted parameters follows.
  998. @table @option
  999. @item nr
  1000. Set the noise reduction in dB, allowed range is 0.01 to 97.
  1001. Default value is 12 dB.
  1002. @item nf
  1003. Set the noise floor in dB, allowed range is -80 to -20.
  1004. Default value is -50 dB.
  1005. @item nt
  1006. Set the noise type.
  1007. It accepts the following values:
  1008. @table @option
  1009. @item w
  1010. Select white noise.
  1011. @item v
  1012. Select vinyl noise.
  1013. @item s
  1014. Select shellac noise.
  1015. @item c
  1016. Select custom noise, defined in @code{bn} option.
  1017. Default value is white noise.
  1018. @end table
  1019. @item bn
  1020. Set custom band noise for every one of 15 bands.
  1021. Bands are separated by ' ' or '|'.
  1022. @item rf
  1023. Set the residual floor in dB, allowed range is -80 to -20.
  1024. Default value is -38 dB.
  1025. @item tn
  1026. Enable noise tracking. By default is disabled.
  1027. With this enabled, noise floor is automatically adjusted.
  1028. @item tr
  1029. Enable residual tracking. By default is disabled.
  1030. @item om
  1031. Set the output mode.
  1032. It accepts the following values:
  1033. @table @option
  1034. @item i
  1035. Pass input unchanged.
  1036. @item o
  1037. Pass noise filtered out.
  1038. @item n
  1039. Pass only noise.
  1040. Default value is @var{o}.
  1041. @end table
  1042. @end table
  1043. @subsection Commands
  1044. This filter supports the following commands:
  1045. @table @option
  1046. @item sample_noise, sn
  1047. Start or stop measuring noise profile.
  1048. Syntax for the command is : "start" or "stop" string.
  1049. After measuring noise profile is stopped it will be
  1050. automatically applied in filtering.
  1051. @item noise_reduction, nr
  1052. Change noise reduction. Argument is single float number.
  1053. Syntax for the command is : "@var{noise_reduction}"
  1054. @item noise_floor, nf
  1055. Change noise floor. Argument is single float number.
  1056. Syntax for the command is : "@var{noise_floor}"
  1057. @item output_mode, om
  1058. Change output mode operation.
  1059. Syntax for the command is : "i", "o" or "n" string.
  1060. @end table
  1061. @section afftfilt
  1062. Apply arbitrary expressions to samples in frequency domain.
  1063. @table @option
  1064. @item real
  1065. Set frequency domain real expression for each separate channel separated
  1066. by '|'. Default is "re".
  1067. If the number of input channels is greater than the number of
  1068. expressions, the last specified expression is used for the remaining
  1069. output channels.
  1070. @item imag
  1071. Set frequency domain imaginary expression for each separate channel
  1072. separated by '|'. Default is "im".
  1073. Each expression in @var{real} and @var{imag} can contain the following
  1074. constants and functions:
  1075. @table @option
  1076. @item sr
  1077. sample rate
  1078. @item b
  1079. current frequency bin number
  1080. @item nb
  1081. number of available bins
  1082. @item ch
  1083. channel number of the current expression
  1084. @item chs
  1085. number of channels
  1086. @item pts
  1087. current frame pts
  1088. @item re
  1089. current real part of frequency bin of current channel
  1090. @item im
  1091. current imaginary part of frequency bin of current channel
  1092. @item real(b, ch)
  1093. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  1094. @item imag(b, ch)
  1095. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  1096. @end table
  1097. @item win_size
  1098. Set window size. Allowed range is from 16 to 131072.
  1099. Default is @code{4096}
  1100. @item win_func
  1101. Set window function.
  1102. It accepts the following values:
  1103. @table @samp
  1104. @item rect
  1105. @item bartlett
  1106. @item hann, hanning
  1107. @item hamming
  1108. @item blackman
  1109. @item welch
  1110. @item flattop
  1111. @item bharris
  1112. @item bnuttall
  1113. @item bhann
  1114. @item sine
  1115. @item nuttall
  1116. @item lanczos
  1117. @item gauss
  1118. @item tukey
  1119. @item dolph
  1120. @item cauchy
  1121. @item parzen
  1122. @item poisson
  1123. @item bohman
  1124. @end table
  1125. Default is @code{hann}.
  1126. @item overlap
  1127. Set window overlap. If set to 1, the recommended overlap for selected
  1128. window function will be picked. Default is @code{0.75}.
  1129. @end table
  1130. @subsection Examples
  1131. @itemize
  1132. @item
  1133. Leave almost only low frequencies in audio:
  1134. @example
  1135. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  1136. @end example
  1137. @item
  1138. Apply robotize effect:
  1139. @example
  1140. afftfilt="real='hypot(re,im)*sin(0)':imag='hypot(re,im)*cos(0)':win_size=512:overlap=0.75"
  1141. @end example
  1142. @item
  1143. Apply whisper effect:
  1144. @example
  1145. afftfilt="real='hypot(re,im)*cos((random(0)*2-1)*2*3.14)':imag='hypot(re,im)*sin((random(1)*2-1)*2*3.14)':win_size=128:overlap=0.8"
  1146. @end example
  1147. @end itemize
  1148. @anchor{afir}
  1149. @section afir
  1150. Apply an arbitrary Finite Impulse Response filter.
  1151. This filter is designed for applying long FIR filters,
  1152. up to 60 seconds long.
  1153. It can be used as component for digital crossover filters,
  1154. room equalization, cross talk cancellation, wavefield synthesis,
  1155. auralization, ambiophonics, ambisonics and spatialization.
  1156. This filter uses the streams higher than first one as FIR coefficients.
  1157. If the non-first stream holds a single channel, it will be used
  1158. for all input channels in the first stream, otherwise
  1159. the number of channels in the non-first stream must be same as
  1160. the number of channels in the first stream.
  1161. It accepts the following parameters:
  1162. @table @option
  1163. @item dry
  1164. Set dry gain. This sets input gain.
  1165. @item wet
  1166. Set wet gain. This sets final output gain.
  1167. @item length
  1168. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  1169. @item gtype
  1170. Enable applying gain measured from power of IR.
  1171. Set which approach to use for auto gain measurement.
  1172. @table @option
  1173. @item none
  1174. Do not apply any gain.
  1175. @item peak
  1176. select peak gain, very conservative approach. This is default value.
  1177. @item dc
  1178. select DC gain, limited application.
  1179. @item gn
  1180. select gain to noise approach, this is most popular one.
  1181. @end table
  1182. @item irgain
  1183. Set gain to be applied to IR coefficients before filtering.
  1184. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  1185. @item irfmt
  1186. Set format of IR stream. Can be @code{mono} or @code{input}.
  1187. Default is @code{input}.
  1188. @item maxir
  1189. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  1190. Allowed range is 0.1 to 60 seconds.
  1191. @item response
  1192. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1193. By default it is disabled.
  1194. @item channel
  1195. Set for which IR channel to display frequency response. By default is first channel
  1196. displayed. This option is used only when @var{response} is enabled.
  1197. @item size
  1198. Set video stream size. This option is used only when @var{response} is enabled.
  1199. @item rate
  1200. Set video stream frame rate. This option is used only when @var{response} is enabled.
  1201. @item minp
  1202. Set minimal partition size used for convolution. Default is @var{8192}.
  1203. Allowed range is from @var{1} to @var{32768}.
  1204. Lower values decreases latency at cost of higher CPU usage.
  1205. @item maxp
  1206. Set maximal partition size used for convolution. Default is @var{8192}.
  1207. Allowed range is from @var{8} to @var{32768}.
  1208. Lower values may increase CPU usage.
  1209. @item nbirs
  1210. Set number of input impulse responses streams which will be switchable at runtime.
  1211. Allowed range is from @var{1} to @var{32}. Default is @var{1}.
  1212. @item ir
  1213. Set IR stream which will be used for convolution, starting from @var{0}, should always be
  1214. lower than supplied value by @code{nbirs} option. Default is @var{0}.
  1215. This option can be changed at runtime via @ref{commands}.
  1216. @end table
  1217. @subsection Examples
  1218. @itemize
  1219. @item
  1220. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  1221. @example
  1222. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  1223. @end example
  1224. @end itemize
  1225. @anchor{aformat}
  1226. @section aformat
  1227. Set output format constraints for the input audio. The framework will
  1228. negotiate the most appropriate format to minimize conversions.
  1229. It accepts the following parameters:
  1230. @table @option
  1231. @item sample_fmts, f
  1232. A '|'-separated list of requested sample formats.
  1233. @item sample_rates, r
  1234. A '|'-separated list of requested sample rates.
  1235. @item channel_layouts, cl
  1236. A '|'-separated list of requested channel layouts.
  1237. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1238. for the required syntax.
  1239. @end table
  1240. If a parameter is omitted, all values are allowed.
  1241. Force the output to either unsigned 8-bit or signed 16-bit stereo
  1242. @example
  1243. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  1244. @end example
  1245. @section afreqshift
  1246. Apply frequency shift to input audio samples.
  1247. The filter accepts the following options:
  1248. @table @option
  1249. @item shift
  1250. Specify frequency shift. Allowed range is -INT_MAX to INT_MAX.
  1251. Default value is 0.0.
  1252. @item level
  1253. Set output gain applied to final output. Allowed range is from 0.0 to 1.0.
  1254. Default value is 1.0.
  1255. @item order
  1256. Set filter order used for filtering. Allowed range is from 1 to 16.
  1257. Default value is 8.
  1258. @end table
  1259. @subsection Commands
  1260. This filter supports the all above options as @ref{commands}.
  1261. @section afwtdn
  1262. Reduce broadband noise from input samples using Wavelets.
  1263. A description of the accepted options follows.
  1264. @table @option
  1265. @item sigma
  1266. Set the noise sigma, allowed range is from 0 to 1.
  1267. Default value is 0.
  1268. This option controls strength of denoising applied to input samples.
  1269. Most useful way to set this option is via decibels, eg. -45dB.
  1270. @item levels
  1271. Set the number of wavelet levels of decomposition.
  1272. Allowed range is from 1 to 12.
  1273. Default value is 10.
  1274. Setting this too low make denoising performance very poor.
  1275. @item wavet
  1276. Set wavelet type for decomposition of input frame.
  1277. They are sorted by number of coefficients, from lowest to highest.
  1278. More coefficients means worse filtering speed, but overall better quality.
  1279. Available wavelets are:
  1280. @table @samp
  1281. @item sym2
  1282. @item sym4
  1283. @item rbior68
  1284. @item deb10
  1285. @item sym10
  1286. @item coif5
  1287. @item bl3
  1288. @end table
  1289. @item percent
  1290. Set percent of full denoising. Allowed range is from 0 to 100 percent.
  1291. Default value is 85 percent or partial denoising.
  1292. @item profile
  1293. If enabled, first input frame will be used as noise profile.
  1294. If first frame samples contain non-noise performance will be very poor.
  1295. @item adaptive
  1296. If enabled, input frames are analyzed for presence of noise.
  1297. If noise is detected with high possibility then input frame profile will be
  1298. used for processing following frames, until new noise frame is detected.
  1299. @item samples
  1300. Set size of single frame in number of samples. Allowed range is from 512 to
  1301. 65536. Default frame size is 8192 samples.
  1302. @item softness
  1303. Set softness applied inside thresholding function. Allowed range is from 0 to
  1304. 10. Default softness is 1.
  1305. @end table
  1306. @subsection Commands
  1307. This filter supports the all above options as @ref{commands}.
  1308. @section agate
  1309. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  1310. processing reduces disturbing noise between useful signals.
  1311. Gating is done by detecting the volume below a chosen level @var{threshold}
  1312. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  1313. floor is set via @var{range}. Because an exact manipulation of the signal
  1314. would cause distortion of the waveform the reduction can be levelled over
  1315. time. This is done by setting @var{attack} and @var{release}.
  1316. @var{attack} determines how long the signal has to fall below the threshold
  1317. before any reduction will occur and @var{release} sets the time the signal
  1318. has to rise above the threshold to reduce the reduction again.
  1319. Shorter signals than the chosen attack time will be left untouched.
  1320. @table @option
  1321. @item level_in
  1322. Set input level before filtering.
  1323. Default is 1. Allowed range is from 0.015625 to 64.
  1324. @item mode
  1325. Set the mode of operation. Can be @code{upward} or @code{downward}.
  1326. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  1327. will be amplified, expanding dynamic range in upward direction.
  1328. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  1329. @item range
  1330. Set the level of gain reduction when the signal is below the threshold.
  1331. Default is 0.06125. Allowed range is from 0 to 1.
  1332. Setting this to 0 disables reduction and then filter behaves like expander.
  1333. @item threshold
  1334. If a signal rises above this level the gain reduction is released.
  1335. Default is 0.125. Allowed range is from 0 to 1.
  1336. @item ratio
  1337. Set a ratio by which the signal is reduced.
  1338. Default is 2. Allowed range is from 1 to 9000.
  1339. @item attack
  1340. Amount of milliseconds the signal has to rise above the threshold before gain
  1341. reduction stops.
  1342. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1343. @item release
  1344. Amount of milliseconds the signal has to fall below the threshold before the
  1345. reduction is increased again. Default is 250 milliseconds.
  1346. Allowed range is from 0.01 to 9000.
  1347. @item makeup
  1348. Set amount of amplification of signal after processing.
  1349. Default is 1. Allowed range is from 1 to 64.
  1350. @item knee
  1351. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1352. Default is 2.828427125. Allowed range is from 1 to 8.
  1353. @item detection
  1354. Choose if exact signal should be taken for detection or an RMS like one.
  1355. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1356. @item link
  1357. Choose if the average level between all channels or the louder channel affects
  1358. the reduction.
  1359. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1360. @end table
  1361. @subsection Commands
  1362. This filter supports the all above options as @ref{commands}.
  1363. @section aiir
  1364. Apply an arbitrary Infinite Impulse Response filter.
  1365. It accepts the following parameters:
  1366. @table @option
  1367. @item zeros, z
  1368. Set B/numerator/zeros/reflection coefficients.
  1369. @item poles, p
  1370. Set A/denominator/poles/ladder coefficients.
  1371. @item gains, k
  1372. Set channels gains.
  1373. @item dry_gain
  1374. Set input gain.
  1375. @item wet_gain
  1376. Set output gain.
  1377. @item format, f
  1378. Set coefficients format.
  1379. @table @samp
  1380. @item ll
  1381. lattice-ladder function
  1382. @item sf
  1383. analog transfer function
  1384. @item tf
  1385. digital transfer function
  1386. @item zp
  1387. Z-plane zeros/poles, cartesian (default)
  1388. @item pr
  1389. Z-plane zeros/poles, polar radians
  1390. @item pd
  1391. Z-plane zeros/poles, polar degrees
  1392. @item sp
  1393. S-plane zeros/poles
  1394. @end table
  1395. @item process, r
  1396. Set type of processing.
  1397. @table @samp
  1398. @item d
  1399. direct processing
  1400. @item s
  1401. serial processing
  1402. @item p
  1403. parallel processing
  1404. @end table
  1405. @item precision, e
  1406. Set filtering precision.
  1407. @table @samp
  1408. @item dbl
  1409. double-precision floating-point (default)
  1410. @item flt
  1411. single-precision floating-point
  1412. @item i32
  1413. 32-bit integers
  1414. @item i16
  1415. 16-bit integers
  1416. @end table
  1417. @item normalize, n
  1418. Normalize filter coefficients, by default is enabled.
  1419. Enabling it will normalize magnitude response at DC to 0dB.
  1420. @item mix
  1421. How much to use filtered signal in output. Default is 1.
  1422. Range is between 0 and 1.
  1423. @item response
  1424. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1425. By default it is disabled.
  1426. @item channel
  1427. Set for which IR channel to display frequency response. By default is first channel
  1428. displayed. This option is used only when @var{response} is enabled.
  1429. @item size
  1430. Set video stream size. This option is used only when @var{response} is enabled.
  1431. @end table
  1432. Coefficients in @code{tf} and @code{sf} format are separated by spaces and are in ascending
  1433. order.
  1434. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1435. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1436. imaginary unit.
  1437. Different coefficients and gains can be provided for every channel, in such case
  1438. use '|' to separate coefficients or gains. Last provided coefficients will be
  1439. used for all remaining channels.
  1440. @subsection Examples
  1441. @itemize
  1442. @item
  1443. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1444. @example
  1445. 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
  1446. @end example
  1447. @item
  1448. Same as above but in @code{zp} format:
  1449. @example
  1450. 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
  1451. @end example
  1452. @item
  1453. Apply 3-rd order analog normalized Butterworth low-pass filter, using analog transfer function format:
  1454. @example
  1455. aiir=z=1.3057 0 0 0:p=1.3057 2.3892 2.1860 1:f=sf:r=d
  1456. @end example
  1457. @end itemize
  1458. @section alimiter
  1459. The limiter prevents an input signal from rising over a desired threshold.
  1460. This limiter uses lookahead technology to prevent your signal from distorting.
  1461. It means that there is a small delay after the signal is processed. Keep in mind
  1462. that the delay it produces is the attack time you set.
  1463. The filter accepts the following options:
  1464. @table @option
  1465. @item level_in
  1466. Set input gain. Default is 1.
  1467. @item level_out
  1468. Set output gain. Default is 1.
  1469. @item limit
  1470. Don't let signals above this level pass the limiter. Default is 1.
  1471. @item attack
  1472. The limiter will reach its attenuation level in this amount of time in
  1473. milliseconds. Default is 5 milliseconds.
  1474. @item release
  1475. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1476. Default is 50 milliseconds.
  1477. @item asc
  1478. When gain reduction is always needed ASC takes care of releasing to an
  1479. average reduction level rather than reaching a reduction of 0 in the release
  1480. time.
  1481. @item asc_level
  1482. Select how much the release time is affected by ASC, 0 means nearly no changes
  1483. in release time while 1 produces higher release times.
  1484. @item level
  1485. Auto level output signal. Default is enabled.
  1486. This normalizes audio back to 0dB if enabled.
  1487. @end table
  1488. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1489. with @ref{aresample} before applying this filter.
  1490. @section allpass
  1491. Apply a two-pole all-pass filter with central frequency (in Hz)
  1492. @var{frequency}, and filter-width @var{width}.
  1493. An all-pass filter changes the audio's frequency to phase relationship
  1494. without changing its frequency to amplitude relationship.
  1495. The filter accepts the following options:
  1496. @table @option
  1497. @item frequency, f
  1498. Set frequency in Hz.
  1499. @item width_type, t
  1500. Set method to specify band-width of filter.
  1501. @table @option
  1502. @item h
  1503. Hz
  1504. @item q
  1505. Q-Factor
  1506. @item o
  1507. octave
  1508. @item s
  1509. slope
  1510. @item k
  1511. kHz
  1512. @end table
  1513. @item width, w
  1514. Specify the band-width of a filter in width_type units.
  1515. @item mix, m
  1516. How much to use filtered signal in output. Default is 1.
  1517. Range is between 0 and 1.
  1518. @item channels, c
  1519. Specify which channels to filter, by default all available are filtered.
  1520. @item normalize, n
  1521. Normalize biquad coefficients, by default is disabled.
  1522. Enabling it will normalize magnitude response at DC to 0dB.
  1523. @item order, o
  1524. Set the filter order, can be 1 or 2. Default is 2.
  1525. @item transform, a
  1526. Set transform type of IIR filter.
  1527. @table @option
  1528. @item di
  1529. @item dii
  1530. @item tdii
  1531. @item latt
  1532. @item svf
  1533. @end table
  1534. @item precision, r
  1535. Set precison of filtering.
  1536. @table @option
  1537. @item auto
  1538. Pick automatic sample format depending on surround filters.
  1539. @item s16
  1540. Always use signed 16-bit.
  1541. @item s32
  1542. Always use signed 32-bit.
  1543. @item f32
  1544. Always use float 32-bit.
  1545. @item f64
  1546. Always use float 64-bit.
  1547. @end table
  1548. @end table
  1549. @subsection Commands
  1550. This filter supports the following commands:
  1551. @table @option
  1552. @item frequency, f
  1553. Change allpass frequency.
  1554. Syntax for the command is : "@var{frequency}"
  1555. @item width_type, t
  1556. Change allpass width_type.
  1557. Syntax for the command is : "@var{width_type}"
  1558. @item width, w
  1559. Change allpass width.
  1560. Syntax for the command is : "@var{width}"
  1561. @item mix, m
  1562. Change allpass mix.
  1563. Syntax for the command is : "@var{mix}"
  1564. @end table
  1565. @section aloop
  1566. Loop audio samples.
  1567. The filter accepts the following options:
  1568. @table @option
  1569. @item loop
  1570. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1571. Default is 0.
  1572. @item size
  1573. Set maximal number of samples. Default is 0.
  1574. @item start
  1575. Set first sample of loop. Default is 0.
  1576. @end table
  1577. @anchor{amerge}
  1578. @section amerge
  1579. Merge two or more audio streams into a single multi-channel stream.
  1580. The filter accepts the following options:
  1581. @table @option
  1582. @item inputs
  1583. Set the number of inputs. Default is 2.
  1584. @end table
  1585. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1586. the channel layout of the output will be set accordingly and the channels
  1587. will be reordered as necessary. If the channel layouts of the inputs are not
  1588. disjoint, the output will have all the channels of the first input then all
  1589. the channels of the second input, in that order, and the channel layout of
  1590. the output will be the default value corresponding to the total number of
  1591. channels.
  1592. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1593. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1594. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1595. first input, b1 is the first channel of the second input).
  1596. On the other hand, if both input are in stereo, the output channels will be
  1597. in the default order: a1, a2, b1, b2, and the channel layout will be
  1598. arbitrarily set to 4.0, which may or may not be the expected value.
  1599. All inputs must have the same sample rate, and format.
  1600. If inputs do not have the same duration, the output will stop with the
  1601. shortest.
  1602. @subsection Examples
  1603. @itemize
  1604. @item
  1605. Merge two mono files into a stereo stream:
  1606. @example
  1607. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1608. @end example
  1609. @item
  1610. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1611. @example
  1612. 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
  1613. @end example
  1614. @end itemize
  1615. @section amix
  1616. Mixes multiple audio inputs into a single output.
  1617. Note that this filter only supports float samples (the @var{amerge}
  1618. and @var{pan} audio filters support many formats). If the @var{amix}
  1619. input has integer samples then @ref{aresample} will be automatically
  1620. inserted to perform the conversion to float samples.
  1621. For example
  1622. @example
  1623. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1624. @end example
  1625. will mix 3 input audio streams to a single output with the same duration as the
  1626. first input and a dropout transition time of 3 seconds.
  1627. It accepts the following parameters:
  1628. @table @option
  1629. @item inputs
  1630. The number of inputs. If unspecified, it defaults to 2.
  1631. @item duration
  1632. How to determine the end-of-stream.
  1633. @table @option
  1634. @item longest
  1635. The duration of the longest input. (default)
  1636. @item shortest
  1637. The duration of the shortest input.
  1638. @item first
  1639. The duration of the first input.
  1640. @end table
  1641. @item dropout_transition
  1642. The transition time, in seconds, for volume renormalization when an input
  1643. stream ends. The default value is 2 seconds.
  1644. @item weights
  1645. Specify weight of each input audio stream as sequence.
  1646. Each weight is separated by space. By default all inputs have same weight.
  1647. @item normalize
  1648. Always scale inputs instead of only doing summation of samples.
  1649. Beware of heavy clipping if inputs are not normalized prior or after filtering
  1650. by this filter if this option is disabled. By default is enabled.
  1651. @end table
  1652. @subsection Commands
  1653. This filter supports the following commands:
  1654. @table @option
  1655. @item weights
  1656. @item normalize
  1657. Syntax is same as option with same name.
  1658. @end table
  1659. @section amultiply
  1660. Multiply first audio stream with second audio stream and store result
  1661. in output audio stream. Multiplication is done by multiplying each
  1662. sample from first stream with sample at same position from second stream.
  1663. With this element-wise multiplication one can create amplitude fades and
  1664. amplitude modulations.
  1665. @section anequalizer
  1666. High-order parametric multiband equalizer for each channel.
  1667. It accepts the following parameters:
  1668. @table @option
  1669. @item params
  1670. This option string is in format:
  1671. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1672. Each equalizer band is separated by '|'.
  1673. @table @option
  1674. @item chn
  1675. Set channel number to which equalization will be applied.
  1676. If input doesn't have that channel the entry is ignored.
  1677. @item f
  1678. Set central frequency for band.
  1679. If input doesn't have that frequency the entry is ignored.
  1680. @item w
  1681. Set band width in Hertz.
  1682. @item g
  1683. Set band gain in dB.
  1684. @item t
  1685. Set filter type for band, optional, can be:
  1686. @table @samp
  1687. @item 0
  1688. Butterworth, this is default.
  1689. @item 1
  1690. Chebyshev type 1.
  1691. @item 2
  1692. Chebyshev type 2.
  1693. @end table
  1694. @end table
  1695. @item curves
  1696. With this option activated frequency response of anequalizer is displayed
  1697. in video stream.
  1698. @item size
  1699. Set video stream size. Only useful if curves option is activated.
  1700. @item mgain
  1701. Set max gain that will be displayed. Only useful if curves option is activated.
  1702. Setting this to a reasonable value makes it possible to display gain which is derived from
  1703. neighbour bands which are too close to each other and thus produce higher gain
  1704. when both are activated.
  1705. @item fscale
  1706. Set frequency scale used to draw frequency response in video output.
  1707. Can be linear or logarithmic. Default is logarithmic.
  1708. @item colors
  1709. Set color for each channel curve which is going to be displayed in video stream.
  1710. This is list of color names separated by space or by '|'.
  1711. Unrecognised or missing colors will be replaced by white color.
  1712. @end table
  1713. @subsection Examples
  1714. @itemize
  1715. @item
  1716. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1717. for first 2 channels using Chebyshev type 1 filter:
  1718. @example
  1719. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1720. @end example
  1721. @end itemize
  1722. @subsection Commands
  1723. This filter supports the following commands:
  1724. @table @option
  1725. @item change
  1726. Alter existing filter parameters.
  1727. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1728. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1729. error is returned.
  1730. @var{freq} set new frequency parameter.
  1731. @var{width} set new width parameter in Hertz.
  1732. @var{gain} set new gain parameter in dB.
  1733. Full filter invocation with asendcmd may look like this:
  1734. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1735. @end table
  1736. @section anlmdn
  1737. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  1738. Each sample is adjusted by looking for other samples with similar contexts. This
  1739. context similarity is defined by comparing their surrounding patches of size
  1740. @option{p}. Patches are searched in an area of @option{r} around the sample.
  1741. The filter accepts the following options:
  1742. @table @option
  1743. @item strength, s
  1744. Set denoising strength. Allowed range is from 0.00001 to 10. Default value is 0.00001.
  1745. @item patch, p
  1746. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  1747. Default value is 2 milliseconds.
  1748. @item research, r
  1749. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  1750. Default value is 6 milliseconds.
  1751. @item output, o
  1752. Set the output mode.
  1753. It accepts the following values:
  1754. @table @option
  1755. @item i
  1756. Pass input unchanged.
  1757. @item o
  1758. Pass noise filtered out.
  1759. @item n
  1760. Pass only noise.
  1761. Default value is @var{o}.
  1762. @end table
  1763. @item smooth, m
  1764. Set smooth factor. Default value is @var{11}. Allowed range is from @var{1} to @var{15}.
  1765. @end table
  1766. @subsection Commands
  1767. This filter supports the all above options as @ref{commands}.
  1768. @section anlmf, anlms
  1769. Apply Normalized Least-Mean-(Squares|Fourth) algorithm to the first audio stream using the second audio stream.
  1770. This adaptive filter is used to mimic a desired filter by finding the filter coefficients that
  1771. relate to producing the least mean square of the error signal (difference between the desired,
  1772. 2nd input audio stream and the actual signal, the 1st input audio stream).
  1773. A description of the accepted options follows.
  1774. @table @option
  1775. @item order
  1776. Set filter order.
  1777. @item mu
  1778. Set filter mu.
  1779. @item eps
  1780. Set the filter eps.
  1781. @item leakage
  1782. Set the filter leakage.
  1783. @item out_mode
  1784. It accepts the following values:
  1785. @table @option
  1786. @item i
  1787. Pass the 1st input.
  1788. @item d
  1789. Pass the 2nd input.
  1790. @item o
  1791. Pass filtered samples.
  1792. @item n
  1793. Pass difference between desired and filtered samples.
  1794. Default value is @var{o}.
  1795. @end table
  1796. @end table
  1797. @subsection Examples
  1798. @itemize
  1799. @item
  1800. One of many usages of this filter is noise reduction, input audio is filtered
  1801. with same samples that are delayed by fixed amount, one such example for stereo audio is:
  1802. @example
  1803. asplit[a][b],[a]adelay=32S|32S[a],[b][a]anlms=order=128:leakage=0.0005:mu=.5:out_mode=o
  1804. @end example
  1805. @end itemize
  1806. @subsection Commands
  1807. This filter supports the same commands as options, excluding option @code{order}.
  1808. @section anull
  1809. Pass the audio source unchanged to the output.
  1810. @section apad
  1811. Pad the end of an audio stream with silence.
  1812. This can be used together with @command{ffmpeg} @option{-shortest} to
  1813. extend audio streams to the same length as the video stream.
  1814. A description of the accepted options follows.
  1815. @table @option
  1816. @item packet_size
  1817. Set silence packet size. Default value is 4096.
  1818. @item pad_len
  1819. Set the number of samples of silence to add to the end. After the
  1820. value is reached, the stream is terminated. This option is mutually
  1821. exclusive with @option{whole_len}.
  1822. @item whole_len
  1823. Set the minimum total number of samples in the output audio stream. If
  1824. the value is longer than the input audio length, silence is added to
  1825. the end, until the value is reached. This option is mutually exclusive
  1826. with @option{pad_len}.
  1827. @item pad_dur
  1828. Specify the duration of samples of silence to add. See
  1829. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1830. for the accepted syntax. Used only if set to non-negative value.
  1831. @item whole_dur
  1832. Specify the minimum total duration in the output audio stream. See
  1833. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1834. for the accepted syntax. Used only if set to non-negative value. If the value is longer than
  1835. the input audio length, silence is added to the end, until the value is reached.
  1836. This option is mutually exclusive with @option{pad_dur}
  1837. @end table
  1838. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  1839. nor @option{whole_dur} option is set, the filter will add silence to the end of
  1840. the input stream indefinitely.
  1841. Note that for ffmpeg 4.4 and earlier a zero @option{pad_dur} or
  1842. @option{whole_dur} also caused the filter to add silence indefinitely.
  1843. @subsection Examples
  1844. @itemize
  1845. @item
  1846. Add 1024 samples of silence to the end of the input:
  1847. @example
  1848. apad=pad_len=1024
  1849. @end example
  1850. @item
  1851. Make sure the audio output will contain at least 10000 samples, pad
  1852. the input with silence if required:
  1853. @example
  1854. apad=whole_len=10000
  1855. @end example
  1856. @item
  1857. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1858. video stream will always result the shortest and will be converted
  1859. until the end in the output file when using the @option{shortest}
  1860. option:
  1861. @example
  1862. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1863. @end example
  1864. @end itemize
  1865. @section aphaser
  1866. Add a phasing effect to the input audio.
  1867. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1868. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1869. A description of the accepted parameters follows.
  1870. @table @option
  1871. @item in_gain
  1872. Set input gain. Default is 0.4.
  1873. @item out_gain
  1874. Set output gain. Default is 0.74
  1875. @item delay
  1876. Set delay in milliseconds. Default is 3.0.
  1877. @item decay
  1878. Set decay. Default is 0.4.
  1879. @item speed
  1880. Set modulation speed in Hz. Default is 0.5.
  1881. @item type
  1882. Set modulation type. Default is triangular.
  1883. It accepts the following values:
  1884. @table @samp
  1885. @item triangular, t
  1886. @item sinusoidal, s
  1887. @end table
  1888. @end table
  1889. @section aphaseshift
  1890. Apply phase shift to input audio samples.
  1891. The filter accepts the following options:
  1892. @table @option
  1893. @item shift
  1894. Specify phase shift. Allowed range is from -1.0 to 1.0.
  1895. Default value is 0.0.
  1896. @item level
  1897. Set output gain applied to final output. Allowed range is from 0.0 to 1.0.
  1898. Default value is 1.0.
  1899. @item order
  1900. Set filter order used for filtering. Allowed range is from 1 to 16.
  1901. Default value is 8.
  1902. @end table
  1903. @subsection Commands
  1904. This filter supports the all above options as @ref{commands}.
  1905. @section apsyclip
  1906. Apply Psychoacoustic clipper to input audio stream.
  1907. The filter accepts the following options:
  1908. @table @option
  1909. @item level_in
  1910. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1911. @item level_out
  1912. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1913. @item clip
  1914. Set the clipping start value. Default value is 0dBFS or 1.
  1915. @item diff
  1916. Output only difference samples, useful to hear introduced distortions.
  1917. By default is disabled.
  1918. @item adaptive
  1919. Set strenght of adaptive distortion applied. Default value is 0.5.
  1920. Allowed range is from 0 to 1.
  1921. @item iterations
  1922. Set number of iterations of psychoacoustic clipper.
  1923. Allowed range is from 1 to 20. Default value is 10.
  1924. @item level
  1925. Auto level output signal. Default is disabled.
  1926. This normalizes audio back to 0dBFS if enabled.
  1927. @end table
  1928. @subsection Commands
  1929. This filter supports the all above options as @ref{commands}.
  1930. @section apulsator
  1931. Audio pulsator is something between an autopanner and a tremolo.
  1932. But it can produce funny stereo effects as well. Pulsator changes the volume
  1933. of the left and right channel based on a LFO (low frequency oscillator) with
  1934. different waveforms and shifted phases.
  1935. This filter have the ability to define an offset between left and right
  1936. channel. An offset of 0 means that both LFO shapes match each other.
  1937. The left and right channel are altered equally - a conventional tremolo.
  1938. An offset of 50% means that the shape of the right channel is exactly shifted
  1939. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1940. an autopanner. At 1 both curves match again. Every setting in between moves the
  1941. phase shift gapless between all stages and produces some "bypassing" sounds with
  1942. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1943. the 0.5) the faster the signal passes from the left to the right speaker.
  1944. The filter accepts the following options:
  1945. @table @option
  1946. @item level_in
  1947. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1948. @item level_out
  1949. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1950. @item mode
  1951. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1952. sawup or sawdown. Default is sine.
  1953. @item amount
  1954. Set modulation. Define how much of original signal is affected by the LFO.
  1955. @item offset_l
  1956. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1957. @item offset_r
  1958. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1959. @item width
  1960. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1961. @item timing
  1962. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1963. @item bpm
  1964. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1965. is set to bpm.
  1966. @item ms
  1967. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1968. is set to ms.
  1969. @item hz
  1970. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1971. if timing is set to hz.
  1972. @end table
  1973. @anchor{aresample}
  1974. @section aresample
  1975. Resample the input audio to the specified parameters, using the
  1976. libswresample library. If none are specified then the filter will
  1977. automatically convert between its input and output.
  1978. This filter is also able to stretch/squeeze the audio data to make it match
  1979. the timestamps or to inject silence / cut out audio to make it match the
  1980. timestamps, do a combination of both or do neither.
  1981. The filter accepts the syntax
  1982. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1983. expresses a sample rate and @var{resampler_options} is a list of
  1984. @var{key}=@var{value} pairs, separated by ":". See the
  1985. @ref{Resampler Options,,"Resampler Options" section in the
  1986. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1987. for the complete list of supported options.
  1988. @subsection Examples
  1989. @itemize
  1990. @item
  1991. Resample the input audio to 44100Hz:
  1992. @example
  1993. aresample=44100
  1994. @end example
  1995. @item
  1996. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1997. samples per second compensation:
  1998. @example
  1999. aresample=async=1000
  2000. @end example
  2001. @end itemize
  2002. @section areverse
  2003. Reverse an audio clip.
  2004. Warning: This filter requires memory to buffer the entire clip, so trimming
  2005. is suggested.
  2006. @subsection Examples
  2007. @itemize
  2008. @item
  2009. Take the first 5 seconds of a clip, and reverse it.
  2010. @example
  2011. atrim=end=5,areverse
  2012. @end example
  2013. @end itemize
  2014. @section arnndn
  2015. Reduce noise from speech using Recurrent Neural Networks.
  2016. This filter accepts the following options:
  2017. @table @option
  2018. @item model, m
  2019. Set train model file to load. This option is always required.
  2020. @item mix
  2021. Set how much to mix filtered samples into final output.
  2022. Allowed range is from -1 to 1. Default value is 1.
  2023. Negative values are special, they set how much to keep filtered noise
  2024. in the final filter output. Set this option to -1 to hear actual
  2025. noise removed from input signal.
  2026. @end table
  2027. @subsection Commands
  2028. This filter supports the all above options as @ref{commands}.
  2029. @section asdr
  2030. Measure Audio Signal-to-Distortion Ratio.
  2031. This filter takes two audio streams for input, and outputs first
  2032. audio stream.
  2033. Results are in dB per channel at end of either input.
  2034. @section asetnsamples
  2035. Set the number of samples per each output audio frame.
  2036. The last output packet may contain a different number of samples, as
  2037. the filter will flush all the remaining samples when the input audio
  2038. signals its end.
  2039. The filter accepts the following options:
  2040. @table @option
  2041. @item nb_out_samples, n
  2042. Set the number of frames per each output audio frame. The number is
  2043. intended as the number of samples @emph{per each channel}.
  2044. Default value is 1024.
  2045. @item pad, p
  2046. If set to 1, the filter will pad the last audio frame with zeroes, so
  2047. that the last frame will contain the same number of samples as the
  2048. previous ones. Default value is 1.
  2049. @end table
  2050. For example, to set the number of per-frame samples to 1234 and
  2051. disable padding for the last frame, use:
  2052. @example
  2053. asetnsamples=n=1234:p=0
  2054. @end example
  2055. @section asetrate
  2056. Set the sample rate without altering the PCM data.
  2057. This will result in a change of speed and pitch.
  2058. The filter accepts the following options:
  2059. @table @option
  2060. @item sample_rate, r
  2061. Set the output sample rate. Default is 44100 Hz.
  2062. @end table
  2063. @section ashowinfo
  2064. Show a line containing various information for each input audio frame.
  2065. The input audio is not modified.
  2066. The shown line contains a sequence of key/value pairs of the form
  2067. @var{key}:@var{value}.
  2068. The following values are shown in the output:
  2069. @table @option
  2070. @item n
  2071. The (sequential) number of the input frame, starting from 0.
  2072. @item pts
  2073. The presentation timestamp of the input frame, in time base units; the time base
  2074. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  2075. @item pts_time
  2076. The presentation timestamp of the input frame in seconds.
  2077. @item pos
  2078. position of the frame in the input stream, -1 if this information in
  2079. unavailable and/or meaningless (for example in case of synthetic audio)
  2080. @item fmt
  2081. The sample format.
  2082. @item chlayout
  2083. The channel layout.
  2084. @item rate
  2085. The sample rate for the audio frame.
  2086. @item nb_samples
  2087. The number of samples (per channel) in the frame.
  2088. @item checksum
  2089. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  2090. audio, the data is treated as if all the planes were concatenated.
  2091. @item plane_checksums
  2092. A list of Adler-32 checksums for each data plane.
  2093. @end table
  2094. @section asoftclip
  2095. Apply audio soft clipping.
  2096. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  2097. along a smooth curve, rather than the abrupt shape of hard-clipping.
  2098. This filter accepts the following options:
  2099. @table @option
  2100. @item type
  2101. Set type of soft-clipping.
  2102. It accepts the following values:
  2103. @table @option
  2104. @item hard
  2105. @item tanh
  2106. @item atan
  2107. @item cubic
  2108. @item exp
  2109. @item alg
  2110. @item quintic
  2111. @item sin
  2112. @item erf
  2113. @end table
  2114. @item threshold
  2115. Set threshold from where to start clipping. Default value is 0dB or 1.
  2116. @item output
  2117. Set gain applied to output. Default value is 0dB or 1.
  2118. @item param
  2119. Set additional parameter which controls sigmoid function.
  2120. @item oversample
  2121. Set oversampling factor.
  2122. @end table
  2123. @subsection Commands
  2124. This filter supports the all above options as @ref{commands}.
  2125. @section aspectralstats
  2126. Display frequency domain statistical information about the audio channels.
  2127. Statistics are calculated and stored as metadata for each audio channel and for each audio frame.
  2128. It accepts the following option:
  2129. @table @option
  2130. @item win_size
  2131. Set the window length in samples. Default value is 2048.
  2132. Allowed range is from 32 to 65536.
  2133. @item win_func
  2134. Set window function.
  2135. It accepts the following values:
  2136. @table @samp
  2137. @item rect
  2138. @item bartlett
  2139. @item hann, hanning
  2140. @item hamming
  2141. @item blackman
  2142. @item welch
  2143. @item flattop
  2144. @item bharris
  2145. @item bnuttall
  2146. @item bhann
  2147. @item sine
  2148. @item nuttall
  2149. @item lanczos
  2150. @item gauss
  2151. @item tukey
  2152. @item dolph
  2153. @item cauchy
  2154. @item parzen
  2155. @item poisson
  2156. @item bohman
  2157. @end table
  2158. Default is @code{hann}.
  2159. @item overlap
  2160. Set window overlap. Allowed range is from @code{0}
  2161. to @code{1}. Default value is @code{0.5}.
  2162. @end table
  2163. A list of each metadata key follows:
  2164. @table @option
  2165. @item mean
  2166. @item variance
  2167. @item centroid
  2168. @item spread
  2169. @item skewness
  2170. @item kurtosis
  2171. @item entropy
  2172. @item flatness
  2173. @item crest
  2174. @item flux
  2175. @item slope
  2176. @item decrease
  2177. @item rolloff
  2178. @end table
  2179. @section asr
  2180. Automatic Speech Recognition
  2181. This filter uses PocketSphinx for speech recognition. To enable
  2182. compilation of this filter, you need to configure FFmpeg with
  2183. @code{--enable-pocketsphinx}.
  2184. It accepts the following options:
  2185. @table @option
  2186. @item rate
  2187. Set sampling rate of input audio. Defaults is @code{16000}.
  2188. This need to match speech models, otherwise one will get poor results.
  2189. @item hmm
  2190. Set dictionary containing acoustic model files.
  2191. @item dict
  2192. Set pronunciation dictionary.
  2193. @item lm
  2194. Set language model file.
  2195. @item lmctl
  2196. Set language model set.
  2197. @item lmname
  2198. Set which language model to use.
  2199. @item logfn
  2200. Set output for log messages.
  2201. @end table
  2202. The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
  2203. @anchor{astats}
  2204. @section astats
  2205. Display time domain statistical information about the audio channels.
  2206. Statistics are calculated and displayed for each audio channel and,
  2207. where applicable, an overall figure is also given.
  2208. It accepts the following option:
  2209. @table @option
  2210. @item length
  2211. Short window length in seconds, used for peak and trough RMS measurement.
  2212. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0 - 10]}.
  2213. @item metadata
  2214. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  2215. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  2216. disabled.
  2217. Available keys for each channel are:
  2218. DC_offset
  2219. Min_level
  2220. Max_level
  2221. Min_difference
  2222. Max_difference
  2223. Mean_difference
  2224. RMS_difference
  2225. Peak_level
  2226. RMS_peak
  2227. RMS_trough
  2228. Crest_factor
  2229. Flat_factor
  2230. Peak_count
  2231. Noise_floor
  2232. Noise_floor_count
  2233. Entropy
  2234. Bit_depth
  2235. Dynamic_range
  2236. Zero_crossings
  2237. Zero_crossings_rate
  2238. Number_of_NaNs
  2239. Number_of_Infs
  2240. Number_of_denormals
  2241. and for Overall:
  2242. DC_offset
  2243. Min_level
  2244. Max_level
  2245. Min_difference
  2246. Max_difference
  2247. Mean_difference
  2248. RMS_difference
  2249. Peak_level
  2250. RMS_level
  2251. RMS_peak
  2252. RMS_trough
  2253. Flat_factor
  2254. Peak_count
  2255. Noise_floor
  2256. Noise_floor_count
  2257. Entropy
  2258. Bit_depth
  2259. Number_of_samples
  2260. Number_of_NaNs
  2261. Number_of_Infs
  2262. Number_of_denormals
  2263. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  2264. this @code{lavfi.astats.Overall.Peak_count}.
  2265. For description what each key means read below.
  2266. @item reset
  2267. Set the number of frames over which cumulative stats are calculated before
  2268. being reset
  2269. Default is disabled.
  2270. @item measure_perchannel
  2271. Select the parameters which are measured per channel. The metadata keys can
  2272. be used as flags, default is @option{all} which measures everything.
  2273. @option{none} disables all per channel measurement.
  2274. @item measure_overall
  2275. Select the parameters which are measured overall. The metadata keys can
  2276. be used as flags, default is @option{all} which measures everything.
  2277. @option{none} disables all overall measurement.
  2278. @end table
  2279. A description of each shown parameter follows:
  2280. @table @option
  2281. @item DC offset
  2282. Mean amplitude displacement from zero.
  2283. @item Min level
  2284. Minimal sample level.
  2285. @item Max level
  2286. Maximal sample level.
  2287. @item Min difference
  2288. Minimal difference between two consecutive samples.
  2289. @item Max difference
  2290. Maximal difference between two consecutive samples.
  2291. @item Mean difference
  2292. Mean difference between two consecutive samples.
  2293. The average of each difference between two consecutive samples.
  2294. @item RMS difference
  2295. Root Mean Square difference between two consecutive samples.
  2296. @item Peak level dB
  2297. @item RMS level dB
  2298. Standard peak and RMS level measured in dBFS.
  2299. @item RMS peak dB
  2300. @item RMS trough dB
  2301. Peak and trough values for RMS level measured over a short window.
  2302. @item Crest factor
  2303. Standard ratio of peak to RMS level (note: not in dB).
  2304. @item Flat factor
  2305. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  2306. (i.e. either @var{Min level} or @var{Max level}).
  2307. @item Peak count
  2308. Number of occasions (not the number of samples) that the signal attained either
  2309. @var{Min level} or @var{Max level}.
  2310. @item Noise floor dB
  2311. Minimum local peak measured in dBFS over a short window.
  2312. @item Noise floor count
  2313. Number of occasions (not the number of samples) that the signal attained
  2314. @var{Noise floor}.
  2315. @item Entropy
  2316. Entropy measured across whole audio. Entropy of value near 1.0 is typically measured for white noise.
  2317. @item Bit depth
  2318. Overall bit depth of audio. Number of bits used for each sample.
  2319. @item Dynamic range
  2320. Measured dynamic range of audio in dB.
  2321. @item Zero crossings
  2322. Number of points where the waveform crosses the zero level axis.
  2323. @item Zero crossings rate
  2324. Rate of Zero crossings and number of audio samples.
  2325. @end table
  2326. @section asubboost
  2327. Boost subwoofer frequencies.
  2328. The filter accepts the following options:
  2329. @table @option
  2330. @item dry
  2331. Set dry gain, how much of original signal is kept. Allowed range is from 0 to 1.
  2332. Default value is 0.7.
  2333. @item wet
  2334. Set wet gain, how much of filtered signal is kept. Allowed range is from 0 to 1.
  2335. Default value is 0.7.
  2336. @item decay
  2337. Set delay line decay gain value. Allowed range is from 0 to 1.
  2338. Default value is 0.7.
  2339. @item feedback
  2340. Set delay line feedback gain value. Allowed range is from 0 to 1.
  2341. Default value is 0.9.
  2342. @item cutoff
  2343. Set cutoff frequency in Hertz. Allowed range is 50 to 900.
  2344. Default value is 100.
  2345. @item slope
  2346. Set slope amount for cutoff frequency. Allowed range is 0.0001 to 1.
  2347. Default value is 0.5.
  2348. @item delay
  2349. Set delay. Allowed range is from 1 to 100.
  2350. Default value is 20.
  2351. @end table
  2352. @subsection Commands
  2353. This filter supports the all above options as @ref{commands}.
  2354. @section asubcut
  2355. Cut subwoofer frequencies.
  2356. This filter allows to set custom, steeper
  2357. roll off than highpass filter, and thus is able to more attenuate
  2358. frequency content in stop-band.
  2359. The filter accepts the following options:
  2360. @table @option
  2361. @item cutoff
  2362. Set cutoff frequency in Hertz. Allowed range is 2 to 200.
  2363. Default value is 20.
  2364. @item order
  2365. Set filter order. Available values are from 3 to 20.
  2366. Default value is 10.
  2367. @item level
  2368. Set input gain level. Allowed range is from 0 to 1. Default value is 1.
  2369. @end table
  2370. @subsection Commands
  2371. This filter supports the all above options as @ref{commands}.
  2372. @section asupercut
  2373. Cut super frequencies.
  2374. The filter accepts the following options:
  2375. @table @option
  2376. @item cutoff
  2377. Set cutoff frequency in Hertz. Allowed range is 20000 to 192000.
  2378. Default value is 20000.
  2379. @item order
  2380. Set filter order. Available values are from 3 to 20.
  2381. Default value is 10.
  2382. @item level
  2383. Set input gain level. Allowed range is from 0 to 1. Default value is 1.
  2384. @end table
  2385. @subsection Commands
  2386. This filter supports the all above options as @ref{commands}.
  2387. @section asuperpass
  2388. Apply high order Butterworth band-pass filter.
  2389. The filter accepts the following options:
  2390. @table @option
  2391. @item centerf
  2392. Set center frequency in Hertz. Allowed range is 2 to 999999.
  2393. Default value is 1000.
  2394. @item order
  2395. Set filter order. Available values are from 4 to 20.
  2396. Default value is 4.
  2397. @item qfactor
  2398. Set Q-factor. Allowed range is from 0.01 to 100. Default value is 1.
  2399. @item level
  2400. Set input gain level. Allowed range is from 0 to 2. Default value is 1.
  2401. @end table
  2402. @subsection Commands
  2403. This filter supports the all above options as @ref{commands}.
  2404. @section asuperstop
  2405. Apply high order Butterworth band-stop filter.
  2406. The filter accepts the following options:
  2407. @table @option
  2408. @item centerf
  2409. Set center frequency in Hertz. Allowed range is 2 to 999999.
  2410. Default value is 1000.
  2411. @item order
  2412. Set filter order. Available values are from 4 to 20.
  2413. Default value is 4.
  2414. @item qfactor
  2415. Set Q-factor. Allowed range is from 0.01 to 100. Default value is 1.
  2416. @item level
  2417. Set input gain level. Allowed range is from 0 to 2. Default value is 1.
  2418. @end table
  2419. @subsection Commands
  2420. This filter supports the all above options as @ref{commands}.
  2421. @section atempo
  2422. Adjust audio tempo.
  2423. The filter accepts exactly one parameter, the audio tempo. If not
  2424. specified then the filter will assume nominal 1.0 tempo. Tempo must
  2425. be in the [0.5, 100.0] range.
  2426. Note that tempo greater than 2 will skip some samples rather than
  2427. blend them in. If for any reason this is a concern it is always
  2428. possible to daisy-chain several instances of atempo to achieve the
  2429. desired product tempo.
  2430. @subsection Examples
  2431. @itemize
  2432. @item
  2433. Slow down audio to 80% tempo:
  2434. @example
  2435. atempo=0.8
  2436. @end example
  2437. @item
  2438. To speed up audio to 300% tempo:
  2439. @example
  2440. atempo=3
  2441. @end example
  2442. @item
  2443. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  2444. @example
  2445. atempo=sqrt(3),atempo=sqrt(3)
  2446. @end example
  2447. @end itemize
  2448. @subsection Commands
  2449. This filter supports the following commands:
  2450. @table @option
  2451. @item tempo
  2452. Change filter tempo scale factor.
  2453. Syntax for the command is : "@var{tempo}"
  2454. @end table
  2455. @section atilt
  2456. Apply spectral tilt filter to audio stream.
  2457. This filter apply any spectral roll-off slope over any specified frequency band.
  2458. The filter accepts the following options:
  2459. @table @option
  2460. @item freq
  2461. Set central frequency of tilt in Hz. Default is 10000 Hz.
  2462. @item slope
  2463. Set slope direction of tilt. Default is 0. Allowed range is from -1 to 1.
  2464. @item width
  2465. Set width of tilt. Default is 1000. Allowed range is from 100 to 10000.
  2466. @item order
  2467. Set order of tilt filter.
  2468. @item level
  2469. Set input volume level. Allowed range is from 0 to 4.
  2470. Defalt is 1.
  2471. @end table
  2472. @subsection Commands
  2473. This filter supports the all above options as @ref{commands}.
  2474. @section atrim
  2475. Trim the input so that the output contains one continuous subpart of the input.
  2476. It accepts the following parameters:
  2477. @table @option
  2478. @item start
  2479. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  2480. sample with the timestamp @var{start} will be the first sample in the output.
  2481. @item end
  2482. Specify time of the first audio sample that will be dropped, i.e. the
  2483. audio sample immediately preceding the one with the timestamp @var{end} will be
  2484. the last sample in the output.
  2485. @item start_pts
  2486. Same as @var{start}, except this option sets the start timestamp in samples
  2487. instead of seconds.
  2488. @item end_pts
  2489. Same as @var{end}, except this option sets the end timestamp in samples instead
  2490. of seconds.
  2491. @item duration
  2492. The maximum duration of the output in seconds.
  2493. @item start_sample
  2494. The number of the first sample that should be output.
  2495. @item end_sample
  2496. The number of the first sample that should be dropped.
  2497. @end table
  2498. @option{start}, @option{end}, and @option{duration} are expressed as time
  2499. duration specifications; see
  2500. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  2501. Note that the first two sets of the start/end options and the @option{duration}
  2502. option look at the frame timestamp, while the _sample options simply count the
  2503. samples that pass through the filter. So start/end_pts and start/end_sample will
  2504. give different results when the timestamps are wrong, inexact or do not start at
  2505. zero. Also note that this filter does not modify the timestamps. If you wish
  2506. to have the output timestamps start at zero, insert the asetpts filter after the
  2507. atrim filter.
  2508. If multiple start or end options are set, this filter tries to be greedy and
  2509. keep all samples that match at least one of the specified constraints. To keep
  2510. only the part that matches all the constraints at once, chain multiple atrim
  2511. filters.
  2512. The defaults are such that all the input is kept. So it is possible to set e.g.
  2513. just the end values to keep everything before the specified time.
  2514. Examples:
  2515. @itemize
  2516. @item
  2517. Drop everything except the second minute of input:
  2518. @example
  2519. ffmpeg -i INPUT -af atrim=60:120
  2520. @end example
  2521. @item
  2522. Keep only the first 1000 samples:
  2523. @example
  2524. ffmpeg -i INPUT -af atrim=end_sample=1000
  2525. @end example
  2526. @end itemize
  2527. @section axcorrelate
  2528. Calculate normalized windowed cross-correlation between two input audio streams.
  2529. Resulted samples are always between -1 and 1 inclusive.
  2530. If result is 1 it means two input samples are highly correlated in that selected segment.
  2531. Result 0 means they are not correlated at all.
  2532. If result is -1 it means two input samples are out of phase, which means they cancel each
  2533. other.
  2534. The filter accepts the following options:
  2535. @table @option
  2536. @item size
  2537. Set size of segment over which cross-correlation is calculated.
  2538. Default is 256. Allowed range is from 2 to 131072.
  2539. @item algo
  2540. Set algorithm for cross-correlation. Can be @code{slow} or @code{fast}.
  2541. Default is @code{slow}. Fast algorithm assumes mean values over any given segment
  2542. are always zero and thus need much less calculations to make.
  2543. This is generally not true, but is valid for typical audio streams.
  2544. @end table
  2545. @subsection Examples
  2546. @itemize
  2547. @item
  2548. Calculate correlation between channels in stereo audio stream:
  2549. @example
  2550. ffmpeg -i stereo.wav -af channelsplit,axcorrelate=size=1024:algo=fast correlation.wav
  2551. @end example
  2552. @end itemize
  2553. @section bandpass
  2554. Apply a two-pole Butterworth band-pass filter with central
  2555. frequency @var{frequency}, and (3dB-point) band-width width.
  2556. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  2557. instead of the default: constant 0dB peak gain.
  2558. The filter roll off at 6dB per octave (20dB per decade).
  2559. The filter accepts the following options:
  2560. @table @option
  2561. @item frequency, f
  2562. Set the filter's central frequency. Default is @code{3000}.
  2563. @item csg
  2564. Constant skirt gain if set to 1. Defaults to 0.
  2565. @item width_type, t
  2566. Set method to specify band-width of filter.
  2567. @table @option
  2568. @item h
  2569. Hz
  2570. @item q
  2571. Q-Factor
  2572. @item o
  2573. octave
  2574. @item s
  2575. slope
  2576. @item k
  2577. kHz
  2578. @end table
  2579. @item width, w
  2580. Specify the band-width of a filter in width_type units.
  2581. @item mix, m
  2582. How much to use filtered signal in output. Default is 1.
  2583. Range is between 0 and 1.
  2584. @item channels, c
  2585. Specify which channels to filter, by default all available are filtered.
  2586. @item normalize, n
  2587. Normalize biquad coefficients, by default is disabled.
  2588. Enabling it will normalize magnitude response at DC to 0dB.
  2589. @item transform, a
  2590. Set transform type of IIR filter.
  2591. @table @option
  2592. @item di
  2593. @item dii
  2594. @item tdii
  2595. @item latt
  2596. @item svf
  2597. @end table
  2598. @item precision, r
  2599. Set precison of filtering.
  2600. @table @option
  2601. @item auto
  2602. Pick automatic sample format depending on surround filters.
  2603. @item s16
  2604. Always use signed 16-bit.
  2605. @item s32
  2606. Always use signed 32-bit.
  2607. @item f32
  2608. Always use float 32-bit.
  2609. @item f64
  2610. Always use float 64-bit.
  2611. @end table
  2612. @end table
  2613. @subsection Commands
  2614. This filter supports the following commands:
  2615. @table @option
  2616. @item frequency, f
  2617. Change bandpass frequency.
  2618. Syntax for the command is : "@var{frequency}"
  2619. @item width_type, t
  2620. Change bandpass width_type.
  2621. Syntax for the command is : "@var{width_type}"
  2622. @item width, w
  2623. Change bandpass width.
  2624. Syntax for the command is : "@var{width}"
  2625. @item mix, m
  2626. Change bandpass mix.
  2627. Syntax for the command is : "@var{mix}"
  2628. @end table
  2629. @section bandreject
  2630. Apply a two-pole Butterworth band-reject filter with central
  2631. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  2632. The filter roll off at 6dB per octave (20dB per decade).
  2633. The filter accepts the following options:
  2634. @table @option
  2635. @item frequency, f
  2636. Set the filter's central frequency. Default is @code{3000}.
  2637. @item width_type, t
  2638. Set method to specify band-width of filter.
  2639. @table @option
  2640. @item h
  2641. Hz
  2642. @item q
  2643. Q-Factor
  2644. @item o
  2645. octave
  2646. @item s
  2647. slope
  2648. @item k
  2649. kHz
  2650. @end table
  2651. @item width, w
  2652. Specify the band-width of a filter in width_type units.
  2653. @item mix, m
  2654. How much to use filtered signal in output. Default is 1.
  2655. Range is between 0 and 1.
  2656. @item channels, c
  2657. Specify which channels to filter, by default all available are filtered.
  2658. @item normalize, n
  2659. Normalize biquad coefficients, by default is disabled.
  2660. Enabling it will normalize magnitude response at DC to 0dB.
  2661. @item transform, a
  2662. Set transform type of IIR filter.
  2663. @table @option
  2664. @item di
  2665. @item dii
  2666. @item tdii
  2667. @item latt
  2668. @item svf
  2669. @end table
  2670. @item precision, r
  2671. Set precison of filtering.
  2672. @table @option
  2673. @item auto
  2674. Pick automatic sample format depending on surround filters.
  2675. @item s16
  2676. Always use signed 16-bit.
  2677. @item s32
  2678. Always use signed 32-bit.
  2679. @item f32
  2680. Always use float 32-bit.
  2681. @item f64
  2682. Always use float 64-bit.
  2683. @end table
  2684. @end table
  2685. @subsection Commands
  2686. This filter supports the following commands:
  2687. @table @option
  2688. @item frequency, f
  2689. Change bandreject frequency.
  2690. Syntax for the command is : "@var{frequency}"
  2691. @item width_type, t
  2692. Change bandreject width_type.
  2693. Syntax for the command is : "@var{width_type}"
  2694. @item width, w
  2695. Change bandreject width.
  2696. Syntax for the command is : "@var{width}"
  2697. @item mix, m
  2698. Change bandreject mix.
  2699. Syntax for the command is : "@var{mix}"
  2700. @end table
  2701. @section bass, lowshelf
  2702. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  2703. shelving filter with a response similar to that of a standard
  2704. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2705. The filter accepts the following options:
  2706. @table @option
  2707. @item gain, g
  2708. Give the gain at 0 Hz. Its useful range is about -20
  2709. (for a large cut) to +20 (for a large boost).
  2710. Beware of clipping when using a positive gain.
  2711. @item frequency, f
  2712. Set the filter's central frequency and so can be used
  2713. to extend or reduce the frequency range to be boosted or cut.
  2714. The default value is @code{100} Hz.
  2715. @item width_type, t
  2716. Set method to specify band-width of filter.
  2717. @table @option
  2718. @item h
  2719. Hz
  2720. @item q
  2721. Q-Factor
  2722. @item o
  2723. octave
  2724. @item s
  2725. slope
  2726. @item k
  2727. kHz
  2728. @end table
  2729. @item width, w
  2730. Determine how steep is the filter's shelf transition.
  2731. @item poles, p
  2732. Set number of poles. Default is 2.
  2733. @item mix, m
  2734. How much to use filtered signal in output. Default is 1.
  2735. Range is between 0 and 1.
  2736. @item channels, c
  2737. Specify which channels to filter, by default all available are filtered.
  2738. @item normalize, n
  2739. Normalize biquad coefficients, by default is disabled.
  2740. Enabling it will normalize magnitude response at DC to 0dB.
  2741. @item transform, a
  2742. Set transform type of IIR filter.
  2743. @table @option
  2744. @item di
  2745. @item dii
  2746. @item tdii
  2747. @item latt
  2748. @item svf
  2749. @end table
  2750. @item precision, r
  2751. Set precison of filtering.
  2752. @table @option
  2753. @item auto
  2754. Pick automatic sample format depending on surround filters.
  2755. @item s16
  2756. Always use signed 16-bit.
  2757. @item s32
  2758. Always use signed 32-bit.
  2759. @item f32
  2760. Always use float 32-bit.
  2761. @item f64
  2762. Always use float 64-bit.
  2763. @end table
  2764. @end table
  2765. @subsection Commands
  2766. This filter supports the following commands:
  2767. @table @option
  2768. @item frequency, f
  2769. Change bass frequency.
  2770. Syntax for the command is : "@var{frequency}"
  2771. @item width_type, t
  2772. Change bass width_type.
  2773. Syntax for the command is : "@var{width_type}"
  2774. @item width, w
  2775. Change bass width.
  2776. Syntax for the command is : "@var{width}"
  2777. @item gain, g
  2778. Change bass gain.
  2779. Syntax for the command is : "@var{gain}"
  2780. @item mix, m
  2781. Change bass mix.
  2782. Syntax for the command is : "@var{mix}"
  2783. @end table
  2784. @section biquad
  2785. Apply a biquad IIR filter with the given coefficients.
  2786. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  2787. are the numerator and denominator coefficients respectively.
  2788. and @var{channels}, @var{c} specify which channels to filter, by default all
  2789. available are filtered.
  2790. @subsection Commands
  2791. This filter supports the following commands:
  2792. @table @option
  2793. @item a0
  2794. @item a1
  2795. @item a2
  2796. @item b0
  2797. @item b1
  2798. @item b2
  2799. Change biquad parameter.
  2800. Syntax for the command is : "@var{value}"
  2801. @item mix, m
  2802. How much to use filtered signal in output. Default is 1.
  2803. Range is between 0 and 1.
  2804. @item channels, c
  2805. Specify which channels to filter, by default all available are filtered.
  2806. @item normalize, n
  2807. Normalize biquad coefficients, by default is disabled.
  2808. Enabling it will normalize magnitude response at DC to 0dB.
  2809. @item transform, a
  2810. Set transform type of IIR filter.
  2811. @table @option
  2812. @item di
  2813. @item dii
  2814. @item tdii
  2815. @item latt
  2816. @item svf
  2817. @end table
  2818. @item precision, r
  2819. Set precison of filtering.
  2820. @table @option
  2821. @item auto
  2822. Pick automatic sample format depending on surround filters.
  2823. @item s16
  2824. Always use signed 16-bit.
  2825. @item s32
  2826. Always use signed 32-bit.
  2827. @item f32
  2828. Always use float 32-bit.
  2829. @item f64
  2830. Always use float 64-bit.
  2831. @end table
  2832. @end table
  2833. @section bs2b
  2834. Bauer stereo to binaural transformation, which improves headphone listening of
  2835. stereo audio records.
  2836. To enable compilation of this filter you need to configure FFmpeg with
  2837. @code{--enable-libbs2b}.
  2838. It accepts the following parameters:
  2839. @table @option
  2840. @item profile
  2841. Pre-defined crossfeed level.
  2842. @table @option
  2843. @item default
  2844. Default level (fcut=700, feed=50).
  2845. @item cmoy
  2846. Chu Moy circuit (fcut=700, feed=60).
  2847. @item jmeier
  2848. Jan Meier circuit (fcut=650, feed=95).
  2849. @end table
  2850. @item fcut
  2851. Cut frequency (in Hz).
  2852. @item feed
  2853. Feed level (in Hz).
  2854. @end table
  2855. @section channelmap
  2856. Remap input channels to new locations.
  2857. It accepts the following parameters:
  2858. @table @option
  2859. @item map
  2860. Map channels from input to output. The argument is a '|'-separated list of
  2861. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  2862. @var{in_channel} form. @var{in_channel} can be either the name of the input
  2863. channel (e.g. FL for front left) or its index in the input channel layout.
  2864. @var{out_channel} is the name of the output channel or its index in the output
  2865. channel layout. If @var{out_channel} is not given then it is implicitly an
  2866. index, starting with zero and increasing by one for each mapping.
  2867. @item channel_layout
  2868. The channel layout of the output stream.
  2869. @end table
  2870. If no mapping is present, the filter will implicitly map input channels to
  2871. output channels, preserving indices.
  2872. @subsection Examples
  2873. @itemize
  2874. @item
  2875. For example, assuming a 5.1+downmix input MOV file,
  2876. @example
  2877. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  2878. @end example
  2879. will create an output WAV file tagged as stereo from the downmix channels of
  2880. the input.
  2881. @item
  2882. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  2883. @example
  2884. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  2885. @end example
  2886. @end itemize
  2887. @section channelsplit
  2888. Split each channel from an input audio stream into a separate output stream.
  2889. It accepts the following parameters:
  2890. @table @option
  2891. @item channel_layout
  2892. The channel layout of the input stream. The default is "stereo".
  2893. @item channels
  2894. A channel layout describing the channels to be extracted as separate output streams
  2895. or "all" to extract each input channel as a separate stream. The default is "all".
  2896. Choosing channels not present in channel layout in the input will result in an error.
  2897. @end table
  2898. @subsection Examples
  2899. @itemize
  2900. @item
  2901. For example, assuming a stereo input MP3 file,
  2902. @example
  2903. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  2904. @end example
  2905. will create an output Matroska file with two audio streams, one containing only
  2906. the left channel and the other the right channel.
  2907. @item
  2908. Split a 5.1 WAV file into per-channel files:
  2909. @example
  2910. ffmpeg -i in.wav -filter_complex
  2911. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  2912. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  2913. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  2914. side_right.wav
  2915. @end example
  2916. @item
  2917. Extract only LFE from a 5.1 WAV file:
  2918. @example
  2919. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  2920. -map '[LFE]' lfe.wav
  2921. @end example
  2922. @end itemize
  2923. @section chorus
  2924. Add a chorus effect to the audio.
  2925. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  2926. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  2927. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  2928. The modulation depth defines the range the modulated delay is played before or after
  2929. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  2930. sound tuned around the original one, like in a chorus where some vocals are slightly
  2931. off key.
  2932. It accepts the following parameters:
  2933. @table @option
  2934. @item in_gain
  2935. Set input gain. Default is 0.4.
  2936. @item out_gain
  2937. Set output gain. Default is 0.4.
  2938. @item delays
  2939. Set delays. A typical delay is around 40ms to 60ms.
  2940. @item decays
  2941. Set decays.
  2942. @item speeds
  2943. Set speeds.
  2944. @item depths
  2945. Set depths.
  2946. @end table
  2947. @subsection Examples
  2948. @itemize
  2949. @item
  2950. A single delay:
  2951. @example
  2952. chorus=0.7:0.9:55:0.4:0.25:2
  2953. @end example
  2954. @item
  2955. Two delays:
  2956. @example
  2957. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  2958. @end example
  2959. @item
  2960. Fuller sounding chorus with three delays:
  2961. @example
  2962. 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
  2963. @end example
  2964. @end itemize
  2965. @section compand
  2966. Compress or expand the audio's dynamic range.
  2967. It accepts the following parameters:
  2968. @table @option
  2969. @item attacks
  2970. @item decays
  2971. A list of times in seconds for each channel over which the instantaneous level
  2972. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2973. increase of volume and @var{decays} refers to decrease of volume. For most
  2974. situations, the attack time (response to the audio getting louder) should be
  2975. shorter than the decay time, because the human ear is more sensitive to sudden
  2976. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2977. a typical value for decay is 0.8 seconds.
  2978. If specified number of attacks & decays is lower than number of channels, the last
  2979. set attack/decay will be used for all remaining channels.
  2980. @item points
  2981. A list of points for the transfer function, specified in dB relative to the
  2982. maximum possible signal amplitude. Each key points list must be defined using
  2983. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2984. @code{x0/y0 x1/y1 x2/y2 ....}
  2985. The input values must be in strictly increasing order but the transfer function
  2986. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2987. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2988. function are @code{-70/-70|-60/-20|1/0}.
  2989. @item soft-knee
  2990. Set the curve radius in dB for all joints. It defaults to 0.01.
  2991. @item gain
  2992. Set the additional gain in dB to be applied at all points on the transfer
  2993. function. This allows for easy adjustment of the overall gain.
  2994. It defaults to 0.
  2995. @item volume
  2996. Set an initial volume, in dB, to be assumed for each channel when filtering
  2997. starts. This permits the user to supply a nominal level initially, so that, for
  2998. example, a very large gain is not applied to initial signal levels before the
  2999. companding has begun to operate. A typical value for audio which is initially
  3000. quiet is -90 dB. It defaults to 0.
  3001. @item delay
  3002. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  3003. delayed before being fed to the volume adjuster. Specifying a delay
  3004. approximately equal to the attack/decay times allows the filter to effectively
  3005. operate in predictive rather than reactive mode. It defaults to 0.
  3006. @end table
  3007. @subsection Examples
  3008. @itemize
  3009. @item
  3010. Make music with both quiet and loud passages suitable for listening to in a
  3011. noisy environment:
  3012. @example
  3013. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  3014. @end example
  3015. Another example for audio with whisper and explosion parts:
  3016. @example
  3017. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  3018. @end example
  3019. @item
  3020. A noise gate for when the noise is at a lower level than the signal:
  3021. @example
  3022. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  3023. @end example
  3024. @item
  3025. Here is another noise gate, this time for when the noise is at a higher level
  3026. than the signal (making it, in some ways, similar to squelch):
  3027. @example
  3028. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  3029. @end example
  3030. @item
  3031. 2:1 compression starting at -6dB:
  3032. @example
  3033. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  3034. @end example
  3035. @item
  3036. 2:1 compression starting at -9dB:
  3037. @example
  3038. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  3039. @end example
  3040. @item
  3041. 2:1 compression starting at -12dB:
  3042. @example
  3043. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  3044. @end example
  3045. @item
  3046. 2:1 compression starting at -18dB:
  3047. @example
  3048. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  3049. @end example
  3050. @item
  3051. 3:1 compression starting at -15dB:
  3052. @example
  3053. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  3054. @end example
  3055. @item
  3056. Compressor/Gate:
  3057. @example
  3058. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  3059. @end example
  3060. @item
  3061. Expander:
  3062. @example
  3063. 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
  3064. @end example
  3065. @item
  3066. Hard limiter at -6dB:
  3067. @example
  3068. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  3069. @end example
  3070. @item
  3071. Hard limiter at -12dB:
  3072. @example
  3073. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  3074. @end example
  3075. @item
  3076. Hard noise gate at -35 dB:
  3077. @example
  3078. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  3079. @end example
  3080. @item
  3081. Soft limiter:
  3082. @example
  3083. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  3084. @end example
  3085. @end itemize
  3086. @section compensationdelay
  3087. Compensation Delay Line is a metric based delay to compensate differing
  3088. positions of microphones or speakers.
  3089. For example, you have recorded guitar with two microphones placed in
  3090. different locations. Because the front of sound wave has fixed speed in
  3091. normal conditions, the phasing of microphones can vary and depends on
  3092. their location and interposition. The best sound mix can be achieved when
  3093. these microphones are in phase (synchronized). Note that a distance of
  3094. ~30 cm between microphones makes one microphone capture the signal in
  3095. antiphase to the other microphone. That makes the final mix sound moody.
  3096. This filter helps to solve phasing problems by adding different delays
  3097. to each microphone track and make them synchronized.
  3098. The best result can be reached when you take one track as base and
  3099. synchronize other tracks one by one with it.
  3100. Remember that synchronization/delay tolerance depends on sample rate, too.
  3101. Higher sample rates will give more tolerance.
  3102. The filter accepts the following parameters:
  3103. @table @option
  3104. @item mm
  3105. Set millimeters distance. This is compensation distance for fine tuning.
  3106. Default is 0.
  3107. @item cm
  3108. Set cm distance. This is compensation distance for tightening distance setup.
  3109. Default is 0.
  3110. @item m
  3111. Set meters distance. This is compensation distance for hard distance setup.
  3112. Default is 0.
  3113. @item dry
  3114. Set dry amount. Amount of unprocessed (dry) signal.
  3115. Default is 0.
  3116. @item wet
  3117. Set wet amount. Amount of processed (wet) signal.
  3118. Default is 1.
  3119. @item temp
  3120. Set temperature in degrees Celsius. This is the temperature of the environment.
  3121. Default is 20.
  3122. @end table
  3123. @section crossfeed
  3124. Apply headphone crossfeed filter.
  3125. Crossfeed is the process of blending the left and right channels of stereo
  3126. audio recording.
  3127. It is mainly used to reduce extreme stereo separation of low frequencies.
  3128. The intent is to produce more speaker like sound to the listener.
  3129. The filter accepts the following options:
  3130. @table @option
  3131. @item strength
  3132. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  3133. This sets gain of low shelf filter for side part of stereo image.
  3134. Default is -6dB. Max allowed is -30db when strength is set to 1.
  3135. @item range
  3136. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  3137. This sets cut off frequency of low shelf filter. Default is cut off near
  3138. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  3139. @item slope
  3140. Set curve slope of low shelf filter. Default is 0.5.
  3141. Allowed range is from 0.01 to 1.
  3142. @item level_in
  3143. Set input gain. Default is 0.9.
  3144. @item level_out
  3145. Set output gain. Default is 1.
  3146. @end table
  3147. @subsection Commands
  3148. This filter supports the all above options as @ref{commands}.
  3149. @section crystalizer
  3150. Simple algorithm for audio noise sharpening.
  3151. This filter linearly increases differences betweeen each audio sample.
  3152. The filter accepts the following options:
  3153. @table @option
  3154. @item i
  3155. Sets the intensity of effect (default: 2.0). Must be in range between -10.0 to 0
  3156. (unchanged sound) to 10.0 (maximum effect).
  3157. To inverse filtering use negative value.
  3158. @item c
  3159. Enable clipping. By default is enabled.
  3160. @end table
  3161. @subsection Commands
  3162. This filter supports the all above options as @ref{commands}.
  3163. @section dcshift
  3164. Apply a DC shift to the audio.
  3165. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  3166. in the recording chain) from the audio. The effect of a DC offset is reduced
  3167. headroom and hence volume. The @ref{astats} filter can be used to determine if
  3168. a signal has a DC offset.
  3169. @table @option
  3170. @item shift
  3171. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  3172. the audio.
  3173. @item limitergain
  3174. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  3175. used to prevent clipping.
  3176. @end table
  3177. @section deesser
  3178. Apply de-essing to the audio samples.
  3179. @table @option
  3180. @item i
  3181. Set intensity for triggering de-essing. Allowed range is from 0 to 1.
  3182. Default is 0.
  3183. @item m
  3184. Set amount of ducking on treble part of sound. Allowed range is from 0 to 1.
  3185. Default is 0.5.
  3186. @item f
  3187. How much of original frequency content to keep when de-essing. Allowed range is from 0 to 1.
  3188. Default is 0.5.
  3189. @item s
  3190. Set the output mode.
  3191. It accepts the following values:
  3192. @table @option
  3193. @item i
  3194. Pass input unchanged.
  3195. @item o
  3196. Pass ess filtered out.
  3197. @item e
  3198. Pass only ess.
  3199. Default value is @var{o}.
  3200. @end table
  3201. @end table
  3202. @section drmeter
  3203. Measure audio dynamic range.
  3204. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  3205. is found in transition material. And anything less that 8 have very poor dynamics
  3206. and is very compressed.
  3207. The filter accepts the following options:
  3208. @table @option
  3209. @item length
  3210. Set window length in seconds used to split audio into segments of equal length.
  3211. Default is 3 seconds.
  3212. @end table
  3213. @section dynaudnorm
  3214. Dynamic Audio Normalizer.
  3215. This filter applies a certain amount of gain to the input audio in order
  3216. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  3217. contrast to more "simple" normalization algorithms, the Dynamic Audio
  3218. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  3219. This allows for applying extra gain to the "quiet" sections of the audio
  3220. while avoiding distortions or clipping the "loud" sections. In other words:
  3221. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  3222. sections, in the sense that the volume of each section is brought to the
  3223. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  3224. this goal *without* applying "dynamic range compressing". It will retain 100%
  3225. of the dynamic range *within* each section of the audio file.
  3226. @table @option
  3227. @item framelen, f
  3228. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  3229. Default is 500 milliseconds.
  3230. The Dynamic Audio Normalizer processes the input audio in small chunks,
  3231. referred to as frames. This is required, because a peak magnitude has no
  3232. meaning for just a single sample value. Instead, we need to determine the
  3233. peak magnitude for a contiguous sequence of sample values. While a "standard"
  3234. normalizer would simply use the peak magnitude of the complete file, the
  3235. Dynamic Audio Normalizer determines the peak magnitude individually for each
  3236. frame. The length of a frame is specified in milliseconds. By default, the
  3237. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  3238. been found to give good results with most files.
  3239. Note that the exact frame length, in number of samples, will be determined
  3240. automatically, based on the sampling rate of the individual input audio file.
  3241. @item gausssize, g
  3242. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  3243. number. Default is 31.
  3244. Probably the most important parameter of the Dynamic Audio Normalizer is the
  3245. @code{window size} of the Gaussian smoothing filter. The filter's window size
  3246. is specified in frames, centered around the current frame. For the sake of
  3247. simplicity, this must be an odd number. Consequently, the default value of 31
  3248. takes into account the current frame, as well as the 15 preceding frames and
  3249. the 15 subsequent frames. Using a larger window results in a stronger
  3250. smoothing effect and thus in less gain variation, i.e. slower gain
  3251. adaptation. Conversely, using a smaller window results in a weaker smoothing
  3252. effect and thus in more gain variation, i.e. faster gain adaptation.
  3253. In other words, the more you increase this value, the more the Dynamic Audio
  3254. Normalizer will behave like a "traditional" normalization filter. On the
  3255. contrary, the more you decrease this value, the more the Dynamic Audio
  3256. Normalizer will behave like a dynamic range compressor.
  3257. @item peak, p
  3258. Set the target peak value. This specifies the highest permissible magnitude
  3259. level for the normalized audio input. This filter will try to approach the
  3260. target peak magnitude as closely as possible, but at the same time it also
  3261. makes sure that the normalized signal will never exceed the peak magnitude.
  3262. A frame's maximum local gain factor is imposed directly by the target peak
  3263. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  3264. It is not recommended to go above this value.
  3265. @item maxgain, m
  3266. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  3267. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  3268. factor for each input frame, i.e. the maximum gain factor that does not
  3269. result in clipping or distortion. The maximum gain factor is determined by
  3270. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  3271. additionally bounds the frame's maximum gain factor by a predetermined
  3272. (global) maximum gain factor. This is done in order to avoid excessive gain
  3273. factors in "silent" or almost silent frames. By default, the maximum gain
  3274. factor is 10.0, For most inputs the default value should be sufficient and
  3275. it usually is not recommended to increase this value. Though, for input
  3276. with an extremely low overall volume level, it may be necessary to allow even
  3277. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  3278. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  3279. Instead, a "sigmoid" threshold function will be applied. This way, the
  3280. gain factors will smoothly approach the threshold value, but never exceed that
  3281. value.
  3282. @item targetrms, r
  3283. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  3284. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  3285. This means that the maximum local gain factor for each frame is defined
  3286. (only) by the frame's highest magnitude sample. This way, the samples can
  3287. be amplified as much as possible without exceeding the maximum signal
  3288. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  3289. Normalizer can also take into account the frame's root mean square,
  3290. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  3291. determine the power of a time-varying signal. It is therefore considered
  3292. that the RMS is a better approximation of the "perceived loudness" than
  3293. just looking at the signal's peak magnitude. Consequently, by adjusting all
  3294. frames to a constant RMS value, a uniform "perceived loudness" can be
  3295. established. If a target RMS value has been specified, a frame's local gain
  3296. factor is defined as the factor that would result in exactly that RMS value.
  3297. Note, however, that the maximum local gain factor is still restricted by the
  3298. frame's highest magnitude sample, in order to prevent clipping.
  3299. @item coupling, n
  3300. Enable channels coupling. By default is enabled.
  3301. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  3302. amount. This means the same gain factor will be applied to all channels, i.e.
  3303. the maximum possible gain factor is determined by the "loudest" channel.
  3304. However, in some recordings, it may happen that the volume of the different
  3305. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  3306. In this case, this option can be used to disable the channel coupling. This way,
  3307. the gain factor will be determined independently for each channel, depending
  3308. only on the individual channel's highest magnitude sample. This allows for
  3309. harmonizing the volume of the different channels.
  3310. @item correctdc, c
  3311. Enable DC bias correction. By default is disabled.
  3312. An audio signal (in the time domain) is a sequence of sample values.
  3313. In the Dynamic Audio Normalizer these sample values are represented in the
  3314. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  3315. audio signal, or "waveform", should be centered around the zero point.
  3316. That means if we calculate the mean value of all samples in a file, or in a
  3317. single frame, then the result should be 0.0 or at least very close to that
  3318. value. If, however, there is a significant deviation of the mean value from
  3319. 0.0, in either positive or negative direction, this is referred to as a
  3320. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  3321. Audio Normalizer provides optional DC bias correction.
  3322. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  3323. the mean value, or "DC correction" offset, of each input frame and subtract
  3324. that value from all of the frame's sample values which ensures those samples
  3325. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  3326. boundaries, the DC correction offset values will be interpolated smoothly
  3327. between neighbouring frames.
  3328. @item altboundary, b
  3329. Enable alternative boundary mode. By default is disabled.
  3330. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  3331. around each frame. This includes the preceding frames as well as the
  3332. subsequent frames. However, for the "boundary" frames, located at the very
  3333. beginning and at the very end of the audio file, not all neighbouring
  3334. frames are available. In particular, for the first few frames in the audio
  3335. file, the preceding frames are not known. And, similarly, for the last few
  3336. frames in the audio file, the subsequent frames are not known. Thus, the
  3337. question arises which gain factors should be assumed for the missing frames
  3338. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  3339. to deal with this situation. The default boundary mode assumes a gain factor
  3340. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  3341. "fade out" at the beginning and at the end of the input, respectively.
  3342. @item compress, s
  3343. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  3344. By default, the Dynamic Audio Normalizer does not apply "traditional"
  3345. compression. This means that signal peaks will not be pruned and thus the
  3346. full dynamic range will be retained within each local neighbourhood. However,
  3347. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  3348. normalization algorithm with a more "traditional" compression.
  3349. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  3350. (thresholding) function. If (and only if) the compression feature is enabled,
  3351. all input frames will be processed by a soft knee thresholding function prior
  3352. to the actual normalization process. Put simply, the thresholding function is
  3353. going to prune all samples whose magnitude exceeds a certain threshold value.
  3354. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  3355. value. Instead, the threshold value will be adjusted for each individual
  3356. frame.
  3357. In general, smaller parameters result in stronger compression, and vice versa.
  3358. Values below 3.0 are not recommended, because audible distortion may appear.
  3359. @item threshold, t
  3360. Set the target threshold value. This specifies the lowest permissible
  3361. magnitude level for the audio input which will be normalized.
  3362. If input frame volume is above this value frame will be normalized.
  3363. Otherwise frame may not be normalized at all. The default value is set
  3364. to 0, which means all input frames will be normalized.
  3365. This option is mostly useful if digital noise is not wanted to be amplified.
  3366. @end table
  3367. @subsection Commands
  3368. This filter supports the all above options as @ref{commands}.
  3369. @section earwax
  3370. Make audio easier to listen to on headphones.
  3371. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  3372. so that when listened to on headphones the stereo image is moved from
  3373. inside your head (standard for headphones) to outside and in front of
  3374. the listener (standard for speakers).
  3375. Ported from SoX.
  3376. @section equalizer
  3377. Apply a two-pole peaking equalisation (EQ) filter. With this
  3378. filter, the signal-level at and around a selected frequency can
  3379. be increased or decreased, whilst (unlike bandpass and bandreject
  3380. filters) that at all other frequencies is unchanged.
  3381. In order to produce complex equalisation curves, this filter can
  3382. be given several times, each with a different central frequency.
  3383. The filter accepts the following options:
  3384. @table @option
  3385. @item frequency, f
  3386. Set the filter's central frequency in Hz.
  3387. @item width_type, t
  3388. Set method to specify band-width of filter.
  3389. @table @option
  3390. @item h
  3391. Hz
  3392. @item q
  3393. Q-Factor
  3394. @item o
  3395. octave
  3396. @item s
  3397. slope
  3398. @item k
  3399. kHz
  3400. @end table
  3401. @item width, w
  3402. Specify the band-width of a filter in width_type units.
  3403. @item gain, g
  3404. Set the required gain or attenuation in dB.
  3405. Beware of clipping when using a positive gain.
  3406. @item mix, m
  3407. How much to use filtered signal in output. Default is 1.
  3408. Range is between 0 and 1.
  3409. @item channels, c
  3410. Specify which channels to filter, by default all available are filtered.
  3411. @item normalize, n
  3412. Normalize biquad coefficients, by default is disabled.
  3413. Enabling it will normalize magnitude response at DC to 0dB.
  3414. @item transform, a
  3415. Set transform type of IIR filter.
  3416. @table @option
  3417. @item di
  3418. @item dii
  3419. @item tdii
  3420. @item latt
  3421. @item svf
  3422. @end table
  3423. @item precision, r
  3424. Set precison of filtering.
  3425. @table @option
  3426. @item auto
  3427. Pick automatic sample format depending on surround filters.
  3428. @item s16
  3429. Always use signed 16-bit.
  3430. @item s32
  3431. Always use signed 32-bit.
  3432. @item f32
  3433. Always use float 32-bit.
  3434. @item f64
  3435. Always use float 64-bit.
  3436. @end table
  3437. @end table
  3438. @subsection Examples
  3439. @itemize
  3440. @item
  3441. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  3442. @example
  3443. equalizer=f=1000:t=h:width=200:g=-10
  3444. @end example
  3445. @item
  3446. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  3447. @example
  3448. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  3449. @end example
  3450. @end itemize
  3451. @subsection Commands
  3452. This filter supports the following commands:
  3453. @table @option
  3454. @item frequency, f
  3455. Change equalizer frequency.
  3456. Syntax for the command is : "@var{frequency}"
  3457. @item width_type, t
  3458. Change equalizer width_type.
  3459. Syntax for the command is : "@var{width_type}"
  3460. @item width, w
  3461. Change equalizer width.
  3462. Syntax for the command is : "@var{width}"
  3463. @item gain, g
  3464. Change equalizer gain.
  3465. Syntax for the command is : "@var{gain}"
  3466. @item mix, m
  3467. Change equalizer mix.
  3468. Syntax for the command is : "@var{mix}"
  3469. @end table
  3470. @section extrastereo
  3471. Linearly increases the difference between left and right channels which
  3472. adds some sort of "live" effect to playback.
  3473. The filter accepts the following options:
  3474. @table @option
  3475. @item m
  3476. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  3477. (average of both channels), with 1.0 sound will be unchanged, with
  3478. -1.0 left and right channels will be swapped.
  3479. @item c
  3480. Enable clipping. By default is enabled.
  3481. @end table
  3482. @subsection Commands
  3483. This filter supports the all above options as @ref{commands}.
  3484. @section firequalizer
  3485. Apply FIR Equalization using arbitrary frequency response.
  3486. The filter accepts the following option:
  3487. @table @option
  3488. @item gain
  3489. Set gain curve equation (in dB). The expression can contain variables:
  3490. @table @option
  3491. @item f
  3492. the evaluated frequency
  3493. @item sr
  3494. sample rate
  3495. @item ch
  3496. channel number, set to 0 when multichannels evaluation is disabled
  3497. @item chid
  3498. channel id, see libavutil/channel_layout.h, set to the first channel id when
  3499. multichannels evaluation is disabled
  3500. @item chs
  3501. number of channels
  3502. @item chlayout
  3503. channel_layout, see libavutil/channel_layout.h
  3504. @end table
  3505. and functions:
  3506. @table @option
  3507. @item gain_interpolate(f)
  3508. interpolate gain on frequency f based on gain_entry
  3509. @item cubic_interpolate(f)
  3510. same as gain_interpolate, but smoother
  3511. @end table
  3512. This option is also available as command. Default is @code{gain_interpolate(f)}.
  3513. @item gain_entry
  3514. Set gain entry for gain_interpolate function. The expression can
  3515. contain functions:
  3516. @table @option
  3517. @item entry(f, g)
  3518. store gain entry at frequency f with value g
  3519. @end table
  3520. This option is also available as command.
  3521. @item delay
  3522. Set filter delay in seconds. Higher value means more accurate.
  3523. Default is @code{0.01}.
  3524. @item accuracy
  3525. Set filter accuracy in Hz. Lower value means more accurate.
  3526. Default is @code{5}.
  3527. @item wfunc
  3528. Set window function. Acceptable values are:
  3529. @table @option
  3530. @item rectangular
  3531. rectangular window, useful when gain curve is already smooth
  3532. @item hann
  3533. hann window (default)
  3534. @item hamming
  3535. hamming window
  3536. @item blackman
  3537. blackman window
  3538. @item nuttall3
  3539. 3-terms continuous 1st derivative nuttall window
  3540. @item mnuttall3
  3541. minimum 3-terms discontinuous nuttall window
  3542. @item nuttall
  3543. 4-terms continuous 1st derivative nuttall window
  3544. @item bnuttall
  3545. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  3546. @item bharris
  3547. blackman-harris window
  3548. @item tukey
  3549. tukey window
  3550. @end table
  3551. @item fixed
  3552. If enabled, use fixed number of audio samples. This improves speed when
  3553. filtering with large delay. Default is disabled.
  3554. @item multi
  3555. Enable multichannels evaluation on gain. Default is disabled.
  3556. @item zero_phase
  3557. Enable zero phase mode by subtracting timestamp to compensate delay.
  3558. Default is disabled.
  3559. @item scale
  3560. Set scale used by gain. Acceptable values are:
  3561. @table @option
  3562. @item linlin
  3563. linear frequency, linear gain
  3564. @item linlog
  3565. linear frequency, logarithmic (in dB) gain (default)
  3566. @item loglin
  3567. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  3568. @item loglog
  3569. logarithmic frequency, logarithmic gain
  3570. @end table
  3571. @item dumpfile
  3572. Set file for dumping, suitable for gnuplot.
  3573. @item dumpscale
  3574. Set scale for dumpfile. Acceptable values are same with scale option.
  3575. Default is linlog.
  3576. @item fft2
  3577. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  3578. Default is disabled.
  3579. @item min_phase
  3580. Enable minimum phase impulse response. Default is disabled.
  3581. @end table
  3582. @subsection Examples
  3583. @itemize
  3584. @item
  3585. lowpass at 1000 Hz:
  3586. @example
  3587. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  3588. @end example
  3589. @item
  3590. lowpass at 1000 Hz with gain_entry:
  3591. @example
  3592. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  3593. @end example
  3594. @item
  3595. custom equalization:
  3596. @example
  3597. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  3598. @end example
  3599. @item
  3600. higher delay with zero phase to compensate delay:
  3601. @example
  3602. firequalizer=delay=0.1:fixed=on:zero_phase=on
  3603. @end example
  3604. @item
  3605. lowpass on left channel, highpass on right channel:
  3606. @example
  3607. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  3608. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  3609. @end example
  3610. @end itemize
  3611. @section flanger
  3612. Apply a flanging effect to the audio.
  3613. The filter accepts the following options:
  3614. @table @option
  3615. @item delay
  3616. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  3617. @item depth
  3618. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  3619. @item regen
  3620. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  3621. Default value is 0.
  3622. @item width
  3623. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  3624. Default value is 71.
  3625. @item speed
  3626. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  3627. @item shape
  3628. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  3629. Default value is @var{sinusoidal}.
  3630. @item phase
  3631. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  3632. Default value is 25.
  3633. @item interp
  3634. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  3635. Default is @var{linear}.
  3636. @end table
  3637. @section haas
  3638. Apply Haas effect to audio.
  3639. Note that this makes most sense to apply on mono signals.
  3640. With this filter applied to mono signals it give some directionality and
  3641. stretches its stereo image.
  3642. The filter accepts the following options:
  3643. @table @option
  3644. @item level_in
  3645. Set input level. By default is @var{1}, or 0dB
  3646. @item level_out
  3647. Set output level. By default is @var{1}, or 0dB.
  3648. @item side_gain
  3649. Set gain applied to side part of signal. By default is @var{1}.
  3650. @item middle_source
  3651. Set kind of middle source. Can be one of the following:
  3652. @table @samp
  3653. @item left
  3654. Pick left channel.
  3655. @item right
  3656. Pick right channel.
  3657. @item mid
  3658. Pick middle part signal of stereo image.
  3659. @item side
  3660. Pick side part signal of stereo image.
  3661. @end table
  3662. @item middle_phase
  3663. Change middle phase. By default is disabled.
  3664. @item left_delay
  3665. Set left channel delay. By default is @var{2.05} milliseconds.
  3666. @item left_balance
  3667. Set left channel balance. By default is @var{-1}.
  3668. @item left_gain
  3669. Set left channel gain. By default is @var{1}.
  3670. @item left_phase
  3671. Change left phase. By default is disabled.
  3672. @item right_delay
  3673. Set right channel delay. By defaults is @var{2.12} milliseconds.
  3674. @item right_balance
  3675. Set right channel balance. By default is @var{1}.
  3676. @item right_gain
  3677. Set right channel gain. By default is @var{1}.
  3678. @item right_phase
  3679. Change right phase. By default is enabled.
  3680. @end table
  3681. @section hdcd
  3682. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  3683. embedded HDCD codes is expanded into a 20-bit PCM stream.
  3684. The filter supports the Peak Extend and Low-level Gain Adjustment features
  3685. of HDCD, and detects the Transient Filter flag.
  3686. @example
  3687. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  3688. @end example
  3689. When using the filter with wav, note the default encoding for wav is 16-bit,
  3690. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  3691. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  3692. @example
  3693. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  3694. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  3695. @end example
  3696. The filter accepts the following options:
  3697. @table @option
  3698. @item disable_autoconvert
  3699. Disable any automatic format conversion or resampling in the filter graph.
  3700. @item process_stereo
  3701. Process the stereo channels together. If target_gain does not match between
  3702. channels, consider it invalid and use the last valid target_gain.
  3703. @item cdt_ms
  3704. Set the code detect timer period in ms.
  3705. @item force_pe
  3706. Always extend peaks above -3dBFS even if PE isn't signaled.
  3707. @item analyze_mode
  3708. Replace audio with a solid tone and adjust the amplitude to signal some
  3709. specific aspect of the decoding process. The output file can be loaded in
  3710. an audio editor alongside the original to aid analysis.
  3711. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  3712. Modes are:
  3713. @table @samp
  3714. @item 0, off
  3715. Disabled
  3716. @item 1, lle
  3717. Gain adjustment level at each sample
  3718. @item 2, pe
  3719. Samples where peak extend occurs
  3720. @item 3, cdt
  3721. Samples where the code detect timer is active
  3722. @item 4, tgm
  3723. Samples where the target gain does not match between channels
  3724. @end table
  3725. @end table
  3726. @section headphone
  3727. Apply head-related transfer functions (HRTFs) to create virtual
  3728. loudspeakers around the user for binaural listening via headphones.
  3729. The HRIRs are provided via additional streams, for each channel
  3730. one stereo input stream is needed.
  3731. The filter accepts the following options:
  3732. @table @option
  3733. @item map
  3734. Set mapping of input streams for convolution.
  3735. The argument is a '|'-separated list of channel names in order as they
  3736. are given as additional stream inputs for filter.
  3737. This also specify number of input streams. Number of input streams
  3738. must be not less than number of channels in first stream plus one.
  3739. @item gain
  3740. Set gain applied to audio. Value is in dB. Default is 0.
  3741. @item type
  3742. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3743. processing audio in time domain which is slow.
  3744. @var{freq} is processing audio in frequency domain which is fast.
  3745. Default is @var{freq}.
  3746. @item lfe
  3747. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3748. @item size
  3749. Set size of frame in number of samples which will be processed at once.
  3750. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  3751. @item hrir
  3752. Set format of hrir stream.
  3753. Default value is @var{stereo}. Alternative value is @var{multich}.
  3754. If value is set to @var{stereo}, number of additional streams should
  3755. be greater or equal to number of input channels in first input stream.
  3756. Also each additional stream should have stereo number of channels.
  3757. If value is set to @var{multich}, number of additional streams should
  3758. be exactly one. Also number of input channels of additional stream
  3759. should be equal or greater than twice number of channels of first input
  3760. stream.
  3761. @end table
  3762. @subsection Examples
  3763. @itemize
  3764. @item
  3765. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3766. each amovie filter use stereo file with IR coefficients as input.
  3767. The files give coefficients for each position of virtual loudspeaker:
  3768. @example
  3769. ffmpeg -i input.wav
  3770. -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"
  3771. output.wav
  3772. @end example
  3773. @item
  3774. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  3775. but now in @var{multich} @var{hrir} format.
  3776. @example
  3777. 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"
  3778. output.wav
  3779. @end example
  3780. @end itemize
  3781. @section highpass
  3782. Apply a high-pass filter with 3dB point frequency.
  3783. The filter can be either single-pole, or double-pole (the default).
  3784. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3785. The filter accepts the following options:
  3786. @table @option
  3787. @item frequency, f
  3788. Set frequency in Hz. Default is 3000.
  3789. @item poles, p
  3790. Set number of poles. Default is 2.
  3791. @item width_type, t
  3792. Set method to specify band-width of filter.
  3793. @table @option
  3794. @item h
  3795. Hz
  3796. @item q
  3797. Q-Factor
  3798. @item o
  3799. octave
  3800. @item s
  3801. slope
  3802. @item k
  3803. kHz
  3804. @end table
  3805. @item width, w
  3806. Specify the band-width of a filter in width_type units.
  3807. Applies only to double-pole filter.
  3808. The default is 0.707q and gives a Butterworth response.
  3809. @item mix, m
  3810. How much to use filtered signal in output. Default is 1.
  3811. Range is between 0 and 1.
  3812. @item channels, c
  3813. Specify which channels to filter, by default all available are filtered.
  3814. @item normalize, n
  3815. Normalize biquad coefficients, by default is disabled.
  3816. Enabling it will normalize magnitude response at DC to 0dB.
  3817. @item transform, a
  3818. Set transform type of IIR filter.
  3819. @table @option
  3820. @item di
  3821. @item dii
  3822. @item tdii
  3823. @item latt
  3824. @item svf
  3825. @end table
  3826. @item precision, r
  3827. Set precison of filtering.
  3828. @table @option
  3829. @item auto
  3830. Pick automatic sample format depending on surround filters.
  3831. @item s16
  3832. Always use signed 16-bit.
  3833. @item s32
  3834. Always use signed 32-bit.
  3835. @item f32
  3836. Always use float 32-bit.
  3837. @item f64
  3838. Always use float 64-bit.
  3839. @end table
  3840. @end table
  3841. @subsection Commands
  3842. This filter supports the following commands:
  3843. @table @option
  3844. @item frequency, f
  3845. Change highpass frequency.
  3846. Syntax for the command is : "@var{frequency}"
  3847. @item width_type, t
  3848. Change highpass width_type.
  3849. Syntax for the command is : "@var{width_type}"
  3850. @item width, w
  3851. Change highpass width.
  3852. Syntax for the command is : "@var{width}"
  3853. @item mix, m
  3854. Change highpass mix.
  3855. Syntax for the command is : "@var{mix}"
  3856. @end table
  3857. @section join
  3858. Join multiple input streams into one multi-channel stream.
  3859. It accepts the following parameters:
  3860. @table @option
  3861. @item inputs
  3862. The number of input streams. It defaults to 2.
  3863. @item channel_layout
  3864. The desired output channel layout. It defaults to stereo.
  3865. @item map
  3866. Map channels from inputs to output. The argument is a '|'-separated list of
  3867. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  3868. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  3869. can be either the name of the input channel (e.g. FL for front left) or its
  3870. index in the specified input stream. @var{out_channel} is the name of the output
  3871. channel.
  3872. @end table
  3873. The filter will attempt to guess the mappings when they are not specified
  3874. explicitly. It does so by first trying to find an unused matching input channel
  3875. and if that fails it picks the first unused input channel.
  3876. Join 3 inputs (with properly set channel layouts):
  3877. @example
  3878. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  3879. @end example
  3880. Build a 5.1 output from 6 single-channel streams:
  3881. @example
  3882. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  3883. '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'
  3884. out
  3885. @end example
  3886. @section ladspa
  3887. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  3888. To enable compilation of this filter you need to configure FFmpeg with
  3889. @code{--enable-ladspa}.
  3890. @table @option
  3891. @item file, f
  3892. Specifies the name of LADSPA plugin library to load. If the environment
  3893. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  3894. each one of the directories specified by the colon separated list in
  3895. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  3896. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  3897. @file{/usr/lib/ladspa/}.
  3898. @item plugin, p
  3899. Specifies the plugin within the library. Some libraries contain only
  3900. one plugin, but others contain many of them. If this is not set filter
  3901. will list all available plugins within the specified library.
  3902. @item controls, c
  3903. Set the '|' separated list of controls which are zero or more floating point
  3904. values that determine the behavior of the loaded plugin (for example delay,
  3905. threshold or gain).
  3906. Controls need to be defined using the following syntax:
  3907. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  3908. @var{valuei} is the value set on the @var{i}-th control.
  3909. Alternatively they can be also defined using the following syntax:
  3910. @var{value0}|@var{value1}|@var{value2}|..., where
  3911. @var{valuei} is the value set on the @var{i}-th control.
  3912. If @option{controls} is set to @code{help}, all available controls and
  3913. their valid ranges are printed.
  3914. @item sample_rate, s
  3915. Specify the sample rate, default to 44100. Only used if plugin have
  3916. zero inputs.
  3917. @item nb_samples, n
  3918. Set the number of samples per channel per each output frame, default
  3919. is 1024. Only used if plugin have zero inputs.
  3920. @item duration, d
  3921. Set the minimum duration of the sourced audio. See
  3922. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3923. for the accepted syntax.
  3924. Note that the resulting duration may be greater than the specified duration,
  3925. as the generated audio is always cut at the end of a complete frame.
  3926. If not specified, or the expressed duration is negative, the audio is
  3927. supposed to be generated forever.
  3928. Only used if plugin have zero inputs.
  3929. @item latency, l
  3930. Enable latency compensation, by default is disabled.
  3931. Only used if plugin have inputs.
  3932. @end table
  3933. @subsection Examples
  3934. @itemize
  3935. @item
  3936. List all available plugins within amp (LADSPA example plugin) library:
  3937. @example
  3938. ladspa=file=amp
  3939. @end example
  3940. @item
  3941. List all available controls and their valid ranges for @code{vcf_notch}
  3942. plugin from @code{VCF} library:
  3943. @example
  3944. ladspa=f=vcf:p=vcf_notch:c=help
  3945. @end example
  3946. @item
  3947. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  3948. plugin library:
  3949. @example
  3950. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  3951. @end example
  3952. @item
  3953. Add reverberation to the audio using TAP-plugins
  3954. (Tom's Audio Processing plugins):
  3955. @example
  3956. ladspa=file=tap_reverb:tap_reverb
  3957. @end example
  3958. @item
  3959. Generate white noise, with 0.2 amplitude:
  3960. @example
  3961. ladspa=file=cmt:noise_source_white:c=c0=.2
  3962. @end example
  3963. @item
  3964. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  3965. @code{C* Audio Plugin Suite} (CAPS) library:
  3966. @example
  3967. ladspa=file=caps:Click:c=c1=20'
  3968. @end example
  3969. @item
  3970. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  3971. @example
  3972. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  3973. @end example
  3974. @item
  3975. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  3976. @code{SWH Plugins} collection:
  3977. @example
  3978. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  3979. @end example
  3980. @item
  3981. Attenuate low frequencies using Multiband EQ from Steve Harris
  3982. @code{SWH Plugins} collection:
  3983. @example
  3984. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  3985. @end example
  3986. @item
  3987. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  3988. (CAPS) library:
  3989. @example
  3990. ladspa=caps:Narrower
  3991. @end example
  3992. @item
  3993. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  3994. @example
  3995. ladspa=caps:White:.2
  3996. @end example
  3997. @item
  3998. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  3999. @example
  4000. ladspa=caps:Fractal:c=c1=1
  4001. @end example
  4002. @item
  4003. Dynamic volume normalization using @code{VLevel} plugin:
  4004. @example
  4005. ladspa=vlevel-ladspa:vlevel_mono
  4006. @end example
  4007. @end itemize
  4008. @subsection Commands
  4009. This filter supports the following commands:
  4010. @table @option
  4011. @item cN
  4012. Modify the @var{N}-th control value.
  4013. If the specified value is not valid, it is ignored and prior one is kept.
  4014. @end table
  4015. @section loudnorm
  4016. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  4017. Support for both single pass (livestreams, files) and double pass (files) modes.
  4018. This algorithm can target IL, LRA, and maximum true peak. In dynamic mode, to accurately
  4019. detect true peaks, the audio stream will be upsampled to 192 kHz.
  4020. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  4021. The filter accepts the following options:
  4022. @table @option
  4023. @item I, i
  4024. Set integrated loudness target.
  4025. Range is -70.0 - -5.0. Default value is -24.0.
  4026. @item LRA, lra
  4027. Set loudness range target.
  4028. Range is 1.0 - 20.0. Default value is 7.0.
  4029. @item TP, tp
  4030. Set maximum true peak.
  4031. Range is -9.0 - +0.0. Default value is -2.0.
  4032. @item measured_I, measured_i
  4033. Measured IL of input file.
  4034. Range is -99.0 - +0.0.
  4035. @item measured_LRA, measured_lra
  4036. Measured LRA of input file.
  4037. Range is 0.0 - 99.0.
  4038. @item measured_TP, measured_tp
  4039. Measured true peak of input file.
  4040. Range is -99.0 - +99.0.
  4041. @item measured_thresh
  4042. Measured threshold of input file.
  4043. Range is -99.0 - +0.0.
  4044. @item offset
  4045. Set offset gain. Gain is applied before the true-peak limiter.
  4046. Range is -99.0 - +99.0. Default is +0.0.
  4047. @item linear
  4048. Normalize by linearly scaling the source audio.
  4049. @code{measured_I}, @code{measured_LRA}, @code{measured_TP},
  4050. and @code{measured_thresh} must all be specified. Target LRA shouldn't
  4051. be lower than source LRA and the change in integrated loudness shouldn't
  4052. result in a true peak which exceeds the target TP. If any of these
  4053. conditions aren't met, normalization mode will revert to @var{dynamic}.
  4054. Options are @code{true} or @code{false}. Default is @code{true}.
  4055. @item dual_mono
  4056. Treat mono input files as "dual-mono". If a mono file is intended for playback
  4057. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  4058. If set to @code{true}, this option will compensate for this effect.
  4059. Multi-channel input files are not affected by this option.
  4060. Options are true or false. Default is false.
  4061. @item print_format
  4062. Set print format for stats. Options are summary, json, or none.
  4063. Default value is none.
  4064. @end table
  4065. @section lowpass
  4066. Apply a low-pass filter with 3dB point frequency.
  4067. The filter can be either single-pole or double-pole (the default).
  4068. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  4069. The filter accepts the following options:
  4070. @table @option
  4071. @item frequency, f
  4072. Set frequency in Hz. Default is 500.
  4073. @item poles, p
  4074. Set number of poles. Default is 2.
  4075. @item width_type, t
  4076. Set method to specify band-width of filter.
  4077. @table @option
  4078. @item h
  4079. Hz
  4080. @item q
  4081. Q-Factor
  4082. @item o
  4083. octave
  4084. @item s
  4085. slope
  4086. @item k
  4087. kHz
  4088. @end table
  4089. @item width, w
  4090. Specify the band-width of a filter in width_type units.
  4091. Applies only to double-pole filter.
  4092. The default is 0.707q and gives a Butterworth response.
  4093. @item mix, m
  4094. How much to use filtered signal in output. Default is 1.
  4095. Range is between 0 and 1.
  4096. @item channels, c
  4097. Specify which channels to filter, by default all available are filtered.
  4098. @item normalize, n
  4099. Normalize biquad coefficients, by default is disabled.
  4100. Enabling it will normalize magnitude response at DC to 0dB.
  4101. @item transform, a
  4102. Set transform type of IIR filter.
  4103. @table @option
  4104. @item di
  4105. @item dii
  4106. @item tdii
  4107. @item latt
  4108. @item svf
  4109. @end table
  4110. @item precision, r
  4111. Set precison of filtering.
  4112. @table @option
  4113. @item auto
  4114. Pick automatic sample format depending on surround filters.
  4115. @item s16
  4116. Always use signed 16-bit.
  4117. @item s32
  4118. Always use signed 32-bit.
  4119. @item f32
  4120. Always use float 32-bit.
  4121. @item f64
  4122. Always use float 64-bit.
  4123. @end table
  4124. @end table
  4125. @subsection Examples
  4126. @itemize
  4127. @item
  4128. Lowpass only LFE channel, it LFE is not present it does nothing:
  4129. @example
  4130. lowpass=c=LFE
  4131. @end example
  4132. @end itemize
  4133. @subsection Commands
  4134. This filter supports the following commands:
  4135. @table @option
  4136. @item frequency, f
  4137. Change lowpass frequency.
  4138. Syntax for the command is : "@var{frequency}"
  4139. @item width_type, t
  4140. Change lowpass width_type.
  4141. Syntax for the command is : "@var{width_type}"
  4142. @item width, w
  4143. Change lowpass width.
  4144. Syntax for the command is : "@var{width}"
  4145. @item mix, m
  4146. Change lowpass mix.
  4147. Syntax for the command is : "@var{mix}"
  4148. @end table
  4149. @section lv2
  4150. Load a LV2 (LADSPA Version 2) plugin.
  4151. To enable compilation of this filter you need to configure FFmpeg with
  4152. @code{--enable-lv2}.
  4153. @table @option
  4154. @item plugin, p
  4155. Specifies the plugin URI. You may need to escape ':'.
  4156. @item controls, c
  4157. Set the '|' separated list of controls which are zero or more floating point
  4158. values that determine the behavior of the loaded plugin (for example delay,
  4159. threshold or gain).
  4160. If @option{controls} is set to @code{help}, all available controls and
  4161. their valid ranges are printed.
  4162. @item sample_rate, s
  4163. Specify the sample rate, default to 44100. Only used if plugin have
  4164. zero inputs.
  4165. @item nb_samples, n
  4166. Set the number of samples per channel per each output frame, default
  4167. is 1024. Only used if plugin have zero inputs.
  4168. @item duration, d
  4169. Set the minimum duration of the sourced audio. See
  4170. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4171. for the accepted syntax.
  4172. Note that the resulting duration may be greater than the specified duration,
  4173. as the generated audio is always cut at the end of a complete frame.
  4174. If not specified, or the expressed duration is negative, the audio is
  4175. supposed to be generated forever.
  4176. Only used if plugin have zero inputs.
  4177. @end table
  4178. @subsection Examples
  4179. @itemize
  4180. @item
  4181. Apply bass enhancer plugin from Calf:
  4182. @example
  4183. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  4184. @end example
  4185. @item
  4186. Apply vinyl plugin from Calf:
  4187. @example
  4188. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  4189. @end example
  4190. @item
  4191. Apply bit crusher plugin from ArtyFX:
  4192. @example
  4193. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  4194. @end example
  4195. @end itemize
  4196. @section mcompand
  4197. Multiband Compress or expand the audio's dynamic range.
  4198. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  4199. This is akin to the crossover of a loudspeaker, and results in flat frequency
  4200. response when absent compander action.
  4201. It accepts the following parameters:
  4202. @table @option
  4203. @item args
  4204. This option syntax is:
  4205. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  4206. For explanation of each item refer to compand filter documentation.
  4207. @end table
  4208. @anchor{pan}
  4209. @section pan
  4210. Mix channels with specific gain levels. The filter accepts the output
  4211. channel layout followed by a set of channels definitions.
  4212. This filter is also designed to efficiently remap the channels of an audio
  4213. stream.
  4214. The filter accepts parameters of the form:
  4215. "@var{l}|@var{outdef}|@var{outdef}|..."
  4216. @table @option
  4217. @item l
  4218. output channel layout or number of channels
  4219. @item outdef
  4220. output channel specification, of the form:
  4221. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  4222. @item out_name
  4223. output channel to define, either a channel name (FL, FR, etc.) or a channel
  4224. number (c0, c1, etc.)
  4225. @item gain
  4226. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  4227. @item in_name
  4228. input channel to use, see out_name for details; it is not possible to mix
  4229. named and numbered input channels
  4230. @end table
  4231. If the `=' in a channel specification is replaced by `<', then the gains for
  4232. that specification will be renormalized so that the total is 1, thus
  4233. avoiding clipping noise.
  4234. @subsection Mixing examples
  4235. For example, if you want to down-mix from stereo to mono, but with a bigger
  4236. factor for the left channel:
  4237. @example
  4238. pan=1c|c0=0.9*c0+0.1*c1
  4239. @end example
  4240. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  4241. 7-channels surround:
  4242. @example
  4243. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  4244. @end example
  4245. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  4246. that should be preferred (see "-ac" option) unless you have very specific
  4247. needs.
  4248. @subsection Remapping examples
  4249. The channel remapping will be effective if, and only if:
  4250. @itemize
  4251. @item gain coefficients are zeroes or ones,
  4252. @item only one input per channel output,
  4253. @end itemize
  4254. If all these conditions are satisfied, the filter will notify the user ("Pure
  4255. channel mapping detected"), and use an optimized and lossless method to do the
  4256. remapping.
  4257. For example, if you have a 5.1 source and want a stereo audio stream by
  4258. dropping the extra channels:
  4259. @example
  4260. pan="stereo| c0=FL | c1=FR"
  4261. @end example
  4262. Given the same source, you can also switch front left and front right channels
  4263. and keep the input channel layout:
  4264. @example
  4265. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  4266. @end example
  4267. If the input is a stereo audio stream, you can mute the front left channel (and
  4268. still keep the stereo channel layout) with:
  4269. @example
  4270. pan="stereo|c1=c1"
  4271. @end example
  4272. Still with a stereo audio stream input, you can copy the right channel in both
  4273. front left and right:
  4274. @example
  4275. pan="stereo| c0=FR | c1=FR"
  4276. @end example
  4277. @section replaygain
  4278. ReplayGain scanner filter. This filter takes an audio stream as an input and
  4279. outputs it unchanged.
  4280. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  4281. @section resample
  4282. Convert the audio sample format, sample rate and channel layout. It is
  4283. not meant to be used directly.
  4284. @section rubberband
  4285. Apply time-stretching and pitch-shifting with librubberband.
  4286. To enable compilation of this filter, you need to configure FFmpeg with
  4287. @code{--enable-librubberband}.
  4288. The filter accepts the following options:
  4289. @table @option
  4290. @item tempo
  4291. Set tempo scale factor.
  4292. @item pitch
  4293. Set pitch scale factor.
  4294. @item transients
  4295. Set transients detector.
  4296. Possible values are:
  4297. @table @var
  4298. @item crisp
  4299. @item mixed
  4300. @item smooth
  4301. @end table
  4302. @item detector
  4303. Set detector.
  4304. Possible values are:
  4305. @table @var
  4306. @item compound
  4307. @item percussive
  4308. @item soft
  4309. @end table
  4310. @item phase
  4311. Set phase.
  4312. Possible values are:
  4313. @table @var
  4314. @item laminar
  4315. @item independent
  4316. @end table
  4317. @item window
  4318. Set processing window size.
  4319. Possible values are:
  4320. @table @var
  4321. @item standard
  4322. @item short
  4323. @item long
  4324. @end table
  4325. @item smoothing
  4326. Set smoothing.
  4327. Possible values are:
  4328. @table @var
  4329. @item off
  4330. @item on
  4331. @end table
  4332. @item formant
  4333. Enable formant preservation when shift pitching.
  4334. Possible values are:
  4335. @table @var
  4336. @item shifted
  4337. @item preserved
  4338. @end table
  4339. @item pitchq
  4340. Set pitch quality.
  4341. Possible values are:
  4342. @table @var
  4343. @item quality
  4344. @item speed
  4345. @item consistency
  4346. @end table
  4347. @item channels
  4348. Set channels.
  4349. Possible values are:
  4350. @table @var
  4351. @item apart
  4352. @item together
  4353. @end table
  4354. @end table
  4355. @subsection Commands
  4356. This filter supports the following commands:
  4357. @table @option
  4358. @item tempo
  4359. Change filter tempo scale factor.
  4360. Syntax for the command is : "@var{tempo}"
  4361. @item pitch
  4362. Change filter pitch scale factor.
  4363. Syntax for the command is : "@var{pitch}"
  4364. @end table
  4365. @section sidechaincompress
  4366. This filter acts like normal compressor but has the ability to compress
  4367. detected signal using second input signal.
  4368. It needs two input streams and returns one output stream.
  4369. First input stream will be processed depending on second stream signal.
  4370. The filtered signal then can be filtered with other filters in later stages of
  4371. processing. See @ref{pan} and @ref{amerge} filter.
  4372. The filter accepts the following options:
  4373. @table @option
  4374. @item level_in
  4375. Set input gain. Default is 1. Range is between 0.015625 and 64.
  4376. @item mode
  4377. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  4378. Default is @code{downward}.
  4379. @item threshold
  4380. If a signal of second stream raises above this level it will affect the gain
  4381. reduction of first stream.
  4382. By default is 0.125. Range is between 0.00097563 and 1.
  4383. @item ratio
  4384. Set a ratio about which the signal is reduced. 1:2 means that if the level
  4385. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  4386. Default is 2. Range is between 1 and 20.
  4387. @item attack
  4388. Amount of milliseconds the signal has to rise above the threshold before gain
  4389. reduction starts. Default is 20. Range is between 0.01 and 2000.
  4390. @item release
  4391. Amount of milliseconds the signal has to fall below the threshold before
  4392. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  4393. @item makeup
  4394. Set the amount by how much signal will be amplified after processing.
  4395. Default is 1. Range is from 1 to 64.
  4396. @item knee
  4397. Curve the sharp knee around the threshold to enter gain reduction more softly.
  4398. Default is 2.82843. Range is between 1 and 8.
  4399. @item link
  4400. Choose if the @code{average} level between all channels of side-chain stream
  4401. or the louder(@code{maximum}) channel of side-chain stream affects the
  4402. reduction. Default is @code{average}.
  4403. @item detection
  4404. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  4405. of @code{rms}. Default is @code{rms} which is mainly smoother.
  4406. @item level_sc
  4407. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  4408. @item mix
  4409. How much to use compressed signal in output. Default is 1.
  4410. Range is between 0 and 1.
  4411. @end table
  4412. @subsection Commands
  4413. This filter supports the all above options as @ref{commands}.
  4414. @subsection Examples
  4415. @itemize
  4416. @item
  4417. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  4418. depending on the signal of 2nd input and later compressed signal to be
  4419. merged with 2nd input:
  4420. @example
  4421. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  4422. @end example
  4423. @end itemize
  4424. @section sidechaingate
  4425. A sidechain gate acts like a normal (wideband) gate but has the ability to
  4426. filter the detected signal before sending it to the gain reduction stage.
  4427. Normally a gate uses the full range signal to detect a level above the
  4428. threshold.
  4429. For example: If you cut all lower frequencies from your sidechain signal
  4430. the gate will decrease the volume of your track only if not enough highs
  4431. appear. With this technique you are able to reduce the resonation of a
  4432. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  4433. guitar.
  4434. It needs two input streams and returns one output stream.
  4435. First input stream will be processed depending on second stream signal.
  4436. The filter accepts the following options:
  4437. @table @option
  4438. @item level_in
  4439. Set input level before filtering.
  4440. Default is 1. Allowed range is from 0.015625 to 64.
  4441. @item mode
  4442. Set the mode of operation. Can be @code{upward} or @code{downward}.
  4443. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  4444. will be amplified, expanding dynamic range in upward direction.
  4445. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  4446. @item range
  4447. Set the level of gain reduction when the signal is below the threshold.
  4448. Default is 0.06125. Allowed range is from 0 to 1.
  4449. Setting this to 0 disables reduction and then filter behaves like expander.
  4450. @item threshold
  4451. If a signal rises above this level the gain reduction is released.
  4452. Default is 0.125. Allowed range is from 0 to 1.
  4453. @item ratio
  4454. Set a ratio about which the signal is reduced.
  4455. Default is 2. Allowed range is from 1 to 9000.
  4456. @item attack
  4457. Amount of milliseconds the signal has to rise above the threshold before gain
  4458. reduction stops.
  4459. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  4460. @item release
  4461. Amount of milliseconds the signal has to fall below the threshold before the
  4462. reduction is increased again. Default is 250 milliseconds.
  4463. Allowed range is from 0.01 to 9000.
  4464. @item makeup
  4465. Set amount of amplification of signal after processing.
  4466. Default is 1. Allowed range is from 1 to 64.
  4467. @item knee
  4468. Curve the sharp knee around the threshold to enter gain reduction more softly.
  4469. Default is 2.828427125. Allowed range is from 1 to 8.
  4470. @item detection
  4471. Choose if exact signal should be taken for detection or an RMS like one.
  4472. Default is rms. Can be peak or rms.
  4473. @item link
  4474. Choose if the average level between all channels or the louder channel affects
  4475. the reduction.
  4476. Default is average. Can be average or maximum.
  4477. @item level_sc
  4478. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  4479. @end table
  4480. @subsection Commands
  4481. This filter supports the all above options as @ref{commands}.
  4482. @section silencedetect
  4483. Detect silence in an audio stream.
  4484. This filter logs a message when it detects that the input audio volume is less
  4485. or equal to a noise tolerance value for a duration greater or equal to the
  4486. minimum detected noise duration.
  4487. The printed times and duration are expressed in seconds. The
  4488. @code{lavfi.silence_start} or @code{lavfi.silence_start.X} metadata key
  4489. is set on the first frame whose timestamp equals or exceeds the detection
  4490. duration and it contains the timestamp of the first frame of the silence.
  4491. The @code{lavfi.silence_duration} or @code{lavfi.silence_duration.X}
  4492. and @code{lavfi.silence_end} or @code{lavfi.silence_end.X} metadata
  4493. keys are set on the first frame after the silence. If @option{mono} is
  4494. enabled, and each channel is evaluated separately, the @code{.X}
  4495. suffixed keys are used, and @code{X} corresponds to the channel number.
  4496. The filter accepts the following options:
  4497. @table @option
  4498. @item noise, n
  4499. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  4500. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  4501. @item duration, d
  4502. Set silence duration until notification (default is 2 seconds). See
  4503. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4504. for the accepted syntax.
  4505. @item mono, m
  4506. Process each channel separately, instead of combined. By default is disabled.
  4507. @end table
  4508. @subsection Examples
  4509. @itemize
  4510. @item
  4511. Detect 5 seconds of silence with -50dB noise tolerance:
  4512. @example
  4513. silencedetect=n=-50dB:d=5
  4514. @end example
  4515. @item
  4516. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  4517. tolerance in @file{silence.mp3}:
  4518. @example
  4519. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  4520. @end example
  4521. @end itemize
  4522. @section silenceremove
  4523. Remove silence from the beginning, middle or end of the audio.
  4524. The filter accepts the following options:
  4525. @table @option
  4526. @item start_periods
  4527. This value is used to indicate if audio should be trimmed at beginning of
  4528. the audio. A value of zero indicates no silence should be trimmed from the
  4529. beginning. When specifying a non-zero value, it trims audio up until it
  4530. finds non-silence. Normally, when trimming silence from beginning of audio
  4531. the @var{start_periods} will be @code{1} but it can be increased to higher
  4532. values to trim all audio up to specific count of non-silence periods.
  4533. Default value is @code{0}.
  4534. @item start_duration
  4535. Specify the amount of time that non-silence must be detected before it stops
  4536. trimming audio. By increasing the duration, bursts of noises can be treated
  4537. as silence and trimmed off. Default value is @code{0}.
  4538. @item start_threshold
  4539. This indicates what sample value should be treated as silence. For digital
  4540. audio, a value of @code{0} may be fine but for audio recorded from analog,
  4541. you may wish to increase the value to account for background noise.
  4542. Can be specified in dB (in case "dB" is appended to the specified value)
  4543. or amplitude ratio. Default value is @code{0}.
  4544. @item start_silence
  4545. Specify max duration of silence at beginning that will be kept after
  4546. trimming. Default is 0, which is equal to trimming all samples detected
  4547. as silence.
  4548. @item start_mode
  4549. Specify mode of detection of silence end in start of multi-channel audio.
  4550. Can be @var{any} or @var{all}. Default is @var{any}.
  4551. With @var{any}, any sample that is detected as non-silence will cause
  4552. stopped trimming of silence.
  4553. With @var{all}, only if all channels are detected as non-silence will cause
  4554. stopped trimming of silence.
  4555. @item stop_periods
  4556. Set the count for trimming silence from the end of audio.
  4557. To remove silence from the middle of a file, specify a @var{stop_periods}
  4558. that is negative. This value is then treated as a positive value and is
  4559. used to indicate the effect should restart processing as specified by
  4560. @var{start_periods}, making it suitable for removing periods of silence
  4561. in the middle of the audio.
  4562. Default value is @code{0}.
  4563. @item stop_duration
  4564. Specify a duration of silence that must exist before audio is not copied any
  4565. more. By specifying a higher duration, silence that is wanted can be left in
  4566. the audio.
  4567. Default value is @code{0}.
  4568. @item stop_threshold
  4569. This is the same as @option{start_threshold} but for trimming silence from
  4570. the end of audio.
  4571. Can be specified in dB (in case "dB" is appended to the specified value)
  4572. or amplitude ratio. Default value is @code{0}.
  4573. @item stop_silence
  4574. Specify max duration of silence at end that will be kept after
  4575. trimming. Default is 0, which is equal to trimming all samples detected
  4576. as silence.
  4577. @item stop_mode
  4578. Specify mode of detection of silence start in end of multi-channel audio.
  4579. Can be @var{any} or @var{all}. Default is @var{any}.
  4580. With @var{any}, any sample that is detected as non-silence will cause
  4581. stopped trimming of silence.
  4582. With @var{all}, only if all channels are detected as non-silence will cause
  4583. stopped trimming of silence.
  4584. @item detection
  4585. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  4586. and works better with digital silence which is exactly 0.
  4587. Default value is @code{rms}.
  4588. @item window
  4589. Set duration in number of seconds used to calculate size of window in number
  4590. of samples for detecting silence.
  4591. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  4592. @end table
  4593. @subsection Examples
  4594. @itemize
  4595. @item
  4596. The following example shows how this filter can be used to start a recording
  4597. that does not contain the delay at the start which usually occurs between
  4598. pressing the record button and the start of the performance:
  4599. @example
  4600. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  4601. @end example
  4602. @item
  4603. Trim all silence encountered from beginning to end where there is more than 1
  4604. second of silence in audio:
  4605. @example
  4606. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  4607. @end example
  4608. @item
  4609. Trim all digital silence samples, using peak detection, from beginning to end
  4610. where there is more than 0 samples of digital silence in audio and digital
  4611. silence is detected in all channels at same positions in stream:
  4612. @example
  4613. silenceremove=window=0:detection=peak:stop_mode=all:start_mode=all:stop_periods=-1:stop_threshold=0
  4614. @end example
  4615. @end itemize
  4616. @section sofalizer
  4617. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  4618. loudspeakers around the user for binaural listening via headphones (audio
  4619. formats up to 9 channels supported).
  4620. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  4621. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  4622. Austrian Academy of Sciences.
  4623. To enable compilation of this filter you need to configure FFmpeg with
  4624. @code{--enable-libmysofa}.
  4625. The filter accepts the following options:
  4626. @table @option
  4627. @item sofa
  4628. Set the SOFA file used for rendering.
  4629. @item gain
  4630. Set gain applied to audio. Value is in dB. Default is 0.
  4631. @item rotation
  4632. Set rotation of virtual loudspeakers in deg. Default is 0.
  4633. @item elevation
  4634. Set elevation of virtual speakers in deg. Default is 0.
  4635. @item radius
  4636. Set distance in meters between loudspeakers and the listener with near-field
  4637. HRTFs. Default is 1.
  4638. @item type
  4639. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  4640. processing audio in time domain which is slow.
  4641. @var{freq} is processing audio in frequency domain which is fast.
  4642. Default is @var{freq}.
  4643. @item speakers
  4644. Set custom positions of virtual loudspeakers. Syntax for this option is:
  4645. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  4646. Each virtual loudspeaker is described with short channel name following with
  4647. azimuth and elevation in degrees.
  4648. Each virtual loudspeaker description is separated by '|'.
  4649. For example to override front left and front right channel positions use:
  4650. 'speakers=FL 45 15|FR 345 15'.
  4651. Descriptions with unrecognised channel names are ignored.
  4652. @item lfegain
  4653. Set custom gain for LFE channels. Value is in dB. Default is 0.
  4654. @item framesize
  4655. Set custom frame size in number of samples. Default is 1024.
  4656. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  4657. is set to @var{freq}.
  4658. @item normalize
  4659. Should all IRs be normalized upon importing SOFA file.
  4660. By default is enabled.
  4661. @item interpolate
  4662. Should nearest IRs be interpolated with neighbor IRs if exact position
  4663. does not match. By default is disabled.
  4664. @item minphase
  4665. Minphase all IRs upon loading of SOFA file. By default is disabled.
  4666. @item anglestep
  4667. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  4668. @item radstep
  4669. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  4670. @end table
  4671. @subsection Examples
  4672. @itemize
  4673. @item
  4674. Using ClubFritz6 sofa file:
  4675. @example
  4676. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  4677. @end example
  4678. @item
  4679. Using ClubFritz12 sofa file and bigger radius with small rotation:
  4680. @example
  4681. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  4682. @end example
  4683. @item
  4684. Similar as above but with custom speaker positions for front left, front right, back left and back right
  4685. and also with custom gain:
  4686. @example
  4687. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  4688. @end example
  4689. @end itemize
  4690. @section speechnorm
  4691. Speech Normalizer.
  4692. This filter expands or compresses each half-cycle of audio samples
  4693. (local set of samples all above or all below zero and between two nearest zero crossings) depending
  4694. on threshold value, so audio reaches target peak value under conditions controlled by below options.
  4695. The filter accepts the following options:
  4696. @table @option
  4697. @item peak, p
  4698. Set the expansion target peak value. This specifies the highest allowed absolute amplitude
  4699. level for the normalized audio input. Default value is 0.95. Allowed range is from 0.0 to 1.0.
  4700. @item expansion, e
  4701. Set the maximum expansion factor. Allowed range is from 1.0 to 50.0. Default value is 2.0.
  4702. This option controls maximum local half-cycle of samples expansion. The maximum expansion
  4703. would be such that local peak value reaches target peak value but never to surpass it and that
  4704. ratio between new and previous peak value does not surpass this option value.
  4705. @item compression, c
  4706. Set the maximum compression factor. Allowed range is from 1.0 to 50.0. Default value is 2.0.
  4707. This option controls maximum local half-cycle of samples compression. This option is used
  4708. only if @option{threshold} option is set to value greater than 0.0, then in such cases
  4709. when local peak is lower or same as value set by @option{threshold} all samples belonging to
  4710. that peak's half-cycle will be compressed by current compression factor.
  4711. @item threshold, t
  4712. Set the threshold value. Default value is 0.0. Allowed range is from 0.0 to 1.0.
  4713. This option specifies which half-cycles of samples will be compressed and which will be expanded.
  4714. Any half-cycle samples with their local peak value below or same as this option value will be
  4715. compressed by current compression factor, otherwise, if greater than threshold value they will be
  4716. expanded with expansion factor so that it could reach peak target value but never surpass it.
  4717. @item raise, r
  4718. Set the expansion raising amount per each half-cycle of samples. Default value is 0.001.
  4719. Allowed range is from 0.0 to 1.0. This controls how fast expansion factor is raised per
  4720. each new half-cycle until it reaches @option{expansion} value.
  4721. Setting this options too high may lead to distortions.
  4722. @item fall, f
  4723. Set the compression raising amount per each half-cycle of samples. Default value is 0.001.
  4724. Allowed range is from 0.0 to 1.0. This controls how fast compression factor is raised per
  4725. each new half-cycle until it reaches @option{compression} value.
  4726. @item channels, h
  4727. Specify which channels to filter, by default all available channels are filtered.
  4728. @item invert, i
  4729. Enable inverted filtering, by default is disabled. This inverts interpretation of @option{threshold}
  4730. option. When enabled any half-cycle of samples with their local peak value below or same as
  4731. @option{threshold} option will be expanded otherwise it will be compressed.
  4732. @item link, l
  4733. Link channels when calculating gain applied to each filtered channel sample, by default is disabled.
  4734. When disabled each filtered channel gain calculation is independent, otherwise when this option
  4735. is enabled the minimum of all possible gains for each filtered channel is used.
  4736. @end table
  4737. @subsection Commands
  4738. This filter supports the all above options as @ref{commands}.
  4739. @section stereotools
  4740. This filter has some handy utilities to manage stereo signals, for converting
  4741. M/S stereo recordings to L/R signal while having control over the parameters
  4742. or spreading the stereo image of master track.
  4743. The filter accepts the following options:
  4744. @table @option
  4745. @item level_in
  4746. Set input level before filtering for both channels. Defaults is 1.
  4747. Allowed range is from 0.015625 to 64.
  4748. @item level_out
  4749. Set output level after filtering for both channels. Defaults is 1.
  4750. Allowed range is from 0.015625 to 64.
  4751. @item balance_in
  4752. Set input balance between both channels. Default is 0.
  4753. Allowed range is from -1 to 1.
  4754. @item balance_out
  4755. Set output balance between both channels. Default is 0.
  4756. Allowed range is from -1 to 1.
  4757. @item softclip
  4758. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  4759. clipping. Disabled by default.
  4760. @item mutel
  4761. Mute the left channel. Disabled by default.
  4762. @item muter
  4763. Mute the right channel. Disabled by default.
  4764. @item phasel
  4765. Change the phase of the left channel. Disabled by default.
  4766. @item phaser
  4767. Change the phase of the right channel. Disabled by default.
  4768. @item mode
  4769. Set stereo mode. Available values are:
  4770. @table @samp
  4771. @item lr>lr
  4772. Left/Right to Left/Right, this is default.
  4773. @item lr>ms
  4774. Left/Right to Mid/Side.
  4775. @item ms>lr
  4776. Mid/Side to Left/Right.
  4777. @item lr>ll
  4778. Left/Right to Left/Left.
  4779. @item lr>rr
  4780. Left/Right to Right/Right.
  4781. @item lr>l+r
  4782. Left/Right to Left + Right.
  4783. @item lr>rl
  4784. Left/Right to Right/Left.
  4785. @item ms>ll
  4786. Mid/Side to Left/Left.
  4787. @item ms>rr
  4788. Mid/Side to Right/Right.
  4789. @item ms>rl
  4790. Mid/Side to Right/Left.
  4791. @item lr>l-r
  4792. Left/Right to Left - Right.
  4793. @end table
  4794. @item slev
  4795. Set level of side signal. Default is 1.
  4796. Allowed range is from 0.015625 to 64.
  4797. @item sbal
  4798. Set balance of side signal. Default is 0.
  4799. Allowed range is from -1 to 1.
  4800. @item mlev
  4801. Set level of the middle signal. Default is 1.
  4802. Allowed range is from 0.015625 to 64.
  4803. @item mpan
  4804. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  4805. @item base
  4806. Set stereo base between mono and inversed channels. Default is 0.
  4807. Allowed range is from -1 to 1.
  4808. @item delay
  4809. Set delay in milliseconds how much to delay left from right channel and
  4810. vice versa. Default is 0. Allowed range is from -20 to 20.
  4811. @item sclevel
  4812. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  4813. @item phase
  4814. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  4815. @item bmode_in, bmode_out
  4816. Set balance mode for balance_in/balance_out option.
  4817. Can be one of the following:
  4818. @table @samp
  4819. @item balance
  4820. Classic balance mode. Attenuate one channel at time.
  4821. Gain is raised up to 1.
  4822. @item amplitude
  4823. Similar as classic mode above but gain is raised up to 2.
  4824. @item power
  4825. Equal power distribution, from -6dB to +6dB range.
  4826. @end table
  4827. @end table
  4828. @subsection Commands
  4829. This filter supports the all above options as @ref{commands}.
  4830. @subsection Examples
  4831. @itemize
  4832. @item
  4833. Apply karaoke like effect:
  4834. @example
  4835. stereotools=mlev=0.015625
  4836. @end example
  4837. @item
  4838. Convert M/S signal to L/R:
  4839. @example
  4840. "stereotools=mode=ms>lr"
  4841. @end example
  4842. @end itemize
  4843. @section stereowiden
  4844. This filter enhance the stereo effect by suppressing signal common to both
  4845. channels and by delaying the signal of left into right and vice versa,
  4846. thereby widening the stereo effect.
  4847. The filter accepts the following options:
  4848. @table @option
  4849. @item delay
  4850. Time in milliseconds of the delay of left signal into right and vice versa.
  4851. Default is 20 milliseconds.
  4852. @item feedback
  4853. Amount of gain in delayed signal into right and vice versa. Gives a delay
  4854. effect of left signal in right output and vice versa which gives widening
  4855. effect. Default is 0.3.
  4856. @item crossfeed
  4857. Cross feed of left into right with inverted phase. This helps in suppressing
  4858. the mono. If the value is 1 it will cancel all the signal common to both
  4859. channels. Default is 0.3.
  4860. @item drymix
  4861. Set level of input signal of original channel. Default is 0.8.
  4862. @end table
  4863. @subsection Commands
  4864. This filter supports the all above options except @code{delay} as @ref{commands}.
  4865. @section superequalizer
  4866. Apply 18 band equalizer.
  4867. The filter accepts the following options:
  4868. @table @option
  4869. @item 1b
  4870. Set 65Hz band gain.
  4871. @item 2b
  4872. Set 92Hz band gain.
  4873. @item 3b
  4874. Set 131Hz band gain.
  4875. @item 4b
  4876. Set 185Hz band gain.
  4877. @item 5b
  4878. Set 262Hz band gain.
  4879. @item 6b
  4880. Set 370Hz band gain.
  4881. @item 7b
  4882. Set 523Hz band gain.
  4883. @item 8b
  4884. Set 740Hz band gain.
  4885. @item 9b
  4886. Set 1047Hz band gain.
  4887. @item 10b
  4888. Set 1480Hz band gain.
  4889. @item 11b
  4890. Set 2093Hz band gain.
  4891. @item 12b
  4892. Set 2960Hz band gain.
  4893. @item 13b
  4894. Set 4186Hz band gain.
  4895. @item 14b
  4896. Set 5920Hz band gain.
  4897. @item 15b
  4898. Set 8372Hz band gain.
  4899. @item 16b
  4900. Set 11840Hz band gain.
  4901. @item 17b
  4902. Set 16744Hz band gain.
  4903. @item 18b
  4904. Set 20000Hz band gain.
  4905. @end table
  4906. @section surround
  4907. Apply audio surround upmix filter.
  4908. This filter allows to produce multichannel output from audio stream.
  4909. The filter accepts the following options:
  4910. @table @option
  4911. @item chl_out
  4912. Set output channel layout. By default, this is @var{5.1}.
  4913. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4914. for the required syntax.
  4915. @item chl_in
  4916. Set input channel layout. By default, this is @var{stereo}.
  4917. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4918. for the required syntax.
  4919. @item level_in
  4920. Set input volume level. By default, this is @var{1}.
  4921. @item level_out
  4922. Set output volume level. By default, this is @var{1}.
  4923. @item lfe
  4924. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  4925. @item lfe_low
  4926. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  4927. @item lfe_high
  4928. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  4929. @item lfe_mode
  4930. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  4931. In @var{add} mode, LFE channel is created from input audio and added to output.
  4932. In @var{sub} mode, LFE channel is created from input audio and added to output but
  4933. also all non-LFE output channels are subtracted with output LFE channel.
  4934. @item angle
  4935. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  4936. Default is @var{90}.
  4937. @item fc_in
  4938. Set front center input volume. By default, this is @var{1}.
  4939. @item fc_out
  4940. Set front center output volume. By default, this is @var{1}.
  4941. @item fl_in
  4942. Set front left input volume. By default, this is @var{1}.
  4943. @item fl_out
  4944. Set front left output volume. By default, this is @var{1}.
  4945. @item fr_in
  4946. Set front right input volume. By default, this is @var{1}.
  4947. @item fr_out
  4948. Set front right output volume. By default, this is @var{1}.
  4949. @item sl_in
  4950. Set side left input volume. By default, this is @var{1}.
  4951. @item sl_out
  4952. Set side left output volume. By default, this is @var{1}.
  4953. @item sr_in
  4954. Set side right input volume. By default, this is @var{1}.
  4955. @item sr_out
  4956. Set side right output volume. By default, this is @var{1}.
  4957. @item bl_in
  4958. Set back left input volume. By default, this is @var{1}.
  4959. @item bl_out
  4960. Set back left output volume. By default, this is @var{1}.
  4961. @item br_in
  4962. Set back right input volume. By default, this is @var{1}.
  4963. @item br_out
  4964. Set back right output volume. By default, this is @var{1}.
  4965. @item bc_in
  4966. Set back center input volume. By default, this is @var{1}.
  4967. @item bc_out
  4968. Set back center output volume. By default, this is @var{1}.
  4969. @item lfe_in
  4970. Set LFE input volume. By default, this is @var{1}.
  4971. @item lfe_out
  4972. Set LFE output volume. By default, this is @var{1}.
  4973. @item allx
  4974. Set spread usage of stereo image across X axis for all channels.
  4975. @item ally
  4976. Set spread usage of stereo image across Y axis for all channels.
  4977. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  4978. Set spread usage of stereo image across X axis for each channel.
  4979. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  4980. Set spread usage of stereo image across Y axis for each channel.
  4981. @item win_size
  4982. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  4983. @item win_func
  4984. Set window function.
  4985. It accepts the following values:
  4986. @table @samp
  4987. @item rect
  4988. @item bartlett
  4989. @item hann, hanning
  4990. @item hamming
  4991. @item blackman
  4992. @item welch
  4993. @item flattop
  4994. @item bharris
  4995. @item bnuttall
  4996. @item bhann
  4997. @item sine
  4998. @item nuttall
  4999. @item lanczos
  5000. @item gauss
  5001. @item tukey
  5002. @item dolph
  5003. @item cauchy
  5004. @item parzen
  5005. @item poisson
  5006. @item bohman
  5007. @end table
  5008. Default is @code{hann}.
  5009. @item overlap
  5010. Set window overlap. If set to 1, the recommended overlap for selected
  5011. window function will be picked. Default is @code{0.5}.
  5012. @end table
  5013. @section treble, highshelf
  5014. Boost or cut treble (upper) frequencies of the audio using a two-pole
  5015. shelving filter with a response similar to that of a standard
  5016. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  5017. The filter accepts the following options:
  5018. @table @option
  5019. @item gain, g
  5020. Give the gain at whichever is the lower of ~22 kHz and the
  5021. Nyquist frequency. Its useful range is about -20 (for a large cut)
  5022. to +20 (for a large boost). Beware of clipping when using a positive gain.
  5023. @item frequency, f
  5024. Set the filter's central frequency and so can be used
  5025. to extend or reduce the frequency range to be boosted or cut.
  5026. The default value is @code{3000} Hz.
  5027. @item width_type, t
  5028. Set method to specify band-width of filter.
  5029. @table @option
  5030. @item h
  5031. Hz
  5032. @item q
  5033. Q-Factor
  5034. @item o
  5035. octave
  5036. @item s
  5037. slope
  5038. @item k
  5039. kHz
  5040. @end table
  5041. @item width, w
  5042. Determine how steep is the filter's shelf transition.
  5043. @item poles, p
  5044. Set number of poles. Default is 2.
  5045. @item mix, m
  5046. How much to use filtered signal in output. Default is 1.
  5047. Range is between 0 and 1.
  5048. @item channels, c
  5049. Specify which channels to filter, by default all available are filtered.
  5050. @item normalize, n
  5051. Normalize biquad coefficients, by default is disabled.
  5052. Enabling it will normalize magnitude response at DC to 0dB.
  5053. @item transform, a
  5054. Set transform type of IIR filter.
  5055. @table @option
  5056. @item di
  5057. @item dii
  5058. @item tdii
  5059. @item latt
  5060. @item svf
  5061. @end table
  5062. @item precision, r
  5063. Set precison of filtering.
  5064. @table @option
  5065. @item auto
  5066. Pick automatic sample format depending on surround filters.
  5067. @item s16
  5068. Always use signed 16-bit.
  5069. @item s32
  5070. Always use signed 32-bit.
  5071. @item f32
  5072. Always use float 32-bit.
  5073. @item f64
  5074. Always use float 64-bit.
  5075. @end table
  5076. @end table
  5077. @subsection Commands
  5078. This filter supports the following commands:
  5079. @table @option
  5080. @item frequency, f
  5081. Change treble frequency.
  5082. Syntax for the command is : "@var{frequency}"
  5083. @item width_type, t
  5084. Change treble width_type.
  5085. Syntax for the command is : "@var{width_type}"
  5086. @item width, w
  5087. Change treble width.
  5088. Syntax for the command is : "@var{width}"
  5089. @item gain, g
  5090. Change treble gain.
  5091. Syntax for the command is : "@var{gain}"
  5092. @item mix, m
  5093. Change treble mix.
  5094. Syntax for the command is : "@var{mix}"
  5095. @end table
  5096. @section tremolo
  5097. Sinusoidal amplitude modulation.
  5098. The filter accepts the following options:
  5099. @table @option
  5100. @item f
  5101. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  5102. (20 Hz or lower) will result in a tremolo effect.
  5103. This filter may also be used as a ring modulator by specifying
  5104. a modulation frequency higher than 20 Hz.
  5105. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  5106. @item d
  5107. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  5108. Default value is 0.5.
  5109. @end table
  5110. @section vibrato
  5111. Sinusoidal phase modulation.
  5112. The filter accepts the following options:
  5113. @table @option
  5114. @item f
  5115. Modulation frequency in Hertz.
  5116. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  5117. @item d
  5118. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  5119. Default value is 0.5.
  5120. @end table
  5121. @section volume
  5122. Adjust the input audio volume.
  5123. It accepts the following parameters:
  5124. @table @option
  5125. @item volume
  5126. Set audio volume expression.
  5127. Output values are clipped to the maximum value.
  5128. The output audio volume is given by the relation:
  5129. @example
  5130. @var{output_volume} = @var{volume} * @var{input_volume}
  5131. @end example
  5132. The default value for @var{volume} is "1.0".
  5133. @item precision
  5134. This parameter represents the mathematical precision.
  5135. It determines which input sample formats will be allowed, which affects the
  5136. precision of the volume scaling.
  5137. @table @option
  5138. @item fixed
  5139. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  5140. @item float
  5141. 32-bit floating-point; this limits input sample format to FLT. (default)
  5142. @item double
  5143. 64-bit floating-point; this limits input sample format to DBL.
  5144. @end table
  5145. @item replaygain
  5146. Choose the behaviour on encountering ReplayGain side data in input frames.
  5147. @table @option
  5148. @item drop
  5149. Remove ReplayGain side data, ignoring its contents (the default).
  5150. @item ignore
  5151. Ignore ReplayGain side data, but leave it in the frame.
  5152. @item track
  5153. Prefer the track gain, if present.
  5154. @item album
  5155. Prefer the album gain, if present.
  5156. @end table
  5157. @item replaygain_preamp
  5158. Pre-amplification gain in dB to apply to the selected replaygain gain.
  5159. Default value for @var{replaygain_preamp} is 0.0.
  5160. @item replaygain_noclip
  5161. Prevent clipping by limiting the gain applied.
  5162. Default value for @var{replaygain_noclip} is 1.
  5163. @item eval
  5164. Set when the volume expression is evaluated.
  5165. It accepts the following values:
  5166. @table @samp
  5167. @item once
  5168. only evaluate expression once during the filter initialization, or
  5169. when the @samp{volume} command is sent
  5170. @item frame
  5171. evaluate expression for each incoming frame
  5172. @end table
  5173. Default value is @samp{once}.
  5174. @end table
  5175. The volume expression can contain the following parameters.
  5176. @table @option
  5177. @item n
  5178. frame number (starting at zero)
  5179. @item nb_channels
  5180. number of channels
  5181. @item nb_consumed_samples
  5182. number of samples consumed by the filter
  5183. @item nb_samples
  5184. number of samples in the current frame
  5185. @item pos
  5186. original frame position in the file
  5187. @item pts
  5188. frame PTS
  5189. @item sample_rate
  5190. sample rate
  5191. @item startpts
  5192. PTS at start of stream
  5193. @item startt
  5194. time at start of stream
  5195. @item t
  5196. frame time
  5197. @item tb
  5198. timestamp timebase
  5199. @item volume
  5200. last set volume value
  5201. @end table
  5202. Note that when @option{eval} is set to @samp{once} only the
  5203. @var{sample_rate} and @var{tb} variables are available, all other
  5204. variables will evaluate to NAN.
  5205. @subsection Commands
  5206. This filter supports the following commands:
  5207. @table @option
  5208. @item volume
  5209. Modify the volume expression.
  5210. The command accepts the same syntax of the corresponding option.
  5211. If the specified expression is not valid, it is kept at its current
  5212. value.
  5213. @end table
  5214. @subsection Examples
  5215. @itemize
  5216. @item
  5217. Halve the input audio volume:
  5218. @example
  5219. volume=volume=0.5
  5220. volume=volume=1/2
  5221. volume=volume=-6.0206dB
  5222. @end example
  5223. In all the above example the named key for @option{volume} can be
  5224. omitted, for example like in:
  5225. @example
  5226. volume=0.5
  5227. @end example
  5228. @item
  5229. Increase input audio power by 6 decibels using fixed-point precision:
  5230. @example
  5231. volume=volume=6dB:precision=fixed
  5232. @end example
  5233. @item
  5234. Fade volume after time 10 with an annihilation period of 5 seconds:
  5235. @example
  5236. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  5237. @end example
  5238. @end itemize
  5239. @section volumedetect
  5240. Detect the volume of the input video.
  5241. The filter has no parameters. The input is not modified. Statistics about
  5242. the volume will be printed in the log when the input stream end is reached.
  5243. In particular it will show the mean volume (root mean square), maximum
  5244. volume (on a per-sample basis), and the beginning of a histogram of the
  5245. registered volume values (from the maximum value to a cumulated 1/1000 of
  5246. the samples).
  5247. All volumes are in decibels relative to the maximum PCM value.
  5248. @subsection Examples
  5249. Here is an excerpt of the output:
  5250. @example
  5251. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  5252. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  5253. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  5254. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  5255. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  5256. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  5257. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  5258. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  5259. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  5260. @end example
  5261. It means that:
  5262. @itemize
  5263. @item
  5264. The mean square energy is approximately -27 dB, or 10^-2.7.
  5265. @item
  5266. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  5267. @item
  5268. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  5269. @end itemize
  5270. In other words, raising the volume by +4 dB does not cause any clipping,
  5271. raising it by +5 dB causes clipping for 6 samples, etc.
  5272. @c man end AUDIO FILTERS
  5273. @chapter Audio Sources
  5274. @c man begin AUDIO SOURCES
  5275. Below is a description of the currently available audio sources.
  5276. @section abuffer
  5277. Buffer audio frames, and make them available to the filter chain.
  5278. This source is mainly intended for a programmatic use, in particular
  5279. through the interface defined in @file{libavfilter/buffersrc.h}.
  5280. It accepts the following parameters:
  5281. @table @option
  5282. @item time_base
  5283. The timebase which will be used for timestamps of submitted frames. It must be
  5284. either a floating-point number or in @var{numerator}/@var{denominator} form.
  5285. @item sample_rate
  5286. The sample rate of the incoming audio buffers.
  5287. @item sample_fmt
  5288. The sample format of the incoming audio buffers.
  5289. Either a sample format name or its corresponding integer representation from
  5290. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  5291. @item channel_layout
  5292. The channel layout of the incoming audio buffers.
  5293. Either a channel layout name from channel_layout_map in
  5294. @file{libavutil/channel_layout.c} or its corresponding integer representation
  5295. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  5296. @item channels
  5297. The number of channels of the incoming audio buffers.
  5298. If both @var{channels} and @var{channel_layout} are specified, then they
  5299. must be consistent.
  5300. @end table
  5301. @subsection Examples
  5302. @example
  5303. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  5304. @end example
  5305. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  5306. Since the sample format with name "s16p" corresponds to the number
  5307. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  5308. equivalent to:
  5309. @example
  5310. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  5311. @end example
  5312. @section aevalsrc
  5313. Generate an audio signal specified by an expression.
  5314. This source accepts in input one or more expressions (one for each
  5315. channel), which are evaluated and used to generate a corresponding
  5316. audio signal.
  5317. This source accepts the following options:
  5318. @table @option
  5319. @item exprs
  5320. Set the '|'-separated expressions list for each separate channel. In case the
  5321. @option{channel_layout} option is not specified, the selected channel layout
  5322. depends on the number of provided expressions. Otherwise the last
  5323. specified expression is applied to the remaining output channels.
  5324. @item channel_layout, c
  5325. Set the channel layout. The number of channels in the specified layout
  5326. must be equal to the number of specified expressions.
  5327. @item duration, d
  5328. Set the minimum duration of the sourced audio. See
  5329. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  5330. for the accepted syntax.
  5331. Note that the resulting duration may be greater than the specified
  5332. duration, as the generated audio is always cut at the end of a
  5333. complete frame.
  5334. If not specified, or the expressed duration is negative, the audio is
  5335. supposed to be generated forever.
  5336. @item nb_samples, n
  5337. Set the number of samples per channel per each output frame,
  5338. default to 1024.
  5339. @item sample_rate, s
  5340. Specify the sample rate, default to 44100.
  5341. @end table
  5342. Each expression in @var{exprs} can contain the following constants:
  5343. @table @option
  5344. @item n
  5345. number of the evaluated sample, starting from 0
  5346. @item t
  5347. time of the evaluated sample expressed in seconds, starting from 0
  5348. @item s
  5349. sample rate
  5350. @end table
  5351. @subsection Examples
  5352. @itemize
  5353. @item
  5354. Generate silence:
  5355. @example
  5356. aevalsrc=0
  5357. @end example
  5358. @item
  5359. Generate a sin signal with frequency of 440 Hz, set sample rate to
  5360. 8000 Hz:
  5361. @example
  5362. aevalsrc="sin(440*2*PI*t):s=8000"
  5363. @end example
  5364. @item
  5365. Generate a two channels signal, specify the channel layout (Front
  5366. Center + Back Center) explicitly:
  5367. @example
  5368. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  5369. @end example
  5370. @item
  5371. Generate white noise:
  5372. @example
  5373. aevalsrc="-2+random(0)"
  5374. @end example
  5375. @item
  5376. Generate an amplitude modulated signal:
  5377. @example
  5378. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  5379. @end example
  5380. @item
  5381. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  5382. @example
  5383. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  5384. @end example
  5385. @end itemize
  5386. @section afirsrc
  5387. Generate a FIR coefficients using frequency sampling method.
  5388. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  5389. The filter accepts the following options:
  5390. @table @option
  5391. @item taps, t
  5392. Set number of filter coefficents in output audio stream.
  5393. Default value is 1025.
  5394. @item frequency, f
  5395. Set frequency points from where magnitude and phase are set.
  5396. This must be in non decreasing order, and first element must be 0, while last element
  5397. must be 1. Elements are separated by white spaces.
  5398. @item magnitude, m
  5399. Set magnitude value for every frequency point set by @option{frequency}.
  5400. Number of values must be same as number of frequency points.
  5401. Values are separated by white spaces.
  5402. @item phase, p
  5403. Set phase value for every frequency point set by @option{frequency}.
  5404. Number of values must be same as number of frequency points.
  5405. Values are separated by white spaces.
  5406. @item sample_rate, r
  5407. Set sample rate, default is 44100.
  5408. @item nb_samples, n
  5409. Set number of samples per each frame. Default is 1024.
  5410. @item win_func, w
  5411. Set window function. Default is blackman.
  5412. @end table
  5413. @section anullsrc
  5414. The null audio source, return unprocessed audio frames. It is mainly useful
  5415. as a template and to be employed in analysis / debugging tools, or as
  5416. the source for filters which ignore the input data (for example the sox
  5417. synth filter).
  5418. This source accepts the following options:
  5419. @table @option
  5420. @item channel_layout, cl
  5421. Specifies the channel layout, and can be either an integer or a string
  5422. representing a channel layout. The default value of @var{channel_layout}
  5423. is "stereo".
  5424. Check the channel_layout_map definition in
  5425. @file{libavutil/channel_layout.c} for the mapping between strings and
  5426. channel layout values.
  5427. @item sample_rate, r
  5428. Specifies the sample rate, and defaults to 44100.
  5429. @item nb_samples, n
  5430. Set the number of samples per requested frames.
  5431. @item duration, d
  5432. Set the duration of the sourced audio. See
  5433. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  5434. for the accepted syntax.
  5435. If not specified, or the expressed duration is negative, the audio is
  5436. supposed to be generated forever.
  5437. @end table
  5438. @subsection Examples
  5439. @itemize
  5440. @item
  5441. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  5442. @example
  5443. anullsrc=r=48000:cl=4
  5444. @end example
  5445. @item
  5446. Do the same operation with a more obvious syntax:
  5447. @example
  5448. anullsrc=r=48000:cl=mono
  5449. @end example
  5450. @end itemize
  5451. All the parameters need to be explicitly defined.
  5452. @section flite
  5453. Synthesize a voice utterance using the libflite library.
  5454. To enable compilation of this filter you need to configure FFmpeg with
  5455. @code{--enable-libflite}.
  5456. Note that versions of the flite library prior to 2.0 are not thread-safe.
  5457. The filter accepts the following options:
  5458. @table @option
  5459. @item list_voices
  5460. If set to 1, list the names of the available voices and exit
  5461. immediately. Default value is 0.
  5462. @item nb_samples, n
  5463. Set the maximum number of samples per frame. Default value is 512.
  5464. @item textfile
  5465. Set the filename containing the text to speak.
  5466. @item text
  5467. Set the text to speak.
  5468. @item voice, v
  5469. Set the voice to use for the speech synthesis. Default value is
  5470. @code{kal}. See also the @var{list_voices} option.
  5471. @end table
  5472. @subsection Examples
  5473. @itemize
  5474. @item
  5475. Read from file @file{speech.txt}, and synthesize the text using the
  5476. standard flite voice:
  5477. @example
  5478. flite=textfile=speech.txt
  5479. @end example
  5480. @item
  5481. Read the specified text selecting the @code{slt} voice:
  5482. @example
  5483. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  5484. @end example
  5485. @item
  5486. Input text to ffmpeg:
  5487. @example
  5488. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  5489. @end example
  5490. @item
  5491. Make @file{ffplay} speak the specified text, using @code{flite} and
  5492. the @code{lavfi} device:
  5493. @example
  5494. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  5495. @end example
  5496. @end itemize
  5497. For more information about libflite, check:
  5498. @url{http://www.festvox.org/flite/}
  5499. @section anoisesrc
  5500. Generate a noise audio signal.
  5501. The filter accepts the following options:
  5502. @table @option
  5503. @item sample_rate, r
  5504. Specify the sample rate. Default value is 48000 Hz.
  5505. @item amplitude, a
  5506. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  5507. is 1.0.
  5508. @item duration, d
  5509. Specify the duration of the generated audio stream. Not specifying this option
  5510. results in noise with an infinite length.
  5511. @item color, colour, c
  5512. Specify the color of noise. Available noise colors are white, pink, brown,
  5513. blue, violet and velvet. Default color is white.
  5514. @item seed, s
  5515. Specify a value used to seed the PRNG.
  5516. @item nb_samples, n
  5517. Set the number of samples per each output frame, default is 1024.
  5518. @end table
  5519. @subsection Examples
  5520. @itemize
  5521. @item
  5522. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  5523. @example
  5524. anoisesrc=d=60:c=pink:r=44100:a=0.5
  5525. @end example
  5526. @end itemize
  5527. @section hilbert
  5528. Generate odd-tap Hilbert transform FIR coefficients.
  5529. The resulting stream can be used with @ref{afir} filter for phase-shifting
  5530. the signal by 90 degrees.
  5531. This is used in many matrix coding schemes and for analytic signal generation.
  5532. The process is often written as a multiplication by i (or j), the imaginary unit.
  5533. The filter accepts the following options:
  5534. @table @option
  5535. @item sample_rate, s
  5536. Set sample rate, default is 44100.
  5537. @item taps, t
  5538. Set length of FIR filter, default is 22051.
  5539. @item nb_samples, n
  5540. Set number of samples per each frame.
  5541. @item win_func, w
  5542. Set window function to be used when generating FIR coefficients.
  5543. @end table
  5544. @section sinc
  5545. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  5546. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  5547. The filter accepts the following options:
  5548. @table @option
  5549. @item sample_rate, r
  5550. Set sample rate, default is 44100.
  5551. @item nb_samples, n
  5552. Set number of samples per each frame. Default is 1024.
  5553. @item hp
  5554. Set high-pass frequency. Default is 0.
  5555. @item lp
  5556. Set low-pass frequency. Default is 0.
  5557. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  5558. is higher than 0 then filter will create band-pass filter coefficients,
  5559. otherwise band-reject filter coefficients.
  5560. @item phase
  5561. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  5562. @item beta
  5563. Set Kaiser window beta.
  5564. @item att
  5565. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  5566. @item round
  5567. Enable rounding, by default is disabled.
  5568. @item hptaps
  5569. Set number of taps for high-pass filter.
  5570. @item lptaps
  5571. Set number of taps for low-pass filter.
  5572. @end table
  5573. @section sine
  5574. Generate an audio signal made of a sine wave with amplitude 1/8.
  5575. The audio signal is bit-exact.
  5576. The filter accepts the following options:
  5577. @table @option
  5578. @item frequency, f
  5579. Set the carrier frequency. Default is 440 Hz.
  5580. @item beep_factor, b
  5581. Enable a periodic beep every second with frequency @var{beep_factor} times
  5582. the carrier frequency. Default is 0, meaning the beep is disabled.
  5583. @item sample_rate, r
  5584. Specify the sample rate, default is 44100.
  5585. @item duration, d
  5586. Specify the duration of the generated audio stream.
  5587. @item samples_per_frame
  5588. Set the number of samples per output frame.
  5589. The expression can contain the following constants:
  5590. @table @option
  5591. @item n
  5592. The (sequential) number of the output audio frame, starting from 0.
  5593. @item pts
  5594. The PTS (Presentation TimeStamp) of the output audio frame,
  5595. expressed in @var{TB} units.
  5596. @item t
  5597. The PTS of the output audio frame, expressed in seconds.
  5598. @item TB
  5599. The timebase of the output audio frames.
  5600. @end table
  5601. Default is @code{1024}.
  5602. @end table
  5603. @subsection Examples
  5604. @itemize
  5605. @item
  5606. Generate a simple 440 Hz sine wave:
  5607. @example
  5608. sine
  5609. @end example
  5610. @item
  5611. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  5612. @example
  5613. sine=220:4:d=5
  5614. sine=f=220:b=4:d=5
  5615. sine=frequency=220:beep_factor=4:duration=5
  5616. @end example
  5617. @item
  5618. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  5619. pattern:
  5620. @example
  5621. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  5622. @end example
  5623. @end itemize
  5624. @c man end AUDIO SOURCES
  5625. @chapter Audio Sinks
  5626. @c man begin AUDIO SINKS
  5627. Below is a description of the currently available audio sinks.
  5628. @section abuffersink
  5629. Buffer audio frames, and make them available to the end of filter chain.
  5630. This sink is mainly intended for programmatic use, in particular
  5631. through the interface defined in @file{libavfilter/buffersink.h}
  5632. or the options system.
  5633. It accepts a pointer to an AVABufferSinkContext structure, which
  5634. defines the incoming buffers' formats, to be passed as the opaque
  5635. parameter to @code{avfilter_init_filter} for initialization.
  5636. @section anullsink
  5637. Null audio sink; do absolutely nothing with the input audio. It is
  5638. mainly useful as a template and for use in analysis / debugging
  5639. tools.
  5640. @c man end AUDIO SINKS
  5641. @chapter Video Filters
  5642. @c man begin VIDEO FILTERS
  5643. When you configure your FFmpeg build, you can disable any of the
  5644. existing filters using @code{--disable-filters}.
  5645. The configure output will show the video filters included in your
  5646. build.
  5647. Below is a description of the currently available video filters.
  5648. @section addroi
  5649. Mark a region of interest in a video frame.
  5650. The frame data is passed through unchanged, but metadata is attached
  5651. to the frame indicating regions of interest which can affect the
  5652. behaviour of later encoding. Multiple regions can be marked by
  5653. applying the filter multiple times.
  5654. @table @option
  5655. @item x
  5656. Region distance in pixels from the left edge of the frame.
  5657. @item y
  5658. Region distance in pixels from the top edge of the frame.
  5659. @item w
  5660. Region width in pixels.
  5661. @item h
  5662. Region height in pixels.
  5663. The parameters @var{x}, @var{y}, @var{w} and @var{h} are expressions,
  5664. and may contain the following variables:
  5665. @table @option
  5666. @item iw
  5667. Width of the input frame.
  5668. @item ih
  5669. Height of the input frame.
  5670. @end table
  5671. @item qoffset
  5672. Quantisation offset to apply within the region.
  5673. This must be a real value in the range -1 to +1. A value of zero
  5674. indicates no quality change. A negative value asks for better quality
  5675. (less quantisation), while a positive value asks for worse quality
  5676. (greater quantisation).
  5677. The range is calibrated so that the extreme values indicate the
  5678. largest possible offset - if the rest of the frame is encoded with the
  5679. worst possible quality, an offset of -1 indicates that this region
  5680. should be encoded with the best possible quality anyway. Intermediate
  5681. values are then interpolated in some codec-dependent way.
  5682. For example, in 10-bit H.264 the quantisation parameter varies between
  5683. -12 and 51. A typical qoffset value of -1/10 therefore indicates that
  5684. this region should be encoded with a QP around one-tenth of the full
  5685. range better than the rest of the frame. So, if most of the frame
  5686. were to be encoded with a QP of around 30, this region would get a QP
  5687. of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3).
  5688. An extreme value of -1 would indicate that this region should be
  5689. encoded with the best possible quality regardless of the treatment of
  5690. the rest of the frame - that is, should be encoded at a QP of -12.
  5691. @item clear
  5692. If set to true, remove any existing regions of interest marked on the
  5693. frame before adding the new one.
  5694. @end table
  5695. @subsection Examples
  5696. @itemize
  5697. @item
  5698. Mark the centre quarter of the frame as interesting.
  5699. @example
  5700. addroi=iw/4:ih/4:iw/2:ih/2:-1/10
  5701. @end example
  5702. @item
  5703. Mark the 100-pixel-wide region on the left edge of the frame as very
  5704. uninteresting (to be encoded at much lower quality than the rest of
  5705. the frame).
  5706. @example
  5707. addroi=0:0:100:ih:+1/5
  5708. @end example
  5709. @end itemize
  5710. @section alphaextract
  5711. Extract the alpha component from the input as a grayscale video. This
  5712. is especially useful with the @var{alphamerge} filter.
  5713. @section alphamerge
  5714. Add or replace the alpha component of the primary input with the
  5715. grayscale value of a second input. This is intended for use with
  5716. @var{alphaextract} to allow the transmission or storage of frame
  5717. sequences that have alpha in a format that doesn't support an alpha
  5718. channel.
  5719. For example, to reconstruct full frames from a normal YUV-encoded video
  5720. and a separate video created with @var{alphaextract}, you might use:
  5721. @example
  5722. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  5723. @end example
  5724. @section amplify
  5725. Amplify differences between current pixel and pixels of adjacent frames in
  5726. same pixel location.
  5727. This filter accepts the following options:
  5728. @table @option
  5729. @item radius
  5730. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  5731. For example radius of 3 will instruct filter to calculate average of 7 frames.
  5732. @item factor
  5733. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  5734. @item threshold
  5735. Set threshold for difference amplification. Any difference greater or equal to
  5736. this value will not alter source pixel. Default is 10.
  5737. Allowed range is from 0 to 65535.
  5738. @item tolerance
  5739. Set tolerance for difference amplification. Any difference lower to
  5740. this value will not alter source pixel. Default is 0.
  5741. Allowed range is from 0 to 65535.
  5742. @item low
  5743. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  5744. This option controls maximum possible value that will decrease source pixel value.
  5745. @item high
  5746. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  5747. This option controls maximum possible value that will increase source pixel value.
  5748. @item planes
  5749. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  5750. @end table
  5751. @subsection Commands
  5752. This filter supports the following @ref{commands} that corresponds to option of same name:
  5753. @table @option
  5754. @item factor
  5755. @item threshold
  5756. @item tolerance
  5757. @item low
  5758. @item high
  5759. @item planes
  5760. @end table
  5761. @section ass
  5762. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  5763. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  5764. Substation Alpha) subtitles files.
  5765. This filter accepts the following option in addition to the common options from
  5766. the @ref{subtitles} filter:
  5767. @table @option
  5768. @item shaping
  5769. Set the shaping engine
  5770. Available values are:
  5771. @table @samp
  5772. @item auto
  5773. The default libass shaping engine, which is the best available.
  5774. @item simple
  5775. Fast, font-agnostic shaper that can do only substitutions
  5776. @item complex
  5777. Slower shaper using OpenType for substitutions and positioning
  5778. @end table
  5779. The default is @code{auto}.
  5780. @end table
  5781. @section atadenoise
  5782. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  5783. The filter accepts the following options:
  5784. @table @option
  5785. @item 0a
  5786. Set threshold A for 1st plane. Default is 0.02.
  5787. Valid range is 0 to 0.3.
  5788. @item 0b
  5789. Set threshold B for 1st plane. Default is 0.04.
  5790. Valid range is 0 to 5.
  5791. @item 1a
  5792. Set threshold A for 2nd plane. Default is 0.02.
  5793. Valid range is 0 to 0.3.
  5794. @item 1b
  5795. Set threshold B for 2nd plane. Default is 0.04.
  5796. Valid range is 0 to 5.
  5797. @item 2a
  5798. Set threshold A for 3rd plane. Default is 0.02.
  5799. Valid range is 0 to 0.3.
  5800. @item 2b
  5801. Set threshold B for 3rd plane. Default is 0.04.
  5802. Valid range is 0 to 5.
  5803. Threshold A is designed to react on abrupt changes in the input signal and
  5804. threshold B is designed to react on continuous changes in the input signal.
  5805. @item s
  5806. Set number of frames filter will use for averaging. Default is 9. Must be odd
  5807. number in range [5, 129].
  5808. @item p
  5809. Set what planes of frame filter will use for averaging. Default is all.
  5810. @item a
  5811. Set what variant of algorithm filter will use for averaging. Default is @code{p} parallel.
  5812. Alternatively can be set to @code{s} serial.
  5813. Parallel can be faster then serial, while other way around is never true.
  5814. Parallel will abort early on first change being greater then thresholds, while serial
  5815. will continue processing other side of frames if they are equal or below thresholds.
  5816. @item 0s
  5817. @item 1s
  5818. @item 2s
  5819. Set sigma for 1st plane, 2nd plane or 3rd plane. Default is 32767.
  5820. Valid range is from 0 to 32767.
  5821. This options controls weight for each pixel in radius defined by size.
  5822. Default value means every pixel have same weight.
  5823. Setting this option to 0 effectively disables filtering.
  5824. @end table
  5825. @subsection Commands
  5826. This filter supports same @ref{commands} as options except option @code{s}.
  5827. The command accepts the same syntax of the corresponding option.
  5828. @section avgblur
  5829. Apply average blur filter.
  5830. The filter accepts the following options:
  5831. @table @option
  5832. @item sizeX
  5833. Set horizontal radius size.
  5834. @item planes
  5835. Set which planes to filter. By default all planes are filtered.
  5836. @item sizeY
  5837. Set vertical radius size, if zero it will be same as @code{sizeX}.
  5838. Default is @code{0}.
  5839. @end table
  5840. @subsection Commands
  5841. This filter supports same commands as options.
  5842. The command accepts the same syntax of the corresponding option.
  5843. If the specified expression is not valid, it is kept at its current
  5844. value.
  5845. @section bbox
  5846. Compute the bounding box for the non-black pixels in the input frame
  5847. luminance plane.
  5848. This filter computes the bounding box containing all the pixels with a
  5849. luminance value greater than the minimum allowed value.
  5850. The parameters describing the bounding box are printed on the filter
  5851. log.
  5852. The filter accepts the following option:
  5853. @table @option
  5854. @item min_val
  5855. Set the minimal luminance value. Default is @code{16}.
  5856. @end table
  5857. @subsection Commands
  5858. This filter supports the all above options as @ref{commands}.
  5859. @section bilateral
  5860. Apply bilateral filter, spatial smoothing while preserving edges.
  5861. The filter accepts the following options:
  5862. @table @option
  5863. @item sigmaS
  5864. Set sigma of gaussian function to calculate spatial weight.
  5865. Allowed range is 0 to 512. Default is 0.1.
  5866. @item sigmaR
  5867. Set sigma of gaussian function to calculate range weight.
  5868. Allowed range is 0 to 1. Default is 0.1.
  5869. @item planes
  5870. Set planes to filter. Default is first only.
  5871. @end table
  5872. @subsection Commands
  5873. This filter supports the all above options as @ref{commands}.
  5874. @section bitplanenoise
  5875. Show and measure bit plane noise.
  5876. The filter accepts the following options:
  5877. @table @option
  5878. @item bitplane
  5879. Set which plane to analyze. Default is @code{1}.
  5880. @item filter
  5881. Filter out noisy pixels from @code{bitplane} set above.
  5882. Default is disabled.
  5883. @end table
  5884. @section blackdetect
  5885. Detect video intervals that are (almost) completely black. Can be
  5886. useful to detect chapter transitions, commercials, or invalid
  5887. recordings.
  5888. The filter outputs its detection analysis to both the log as well as
  5889. frame metadata. If a black segment of at least the specified minimum
  5890. duration is found, a line with the start and end timestamps as well
  5891. as duration is printed to the log with level @code{info}. In addition,
  5892. a log line with level @code{debug} is printed per frame showing the
  5893. black amount detected for that frame.
  5894. The filter also attaches metadata to the first frame of a black
  5895. segment with key @code{lavfi.black_start} and to the first frame
  5896. after the black segment ends with key @code{lavfi.black_end}. The
  5897. value is the frame's timestamp. This metadata is added regardless
  5898. of the minimum duration specified.
  5899. The filter accepts the following options:
  5900. @table @option
  5901. @item black_min_duration, d
  5902. Set the minimum detected black duration expressed in seconds. It must
  5903. be a non-negative floating point number.
  5904. Default value is 2.0.
  5905. @item picture_black_ratio_th, pic_th
  5906. Set the threshold for considering a picture "black".
  5907. Express the minimum value for the ratio:
  5908. @example
  5909. @var{nb_black_pixels} / @var{nb_pixels}
  5910. @end example
  5911. for which a picture is considered black.
  5912. Default value is 0.98.
  5913. @item pixel_black_th, pix_th
  5914. Set the threshold for considering a pixel "black".
  5915. The threshold expresses the maximum pixel luminance value for which a
  5916. pixel is considered "black". The provided value is scaled according to
  5917. the following equation:
  5918. @example
  5919. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  5920. @end example
  5921. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  5922. the input video format, the range is [0-255] for YUV full-range
  5923. formats and [16-235] for YUV non full-range formats.
  5924. Default value is 0.10.
  5925. @end table
  5926. The following example sets the maximum pixel threshold to the minimum
  5927. value, and detects only black intervals of 2 or more seconds:
  5928. @example
  5929. blackdetect=d=2:pix_th=0.00
  5930. @end example
  5931. @section blackframe
  5932. Detect frames that are (almost) completely black. Can be useful to
  5933. detect chapter transitions or commercials. Output lines consist of
  5934. the frame number of the detected frame, the percentage of blackness,
  5935. the position in the file if known or -1 and the timestamp in seconds.
  5936. In order to display the output lines, you need to set the loglevel at
  5937. least to the AV_LOG_INFO value.
  5938. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  5939. The value represents the percentage of pixels in the picture that
  5940. are below the threshold value.
  5941. It accepts the following parameters:
  5942. @table @option
  5943. @item amount
  5944. The percentage of the pixels that have to be below the threshold; it defaults to
  5945. @code{98}.
  5946. @item threshold, thresh
  5947. The threshold below which a pixel value is considered black; it defaults to
  5948. @code{32}.
  5949. @end table
  5950. @anchor{blend}
  5951. @section blend
  5952. Blend two video frames into each other.
  5953. The @code{blend} filter takes two input streams and outputs one
  5954. stream, the first input is the "top" layer and second input is
  5955. "bottom" layer. By default, the output terminates when the longest input terminates.
  5956. The @code{tblend} (time blend) filter takes two consecutive frames
  5957. from one single stream, and outputs the result obtained by blending
  5958. the new frame on top of the old frame.
  5959. A description of the accepted options follows.
  5960. @table @option
  5961. @item c0_mode
  5962. @item c1_mode
  5963. @item c2_mode
  5964. @item c3_mode
  5965. @item all_mode
  5966. Set blend mode for specific pixel component or all pixel components in case
  5967. of @var{all_mode}. Default value is @code{normal}.
  5968. Available values for component modes are:
  5969. @table @samp
  5970. @item addition
  5971. @item and
  5972. @item average
  5973. @item bleach
  5974. @item burn
  5975. @item darken
  5976. @item difference
  5977. @item divide
  5978. @item dodge
  5979. @item exclusion
  5980. @item extremity
  5981. @item freeze
  5982. @item geometric
  5983. @item glow
  5984. @item grainextract
  5985. @item grainmerge
  5986. @item hardlight
  5987. @item hardmix
  5988. @item hardoverlay
  5989. @item harmonic
  5990. @item heat
  5991. @item interpolate
  5992. @item lighten
  5993. @item linearlight
  5994. @item multiply
  5995. @item multiply128
  5996. @item negation
  5997. @item normal
  5998. @item or
  5999. @item overlay
  6000. @item phoenix
  6001. @item pinlight
  6002. @item reflect
  6003. @item screen
  6004. @item softdifference
  6005. @item softlight
  6006. @item stain
  6007. @item subtract
  6008. @item vividlight
  6009. @item xor
  6010. @end table
  6011. @item c0_opacity
  6012. @item c1_opacity
  6013. @item c2_opacity
  6014. @item c3_opacity
  6015. @item all_opacity
  6016. Set blend opacity for specific pixel component or all pixel components in case
  6017. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  6018. @item c0_expr
  6019. @item c1_expr
  6020. @item c2_expr
  6021. @item c3_expr
  6022. @item all_expr
  6023. Set blend expression for specific pixel component or all pixel components in case
  6024. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  6025. The expressions can use the following variables:
  6026. @table @option
  6027. @item N
  6028. The sequential number of the filtered frame, starting from @code{0}.
  6029. @item X
  6030. @item Y
  6031. the coordinates of the current sample
  6032. @item W
  6033. @item H
  6034. the width and height of currently filtered plane
  6035. @item SW
  6036. @item SH
  6037. Width and height scale for the plane being filtered. It is the
  6038. ratio between the dimensions of the current plane to the luma plane,
  6039. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  6040. the luma plane and @code{0.5,0.5} for the chroma planes.
  6041. @item T
  6042. Time of the current frame, expressed in seconds.
  6043. @item TOP, A
  6044. Value of pixel component at current location for first video frame (top layer).
  6045. @item BOTTOM, B
  6046. Value of pixel component at current location for second video frame (bottom layer).
  6047. @end table
  6048. @end table
  6049. The @code{blend} filter also supports the @ref{framesync} options.
  6050. @subsection Examples
  6051. @itemize
  6052. @item
  6053. Apply transition from bottom layer to top layer in first 10 seconds:
  6054. @example
  6055. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  6056. @end example
  6057. @item
  6058. Apply linear horizontal transition from top layer to bottom layer:
  6059. @example
  6060. blend=all_expr='A*(X/W)+B*(1-X/W)'
  6061. @end example
  6062. @item
  6063. Apply 1x1 checkerboard effect:
  6064. @example
  6065. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  6066. @end example
  6067. @item
  6068. Apply uncover left effect:
  6069. @example
  6070. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  6071. @end example
  6072. @item
  6073. Apply uncover down effect:
  6074. @example
  6075. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  6076. @end example
  6077. @item
  6078. Apply uncover up-left effect:
  6079. @example
  6080. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  6081. @end example
  6082. @item
  6083. Split diagonally video and shows top and bottom layer on each side:
  6084. @example
  6085. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  6086. @end example
  6087. @item
  6088. Display differences between the current and the previous frame:
  6089. @example
  6090. tblend=all_mode=grainextract
  6091. @end example
  6092. @end itemize
  6093. @subsection Commands
  6094. This filter supports same @ref{commands} as options.
  6095. @section bm3d
  6096. Denoise frames using Block-Matching 3D algorithm.
  6097. The filter accepts the following options.
  6098. @table @option
  6099. @item sigma
  6100. Set denoising strength. Default value is 1.
  6101. Allowed range is from 0 to 999.9.
  6102. The denoising algorithm is very sensitive to sigma, so adjust it
  6103. according to the source.
  6104. @item block
  6105. Set local patch size. This sets dimensions in 2D.
  6106. @item bstep
  6107. Set sliding step for processing blocks. Default value is 4.
  6108. Allowed range is from 1 to 64.
  6109. Smaller values allows processing more reference blocks and is slower.
  6110. @item group
  6111. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  6112. When set to 1, no block matching is done. Larger values allows more blocks
  6113. in single group.
  6114. Allowed range is from 1 to 256.
  6115. @item range
  6116. Set radius for search block matching. Default is 9.
  6117. Allowed range is from 1 to INT32_MAX.
  6118. @item mstep
  6119. Set step between two search locations for block matching. Default is 1.
  6120. Allowed range is from 1 to 64. Smaller is slower.
  6121. @item thmse
  6122. Set threshold of mean square error for block matching. Valid range is 0 to
  6123. INT32_MAX.
  6124. @item hdthr
  6125. Set thresholding parameter for hard thresholding in 3D transformed domain.
  6126. Larger values results in stronger hard-thresholding filtering in frequency
  6127. domain.
  6128. @item estim
  6129. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  6130. Default is @code{basic}.
  6131. @item ref
  6132. If enabled, filter will use 2nd stream for block matching.
  6133. Default is disabled for @code{basic} value of @var{estim} option,
  6134. and always enabled if value of @var{estim} is @code{final}.
  6135. @item planes
  6136. Set planes to filter. Default is all available except alpha.
  6137. @end table
  6138. @subsection Examples
  6139. @itemize
  6140. @item
  6141. Basic filtering with bm3d:
  6142. @example
  6143. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  6144. @end example
  6145. @item
  6146. Same as above, but filtering only luma:
  6147. @example
  6148. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  6149. @end example
  6150. @item
  6151. Same as above, but with both estimation modes:
  6152. @example
  6153. 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
  6154. @end example
  6155. @item
  6156. Same as above, but prefilter with @ref{nlmeans} filter instead:
  6157. @example
  6158. 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
  6159. @end example
  6160. @end itemize
  6161. @section boxblur
  6162. Apply a boxblur algorithm to the input video.
  6163. It accepts the following parameters:
  6164. @table @option
  6165. @item luma_radius, lr
  6166. @item luma_power, lp
  6167. @item chroma_radius, cr
  6168. @item chroma_power, cp
  6169. @item alpha_radius, ar
  6170. @item alpha_power, ap
  6171. @end table
  6172. A description of the accepted options follows.
  6173. @table @option
  6174. @item luma_radius, lr
  6175. @item chroma_radius, cr
  6176. @item alpha_radius, ar
  6177. Set an expression for the box radius in pixels used for blurring the
  6178. corresponding input plane.
  6179. The radius value must be a non-negative number, and must not be
  6180. greater than the value of the expression @code{min(w,h)/2} for the
  6181. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  6182. planes.
  6183. Default value for @option{luma_radius} is "2". If not specified,
  6184. @option{chroma_radius} and @option{alpha_radius} default to the
  6185. corresponding value set for @option{luma_radius}.
  6186. The expressions can contain the following constants:
  6187. @table @option
  6188. @item w
  6189. @item h
  6190. The input width and height in pixels.
  6191. @item cw
  6192. @item ch
  6193. The input chroma image width and height in pixels.
  6194. @item hsub
  6195. @item vsub
  6196. The horizontal and vertical chroma subsample values. For example, for the
  6197. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  6198. @end table
  6199. @item luma_power, lp
  6200. @item chroma_power, cp
  6201. @item alpha_power, ap
  6202. Specify how many times the boxblur filter is applied to the
  6203. corresponding plane.
  6204. Default value for @option{luma_power} is 2. If not specified,
  6205. @option{chroma_power} and @option{alpha_power} default to the
  6206. corresponding value set for @option{luma_power}.
  6207. A value of 0 will disable the effect.
  6208. @end table
  6209. @subsection Examples
  6210. @itemize
  6211. @item
  6212. Apply a boxblur filter with the luma, chroma, and alpha radii
  6213. set to 2:
  6214. @example
  6215. boxblur=luma_radius=2:luma_power=1
  6216. boxblur=2:1
  6217. @end example
  6218. @item
  6219. Set the luma radius to 2, and alpha and chroma radius to 0:
  6220. @example
  6221. boxblur=2:1:cr=0:ar=0
  6222. @end example
  6223. @item
  6224. Set the luma and chroma radii to a fraction of the video dimension:
  6225. @example
  6226. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  6227. @end example
  6228. @end itemize
  6229. @section bwdif
  6230. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  6231. Deinterlacing Filter").
  6232. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  6233. interpolation algorithms.
  6234. It accepts the following parameters:
  6235. @table @option
  6236. @item mode
  6237. The interlacing mode to adopt. It accepts one of the following values:
  6238. @table @option
  6239. @item 0, send_frame
  6240. Output one frame for each frame.
  6241. @item 1, send_field
  6242. Output one frame for each field.
  6243. @end table
  6244. The default value is @code{send_field}.
  6245. @item parity
  6246. The picture field parity assumed for the input interlaced video. It accepts one
  6247. of the following values:
  6248. @table @option
  6249. @item 0, tff
  6250. Assume the top field is first.
  6251. @item 1, bff
  6252. Assume the bottom field is first.
  6253. @item -1, auto
  6254. Enable automatic detection of field parity.
  6255. @end table
  6256. The default value is @code{auto}.
  6257. If the interlacing is unknown or the decoder does not export this information,
  6258. top field first will be assumed.
  6259. @item deint
  6260. Specify which frames to deinterlace. Accepts one of the following
  6261. values:
  6262. @table @option
  6263. @item 0, all
  6264. Deinterlace all frames.
  6265. @item 1, interlaced
  6266. Only deinterlace frames marked as interlaced.
  6267. @end table
  6268. The default value is @code{all}.
  6269. @end table
  6270. @section cas
  6271. Apply Contrast Adaptive Sharpen filter to video stream.
  6272. The filter accepts the following options:
  6273. @table @option
  6274. @item strength
  6275. Set the sharpening strength. Default value is 0.
  6276. @item planes
  6277. Set planes to filter. Default value is to filter all
  6278. planes except alpha plane.
  6279. @end table
  6280. @subsection Commands
  6281. This filter supports same @ref{commands} as options.
  6282. @section chromahold
  6283. Remove all color information for all colors except for certain one.
  6284. The filter accepts the following options:
  6285. @table @option
  6286. @item color
  6287. The color which will not be replaced with neutral chroma.
  6288. @item similarity
  6289. Similarity percentage with the above color.
  6290. 0.01 matches only the exact key color, while 1.0 matches everything.
  6291. @item blend
  6292. Blend percentage.
  6293. 0.0 makes pixels either fully gray, or not gray at all.
  6294. Higher values result in more preserved color.
  6295. @item yuv
  6296. Signals that the color passed is already in YUV instead of RGB.
  6297. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  6298. This can be used to pass exact YUV values as hexadecimal numbers.
  6299. @end table
  6300. @subsection Commands
  6301. This filter supports same @ref{commands} as options.
  6302. The command accepts the same syntax of the corresponding option.
  6303. If the specified expression is not valid, it is kept at its current
  6304. value.
  6305. @section chromakey
  6306. YUV colorspace color/chroma keying.
  6307. The filter accepts the following options:
  6308. @table @option
  6309. @item color
  6310. The color which will be replaced with transparency.
  6311. @item similarity
  6312. Similarity percentage with the key color.
  6313. 0.01 matches only the exact key color, while 1.0 matches everything.
  6314. @item blend
  6315. Blend percentage.
  6316. 0.0 makes pixels either fully transparent, or not transparent at all.
  6317. Higher values result in semi-transparent pixels, with a higher transparency
  6318. the more similar the pixels color is to the key color.
  6319. @item yuv
  6320. Signals that the color passed is already in YUV instead of RGB.
  6321. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  6322. This can be used to pass exact YUV values as hexadecimal numbers.
  6323. @end table
  6324. @subsection Commands
  6325. This filter supports same @ref{commands} as options.
  6326. The command accepts the same syntax of the corresponding option.
  6327. If the specified expression is not valid, it is kept at its current
  6328. value.
  6329. @subsection Examples
  6330. @itemize
  6331. @item
  6332. Make every green pixel in the input image transparent:
  6333. @example
  6334. ffmpeg -i input.png -vf chromakey=green out.png
  6335. @end example
  6336. @item
  6337. Overlay a greenscreen-video on top of a static black background.
  6338. @example
  6339. 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
  6340. @end example
  6341. @end itemize
  6342. @section chromanr
  6343. Reduce chrominance noise.
  6344. The filter accepts the following options:
  6345. @table @option
  6346. @item thres
  6347. Set threshold for averaging chrominance values.
  6348. Sum of absolute difference of Y, U and V pixel components of current
  6349. pixel and neighbour pixels lower than this threshold will be used in
  6350. averaging. Luma component is left unchanged and is copied to output.
  6351. Default value is 30. Allowed range is from 1 to 200.
  6352. @item sizew
  6353. Set horizontal radius of rectangle used for averaging.
  6354. Allowed range is from 1 to 100. Default value is 5.
  6355. @item sizeh
  6356. Set vertical radius of rectangle used for averaging.
  6357. Allowed range is from 1 to 100. Default value is 5.
  6358. @item stepw
  6359. Set horizontal step when averaging. Default value is 1.
  6360. Allowed range is from 1 to 50.
  6361. Mostly useful to speed-up filtering.
  6362. @item steph
  6363. Set vertical step when averaging. Default value is 1.
  6364. Allowed range is from 1 to 50.
  6365. Mostly useful to speed-up filtering.
  6366. @item threy
  6367. Set Y threshold for averaging chrominance values.
  6368. Set finer control for max allowed difference between Y components
  6369. of current pixel and neigbour pixels.
  6370. Default value is 200. Allowed range is from 1 to 200.
  6371. @item threu
  6372. Set U threshold for averaging chrominance values.
  6373. Set finer control for max allowed difference between U components
  6374. of current pixel and neigbour pixels.
  6375. Default value is 200. Allowed range is from 1 to 200.
  6376. @item threv
  6377. Set V threshold for averaging chrominance values.
  6378. Set finer control for max allowed difference between V components
  6379. of current pixel and neigbour pixels.
  6380. Default value is 200. Allowed range is from 1 to 200.
  6381. @item distance
  6382. Set distance type used in calculations.
  6383. @table @samp
  6384. @item manhattan
  6385. Absolute difference.
  6386. @item euclidean
  6387. Difference squared.
  6388. @end table
  6389. Default distance type is manhattan.
  6390. @end table
  6391. @subsection Commands
  6392. This filter supports same @ref{commands} as options.
  6393. The command accepts the same syntax of the corresponding option.
  6394. @section chromashift
  6395. Shift chroma pixels horizontally and/or vertically.
  6396. The filter accepts the following options:
  6397. @table @option
  6398. @item cbh
  6399. Set amount to shift chroma-blue horizontally.
  6400. @item cbv
  6401. Set amount to shift chroma-blue vertically.
  6402. @item crh
  6403. Set amount to shift chroma-red horizontally.
  6404. @item crv
  6405. Set amount to shift chroma-red vertically.
  6406. @item edge
  6407. Set edge mode, can be @var{smear}, default, or @var{warp}.
  6408. @end table
  6409. @subsection Commands
  6410. This filter supports the all above options as @ref{commands}.
  6411. @section ciescope
  6412. Display CIE color diagram with pixels overlaid onto it.
  6413. The filter accepts the following options:
  6414. @table @option
  6415. @item system
  6416. Set color system.
  6417. @table @samp
  6418. @item ntsc, 470m
  6419. @item ebu, 470bg
  6420. @item smpte
  6421. @item 240m
  6422. @item apple
  6423. @item widergb
  6424. @item cie1931
  6425. @item rec709, hdtv
  6426. @item uhdtv, rec2020
  6427. @item dcip3
  6428. @end table
  6429. @item cie
  6430. Set CIE system.
  6431. @table @samp
  6432. @item xyy
  6433. @item ucs
  6434. @item luv
  6435. @end table
  6436. @item gamuts
  6437. Set what gamuts to draw.
  6438. See @code{system} option for available values.
  6439. @item size, s
  6440. Set ciescope size, by default set to 512.
  6441. @item intensity, i
  6442. Set intensity used to map input pixel values to CIE diagram.
  6443. @item contrast
  6444. Set contrast used to draw tongue colors that are out of active color system gamut.
  6445. @item corrgamma
  6446. Correct gamma displayed on scope, by default enabled.
  6447. @item showwhite
  6448. Show white point on CIE diagram, by default disabled.
  6449. @item gamma
  6450. Set input gamma. Used only with XYZ input color space.
  6451. @end table
  6452. @section codecview
  6453. Visualize information exported by some codecs.
  6454. Some codecs can export information through frames using side-data or other
  6455. means. For example, some MPEG based codecs export motion vectors through the
  6456. @var{export_mvs} flag in the codec @option{flags2} option.
  6457. The filter accepts the following option:
  6458. @table @option
  6459. @item block
  6460. Display block partition structure using the luma plane.
  6461. @item mv
  6462. Set motion vectors to visualize.
  6463. Available flags for @var{mv} are:
  6464. @table @samp
  6465. @item pf
  6466. forward predicted MVs of P-frames
  6467. @item bf
  6468. forward predicted MVs of B-frames
  6469. @item bb
  6470. backward predicted MVs of B-frames
  6471. @end table
  6472. @item qp
  6473. Display quantization parameters using the chroma planes.
  6474. @item mv_type, mvt
  6475. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  6476. Available flags for @var{mv_type} are:
  6477. @table @samp
  6478. @item fp
  6479. forward predicted MVs
  6480. @item bp
  6481. backward predicted MVs
  6482. @end table
  6483. @item frame_type, ft
  6484. Set frame type to visualize motion vectors of.
  6485. Available flags for @var{frame_type} are:
  6486. @table @samp
  6487. @item if
  6488. intra-coded frames (I-frames)
  6489. @item pf
  6490. predicted frames (P-frames)
  6491. @item bf
  6492. bi-directionally predicted frames (B-frames)
  6493. @end table
  6494. @end table
  6495. @subsection Examples
  6496. @itemize
  6497. @item
  6498. Visualize forward predicted MVs of all frames using @command{ffplay}:
  6499. @example
  6500. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  6501. @end example
  6502. @item
  6503. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  6504. @example
  6505. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  6506. @end example
  6507. @end itemize
  6508. @section colorbalance
  6509. Modify intensity of primary colors (red, green and blue) of input frames.
  6510. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  6511. regions for the red-cyan, green-magenta or blue-yellow balance.
  6512. A positive adjustment value shifts the balance towards the primary color, a negative
  6513. value towards the complementary color.
  6514. The filter accepts the following options:
  6515. @table @option
  6516. @item rs
  6517. @item gs
  6518. @item bs
  6519. Adjust red, green and blue shadows (darkest pixels).
  6520. @item rm
  6521. @item gm
  6522. @item bm
  6523. Adjust red, green and blue midtones (medium pixels).
  6524. @item rh
  6525. @item gh
  6526. @item bh
  6527. Adjust red, green and blue highlights (brightest pixels).
  6528. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  6529. @item pl
  6530. Preserve lightness when changing color balance. Default is disabled.
  6531. @end table
  6532. @subsection Examples
  6533. @itemize
  6534. @item
  6535. Add red color cast to shadows:
  6536. @example
  6537. colorbalance=rs=.3
  6538. @end example
  6539. @end itemize
  6540. @subsection Commands
  6541. This filter supports the all above options as @ref{commands}.
  6542. @section colorcontrast
  6543. Adjust color contrast between RGB components.
  6544. The filter accepts the following options:
  6545. @table @option
  6546. @item rc
  6547. Set the red-cyan contrast. Defaults is 0.0. Allowed range is from -1.0 to 1.0.
  6548. @item gm
  6549. Set the green-magenta contrast. Defaults is 0.0. Allowed range is from -1.0 to 1.0.
  6550. @item by
  6551. Set the blue-yellow contrast. Defaults is 0.0. Allowed range is from -1.0 to 1.0.
  6552. @item rcw
  6553. @item gmw
  6554. @item byw
  6555. Set the weight of each @code{rc}, @code{gm}, @code{by} option value. Default value is 0.0.
  6556. Allowed range is from 0.0 to 1.0. If all weights are 0.0 filtering is disabled.
  6557. @item pl
  6558. Set the amount of preserving lightness. Default value is 0.0. Allowed range is from 0.0 to 1.0.
  6559. @end table
  6560. @subsection Commands
  6561. This filter supports the all above options as @ref{commands}.
  6562. @section colorcorrect
  6563. Adjust color white balance selectively for blacks and whites.
  6564. This filter operates in YUV colorspace.
  6565. The filter accepts the following options:
  6566. @table @option
  6567. @item rl
  6568. Set the red shadow spot. Allowed range is from -1.0 to 1.0.
  6569. Default value is 0.
  6570. @item bl
  6571. Set the blue shadow spot. Allowed range is from -1.0 to 1.0.
  6572. Default value is 0.
  6573. @item rh
  6574. Set the red highlight spot. Allowed range is from -1.0 to 1.0.
  6575. Default value is 0.
  6576. @item bh
  6577. Set the red highlight spot. Allowed range is from -1.0 to 1.0.
  6578. Default value is 0.
  6579. @item saturation
  6580. Set the amount of saturation. Allowed range is from -3.0 to 3.0.
  6581. Default value is 1.
  6582. @item analyze
  6583. If set to anything other than @code{manual} it will analyze every frame and use derived
  6584. parameters for filtering output frame.
  6585. Possible values are:
  6586. @table @samp
  6587. @item manual
  6588. @item average
  6589. @item minmax
  6590. @item median
  6591. @end table
  6592. Default value is @code{manual}.
  6593. @end table
  6594. @subsection Commands
  6595. This filter supports the all above options as @ref{commands}.
  6596. @section colorchannelmixer
  6597. Adjust video input frames by re-mixing color channels.
  6598. This filter modifies a color channel by adding the values associated to
  6599. the other channels of the same pixels. For example if the value to
  6600. modify is red, the output value will be:
  6601. @example
  6602. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  6603. @end example
  6604. The filter accepts the following options:
  6605. @table @option
  6606. @item rr
  6607. @item rg
  6608. @item rb
  6609. @item ra
  6610. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  6611. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  6612. @item gr
  6613. @item gg
  6614. @item gb
  6615. @item ga
  6616. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  6617. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  6618. @item br
  6619. @item bg
  6620. @item bb
  6621. @item ba
  6622. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  6623. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  6624. @item ar
  6625. @item ag
  6626. @item ab
  6627. @item aa
  6628. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  6629. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  6630. Allowed ranges for options are @code{[-2.0, 2.0]}.
  6631. @item pc
  6632. Set preserve color mode. The accepted values are:
  6633. @table @samp
  6634. @item none
  6635. Disable color preserving, this is default.
  6636. @item lum
  6637. Preserve luminance.
  6638. @item max
  6639. Preserve max value of RGB triplet.
  6640. @item avg
  6641. Preserve average value of RGB triplet.
  6642. @item sum
  6643. Preserve sum value of RGB triplet.
  6644. @item nrm
  6645. Preserve normalized value of RGB triplet.
  6646. @item pwr
  6647. Preserve power value of RGB triplet.
  6648. @end table
  6649. @item pa
  6650. Set the preserve color amount when changing colors. Allowed range is from @code{[0.0, 1.0]}.
  6651. Default is @code{0.0}, thus disabled.
  6652. @end table
  6653. @subsection Examples
  6654. @itemize
  6655. @item
  6656. Convert source to grayscale:
  6657. @example
  6658. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  6659. @end example
  6660. @item
  6661. Simulate sepia tones:
  6662. @example
  6663. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  6664. @end example
  6665. @end itemize
  6666. @subsection Commands
  6667. This filter supports the all above options as @ref{commands}.
  6668. @section colorize
  6669. Overlay a solid color on the video stream.
  6670. The filter accepts the following options:
  6671. @table @option
  6672. @item hue
  6673. Set the color hue. Allowed range is from 0 to 360.
  6674. Default value is 0.
  6675. @item saturation
  6676. Set the color saturation. Allowed range is from 0 to 1.
  6677. Default value is 0.5.
  6678. @item lightness
  6679. Set the color lightness. Allowed range is from 0 to 1.
  6680. Default value is 0.5.
  6681. @item mix
  6682. Set the mix of source lightness. By default is set to 1.0.
  6683. Allowed range is from 0.0 to 1.0.
  6684. @end table
  6685. @subsection Commands
  6686. This filter supports the all above options as @ref{commands}.
  6687. @section colorkey
  6688. RGB colorspace color keying.
  6689. This filter operates on 8-bit RGB format frames by setting the alpha component of each pixel
  6690. which falls within the similarity radius of the key color to 0. The alpha value for pixels outside
  6691. the similarity radius depends on the value of the blend option.
  6692. The filter accepts the following options:
  6693. @table @option
  6694. @item color
  6695. Set the color for which alpha will be set to 0 (full transparency).
  6696. See @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6697. Default is @code{black}.
  6698. @item similarity
  6699. Set the radius from the key color within which other colors also have full transparency.
  6700. The computed distance is related to the unit fractional distance in 3D space between the RGB values
  6701. of the key color and the pixel's color. Range is 0.01 to 1.0. 0.01 matches within a very small radius
  6702. around the exact key color, while 1.0 matches everything.
  6703. Default is @code{0.01}.
  6704. @item blend
  6705. Set how the alpha value for pixels that fall outside the similarity radius is computed.
  6706. 0.0 makes pixels either fully transparent or fully opaque.
  6707. Higher values result in semi-transparent pixels, with greater transparency
  6708. the more similar the pixel color is to the key color.
  6709. Range is 0.0 to 1.0. Default is @code{0.0}.
  6710. @end table
  6711. @subsection Examples
  6712. @itemize
  6713. @item
  6714. Make every green pixel in the input image transparent:
  6715. @example
  6716. ffmpeg -i input.png -vf colorkey=green out.png
  6717. @end example
  6718. @item
  6719. Overlay a greenscreen-video on top of a static background image.
  6720. @example
  6721. 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
  6722. @end example
  6723. @end itemize
  6724. @subsection Commands
  6725. This filter supports same @ref{commands} as options.
  6726. The command accepts the same syntax of the corresponding option.
  6727. If the specified expression is not valid, it is kept at its current
  6728. value.
  6729. @section colorhold
  6730. Remove all color information for all RGB colors except for certain one.
  6731. The filter accepts the following options:
  6732. @table @option
  6733. @item color
  6734. The color which will not be replaced with neutral gray.
  6735. @item similarity
  6736. Similarity percentage with the above color.
  6737. 0.01 matches only the exact key color, while 1.0 matches everything.
  6738. @item blend
  6739. Blend percentage. 0.0 makes pixels fully gray.
  6740. Higher values result in more preserved color.
  6741. @end table
  6742. @subsection Commands
  6743. This filter supports same @ref{commands} as options.
  6744. The command accepts the same syntax of the corresponding option.
  6745. If the specified expression is not valid, it is kept at its current
  6746. value.
  6747. @section colorlevels
  6748. Adjust video input frames using levels.
  6749. The filter accepts the following options:
  6750. @table @option
  6751. @item rimin
  6752. @item gimin
  6753. @item bimin
  6754. @item aimin
  6755. Adjust red, green, blue and alpha input black point.
  6756. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  6757. @item rimax
  6758. @item gimax
  6759. @item bimax
  6760. @item aimax
  6761. Adjust red, green, blue and alpha input white point.
  6762. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  6763. Input levels are used to lighten highlights (bright tones), darken shadows
  6764. (dark tones), change the balance of bright and dark tones.
  6765. @item romin
  6766. @item gomin
  6767. @item bomin
  6768. @item aomin
  6769. Adjust red, green, blue and alpha output black point.
  6770. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  6771. @item romax
  6772. @item gomax
  6773. @item bomax
  6774. @item aomax
  6775. Adjust red, green, blue and alpha output white point.
  6776. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  6777. Output levels allows manual selection of a constrained output level range.
  6778. @item preserve
  6779. Set preserve color mode. The accepted values are:
  6780. @table @samp
  6781. @item none
  6782. Disable color preserving, this is default.
  6783. @item lum
  6784. Preserve luminance.
  6785. @item max
  6786. Preserve max value of RGB triplet.
  6787. @item avg
  6788. Preserve average value of RGB triplet.
  6789. @item sum
  6790. Preserve sum value of RGB triplet.
  6791. @item nrm
  6792. Preserve normalized value of RGB triplet.
  6793. @item pwr
  6794. Preserve power value of RGB triplet.
  6795. @end table
  6796. @end table
  6797. @subsection Examples
  6798. @itemize
  6799. @item
  6800. Make video output darker:
  6801. @example
  6802. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  6803. @end example
  6804. @item
  6805. Increase contrast:
  6806. @example
  6807. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  6808. @end example
  6809. @item
  6810. Make video output lighter:
  6811. @example
  6812. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  6813. @end example
  6814. @item
  6815. Increase brightness:
  6816. @example
  6817. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  6818. @end example
  6819. @end itemize
  6820. @subsection Commands
  6821. This filter supports the all above options as @ref{commands}.
  6822. @section colormatrix
  6823. Convert color matrix.
  6824. The filter accepts the following options:
  6825. @table @option
  6826. @item src
  6827. @item dst
  6828. Specify the source and destination color matrix. Both values must be
  6829. specified.
  6830. The accepted values are:
  6831. @table @samp
  6832. @item bt709
  6833. BT.709
  6834. @item fcc
  6835. FCC
  6836. @item bt601
  6837. BT.601
  6838. @item bt470
  6839. BT.470
  6840. @item bt470bg
  6841. BT.470BG
  6842. @item smpte170m
  6843. SMPTE-170M
  6844. @item smpte240m
  6845. SMPTE-240M
  6846. @item bt2020
  6847. BT.2020
  6848. @end table
  6849. @end table
  6850. For example to convert from BT.601 to SMPTE-240M, use the command:
  6851. @example
  6852. colormatrix=bt601:smpte240m
  6853. @end example
  6854. @section colorspace
  6855. Convert colorspace, transfer characteristics or color primaries.
  6856. Input video needs to have an even size.
  6857. The filter accepts the following options:
  6858. @table @option
  6859. @anchor{all}
  6860. @item all
  6861. Specify all color properties at once.
  6862. The accepted values are:
  6863. @table @samp
  6864. @item bt470m
  6865. BT.470M
  6866. @item bt470bg
  6867. BT.470BG
  6868. @item bt601-6-525
  6869. BT.601-6 525
  6870. @item bt601-6-625
  6871. BT.601-6 625
  6872. @item bt709
  6873. BT.709
  6874. @item smpte170m
  6875. SMPTE-170M
  6876. @item smpte240m
  6877. SMPTE-240M
  6878. @item bt2020
  6879. BT.2020
  6880. @end table
  6881. @anchor{space}
  6882. @item space
  6883. Specify output colorspace.
  6884. The accepted values are:
  6885. @table @samp
  6886. @item bt709
  6887. BT.709
  6888. @item fcc
  6889. FCC
  6890. @item bt470bg
  6891. BT.470BG or BT.601-6 625
  6892. @item smpte170m
  6893. SMPTE-170M or BT.601-6 525
  6894. @item smpte240m
  6895. SMPTE-240M
  6896. @item ycgco
  6897. YCgCo
  6898. @item bt2020ncl
  6899. BT.2020 with non-constant luminance
  6900. @end table
  6901. @anchor{trc}
  6902. @item trc
  6903. Specify output transfer characteristics.
  6904. The accepted values are:
  6905. @table @samp
  6906. @item bt709
  6907. BT.709
  6908. @item bt470m
  6909. BT.470M
  6910. @item bt470bg
  6911. BT.470BG
  6912. @item gamma22
  6913. Constant gamma of 2.2
  6914. @item gamma28
  6915. Constant gamma of 2.8
  6916. @item smpte170m
  6917. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  6918. @item smpte240m
  6919. SMPTE-240M
  6920. @item srgb
  6921. SRGB
  6922. @item iec61966-2-1
  6923. iec61966-2-1
  6924. @item iec61966-2-4
  6925. iec61966-2-4
  6926. @item xvycc
  6927. xvycc
  6928. @item bt2020-10
  6929. BT.2020 for 10-bits content
  6930. @item bt2020-12
  6931. BT.2020 for 12-bits content
  6932. @end table
  6933. @anchor{primaries}
  6934. @item primaries
  6935. Specify output color primaries.
  6936. The accepted values are:
  6937. @table @samp
  6938. @item bt709
  6939. BT.709
  6940. @item bt470m
  6941. BT.470M
  6942. @item bt470bg
  6943. BT.470BG or BT.601-6 625
  6944. @item smpte170m
  6945. SMPTE-170M or BT.601-6 525
  6946. @item smpte240m
  6947. SMPTE-240M
  6948. @item film
  6949. film
  6950. @item smpte431
  6951. SMPTE-431
  6952. @item smpte432
  6953. SMPTE-432
  6954. @item bt2020
  6955. BT.2020
  6956. @item jedec-p22
  6957. JEDEC P22 phosphors
  6958. @end table
  6959. @anchor{range}
  6960. @item range
  6961. Specify output color range.
  6962. The accepted values are:
  6963. @table @samp
  6964. @item tv
  6965. TV (restricted) range
  6966. @item mpeg
  6967. MPEG (restricted) range
  6968. @item pc
  6969. PC (full) range
  6970. @item jpeg
  6971. JPEG (full) range
  6972. @end table
  6973. @item format
  6974. Specify output color format.
  6975. The accepted values are:
  6976. @table @samp
  6977. @item yuv420p
  6978. YUV 4:2:0 planar 8-bits
  6979. @item yuv420p10
  6980. YUV 4:2:0 planar 10-bits
  6981. @item yuv420p12
  6982. YUV 4:2:0 planar 12-bits
  6983. @item yuv422p
  6984. YUV 4:2:2 planar 8-bits
  6985. @item yuv422p10
  6986. YUV 4:2:2 planar 10-bits
  6987. @item yuv422p12
  6988. YUV 4:2:2 planar 12-bits
  6989. @item yuv444p
  6990. YUV 4:4:4 planar 8-bits
  6991. @item yuv444p10
  6992. YUV 4:4:4 planar 10-bits
  6993. @item yuv444p12
  6994. YUV 4:4:4 planar 12-bits
  6995. @end table
  6996. @item fast
  6997. Do a fast conversion, which skips gamma/primary correction. This will take
  6998. significantly less CPU, but will be mathematically incorrect. To get output
  6999. compatible with that produced by the colormatrix filter, use fast=1.
  7000. @item dither
  7001. Specify dithering mode.
  7002. The accepted values are:
  7003. @table @samp
  7004. @item none
  7005. No dithering
  7006. @item fsb
  7007. Floyd-Steinberg dithering
  7008. @end table
  7009. @item wpadapt
  7010. Whitepoint adaptation mode.
  7011. The accepted values are:
  7012. @table @samp
  7013. @item bradford
  7014. Bradford whitepoint adaptation
  7015. @item vonkries
  7016. von Kries whitepoint adaptation
  7017. @item identity
  7018. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  7019. @end table
  7020. @item iall
  7021. Override all input properties at once. Same accepted values as @ref{all}.
  7022. @item ispace
  7023. Override input colorspace. Same accepted values as @ref{space}.
  7024. @item iprimaries
  7025. Override input color primaries. Same accepted values as @ref{primaries}.
  7026. @item itrc
  7027. Override input transfer characteristics. Same accepted values as @ref{trc}.
  7028. @item irange
  7029. Override input color range. Same accepted values as @ref{range}.
  7030. @end table
  7031. The filter converts the transfer characteristics, color space and color
  7032. primaries to the specified user values. The output value, if not specified,
  7033. is set to a default value based on the "all" property. If that property is
  7034. also not specified, the filter will log an error. The output color range and
  7035. format default to the same value as the input color range and format. The
  7036. input transfer characteristics, color space, color primaries and color range
  7037. should be set on the input data. If any of these are missing, the filter will
  7038. log an error and no conversion will take place.
  7039. For example to convert the input to SMPTE-240M, use the command:
  7040. @example
  7041. colorspace=smpte240m
  7042. @end example
  7043. @section colortemperature
  7044. Adjust color temperature in video to simulate variations in ambient color temperature.
  7045. The filter accepts the following options:
  7046. @table @option
  7047. @item temperature
  7048. Set the temperature in Kelvin. Allowed range is from 1000 to 40000.
  7049. Default value is 6500 K.
  7050. @item mix
  7051. Set mixing with filtered output. Allowed range is from 0 to 1.
  7052. Default value is 1.
  7053. @item pl
  7054. Set the amount of preserving lightness. Allowed range is from 0 to 1.
  7055. Default value is 0.
  7056. @end table
  7057. @subsection Commands
  7058. This filter supports same @ref{commands} as options.
  7059. @section convolution
  7060. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  7061. The filter accepts the following options:
  7062. @table @option
  7063. @item 0m
  7064. @item 1m
  7065. @item 2m
  7066. @item 3m
  7067. Set matrix for each plane.
  7068. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  7069. and from 1 to 49 odd number of signed integers in @var{row} mode.
  7070. @item 0rdiv
  7071. @item 1rdiv
  7072. @item 2rdiv
  7073. @item 3rdiv
  7074. Set multiplier for calculated value for each plane.
  7075. If unset or 0, it will be sum of all matrix elements.
  7076. @item 0bias
  7077. @item 1bias
  7078. @item 2bias
  7079. @item 3bias
  7080. Set bias for each plane. This value is added to the result of the multiplication.
  7081. Useful for making the overall image brighter or darker. Default is 0.0.
  7082. @item 0mode
  7083. @item 1mode
  7084. @item 2mode
  7085. @item 3mode
  7086. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  7087. Default is @var{square}.
  7088. @end table
  7089. @subsection Commands
  7090. This filter supports the all above options as @ref{commands}.
  7091. @subsection Examples
  7092. @itemize
  7093. @item
  7094. Apply sharpen:
  7095. @example
  7096. 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"
  7097. @end example
  7098. @item
  7099. Apply blur:
  7100. @example
  7101. 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"
  7102. @end example
  7103. @item
  7104. Apply edge enhance:
  7105. @example
  7106. 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"
  7107. @end example
  7108. @item
  7109. Apply edge detect:
  7110. @example
  7111. 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"
  7112. @end example
  7113. @item
  7114. Apply laplacian edge detector which includes diagonals:
  7115. @example
  7116. 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"
  7117. @end example
  7118. @item
  7119. Apply emboss:
  7120. @example
  7121. 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"
  7122. @end example
  7123. @end itemize
  7124. @section convolve
  7125. Apply 2D convolution of video stream in frequency domain using second stream
  7126. as impulse.
  7127. The filter accepts the following options:
  7128. @table @option
  7129. @item planes
  7130. Set which planes to process.
  7131. @item impulse
  7132. Set which impulse video frames will be processed, can be @var{first}
  7133. or @var{all}. Default is @var{all}.
  7134. @end table
  7135. The @code{convolve} filter also supports the @ref{framesync} options.
  7136. @section copy
  7137. Copy the input video source unchanged to the output. This is mainly useful for
  7138. testing purposes.
  7139. @anchor{coreimage}
  7140. @section coreimage
  7141. Video filtering on GPU using Apple's CoreImage API on OSX.
  7142. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  7143. processed by video hardware. However, software-based OpenGL implementations
  7144. exist which means there is no guarantee for hardware processing. It depends on
  7145. the respective OSX.
  7146. There are many filters and image generators provided by Apple that come with a
  7147. large variety of options. The filter has to be referenced by its name along
  7148. with its options.
  7149. The coreimage filter accepts the following options:
  7150. @table @option
  7151. @item list_filters
  7152. List all available filters and generators along with all their respective
  7153. options as well as possible minimum and maximum values along with the default
  7154. values.
  7155. @example
  7156. list_filters=true
  7157. @end example
  7158. @item filter
  7159. Specify all filters by their respective name and options.
  7160. Use @var{list_filters} to determine all valid filter names and options.
  7161. Numerical options are specified by a float value and are automatically clamped
  7162. to their respective value range. Vector and color options have to be specified
  7163. by a list of space separated float values. Character escaping has to be done.
  7164. A special option name @code{default} is available to use default options for a
  7165. filter.
  7166. It is required to specify either @code{default} or at least one of the filter options.
  7167. All omitted options are used with their default values.
  7168. The syntax of the filter string is as follows:
  7169. @example
  7170. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  7171. @end example
  7172. @item output_rect
  7173. Specify a rectangle where the output of the filter chain is copied into the
  7174. input image. It is given by a list of space separated float values:
  7175. @example
  7176. output_rect=x\ y\ width\ height
  7177. @end example
  7178. If not given, the output rectangle equals the dimensions of the input image.
  7179. The output rectangle is automatically cropped at the borders of the input
  7180. image. Negative values are valid for each component.
  7181. @example
  7182. output_rect=25\ 25\ 100\ 100
  7183. @end example
  7184. @end table
  7185. Several filters can be chained for successive processing without GPU-HOST
  7186. transfers allowing for fast processing of complex filter chains.
  7187. Currently, only filters with zero (generators) or exactly one (filters) input
  7188. image and one output image are supported. Also, transition filters are not yet
  7189. usable as intended.
  7190. Some filters generate output images with additional padding depending on the
  7191. respective filter kernel. The padding is automatically removed to ensure the
  7192. filter output has the same size as the input image.
  7193. For image generators, the size of the output image is determined by the
  7194. previous output image of the filter chain or the input image of the whole
  7195. filterchain, respectively. The generators do not use the pixel information of
  7196. this image to generate their output. However, the generated output is
  7197. blended onto this image, resulting in partial or complete coverage of the
  7198. output image.
  7199. The @ref{coreimagesrc} video source can be used for generating input images
  7200. which are directly fed into the filter chain. By using it, providing input
  7201. images by another video source or an input video is not required.
  7202. @subsection Examples
  7203. @itemize
  7204. @item
  7205. List all filters available:
  7206. @example
  7207. coreimage=list_filters=true
  7208. @end example
  7209. @item
  7210. Use the CIBoxBlur filter with default options to blur an image:
  7211. @example
  7212. coreimage=filter=CIBoxBlur@@default
  7213. @end example
  7214. @item
  7215. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  7216. its center at 100x100 and a radius of 50 pixels:
  7217. @example
  7218. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  7219. @end example
  7220. @item
  7221. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  7222. given as complete and escaped command-line for Apple's standard bash shell:
  7223. @example
  7224. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  7225. @end example
  7226. @end itemize
  7227. @section cover_rect
  7228. Cover a rectangular object
  7229. It accepts the following options:
  7230. @table @option
  7231. @item cover
  7232. Filepath of the optional cover image, needs to be in yuv420.
  7233. @item mode
  7234. Set covering mode.
  7235. It accepts the following values:
  7236. @table @samp
  7237. @item cover
  7238. cover it by the supplied image
  7239. @item blur
  7240. cover it by interpolating the surrounding pixels
  7241. @end table
  7242. Default value is @var{blur}.
  7243. @end table
  7244. @subsection Examples
  7245. @itemize
  7246. @item
  7247. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  7248. @example
  7249. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7250. @end example
  7251. @end itemize
  7252. @section crop
  7253. Crop the input video to given dimensions.
  7254. It accepts the following parameters:
  7255. @table @option
  7256. @item w, out_w
  7257. The width of the output video. It defaults to @code{iw}.
  7258. This expression is evaluated only once during the filter
  7259. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  7260. @item h, out_h
  7261. The height of the output video. It defaults to @code{ih}.
  7262. This expression is evaluated only once during the filter
  7263. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  7264. @item x
  7265. The horizontal position, in the input video, of the left edge of the output
  7266. video. It defaults to @code{(in_w-out_w)/2}.
  7267. This expression is evaluated per-frame.
  7268. @item y
  7269. The vertical position, in the input video, of the top edge of the output video.
  7270. It defaults to @code{(in_h-out_h)/2}.
  7271. This expression is evaluated per-frame.
  7272. @item keep_aspect
  7273. If set to 1 will force the output display aspect ratio
  7274. to be the same of the input, by changing the output sample aspect
  7275. ratio. It defaults to 0.
  7276. @item exact
  7277. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  7278. width/height/x/y as specified and will not be rounded to nearest smaller value.
  7279. It defaults to 0.
  7280. @end table
  7281. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  7282. expressions containing the following constants:
  7283. @table @option
  7284. @item x
  7285. @item y
  7286. The computed values for @var{x} and @var{y}. They are evaluated for
  7287. each new frame.
  7288. @item in_w
  7289. @item in_h
  7290. The input width and height.
  7291. @item iw
  7292. @item ih
  7293. These are the same as @var{in_w} and @var{in_h}.
  7294. @item out_w
  7295. @item out_h
  7296. The output (cropped) width and height.
  7297. @item ow
  7298. @item oh
  7299. These are the same as @var{out_w} and @var{out_h}.
  7300. @item a
  7301. same as @var{iw} / @var{ih}
  7302. @item sar
  7303. input sample aspect ratio
  7304. @item dar
  7305. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  7306. @item hsub
  7307. @item vsub
  7308. horizontal and vertical chroma subsample values. For example for the
  7309. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7310. @item n
  7311. The number of the input frame, starting from 0.
  7312. @item pos
  7313. the position in the file of the input frame, NAN if unknown
  7314. @item t
  7315. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  7316. @end table
  7317. The expression for @var{out_w} may depend on the value of @var{out_h},
  7318. and the expression for @var{out_h} may depend on @var{out_w}, but they
  7319. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  7320. evaluated after @var{out_w} and @var{out_h}.
  7321. The @var{x} and @var{y} parameters specify the expressions for the
  7322. position of the top-left corner of the output (non-cropped) area. They
  7323. are evaluated for each frame. If the evaluated value is not valid, it
  7324. is approximated to the nearest valid value.
  7325. The expression for @var{x} may depend on @var{y}, and the expression
  7326. for @var{y} may depend on @var{x}.
  7327. @subsection Examples
  7328. @itemize
  7329. @item
  7330. Crop area with size 100x100 at position (12,34).
  7331. @example
  7332. crop=100:100:12:34
  7333. @end example
  7334. Using named options, the example above becomes:
  7335. @example
  7336. crop=w=100:h=100:x=12:y=34
  7337. @end example
  7338. @item
  7339. Crop the central input area with size 100x100:
  7340. @example
  7341. crop=100:100
  7342. @end example
  7343. @item
  7344. Crop the central input area with size 2/3 of the input video:
  7345. @example
  7346. crop=2/3*in_w:2/3*in_h
  7347. @end example
  7348. @item
  7349. Crop the input video central square:
  7350. @example
  7351. crop=out_w=in_h
  7352. crop=in_h
  7353. @end example
  7354. @item
  7355. Delimit the rectangle with the top-left corner placed at position
  7356. 100:100 and the right-bottom corner corresponding to the right-bottom
  7357. corner of the input image.
  7358. @example
  7359. crop=in_w-100:in_h-100:100:100
  7360. @end example
  7361. @item
  7362. Crop 10 pixels from the left and right borders, and 20 pixels from
  7363. the top and bottom borders
  7364. @example
  7365. crop=in_w-2*10:in_h-2*20
  7366. @end example
  7367. @item
  7368. Keep only the bottom right quarter of the input image:
  7369. @example
  7370. crop=in_w/2:in_h/2:in_w/2:in_h/2
  7371. @end example
  7372. @item
  7373. Crop height for getting Greek harmony:
  7374. @example
  7375. crop=in_w:1/PHI*in_w
  7376. @end example
  7377. @item
  7378. Apply trembling effect:
  7379. @example
  7380. 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)
  7381. @end example
  7382. @item
  7383. Apply erratic camera effect depending on timestamp:
  7384. @example
  7385. 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)"
  7386. @end example
  7387. @item
  7388. Set x depending on the value of y:
  7389. @example
  7390. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  7391. @end example
  7392. @end itemize
  7393. @subsection Commands
  7394. This filter supports the following commands:
  7395. @table @option
  7396. @item w, out_w
  7397. @item h, out_h
  7398. @item x
  7399. @item y
  7400. Set width/height of the output video and the horizontal/vertical position
  7401. in the input video.
  7402. The command accepts the same syntax of the corresponding option.
  7403. If the specified expression is not valid, it is kept at its current
  7404. value.
  7405. @end table
  7406. @section cropdetect
  7407. Auto-detect the crop size.
  7408. It calculates the necessary cropping parameters and prints the
  7409. recommended parameters via the logging system. The detected dimensions
  7410. correspond to the non-black area of the input video.
  7411. It accepts the following parameters:
  7412. @table @option
  7413. @item limit
  7414. Set higher black value threshold, which can be optionally specified
  7415. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  7416. value greater to the set value is considered non-black. It defaults to 24.
  7417. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  7418. on the bitdepth of the pixel format.
  7419. @item round
  7420. The value which the width/height should be divisible by. It defaults to
  7421. 16. The offset is automatically adjusted to center the video. Use 2 to
  7422. get only even dimensions (needed for 4:2:2 video). 16 is best when
  7423. encoding to most video codecs.
  7424. @item skip
  7425. Set the number of initial frames for which evaluation is skipped.
  7426. Default is 2. Range is 0 to INT_MAX.
  7427. @item reset_count, reset
  7428. Set the counter that determines after how many frames cropdetect will
  7429. reset the previously detected largest video area and start over to
  7430. detect the current optimal crop area. Default value is 0.
  7431. This can be useful when channel logos distort the video area. 0
  7432. indicates 'never reset', and returns the largest area encountered during
  7433. playback.
  7434. @end table
  7435. @anchor{cue}
  7436. @section cue
  7437. Delay video filtering until a given wallclock timestamp. The filter first
  7438. passes on @option{preroll} amount of frames, then it buffers at most
  7439. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  7440. it forwards the buffered frames and also any subsequent frames coming in its
  7441. input.
  7442. The filter can be used synchronize the output of multiple ffmpeg processes for
  7443. realtime output devices like decklink. By putting the delay in the filtering
  7444. chain and pre-buffering frames the process can pass on data to output almost
  7445. immediately after the target wallclock timestamp is reached.
  7446. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  7447. some use cases.
  7448. @table @option
  7449. @item cue
  7450. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  7451. @item preroll
  7452. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  7453. @item buffer
  7454. The maximum duration of content to buffer before waiting for the cue expressed
  7455. in seconds. Default is 0.
  7456. @end table
  7457. @anchor{curves}
  7458. @section curves
  7459. Apply color adjustments using curves.
  7460. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  7461. component (red, green and blue) has its values defined by @var{N} key points
  7462. tied from each other using a smooth curve. The x-axis represents the pixel
  7463. values from the input frame, and the y-axis the new pixel values to be set for
  7464. the output frame.
  7465. By default, a component curve is defined by the two points @var{(0;0)} and
  7466. @var{(1;1)}. This creates a straight line where each original pixel value is
  7467. "adjusted" to its own value, which means no change to the image.
  7468. The filter allows you to redefine these two points and add some more. A new
  7469. curve (using a natural cubic spline interpolation) will be define to pass
  7470. smoothly through all these new coordinates. The new defined points needs to be
  7471. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  7472. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  7473. the vector spaces, the values will be clipped accordingly.
  7474. The filter accepts the following options:
  7475. @table @option
  7476. @item preset
  7477. Select one of the available color presets. This option can be used in addition
  7478. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  7479. options takes priority on the preset values.
  7480. Available presets are:
  7481. @table @samp
  7482. @item none
  7483. @item color_negative
  7484. @item cross_process
  7485. @item darker
  7486. @item increase_contrast
  7487. @item lighter
  7488. @item linear_contrast
  7489. @item medium_contrast
  7490. @item negative
  7491. @item strong_contrast
  7492. @item vintage
  7493. @end table
  7494. Default is @code{none}.
  7495. @item master, m
  7496. Set the master key points. These points will define a second pass mapping. It
  7497. is sometimes called a "luminance" or "value" mapping. It can be used with
  7498. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  7499. post-processing LUT.
  7500. @item red, r
  7501. Set the key points for the red component.
  7502. @item green, g
  7503. Set the key points for the green component.
  7504. @item blue, b
  7505. Set the key points for the blue component.
  7506. @item all
  7507. Set the key points for all components (not including master).
  7508. Can be used in addition to the other key points component
  7509. options. In this case, the unset component(s) will fallback on this
  7510. @option{all} setting.
  7511. @item psfile
  7512. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  7513. @item plot
  7514. Save Gnuplot script of the curves in specified file.
  7515. @end table
  7516. To avoid some filtergraph syntax conflicts, each key points list need to be
  7517. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  7518. @subsection Commands
  7519. This filter supports same @ref{commands} as options.
  7520. @subsection Examples
  7521. @itemize
  7522. @item
  7523. Increase slightly the middle level of blue:
  7524. @example
  7525. curves=blue='0/0 0.5/0.58 1/1'
  7526. @end example
  7527. @item
  7528. Vintage effect:
  7529. @example
  7530. 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'
  7531. @end example
  7532. Here we obtain the following coordinates for each components:
  7533. @table @var
  7534. @item red
  7535. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  7536. @item green
  7537. @code{(0;0) (0.50;0.48) (1;1)}
  7538. @item blue
  7539. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  7540. @end table
  7541. @item
  7542. The previous example can also be achieved with the associated built-in preset:
  7543. @example
  7544. curves=preset=vintage
  7545. @end example
  7546. @item
  7547. Or simply:
  7548. @example
  7549. curves=vintage
  7550. @end example
  7551. @item
  7552. Use a Photoshop preset and redefine the points of the green component:
  7553. @example
  7554. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  7555. @end example
  7556. @item
  7557. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  7558. and @command{gnuplot}:
  7559. @example
  7560. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  7561. gnuplot -p /tmp/curves.plt
  7562. @end example
  7563. @end itemize
  7564. @section datascope
  7565. Video data analysis filter.
  7566. This filter shows hexadecimal pixel values of part of video.
  7567. The filter accepts the following options:
  7568. @table @option
  7569. @item size, s
  7570. Set output video size.
  7571. @item x
  7572. Set x offset from where to pick pixels.
  7573. @item y
  7574. Set y offset from where to pick pixels.
  7575. @item mode
  7576. Set scope mode, can be one of the following:
  7577. @table @samp
  7578. @item mono
  7579. Draw hexadecimal pixel values with white color on black background.
  7580. @item color
  7581. Draw hexadecimal pixel values with input video pixel color on black
  7582. background.
  7583. @item color2
  7584. Draw hexadecimal pixel values on color background picked from input video,
  7585. the text color is picked in such way so its always visible.
  7586. @end table
  7587. @item axis
  7588. Draw rows and columns numbers on left and top of video.
  7589. @item opacity
  7590. Set background opacity.
  7591. @item format
  7592. Set display number format. Can be @code{hex}, or @code{dec}. Default is @code{hex}.
  7593. @item components
  7594. Set pixel components to display. By default all pixel components are displayed.
  7595. @end table
  7596. @subsection Commands
  7597. This filter supports same @ref{commands} as options excluding @code{size} option.
  7598. @section dblur
  7599. Apply Directional blur filter.
  7600. The filter accepts the following options:
  7601. @table @option
  7602. @item angle
  7603. Set angle of directional blur. Default is @code{45}.
  7604. @item radius
  7605. Set radius of directional blur. Default is @code{5}.
  7606. @item planes
  7607. Set which planes to filter. By default all planes are filtered.
  7608. @end table
  7609. @subsection Commands
  7610. This filter supports same @ref{commands} as options.
  7611. The command accepts the same syntax of the corresponding option.
  7612. If the specified expression is not valid, it is kept at its current
  7613. value.
  7614. @section dctdnoiz
  7615. Denoise frames using 2D DCT (frequency domain filtering).
  7616. This filter is not designed for real time.
  7617. The filter accepts the following options:
  7618. @table @option
  7619. @item sigma, s
  7620. Set the noise sigma constant.
  7621. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  7622. coefficient (absolute value) below this threshold with be dropped.
  7623. If you need a more advanced filtering, see @option{expr}.
  7624. Default is @code{0}.
  7625. @item overlap
  7626. Set number overlapping pixels for each block. Since the filter can be slow, you
  7627. may want to reduce this value, at the cost of a less effective filter and the
  7628. risk of various artefacts.
  7629. If the overlapping value doesn't permit processing the whole input width or
  7630. height, a warning will be displayed and according borders won't be denoised.
  7631. Default value is @var{blocksize}-1, which is the best possible setting.
  7632. @item expr, e
  7633. Set the coefficient factor expression.
  7634. For each coefficient of a DCT block, this expression will be evaluated as a
  7635. multiplier value for the coefficient.
  7636. If this is option is set, the @option{sigma} option will be ignored.
  7637. The absolute value of the coefficient can be accessed through the @var{c}
  7638. variable.
  7639. @item n
  7640. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  7641. @var{blocksize}, which is the width and height of the processed blocks.
  7642. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  7643. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  7644. on the speed processing. Also, a larger block size does not necessarily means a
  7645. better de-noising.
  7646. @end table
  7647. @subsection Examples
  7648. Apply a denoise with a @option{sigma} of @code{4.5}:
  7649. @example
  7650. dctdnoiz=4.5
  7651. @end example
  7652. The same operation can be achieved using the expression system:
  7653. @example
  7654. dctdnoiz=e='gte(c, 4.5*3)'
  7655. @end example
  7656. Violent denoise using a block size of @code{16x16}:
  7657. @example
  7658. dctdnoiz=15:n=4
  7659. @end example
  7660. @section deband
  7661. Remove banding artifacts from input video.
  7662. It works by replacing banded pixels with average value of referenced pixels.
  7663. The filter accepts the following options:
  7664. @table @option
  7665. @item 1thr
  7666. @item 2thr
  7667. @item 3thr
  7668. @item 4thr
  7669. Set banding detection threshold for each plane. Default is 0.02.
  7670. Valid range is 0.00003 to 0.5.
  7671. If difference between current pixel and reference pixel is less than threshold,
  7672. it will be considered as banded.
  7673. @item range, r
  7674. Banding detection range in pixels. Default is 16. If positive, random number
  7675. in range 0 to set value will be used. If negative, exact absolute value
  7676. will be used.
  7677. The range defines square of four pixels around current pixel.
  7678. @item direction, d
  7679. Set direction in radians from which four pixel will be compared. If positive,
  7680. random direction from 0 to set direction will be picked. If negative, exact of
  7681. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  7682. will pick only pixels on same row and -PI/2 will pick only pixels on same
  7683. column.
  7684. @item blur, b
  7685. If enabled, current pixel is compared with average value of all four
  7686. surrounding pixels. The default is enabled. If disabled current pixel is
  7687. compared with all four surrounding pixels. The pixel is considered banded
  7688. if only all four differences with surrounding pixels are less than threshold.
  7689. @item coupling, c
  7690. If enabled, current pixel is changed if and only if all pixel components are banded,
  7691. e.g. banding detection threshold is triggered for all color components.
  7692. The default is disabled.
  7693. @end table
  7694. @subsection Commands
  7695. This filter supports the all above options as @ref{commands}.
  7696. @section deblock
  7697. Remove blocking artifacts from input video.
  7698. The filter accepts the following options:
  7699. @table @option
  7700. @item filter
  7701. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  7702. This controls what kind of deblocking is applied.
  7703. @item block
  7704. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  7705. @item alpha
  7706. @item beta
  7707. @item gamma
  7708. @item delta
  7709. Set blocking detection thresholds. Allowed range is 0 to 1.
  7710. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  7711. Using higher threshold gives more deblocking strength.
  7712. Setting @var{alpha} controls threshold detection at exact edge of block.
  7713. Remaining options controls threshold detection near the edge. Each one for
  7714. below/above or left/right. Setting any of those to @var{0} disables
  7715. deblocking.
  7716. @item planes
  7717. Set planes to filter. Default is to filter all available planes.
  7718. @end table
  7719. @subsection Examples
  7720. @itemize
  7721. @item
  7722. Deblock using weak filter and block size of 4 pixels.
  7723. @example
  7724. deblock=filter=weak:block=4
  7725. @end example
  7726. @item
  7727. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  7728. deblocking more edges.
  7729. @example
  7730. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  7731. @end example
  7732. @item
  7733. Similar as above, but filter only first plane.
  7734. @example
  7735. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  7736. @end example
  7737. @item
  7738. Similar as above, but filter only second and third plane.
  7739. @example
  7740. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  7741. @end example
  7742. @end itemize
  7743. @subsection Commands
  7744. This filter supports the all above options as @ref{commands}.
  7745. @anchor{decimate}
  7746. @section decimate
  7747. Drop duplicated frames at regular intervals.
  7748. The filter accepts the following options:
  7749. @table @option
  7750. @item cycle
  7751. Set the number of frames from which one will be dropped. Setting this to
  7752. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  7753. Default is @code{5}.
  7754. @item dupthresh
  7755. Set the threshold for duplicate detection. If the difference metric for a frame
  7756. is less than or equal to this value, then it is declared as duplicate. Default
  7757. is @code{1.1}
  7758. @item scthresh
  7759. Set scene change threshold. Default is @code{15}.
  7760. @item blockx
  7761. @item blocky
  7762. Set the size of the x and y-axis blocks used during metric calculations.
  7763. Larger blocks give better noise suppression, but also give worse detection of
  7764. small movements. Must be a power of two. Default is @code{32}.
  7765. @item ppsrc
  7766. Mark main input as a pre-processed input and activate clean source input
  7767. stream. This allows the input to be pre-processed with various filters to help
  7768. the metrics calculation while keeping the frame selection lossless. When set to
  7769. @code{1}, the first stream is for the pre-processed input, and the second
  7770. stream is the clean source from where the kept frames are chosen. Default is
  7771. @code{0}.
  7772. @item chroma
  7773. Set whether or not chroma is considered in the metric calculations. Default is
  7774. @code{1}.
  7775. @end table
  7776. @section deconvolve
  7777. Apply 2D deconvolution of video stream in frequency domain using second stream
  7778. as impulse.
  7779. The filter accepts the following options:
  7780. @table @option
  7781. @item planes
  7782. Set which planes to process.
  7783. @item impulse
  7784. Set which impulse video frames will be processed, can be @var{first}
  7785. or @var{all}. Default is @var{all}.
  7786. @item noise
  7787. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  7788. and height are not same and not power of 2 or if stream prior to convolving
  7789. had noise.
  7790. @end table
  7791. The @code{deconvolve} filter also supports the @ref{framesync} options.
  7792. @section dedot
  7793. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  7794. It accepts the following options:
  7795. @table @option
  7796. @item m
  7797. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  7798. @var{rainbows} for cross-color reduction.
  7799. @item lt
  7800. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  7801. @item tl
  7802. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  7803. @item tc
  7804. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  7805. @item ct
  7806. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  7807. @end table
  7808. @section deflate
  7809. Apply deflate effect to the video.
  7810. This filter replaces the pixel by the local(3x3) average by taking into account
  7811. only values lower than the pixel.
  7812. It accepts the following options:
  7813. @table @option
  7814. @item threshold0
  7815. @item threshold1
  7816. @item threshold2
  7817. @item threshold3
  7818. Limit the maximum change for each plane, default is 65535.
  7819. If 0, plane will remain unchanged.
  7820. @end table
  7821. @subsection Commands
  7822. This filter supports the all above options as @ref{commands}.
  7823. @section deflicker
  7824. Remove temporal frame luminance variations.
  7825. It accepts the following options:
  7826. @table @option
  7827. @item size, s
  7828. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  7829. @item mode, m
  7830. Set averaging mode to smooth temporal luminance variations.
  7831. Available values are:
  7832. @table @samp
  7833. @item am
  7834. Arithmetic mean
  7835. @item gm
  7836. Geometric mean
  7837. @item hm
  7838. Harmonic mean
  7839. @item qm
  7840. Quadratic mean
  7841. @item cm
  7842. Cubic mean
  7843. @item pm
  7844. Power mean
  7845. @item median
  7846. Median
  7847. @end table
  7848. @item bypass
  7849. Do not actually modify frame. Useful when one only wants metadata.
  7850. @end table
  7851. @section dejudder
  7852. Remove judder produced by partially interlaced telecined content.
  7853. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  7854. source was partially telecined content then the output of @code{pullup,dejudder}
  7855. will have a variable frame rate. May change the recorded frame rate of the
  7856. container. Aside from that change, this filter will not affect constant frame
  7857. rate video.
  7858. The option available in this filter is:
  7859. @table @option
  7860. @item cycle
  7861. Specify the length of the window over which the judder repeats.
  7862. Accepts any integer greater than 1. Useful values are:
  7863. @table @samp
  7864. @item 4
  7865. If the original was telecined from 24 to 30 fps (Film to NTSC).
  7866. @item 5
  7867. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  7868. @item 20
  7869. If a mixture of the two.
  7870. @end table
  7871. The default is @samp{4}.
  7872. @end table
  7873. @section delogo
  7874. Suppress a TV station logo by a simple interpolation of the surrounding
  7875. pixels. Just set a rectangle covering the logo and watch it disappear
  7876. (and sometimes something even uglier appear - your mileage may vary).
  7877. It accepts the following parameters:
  7878. @table @option
  7879. @item x
  7880. @item y
  7881. Specify the top left corner coordinates of the logo. They must be
  7882. specified.
  7883. @item w
  7884. @item h
  7885. Specify the width and height of the logo to clear. They must be
  7886. specified.
  7887. @item show
  7888. When set to 1, a green rectangle is drawn on the screen to simplify
  7889. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  7890. The default value is 0.
  7891. The rectangle is drawn on the outermost pixels which will be (partly)
  7892. replaced with interpolated values. The values of the next pixels
  7893. immediately outside this rectangle in each direction will be used to
  7894. compute the interpolated pixel values inside the rectangle.
  7895. @end table
  7896. @subsection Examples
  7897. @itemize
  7898. @item
  7899. Set a rectangle covering the area with top left corner coordinates 0,0
  7900. and size 100x77:
  7901. @example
  7902. delogo=x=0:y=0:w=100:h=77
  7903. @end example
  7904. @end itemize
  7905. @anchor{derain}
  7906. @section derain
  7907. Remove the rain in the input image/video by applying the derain methods based on
  7908. convolutional neural networks. Supported models:
  7909. @itemize
  7910. @item
  7911. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  7912. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  7913. @end itemize
  7914. Training as well as model generation scripts are provided in
  7915. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  7916. Native model files (.model) can be generated from TensorFlow model
  7917. files (.pb) by using tools/python/convert.py
  7918. The filter accepts the following options:
  7919. @table @option
  7920. @item filter_type
  7921. Specify which filter to use. This option accepts the following values:
  7922. @table @samp
  7923. @item derain
  7924. Derain filter. To conduct derain filter, you need to use a derain model.
  7925. @item dehaze
  7926. Dehaze filter. To conduct dehaze filter, you need to use a dehaze model.
  7927. @end table
  7928. Default value is @samp{derain}.
  7929. @item dnn_backend
  7930. Specify which DNN backend to use for model loading and execution. This option accepts
  7931. the following values:
  7932. @table @samp
  7933. @item native
  7934. Native implementation of DNN loading and execution.
  7935. @item tensorflow
  7936. TensorFlow backend. To enable this backend you
  7937. need to install the TensorFlow for C library (see
  7938. @url{https://www.tensorflow.org/install/lang_c}) and configure FFmpeg with
  7939. @code{--enable-libtensorflow}
  7940. @end table
  7941. Default value is @samp{native}.
  7942. @item model
  7943. Set path to model file specifying network architecture and its parameters.
  7944. Note that different backends use different file formats. TensorFlow and native
  7945. backend can load files for only its format.
  7946. @end table
  7947. To get full functionality (such as async execution), please use the @ref{dnn_processing} filter.
  7948. @section deshake
  7949. Attempt to fix small changes in horizontal and/or vertical shift. This
  7950. filter helps remove camera shake from hand-holding a camera, bumping a
  7951. tripod, moving on a vehicle, etc.
  7952. The filter accepts the following options:
  7953. @table @option
  7954. @item x
  7955. @item y
  7956. @item w
  7957. @item h
  7958. Specify a rectangular area where to limit the search for motion
  7959. vectors.
  7960. If desired the search for motion vectors can be limited to a
  7961. rectangular area of the frame defined by its top left corner, width
  7962. and height. These parameters have the same meaning as the drawbox
  7963. filter which can be used to visualise the position of the bounding
  7964. box.
  7965. This is useful when simultaneous movement of subjects within the frame
  7966. might be confused for camera motion by the motion vector search.
  7967. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  7968. then the full frame is used. This allows later options to be set
  7969. without specifying the bounding box for the motion vector search.
  7970. Default - search the whole frame.
  7971. @item rx
  7972. @item ry
  7973. Specify the maximum extent of movement in x and y directions in the
  7974. range 0-64 pixels. Default 16.
  7975. @item edge
  7976. Specify how to generate pixels to fill blanks at the edge of the
  7977. frame. Available values are:
  7978. @table @samp
  7979. @item blank, 0
  7980. Fill zeroes at blank locations
  7981. @item original, 1
  7982. Original image at blank locations
  7983. @item clamp, 2
  7984. Extruded edge value at blank locations
  7985. @item mirror, 3
  7986. Mirrored edge at blank locations
  7987. @end table
  7988. Default value is @samp{mirror}.
  7989. @item blocksize
  7990. Specify the blocksize to use for motion search. Range 4-128 pixels,
  7991. default 8.
  7992. @item contrast
  7993. Specify the contrast threshold for blocks. Only blocks with more than
  7994. the specified contrast (difference between darkest and lightest
  7995. pixels) will be considered. Range 1-255, default 125.
  7996. @item search
  7997. Specify the search strategy. Available values are:
  7998. @table @samp
  7999. @item exhaustive, 0
  8000. Set exhaustive search
  8001. @item less, 1
  8002. Set less exhaustive search.
  8003. @end table
  8004. Default value is @samp{exhaustive}.
  8005. @item filename
  8006. If set then a detailed log of the motion search is written to the
  8007. specified file.
  8008. @end table
  8009. @section despill
  8010. Remove unwanted contamination of foreground colors, caused by reflected color of
  8011. greenscreen or bluescreen.
  8012. This filter accepts the following options:
  8013. @table @option
  8014. @item type
  8015. Set what type of despill to use.
  8016. @item mix
  8017. Set how spillmap will be generated.
  8018. @item expand
  8019. Set how much to get rid of still remaining spill.
  8020. @item red
  8021. Controls amount of red in spill area.
  8022. @item green
  8023. Controls amount of green in spill area.
  8024. Should be -1 for greenscreen.
  8025. @item blue
  8026. Controls amount of blue in spill area.
  8027. Should be -1 for bluescreen.
  8028. @item brightness
  8029. Controls brightness of spill area, preserving colors.
  8030. @item alpha
  8031. Modify alpha from generated spillmap.
  8032. @end table
  8033. @subsection Commands
  8034. This filter supports the all above options as @ref{commands}.
  8035. @section detelecine
  8036. Apply an exact inverse of the telecine operation. It requires a predefined
  8037. pattern specified using the pattern option which must be the same as that passed
  8038. to the telecine filter.
  8039. This filter accepts the following options:
  8040. @table @option
  8041. @item first_field
  8042. @table @samp
  8043. @item top, t
  8044. top field first
  8045. @item bottom, b
  8046. bottom field first
  8047. The default value is @code{top}.
  8048. @end table
  8049. @item pattern
  8050. A string of numbers representing the pulldown pattern you wish to apply.
  8051. The default value is @code{23}.
  8052. @item start_frame
  8053. A number representing position of the first frame with respect to the telecine
  8054. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  8055. @end table
  8056. @anchor{dilation}
  8057. @section dilation
  8058. Apply dilation effect to the video.
  8059. This filter replaces the pixel by the local(3x3) maximum.
  8060. It accepts the following options:
  8061. @table @option
  8062. @item threshold0
  8063. @item threshold1
  8064. @item threshold2
  8065. @item threshold3
  8066. Limit the maximum change for each plane, default is 65535.
  8067. If 0, plane will remain unchanged.
  8068. @item coordinates
  8069. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  8070. pixels are used.
  8071. Flags to local 3x3 coordinates maps like this:
  8072. 1 2 3
  8073. 4 5
  8074. 6 7 8
  8075. @end table
  8076. @subsection Commands
  8077. This filter supports the all above options as @ref{commands}.
  8078. @section displace
  8079. Displace pixels as indicated by second and third input stream.
  8080. It takes three input streams and outputs one stream, the first input is the
  8081. source, and second and third input are displacement maps.
  8082. The second input specifies how much to displace pixels along the
  8083. x-axis, while the third input specifies how much to displace pixels
  8084. along the y-axis.
  8085. If one of displacement map streams terminates, last frame from that
  8086. displacement map will be used.
  8087. Note that once generated, displacements maps can be reused over and over again.
  8088. A description of the accepted options follows.
  8089. @table @option
  8090. @item edge
  8091. Set displace behavior for pixels that are out of range.
  8092. Available values are:
  8093. @table @samp
  8094. @item blank
  8095. Missing pixels are replaced by black pixels.
  8096. @item smear
  8097. Adjacent pixels will spread out to replace missing pixels.
  8098. @item wrap
  8099. Out of range pixels are wrapped so they point to pixels of other side.
  8100. @item mirror
  8101. Out of range pixels will be replaced with mirrored pixels.
  8102. @end table
  8103. Default is @samp{smear}.
  8104. @end table
  8105. @subsection Examples
  8106. @itemize
  8107. @item
  8108. Add ripple effect to rgb input of video size hd720:
  8109. @example
  8110. 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
  8111. @end example
  8112. @item
  8113. Add wave effect to rgb input of video size hd720:
  8114. @example
  8115. 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
  8116. @end example
  8117. @end itemize
  8118. @section dnn_classify
  8119. Do classification with deep neural networks based on bounding boxes.
  8120. The filter accepts the following options:
  8121. @table @option
  8122. @item dnn_backend
  8123. Specify which DNN backend to use for model loading and execution. This option accepts
  8124. only openvino now, tensorflow backends will be added.
  8125. @item model
  8126. Set path to model file specifying network architecture and its parameters.
  8127. Note that different backends use different file formats.
  8128. @item input
  8129. Set the input name of the dnn network.
  8130. @item output
  8131. Set the output name of the dnn network.
  8132. @item confidence
  8133. Set the confidence threshold (default: 0.5).
  8134. @item labels
  8135. Set path to label file specifying the mapping between label id and name.
  8136. Each label name is written in one line, tailing spaces and empty lines are skipped.
  8137. The first line is the name of label id 0,
  8138. and the second line is the name of label id 1, etc.
  8139. The label id is considered as name if the label file is not provided.
  8140. @item backend_configs
  8141. Set the configs to be passed into backend
  8142. For tensorflow backend, you can set its configs with @option{sess_config} options,
  8143. please use tools/python/tf_sess_config.py to get the configs for your system.
  8144. @end table
  8145. @section dnn_detect
  8146. Do object detection with deep neural networks.
  8147. The filter accepts the following options:
  8148. @table @option
  8149. @item dnn_backend
  8150. Specify which DNN backend to use for model loading and execution. This option accepts
  8151. only openvino now, tensorflow backends will be added.
  8152. @item model
  8153. Set path to model file specifying network architecture and its parameters.
  8154. Note that different backends use different file formats.
  8155. @item input
  8156. Set the input name of the dnn network.
  8157. @item output
  8158. Set the output name of the dnn network.
  8159. @item confidence
  8160. Set the confidence threshold (default: 0.5).
  8161. @item labels
  8162. Set path to label file specifying the mapping between label id and name.
  8163. Each label name is written in one line, tailing spaces and empty lines are skipped.
  8164. The first line is the name of label id 0 (usually it is 'background'),
  8165. and the second line is the name of label id 1, etc.
  8166. The label id is considered as name if the label file is not provided.
  8167. @item backend_configs
  8168. Set the configs to be passed into backend. To use async execution, set async (default: set).
  8169. Roll back to sync execution if the backend does not support async.
  8170. @end table
  8171. @anchor{dnn_processing}
  8172. @section dnn_processing
  8173. Do image processing with deep neural networks. It works together with another filter
  8174. which converts the pixel format of the Frame to what the dnn network requires.
  8175. The filter accepts the following options:
  8176. @table @option
  8177. @item dnn_backend
  8178. Specify which DNN backend to use for model loading and execution. This option accepts
  8179. the following values:
  8180. @table @samp
  8181. @item native
  8182. Native implementation of DNN loading and execution.
  8183. @item tensorflow
  8184. TensorFlow backend. To enable this backend you
  8185. need to install the TensorFlow for C library (see
  8186. @url{https://www.tensorflow.org/install/lang_c}) and configure FFmpeg with
  8187. @code{--enable-libtensorflow}
  8188. @item openvino
  8189. OpenVINO backend. To enable this backend you
  8190. need to build and install the OpenVINO for C library (see
  8191. @url{https://github.com/openvinotoolkit/openvino/blob/master/build-instruction.md}) and configure FFmpeg with
  8192. @code{--enable-libopenvino} (--extra-cflags=-I... --extra-ldflags=-L... might
  8193. be needed if the header files and libraries are not installed into system path)
  8194. @end table
  8195. Default value is @samp{native}.
  8196. @item model
  8197. Set path to model file specifying network architecture and its parameters.
  8198. Note that different backends use different file formats. TensorFlow, OpenVINO and native
  8199. backend can load files for only its format.
  8200. Native model file (.model) can be generated from TensorFlow model file (.pb) by using tools/python/convert.py
  8201. @item input
  8202. Set the input name of the dnn network.
  8203. @item output
  8204. Set the output name of the dnn network.
  8205. @item backend_configs
  8206. Set the configs to be passed into backend. To use async execution, set async (default: set).
  8207. Roll back to sync execution if the backend does not support async.
  8208. For tensorflow backend, you can set its configs with @option{sess_config} options,
  8209. please use tools/python/tf_sess_config.py to get the configs of TensorFlow backend for your system.
  8210. @end table
  8211. @subsection Examples
  8212. @itemize
  8213. @item
  8214. Remove rain in rgb24 frame with can.pb (see @ref{derain} filter):
  8215. @example
  8216. ./ffmpeg -i rain.jpg -vf format=rgb24,dnn_processing=dnn_backend=tensorflow:model=can.pb:input=x:output=y derain.jpg
  8217. @end example
  8218. @item
  8219. Halve the pixel value of the frame with format gray32f:
  8220. @example
  8221. ffmpeg -i input.jpg -vf format=grayf32,dnn_processing=model=halve_gray_float.model:input=dnn_in:output=dnn_out:dnn_backend=native -y out.native.png
  8222. @end example
  8223. @item
  8224. Handle the Y channel with srcnn.pb (see @ref{sr} filter) for frame with yuv420p (planar YUV formats supported):
  8225. @example
  8226. ./ffmpeg -i 480p.jpg -vf format=yuv420p,scale=w=iw*2:h=ih*2,dnn_processing=dnn_backend=tensorflow:model=srcnn.pb:input=x:output=y -y srcnn.jpg
  8227. @end example
  8228. @item
  8229. Handle the Y channel with espcn.pb (see @ref{sr} filter), which changes frame size, for format yuv420p (planar YUV formats supported),
  8230. please use tools/python/tf_sess_config.py to get the configs of TensorFlow backend for your system.
  8231. @example
  8232. ./ffmpeg -i 480p.jpg -vf format=yuv420p,dnn_processing=dnn_backend=tensorflow:model=espcn.pb:input=x:output=y:backend_configs=sess_config=0x10022805320e09cdccccccccccec3f20012a01303801 -y tmp.espcn.jpg
  8233. @end example
  8234. @end itemize
  8235. @section drawbox
  8236. Draw a colored box on the input image.
  8237. It accepts the following parameters:
  8238. @table @option
  8239. @item x
  8240. @item y
  8241. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  8242. @item width, w
  8243. @item height, h
  8244. The expressions which specify the width and height of the box; if 0 they are interpreted as
  8245. the input width and height. It defaults to 0.
  8246. @item color, c
  8247. Specify the color of the box to write. For the general syntax of this option,
  8248. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  8249. value @code{invert} is used, the box edge color is the same as the
  8250. video with inverted luma.
  8251. @item thickness, t
  8252. The expression which sets the thickness of the box edge.
  8253. A value of @code{fill} will create a filled box. Default value is @code{3}.
  8254. See below for the list of accepted constants.
  8255. @item replace
  8256. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  8257. will overwrite the video's color and alpha pixels.
  8258. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  8259. @end table
  8260. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  8261. following constants:
  8262. @table @option
  8263. @item dar
  8264. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  8265. @item hsub
  8266. @item vsub
  8267. horizontal and vertical chroma subsample values. For example for the
  8268. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8269. @item in_h, ih
  8270. @item in_w, iw
  8271. The input width and height.
  8272. @item sar
  8273. The input sample aspect ratio.
  8274. @item x
  8275. @item y
  8276. The x and y offset coordinates where the box is drawn.
  8277. @item w
  8278. @item h
  8279. The width and height of the drawn box.
  8280. @item box_source
  8281. Box source can be set as side_data_detection_bboxes if you want to use box data in
  8282. detection bboxes of side data.
  8283. If @var{box_source} is set, the @var{x}, @var{y}, @var{width} and @var{height} will be ignored and
  8284. still use box data in detection bboxes of side data. So please do not use this parameter if you were
  8285. not sure about the box source.
  8286. @item t
  8287. The thickness of the drawn box.
  8288. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  8289. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  8290. @end table
  8291. @subsection Examples
  8292. @itemize
  8293. @item
  8294. Draw a black box around the edge of the input image:
  8295. @example
  8296. drawbox
  8297. @end example
  8298. @item
  8299. Draw a box with color red and an opacity of 50%:
  8300. @example
  8301. drawbox=10:20:200:60:red@@0.5
  8302. @end example
  8303. The previous example can be specified as:
  8304. @example
  8305. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  8306. @end example
  8307. @item
  8308. Fill the box with pink color:
  8309. @example
  8310. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  8311. @end example
  8312. @item
  8313. Draw a 2-pixel red 2.40:1 mask:
  8314. @example
  8315. 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
  8316. @end example
  8317. @end itemize
  8318. @subsection Commands
  8319. This filter supports same commands as options.
  8320. The command accepts the same syntax of the corresponding option.
  8321. If the specified expression is not valid, it is kept at its current
  8322. value.
  8323. @anchor{drawgraph}
  8324. @section drawgraph
  8325. Draw a graph using input video metadata.
  8326. It accepts the following parameters:
  8327. @table @option
  8328. @item m1
  8329. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  8330. @item fg1
  8331. Set 1st foreground color expression.
  8332. @item m2
  8333. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  8334. @item fg2
  8335. Set 2nd foreground color expression.
  8336. @item m3
  8337. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  8338. @item fg3
  8339. Set 3rd foreground color expression.
  8340. @item m4
  8341. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  8342. @item fg4
  8343. Set 4th foreground color expression.
  8344. @item min
  8345. Set minimal value of metadata value.
  8346. @item max
  8347. Set maximal value of metadata value.
  8348. @item bg
  8349. Set graph background color. Default is white.
  8350. @item mode
  8351. Set graph mode.
  8352. Available values for mode is:
  8353. @table @samp
  8354. @item bar
  8355. @item dot
  8356. @item line
  8357. @end table
  8358. Default is @code{line}.
  8359. @item slide
  8360. Set slide mode.
  8361. Available values for slide is:
  8362. @table @samp
  8363. @item frame
  8364. Draw new frame when right border is reached.
  8365. @item replace
  8366. Replace old columns with new ones.
  8367. @item scroll
  8368. Scroll from right to left.
  8369. @item rscroll
  8370. Scroll from left to right.
  8371. @item picture
  8372. Draw single picture.
  8373. @end table
  8374. Default is @code{frame}.
  8375. @item size
  8376. Set size of graph video. For the syntax of this option, check the
  8377. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8378. The default value is @code{900x256}.
  8379. @item rate, r
  8380. Set the output frame rate. Default value is @code{25}.
  8381. The foreground color expressions can use the following variables:
  8382. @table @option
  8383. @item MIN
  8384. Minimal value of metadata value.
  8385. @item MAX
  8386. Maximal value of metadata value.
  8387. @item VAL
  8388. Current metadata key value.
  8389. @end table
  8390. The color is defined as 0xAABBGGRR.
  8391. @end table
  8392. Example using metadata from @ref{signalstats} filter:
  8393. @example
  8394. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  8395. @end example
  8396. Example using metadata from @ref{ebur128} filter:
  8397. @example
  8398. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  8399. @end example
  8400. @section drawgrid
  8401. Draw a grid on the input image.
  8402. It accepts the following parameters:
  8403. @table @option
  8404. @item x
  8405. @item y
  8406. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  8407. @item width, w
  8408. @item height, h
  8409. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  8410. input width and height, respectively, minus @code{thickness}, so image gets
  8411. framed. Default to 0.
  8412. @item color, c
  8413. Specify the color of the grid. For the general syntax of this option,
  8414. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  8415. value @code{invert} is used, the grid color is the same as the
  8416. video with inverted luma.
  8417. @item thickness, t
  8418. The expression which sets the thickness of the grid line. Default value is @code{1}.
  8419. See below for the list of accepted constants.
  8420. @item replace
  8421. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  8422. will overwrite the video's color and alpha pixels.
  8423. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  8424. @end table
  8425. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  8426. following constants:
  8427. @table @option
  8428. @item dar
  8429. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  8430. @item hsub
  8431. @item vsub
  8432. horizontal and vertical chroma subsample values. For example for the
  8433. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8434. @item in_h, ih
  8435. @item in_w, iw
  8436. The input grid cell width and height.
  8437. @item sar
  8438. The input sample aspect ratio.
  8439. @item x
  8440. @item y
  8441. The x and y coordinates of some point of grid intersection (meant to configure offset).
  8442. @item w
  8443. @item h
  8444. The width and height of the drawn cell.
  8445. @item t
  8446. The thickness of the drawn cell.
  8447. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  8448. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  8449. @end table
  8450. @subsection Examples
  8451. @itemize
  8452. @item
  8453. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  8454. @example
  8455. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  8456. @end example
  8457. @item
  8458. Draw a white 3x3 grid with an opacity of 50%:
  8459. @example
  8460. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  8461. @end example
  8462. @end itemize
  8463. @subsection Commands
  8464. This filter supports same commands as options.
  8465. The command accepts the same syntax of the corresponding option.
  8466. If the specified expression is not valid, it is kept at its current
  8467. value.
  8468. @anchor{drawtext}
  8469. @section drawtext
  8470. Draw a text string or text from a specified file on top of a video, using the
  8471. libfreetype library.
  8472. To enable compilation of this filter, you need to configure FFmpeg with
  8473. @code{--enable-libfreetype}.
  8474. To enable default font fallback and the @var{font} option you need to
  8475. configure FFmpeg with @code{--enable-libfontconfig}.
  8476. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  8477. @code{--enable-libfribidi}.
  8478. @subsection Syntax
  8479. It accepts the following parameters:
  8480. @table @option
  8481. @item box
  8482. Used to draw a box around text using the background color.
  8483. The value must be either 1 (enable) or 0 (disable).
  8484. The default value of @var{box} is 0.
  8485. @item boxborderw
  8486. Set the width of the border to be drawn around the box using @var{boxcolor}.
  8487. The default value of @var{boxborderw} is 0.
  8488. @item boxcolor
  8489. The color to be used for drawing box around text. For the syntax of this
  8490. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8491. The default value of @var{boxcolor} is "white".
  8492. @item line_spacing
  8493. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  8494. The default value of @var{line_spacing} is 0.
  8495. @item borderw
  8496. Set the width of the border to be drawn around the text using @var{bordercolor}.
  8497. The default value of @var{borderw} is 0.
  8498. @item bordercolor
  8499. Set the color to be used for drawing border around text. For the syntax of this
  8500. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8501. The default value of @var{bordercolor} is "black".
  8502. @item expansion
  8503. Select how the @var{text} is expanded. Can be either @code{none},
  8504. @code{strftime} (deprecated) or
  8505. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  8506. below for details.
  8507. @item basetime
  8508. Set a start time for the count. Value is in microseconds. Only applied
  8509. in the deprecated strftime expansion mode. To emulate in normal expansion
  8510. mode use the @code{pts} function, supplying the start time (in seconds)
  8511. as the second argument.
  8512. @item fix_bounds
  8513. If true, check and fix text coords to avoid clipping.
  8514. @item fontcolor
  8515. The color to be used for drawing fonts. For the syntax of this option, check
  8516. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8517. The default value of @var{fontcolor} is "black".
  8518. @item fontcolor_expr
  8519. String which is expanded the same way as @var{text} to obtain dynamic
  8520. @var{fontcolor} value. By default this option has empty value and is not
  8521. processed. When this option is set, it overrides @var{fontcolor} option.
  8522. @item font
  8523. The font family to be used for drawing text. By default Sans.
  8524. @item fontfile
  8525. The font file to be used for drawing text. The path must be included.
  8526. This parameter is mandatory if the fontconfig support is disabled.
  8527. @item alpha
  8528. Draw the text applying alpha blending. The value can
  8529. be a number between 0.0 and 1.0.
  8530. The expression accepts the same variables @var{x, y} as well.
  8531. The default value is 1.
  8532. Please see @var{fontcolor_expr}.
  8533. @item fontsize
  8534. The font size to be used for drawing text.
  8535. The default value of @var{fontsize} is 16.
  8536. @item text_shaping
  8537. If set to 1, attempt to shape the text (for example, reverse the order of
  8538. right-to-left text and join Arabic characters) before drawing it.
  8539. Otherwise, just draw the text exactly as given.
  8540. By default 1 (if supported).
  8541. @item ft_load_flags
  8542. The flags to be used for loading the fonts.
  8543. The flags map the corresponding flags supported by libfreetype, and are
  8544. a combination of the following values:
  8545. @table @var
  8546. @item default
  8547. @item no_scale
  8548. @item no_hinting
  8549. @item render
  8550. @item no_bitmap
  8551. @item vertical_layout
  8552. @item force_autohint
  8553. @item crop_bitmap
  8554. @item pedantic
  8555. @item ignore_global_advance_width
  8556. @item no_recurse
  8557. @item ignore_transform
  8558. @item monochrome
  8559. @item linear_design
  8560. @item no_autohint
  8561. @end table
  8562. Default value is "default".
  8563. For more information consult the documentation for the FT_LOAD_*
  8564. libfreetype flags.
  8565. @item shadowcolor
  8566. The color to be used for drawing a shadow behind the drawn text. For the
  8567. syntax of this option, check the @ref{color syntax,,"Color" section in the
  8568. ffmpeg-utils manual,ffmpeg-utils}.
  8569. The default value of @var{shadowcolor} is "black".
  8570. @item shadowx
  8571. @item shadowy
  8572. The x and y offsets for the text shadow position with respect to the
  8573. position of the text. They can be either positive or negative
  8574. values. The default value for both is "0".
  8575. @item start_number
  8576. The starting frame number for the n/frame_num variable. The default value
  8577. is "0".
  8578. @item tabsize
  8579. The size in number of spaces to use for rendering the tab.
  8580. Default value is 4.
  8581. @item timecode
  8582. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  8583. format. It can be used with or without text parameter. @var{timecode_rate}
  8584. option must be specified.
  8585. @item timecode_rate, rate, r
  8586. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  8587. integer. Minimum value is "1".
  8588. Drop-frame timecode is supported for frame rates 30 & 60.
  8589. @item tc24hmax
  8590. If set to 1, the output of the timecode option will wrap around at 24 hours.
  8591. Default is 0 (disabled).
  8592. @item text
  8593. The text string to be drawn. The text must be a sequence of UTF-8
  8594. encoded characters.
  8595. This parameter is mandatory if no file is specified with the parameter
  8596. @var{textfile}.
  8597. @item textfile
  8598. A text file containing text to be drawn. The text must be a sequence
  8599. of UTF-8 encoded characters.
  8600. This parameter is mandatory if no text string is specified with the
  8601. parameter @var{text}.
  8602. If both @var{text} and @var{textfile} are specified, an error is thrown.
  8603. @item text_source
  8604. Text source should be set as side_data_detection_bboxes if you want to use text data in
  8605. detection bboxes of side data.
  8606. If text source is set, @var{text} and @var{textfile} will be ignored and still use
  8607. text data in detection bboxes of side data. So please do not use this parameter
  8608. if you are not sure about the text source.
  8609. @item reload
  8610. If set to 1, the @var{textfile} will be reloaded before each frame.
  8611. Be sure to update it atomically, or it may be read partially, or even fail.
  8612. @item x
  8613. @item y
  8614. The expressions which specify the offsets where text will be drawn
  8615. within the video frame. They are relative to the top/left border of the
  8616. output image.
  8617. The default value of @var{x} and @var{y} is "0".
  8618. See below for the list of accepted constants and functions.
  8619. @end table
  8620. The parameters for @var{x} and @var{y} are expressions containing the
  8621. following constants and functions:
  8622. @table @option
  8623. @item dar
  8624. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  8625. @item hsub
  8626. @item vsub
  8627. horizontal and vertical chroma subsample values. For example for the
  8628. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8629. @item line_h, lh
  8630. the height of each text line
  8631. @item main_h, h, H
  8632. the input height
  8633. @item main_w, w, W
  8634. the input width
  8635. @item max_glyph_a, ascent
  8636. the maximum distance from the baseline to the highest/upper grid
  8637. coordinate used to place a glyph outline point, for all the rendered
  8638. glyphs.
  8639. It is a positive value, due to the grid's orientation with the Y axis
  8640. upwards.
  8641. @item max_glyph_d, descent
  8642. the maximum distance from the baseline to the lowest grid coordinate
  8643. used to place a glyph outline point, for all the rendered glyphs.
  8644. This is a negative value, due to the grid's orientation, with the Y axis
  8645. upwards.
  8646. @item max_glyph_h
  8647. maximum glyph height, that is the maximum height for all the glyphs
  8648. contained in the rendered text, it is equivalent to @var{ascent} -
  8649. @var{descent}.
  8650. @item max_glyph_w
  8651. maximum glyph width, that is the maximum width for all the glyphs
  8652. contained in the rendered text
  8653. @item n
  8654. the number of input frame, starting from 0
  8655. @item rand(min, max)
  8656. return a random number included between @var{min} and @var{max}
  8657. @item sar
  8658. The input sample aspect ratio.
  8659. @item t
  8660. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8661. @item text_h, th
  8662. the height of the rendered text
  8663. @item text_w, tw
  8664. the width of the rendered text
  8665. @item x
  8666. @item y
  8667. the x and y offset coordinates where the text is drawn.
  8668. These parameters allow the @var{x} and @var{y} expressions to refer
  8669. to each other, so you can for example specify @code{y=x/dar}.
  8670. @item pict_type
  8671. A one character description of the current frame's picture type.
  8672. @item pkt_pos
  8673. The current packet's position in the input file or stream
  8674. (in bytes, from the start of the input). A value of -1 indicates
  8675. this info is not available.
  8676. @item pkt_duration
  8677. The current packet's duration, in seconds.
  8678. @item pkt_size
  8679. The current packet's size (in bytes).
  8680. @end table
  8681. @anchor{drawtext_expansion}
  8682. @subsection Text expansion
  8683. If @option{expansion} is set to @code{strftime},
  8684. the filter recognizes strftime() sequences in the provided text and
  8685. expands them accordingly. Check the documentation of strftime(). This
  8686. feature is deprecated.
  8687. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  8688. If @option{expansion} is set to @code{normal} (which is the default),
  8689. the following expansion mechanism is used.
  8690. The backslash character @samp{\}, followed by any character, always expands to
  8691. the second character.
  8692. Sequences of the form @code{%@{...@}} are expanded. The text between the
  8693. braces is a function name, possibly followed by arguments separated by ':'.
  8694. If the arguments contain special characters or delimiters (':' or '@}'),
  8695. they should be escaped.
  8696. Note that they probably must also be escaped as the value for the
  8697. @option{text} option in the filter argument string and as the filter
  8698. argument in the filtergraph description, and possibly also for the shell,
  8699. that makes up to four levels of escaping; using a text file avoids these
  8700. problems.
  8701. The following functions are available:
  8702. @table @command
  8703. @item expr, e
  8704. The expression evaluation result.
  8705. It must take one argument specifying the expression to be evaluated,
  8706. which accepts the same constants and functions as the @var{x} and
  8707. @var{y} values. Note that not all constants should be used, for
  8708. example the text size is not known when evaluating the expression, so
  8709. the constants @var{text_w} and @var{text_h} will have an undefined
  8710. value.
  8711. @item expr_int_format, eif
  8712. Evaluate the expression's value and output as formatted integer.
  8713. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  8714. The second argument specifies the output format. Allowed values are @samp{x},
  8715. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  8716. @code{printf} function.
  8717. The third parameter is optional and sets the number of positions taken by the output.
  8718. It can be used to add padding with zeros from the left.
  8719. @item gmtime
  8720. The time at which the filter is running, expressed in UTC.
  8721. It can accept an argument: a strftime() format string.
  8722. @item localtime
  8723. The time at which the filter is running, expressed in the local time zone.
  8724. It can accept an argument: a strftime() format string.
  8725. @item metadata
  8726. Frame metadata. Takes one or two arguments.
  8727. The first argument is mandatory and specifies the metadata key.
  8728. The second argument is optional and specifies a default value, used when the
  8729. metadata key is not found or empty.
  8730. Available metadata can be identified by inspecting entries
  8731. starting with TAG included within each frame section
  8732. printed by running @code{ffprobe -show_frames}.
  8733. String metadata generated in filters leading to
  8734. the drawtext filter are also available.
  8735. @item n, frame_num
  8736. The frame number, starting from 0.
  8737. @item pict_type
  8738. A one character description of the current picture type.
  8739. @item pts
  8740. The timestamp of the current frame.
  8741. It can take up to three arguments.
  8742. The first argument is the format of the timestamp; it defaults to @code{flt}
  8743. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  8744. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  8745. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  8746. @code{localtime} stands for the timestamp of the frame formatted as
  8747. local time zone time.
  8748. The second argument is an offset added to the timestamp.
  8749. If the format is set to @code{hms}, a third argument @code{24HH} may be
  8750. supplied to present the hour part of the formatted timestamp in 24h format
  8751. (00-23).
  8752. If the format is set to @code{localtime} or @code{gmtime},
  8753. a third argument may be supplied: a strftime() format string.
  8754. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  8755. @end table
  8756. @subsection Commands
  8757. This filter supports altering parameters via commands:
  8758. @table @option
  8759. @item reinit
  8760. Alter existing filter parameters.
  8761. Syntax for the argument is the same as for filter invocation, e.g.
  8762. @example
  8763. fontsize=56:fontcolor=green:text='Hello World'
  8764. @end example
  8765. Full filter invocation with sendcmd would look like this:
  8766. @example
  8767. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  8768. @end example
  8769. @end table
  8770. If the entire argument can't be parsed or applied as valid values then the filter will
  8771. continue with its existing parameters.
  8772. @subsection Examples
  8773. @itemize
  8774. @item
  8775. Draw "Test Text" with font FreeSerif, using the default values for the
  8776. optional parameters.
  8777. @example
  8778. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  8779. @end example
  8780. @item
  8781. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  8782. and y=50 (counting from the top-left corner of the screen), text is
  8783. yellow with a red box around it. Both the text and the box have an
  8784. opacity of 20%.
  8785. @example
  8786. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  8787. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  8788. @end example
  8789. Note that the double quotes are not necessary if spaces are not used
  8790. within the parameter list.
  8791. @item
  8792. Show the text at the center of the video frame:
  8793. @example
  8794. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  8795. @end example
  8796. @item
  8797. Show the text at a random position, switching to a new position every 30 seconds:
  8798. @example
  8799. 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)"
  8800. @end example
  8801. @item
  8802. Show a text line sliding from right to left in the last row of the video
  8803. frame. The file @file{LONG_LINE} is assumed to contain a single line
  8804. with no newlines.
  8805. @example
  8806. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  8807. @end example
  8808. @item
  8809. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  8810. @example
  8811. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  8812. @end example
  8813. @item
  8814. Draw a single green letter "g", at the center of the input video.
  8815. The glyph baseline is placed at half screen height.
  8816. @example
  8817. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  8818. @end example
  8819. @item
  8820. Show text for 1 second every 3 seconds:
  8821. @example
  8822. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  8823. @end example
  8824. @item
  8825. Use fontconfig to set the font. Note that the colons need to be escaped.
  8826. @example
  8827. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  8828. @end example
  8829. @item
  8830. Draw "Test Text" with font size dependent on height of the video.
  8831. @example
  8832. drawtext="text='Test Text': fontsize=h/30: x=(w-text_w)/2: y=(h-text_h*2)"
  8833. @end example
  8834. @item
  8835. Print the date of a real-time encoding (see strftime(3)):
  8836. @example
  8837. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  8838. @end example
  8839. @item
  8840. Show text fading in and out (appearing/disappearing):
  8841. @example
  8842. #!/bin/sh
  8843. DS=1.0 # display start
  8844. DE=10.0 # display end
  8845. FID=1.5 # fade in duration
  8846. FOD=5 # fade out duration
  8847. 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 @}"
  8848. @end example
  8849. @item
  8850. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  8851. and the @option{fontsize} value are included in the @option{y} offset.
  8852. @example
  8853. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  8854. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  8855. @end example
  8856. @item
  8857. Plot special @var{lavf.image2dec.source_basename} metadata onto each frame if
  8858. such metadata exists. Otherwise, plot the string "NA". Note that image2 demuxer
  8859. must have option @option{-export_path_metadata 1} for the special metadata fields
  8860. to be available for filters.
  8861. @example
  8862. drawtext="fontsize=20:fontcolor=white:fontfile=FreeSans.ttf:text='%@{metadata\:lavf.image2dec.source_basename\:NA@}':x=10:y=10"
  8863. @end example
  8864. @end itemize
  8865. For more information about libfreetype, check:
  8866. @url{http://www.freetype.org/}.
  8867. For more information about fontconfig, check:
  8868. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  8869. For more information about libfribidi, check:
  8870. @url{http://fribidi.org/}.
  8871. @section edgedetect
  8872. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  8873. The filter accepts the following options:
  8874. @table @option
  8875. @item low
  8876. @item high
  8877. Set low and high threshold values used by the Canny thresholding
  8878. algorithm.
  8879. The high threshold selects the "strong" edge pixels, which are then
  8880. connected through 8-connectivity with the "weak" edge pixels selected
  8881. by the low threshold.
  8882. @var{low} and @var{high} threshold values must be chosen in the range
  8883. [0,1], and @var{low} should be lesser or equal to @var{high}.
  8884. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  8885. is @code{50/255}.
  8886. @item mode
  8887. Define the drawing mode.
  8888. @table @samp
  8889. @item wires
  8890. Draw white/gray wires on black background.
  8891. @item colormix
  8892. Mix the colors to create a paint/cartoon effect.
  8893. @item canny
  8894. Apply Canny edge detector on all selected planes.
  8895. @end table
  8896. Default value is @var{wires}.
  8897. @item planes
  8898. Select planes for filtering. By default all available planes are filtered.
  8899. @end table
  8900. @subsection Examples
  8901. @itemize
  8902. @item
  8903. Standard edge detection with custom values for the hysteresis thresholding:
  8904. @example
  8905. edgedetect=low=0.1:high=0.4
  8906. @end example
  8907. @item
  8908. Painting effect without thresholding:
  8909. @example
  8910. edgedetect=mode=colormix:high=0
  8911. @end example
  8912. @end itemize
  8913. @section elbg
  8914. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  8915. For each input image, the filter will compute the optimal mapping from
  8916. the input to the output given the codebook length, that is the number
  8917. of distinct output colors.
  8918. This filter accepts the following options.
  8919. @table @option
  8920. @item codebook_length, l
  8921. Set codebook length. The value must be a positive integer, and
  8922. represents the number of distinct output colors. Default value is 256.
  8923. @item nb_steps, n
  8924. Set the maximum number of iterations to apply for computing the optimal
  8925. mapping. The higher the value the better the result and the higher the
  8926. computation time. Default value is 1.
  8927. @item seed, s
  8928. Set a random seed, must be an integer included between 0 and
  8929. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  8930. will try to use a good random seed on a best effort basis.
  8931. @item pal8
  8932. Set pal8 output pixel format. This option does not work with codebook
  8933. length greater than 256. Default is disabled.
  8934. @item use_alpha
  8935. Include alpha values in the quantization calculation. Allows creating
  8936. palettized output images (e.g. PNG8) with multiple alpha smooth blending.
  8937. @end table
  8938. @section entropy
  8939. Measure graylevel entropy in histogram of color channels of video frames.
  8940. It accepts the following parameters:
  8941. @table @option
  8942. @item mode
  8943. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  8944. @var{diff} mode measures entropy of histogram delta values, absolute differences
  8945. between neighbour histogram values.
  8946. @end table
  8947. @section epx
  8948. Apply the EPX magnification filter which is designed for pixel art.
  8949. It accepts the following option:
  8950. @table @option
  8951. @item n
  8952. Set the scaling dimension: @code{2} for @code{2xEPX}, @code{3} for
  8953. @code{3xEPX}.
  8954. Default is @code{3}.
  8955. @end table
  8956. @section eq
  8957. Set brightness, contrast, saturation and approximate gamma adjustment.
  8958. The filter accepts the following options:
  8959. @table @option
  8960. @item contrast
  8961. Set the contrast expression. The value must be a float value in range
  8962. @code{-1000.0} to @code{1000.0}. The default value is "1".
  8963. @item brightness
  8964. Set the brightness expression. The value must be a float value in
  8965. range @code{-1.0} to @code{1.0}. The default value is "0".
  8966. @item saturation
  8967. Set the saturation expression. The value must be a float in
  8968. range @code{0.0} to @code{3.0}. The default value is "1".
  8969. @item gamma
  8970. Set the gamma expression. The value must be a float in range
  8971. @code{0.1} to @code{10.0}. The default value is "1".
  8972. @item gamma_r
  8973. Set the gamma expression for red. The value must be a float in
  8974. range @code{0.1} to @code{10.0}. The default value is "1".
  8975. @item gamma_g
  8976. Set the gamma expression for green. The value must be a float in range
  8977. @code{0.1} to @code{10.0}. The default value is "1".
  8978. @item gamma_b
  8979. Set the gamma expression for blue. The value must be a float in range
  8980. @code{0.1} to @code{10.0}. The default value is "1".
  8981. @item gamma_weight
  8982. Set the gamma weight expression. It can be used to reduce the effect
  8983. of a high gamma value on bright image areas, e.g. keep them from
  8984. getting overamplified and just plain white. The value must be a float
  8985. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  8986. gamma correction all the way down while @code{1.0} leaves it at its
  8987. full strength. Default is "1".
  8988. @item eval
  8989. Set when the expressions for brightness, contrast, saturation and
  8990. gamma expressions are evaluated.
  8991. It accepts the following values:
  8992. @table @samp
  8993. @item init
  8994. only evaluate expressions once during the filter initialization or
  8995. when a command is processed
  8996. @item frame
  8997. evaluate expressions for each incoming frame
  8998. @end table
  8999. Default value is @samp{init}.
  9000. @end table
  9001. The expressions accept the following parameters:
  9002. @table @option
  9003. @item n
  9004. frame count of the input frame starting from 0
  9005. @item pos
  9006. byte position of the corresponding packet in the input file, NAN if
  9007. unspecified
  9008. @item r
  9009. frame rate of the input video, NAN if the input frame rate is unknown
  9010. @item t
  9011. timestamp expressed in seconds, NAN if the input timestamp is unknown
  9012. @end table
  9013. @subsection Commands
  9014. The filter supports the following commands:
  9015. @table @option
  9016. @item contrast
  9017. Set the contrast expression.
  9018. @item brightness
  9019. Set the brightness expression.
  9020. @item saturation
  9021. Set the saturation expression.
  9022. @item gamma
  9023. Set the gamma expression.
  9024. @item gamma_r
  9025. Set the gamma_r expression.
  9026. @item gamma_g
  9027. Set gamma_g expression.
  9028. @item gamma_b
  9029. Set gamma_b expression.
  9030. @item gamma_weight
  9031. Set gamma_weight expression.
  9032. The command accepts the same syntax of the corresponding option.
  9033. If the specified expression is not valid, it is kept at its current
  9034. value.
  9035. @end table
  9036. @anchor{erosion}
  9037. @section erosion
  9038. Apply erosion effect to the video.
  9039. This filter replaces the pixel by the local(3x3) minimum.
  9040. It accepts the following options:
  9041. @table @option
  9042. @item threshold0
  9043. @item threshold1
  9044. @item threshold2
  9045. @item threshold3
  9046. Limit the maximum change for each plane, default is 65535.
  9047. If 0, plane will remain unchanged.
  9048. @item coordinates
  9049. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  9050. pixels are used.
  9051. Flags to local 3x3 coordinates maps like this:
  9052. 1 2 3
  9053. 4 5
  9054. 6 7 8
  9055. @end table
  9056. @subsection Commands
  9057. This filter supports the all above options as @ref{commands}.
  9058. @section estdif
  9059. Deinterlace the input video ("estdif" stands for "Edge Slope
  9060. Tracing Deinterlacing Filter").
  9061. Spatial only filter that uses edge slope tracing algorithm
  9062. to interpolate missing lines.
  9063. It accepts the following parameters:
  9064. @table @option
  9065. @item mode
  9066. The interlacing mode to adopt. It accepts one of the following values:
  9067. @table @option
  9068. @item frame
  9069. Output one frame for each frame.
  9070. @item field
  9071. Output one frame for each field.
  9072. @end table
  9073. The default value is @code{field}.
  9074. @item parity
  9075. The picture field parity assumed for the input interlaced video. It accepts one
  9076. of the following values:
  9077. @table @option
  9078. @item tff
  9079. Assume the top field is first.
  9080. @item bff
  9081. Assume the bottom field is first.
  9082. @item auto
  9083. Enable automatic detection of field parity.
  9084. @end table
  9085. The default value is @code{auto}.
  9086. If the interlacing is unknown or the decoder does not export this information,
  9087. top field first will be assumed.
  9088. @item deint
  9089. Specify which frames to deinterlace. Accepts one of the following
  9090. values:
  9091. @table @option
  9092. @item all
  9093. Deinterlace all frames.
  9094. @item interlaced
  9095. Only deinterlace frames marked as interlaced.
  9096. @end table
  9097. The default value is @code{all}.
  9098. @item rslope
  9099. Specify the search radius for edge slope tracing. Default value is 1.
  9100. Allowed range is from 1 to 15.
  9101. @item redge
  9102. Specify the search radius for best edge matching. Default value is 2.
  9103. Allowed range is from 0 to 15.
  9104. @item ecost
  9105. Specify the edge cost for edge matching. Default value is 0.03125.
  9106. Allowed range is from 0 to 1.
  9107. @item mcost
  9108. Specify the middle cost for edge matching. Default value is 0.5.
  9109. Allowed range is from 0 to 1.
  9110. @item dcost
  9111. Specify the distance cost for edge matching. Default value is 0.5.
  9112. Allowed range is from 0 to 1.
  9113. @item interp
  9114. Specify the interpolation used. Default is 4-point interpolation. It accepts one
  9115. of the following values:
  9116. @table @option
  9117. @item 2p
  9118. Two-point interpolation.
  9119. @item 4p
  9120. Four-point interpolation.
  9121. @item 6p
  9122. Six-point interpolation.
  9123. @end table
  9124. @end table
  9125. @subsection Commands
  9126. This filter supports same @ref{commands} as options.
  9127. @section exposure
  9128. Adjust exposure of the video stream.
  9129. The filter accepts the following options:
  9130. @table @option
  9131. @item exposure
  9132. Set the exposure correction in EV. Allowed range is from -3.0 to 3.0 EV
  9133. Default value is 0 EV.
  9134. @item black
  9135. Set the black level correction. Allowed range is from -1.0 to 1.0.
  9136. Default value is 0.
  9137. @end table
  9138. @subsection Commands
  9139. This filter supports same @ref{commands} as options.
  9140. @section extractplanes
  9141. Extract color channel components from input video stream into
  9142. separate grayscale video streams.
  9143. The filter accepts the following option:
  9144. @table @option
  9145. @item planes
  9146. Set plane(s) to extract.
  9147. Available values for planes are:
  9148. @table @samp
  9149. @item y
  9150. @item u
  9151. @item v
  9152. @item a
  9153. @item r
  9154. @item g
  9155. @item b
  9156. @end table
  9157. Choosing planes not available in the input will result in an error.
  9158. That means you cannot select @code{r}, @code{g}, @code{b} planes
  9159. with @code{y}, @code{u}, @code{v} planes at same time.
  9160. @end table
  9161. @subsection Examples
  9162. @itemize
  9163. @item
  9164. Extract luma, u and v color channel component from input video frame
  9165. into 3 grayscale outputs:
  9166. @example
  9167. 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
  9168. @end example
  9169. @end itemize
  9170. @section fade
  9171. Apply a fade-in/out effect to the input video.
  9172. It accepts the following parameters:
  9173. @table @option
  9174. @item type, t
  9175. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  9176. effect.
  9177. Default is @code{in}.
  9178. @item start_frame, s
  9179. Specify the number of the frame to start applying the fade
  9180. effect at. Default is 0.
  9181. @item nb_frames, n
  9182. The number of frames that the fade effect lasts. At the end of the
  9183. fade-in effect, the output video will have the same intensity as the input video.
  9184. At the end of the fade-out transition, the output video will be filled with the
  9185. selected @option{color}.
  9186. Default is 25.
  9187. @item alpha
  9188. If set to 1, fade only alpha channel, if one exists on the input.
  9189. Default value is 0.
  9190. @item start_time, st
  9191. Specify the timestamp (in seconds) of the frame to start to apply the fade
  9192. effect. If both start_frame and start_time are specified, the fade will start at
  9193. whichever comes last. Default is 0.
  9194. @item duration, d
  9195. The number of seconds for which the fade effect has to last. At the end of the
  9196. fade-in effect the output video will have the same intensity as the input video,
  9197. at the end of the fade-out transition the output video will be filled with the
  9198. selected @option{color}.
  9199. If both duration and nb_frames are specified, duration is used. Default is 0
  9200. (nb_frames is used by default).
  9201. @item color, c
  9202. Specify the color of the fade. Default is "black".
  9203. @end table
  9204. @subsection Examples
  9205. @itemize
  9206. @item
  9207. Fade in the first 30 frames of video:
  9208. @example
  9209. fade=in:0:30
  9210. @end example
  9211. The command above is equivalent to:
  9212. @example
  9213. fade=t=in:s=0:n=30
  9214. @end example
  9215. @item
  9216. Fade out the last 45 frames of a 200-frame video:
  9217. @example
  9218. fade=out:155:45
  9219. fade=type=out:start_frame=155:nb_frames=45
  9220. @end example
  9221. @item
  9222. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  9223. @example
  9224. fade=in:0:25, fade=out:975:25
  9225. @end example
  9226. @item
  9227. Make the first 5 frames yellow, then fade in from frame 5-24:
  9228. @example
  9229. fade=in:5:20:color=yellow
  9230. @end example
  9231. @item
  9232. Fade in alpha over first 25 frames of video:
  9233. @example
  9234. fade=in:0:25:alpha=1
  9235. @end example
  9236. @item
  9237. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  9238. @example
  9239. fade=t=in:st=5.5:d=0.5
  9240. @end example
  9241. @end itemize
  9242. @section fftdnoiz
  9243. Denoise frames using 3D FFT (frequency domain filtering).
  9244. The filter accepts the following options:
  9245. @table @option
  9246. @item sigma
  9247. Set the noise sigma constant. This sets denoising strength.
  9248. Default value is 1. Allowed range is from 0 to 30.
  9249. Using very high sigma with low overlap may give blocking artifacts.
  9250. @item amount
  9251. Set amount of denoising. By default all detected noise is reduced.
  9252. Default value is 1. Allowed range is from 0 to 1.
  9253. @item block
  9254. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  9255. Actual size of block in pixels is 2 to power of @var{block}, so by default
  9256. block size in pixels is 2^4 which is 16.
  9257. @item overlap
  9258. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  9259. @item prev
  9260. Set number of previous frames to use for denoising. By default is set to 0.
  9261. @item next
  9262. Set number of next frames to to use for denoising. By default is set to 0.
  9263. @item planes
  9264. Set planes which will be filtered, by default are all available filtered
  9265. except alpha.
  9266. @end table
  9267. @section fftfilt
  9268. Apply arbitrary expressions to samples in frequency domain
  9269. @table @option
  9270. @item dc_Y
  9271. Adjust the dc value (gain) of the luma plane of the image. The filter
  9272. accepts an integer value in range @code{0} to @code{1000}. The default
  9273. value is set to @code{0}.
  9274. @item dc_U
  9275. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  9276. filter accepts an integer value in range @code{0} to @code{1000}. The
  9277. default value is set to @code{0}.
  9278. @item dc_V
  9279. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  9280. filter accepts an integer value in range @code{0} to @code{1000}. The
  9281. default value is set to @code{0}.
  9282. @item weight_Y
  9283. Set the frequency domain weight expression for the luma plane.
  9284. @item weight_U
  9285. Set the frequency domain weight expression for the 1st chroma plane.
  9286. @item weight_V
  9287. Set the frequency domain weight expression for the 2nd chroma plane.
  9288. @item eval
  9289. Set when the expressions are evaluated.
  9290. It accepts the following values:
  9291. @table @samp
  9292. @item init
  9293. Only evaluate expressions once during the filter initialization.
  9294. @item frame
  9295. Evaluate expressions for each incoming frame.
  9296. @end table
  9297. Default value is @samp{init}.
  9298. The filter accepts the following variables:
  9299. @item X
  9300. @item Y
  9301. The coordinates of the current sample.
  9302. @item W
  9303. @item H
  9304. The width and height of the image.
  9305. @item N
  9306. The number of input frame, starting from 0.
  9307. @item WS
  9308. @item HS
  9309. The size of FFT array for horizontal and vertical processing.
  9310. @end table
  9311. @subsection Examples
  9312. @itemize
  9313. @item
  9314. High-pass:
  9315. @example
  9316. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  9317. @end example
  9318. @item
  9319. Low-pass:
  9320. @example
  9321. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  9322. @end example
  9323. @item
  9324. Sharpen:
  9325. @example
  9326. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  9327. @end example
  9328. @item
  9329. Blur:
  9330. @example
  9331. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  9332. @end example
  9333. @end itemize
  9334. @section field
  9335. Extract a single field from an interlaced image using stride
  9336. arithmetic to avoid wasting CPU time. The output frames are marked as
  9337. non-interlaced.
  9338. The filter accepts the following options:
  9339. @table @option
  9340. @item type
  9341. Specify whether to extract the top (if the value is @code{0} or
  9342. @code{top}) or the bottom field (if the value is @code{1} or
  9343. @code{bottom}).
  9344. @end table
  9345. @section fieldhint
  9346. Create new frames by copying the top and bottom fields from surrounding frames
  9347. supplied as numbers by the hint file.
  9348. @table @option
  9349. @item hint
  9350. Set file containing hints: absolute/relative frame numbers.
  9351. There must be one line for each frame in a clip. Each line must contain two
  9352. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  9353. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  9354. is current frame number for @code{absolute} mode or out of [-1, 1] range
  9355. for @code{relative} mode. First number tells from which frame to pick up top
  9356. field and second number tells from which frame to pick up bottom field.
  9357. If optionally followed by @code{+} output frame will be marked as interlaced,
  9358. else if followed by @code{-} output frame will be marked as progressive, else
  9359. it will be marked same as input frame.
  9360. If optionally followed by @code{t} output frame will use only top field, or in
  9361. case of @code{b} it will use only bottom field.
  9362. If line starts with @code{#} or @code{;} that line is skipped.
  9363. @item mode
  9364. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  9365. @end table
  9366. Example of first several lines of @code{hint} file for @code{relative} mode:
  9367. @example
  9368. 0,0 - # first frame
  9369. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  9370. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  9371. 1,0 -
  9372. 0,0 -
  9373. 0,0 -
  9374. 1,0 -
  9375. 1,0 -
  9376. 1,0 -
  9377. 0,0 -
  9378. 0,0 -
  9379. 1,0 -
  9380. 1,0 -
  9381. 1,0 -
  9382. 0,0 -
  9383. @end example
  9384. @section fieldmatch
  9385. Field matching filter for inverse telecine. It is meant to reconstruct the
  9386. progressive frames from a telecined stream. The filter does not drop duplicated
  9387. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  9388. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  9389. The separation of the field matching and the decimation is notably motivated by
  9390. the possibility of inserting a de-interlacing filter fallback between the two.
  9391. If the source has mixed telecined and real interlaced content,
  9392. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  9393. But these remaining combed frames will be marked as interlaced, and thus can be
  9394. de-interlaced by a later filter such as @ref{yadif} before decimation.
  9395. In addition to the various configuration options, @code{fieldmatch} can take an
  9396. optional second stream, activated through the @option{ppsrc} option. If
  9397. enabled, the frames reconstruction will be based on the fields and frames from
  9398. this second stream. This allows the first input to be pre-processed in order to
  9399. help the various algorithms of the filter, while keeping the output lossless
  9400. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  9401. or brightness/contrast adjustments can help.
  9402. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  9403. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  9404. which @code{fieldmatch} is based on. While the semantic and usage are very
  9405. close, some behaviour and options names can differ.
  9406. The @ref{decimate} filter currently only works for constant frame rate input.
  9407. If your input has mixed telecined (30fps) and progressive content with a lower
  9408. framerate like 24fps use the following filterchain to produce the necessary cfr
  9409. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  9410. The filter accepts the following options:
  9411. @table @option
  9412. @item order
  9413. Specify the assumed field order of the input stream. Available values are:
  9414. @table @samp
  9415. @item auto
  9416. Auto detect parity (use FFmpeg's internal parity value).
  9417. @item bff
  9418. Assume bottom field first.
  9419. @item tff
  9420. Assume top field first.
  9421. @end table
  9422. Note that it is sometimes recommended not to trust the parity announced by the
  9423. stream.
  9424. Default value is @var{auto}.
  9425. @item mode
  9426. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  9427. sense that it won't risk creating jerkiness due to duplicate frames when
  9428. possible, but if there are bad edits or blended fields it will end up
  9429. outputting combed frames when a good match might actually exist. On the other
  9430. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  9431. but will almost always find a good frame if there is one. The other values are
  9432. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  9433. jerkiness and creating duplicate frames versus finding good matches in sections
  9434. with bad edits, orphaned fields, blended fields, etc.
  9435. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  9436. Available values are:
  9437. @table @samp
  9438. @item pc
  9439. 2-way matching (p/c)
  9440. @item pc_n
  9441. 2-way matching, and trying 3rd match if still combed (p/c + n)
  9442. @item pc_u
  9443. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  9444. @item pc_n_ub
  9445. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  9446. still combed (p/c + n + u/b)
  9447. @item pcn
  9448. 3-way matching (p/c/n)
  9449. @item pcn_ub
  9450. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  9451. detected as combed (p/c/n + u/b)
  9452. @end table
  9453. The parenthesis at the end indicate the matches that would be used for that
  9454. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  9455. @var{top}).
  9456. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  9457. the slowest.
  9458. Default value is @var{pc_n}.
  9459. @item ppsrc
  9460. Mark the main input stream as a pre-processed input, and enable the secondary
  9461. input stream as the clean source to pick the fields from. See the filter
  9462. introduction for more details. It is similar to the @option{clip2} feature from
  9463. VFM/TFM.
  9464. Default value is @code{0} (disabled).
  9465. @item field
  9466. Set the field to match from. It is recommended to set this to the same value as
  9467. @option{order} unless you experience matching failures with that setting. In
  9468. certain circumstances changing the field that is used to match from can have a
  9469. large impact on matching performance. Available values are:
  9470. @table @samp
  9471. @item auto
  9472. Automatic (same value as @option{order}).
  9473. @item bottom
  9474. Match from the bottom field.
  9475. @item top
  9476. Match from the top field.
  9477. @end table
  9478. Default value is @var{auto}.
  9479. @item mchroma
  9480. Set whether or not chroma is included during the match comparisons. In most
  9481. cases it is recommended to leave this enabled. You should set this to @code{0}
  9482. only if your clip has bad chroma problems such as heavy rainbowing or other
  9483. artifacts. Setting this to @code{0} could also be used to speed things up at
  9484. the cost of some accuracy.
  9485. Default value is @code{1}.
  9486. @item y0
  9487. @item y1
  9488. These define an exclusion band which excludes the lines between @option{y0} and
  9489. @option{y1} from being included in the field matching decision. An exclusion
  9490. band can be used to ignore subtitles, a logo, or other things that may
  9491. interfere with the matching. @option{y0} sets the starting scan line and
  9492. @option{y1} sets the ending line; all lines in between @option{y0} and
  9493. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  9494. @option{y0} and @option{y1} to the same value will disable the feature.
  9495. @option{y0} and @option{y1} defaults to @code{0}.
  9496. @item scthresh
  9497. Set the scene change detection threshold as a percentage of maximum change on
  9498. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  9499. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  9500. @option{scthresh} is @code{[0.0, 100.0]}.
  9501. Default value is @code{12.0}.
  9502. @item combmatch
  9503. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  9504. account the combed scores of matches when deciding what match to use as the
  9505. final match. Available values are:
  9506. @table @samp
  9507. @item none
  9508. No final matching based on combed scores.
  9509. @item sc
  9510. Combed scores are only used when a scene change is detected.
  9511. @item full
  9512. Use combed scores all the time.
  9513. @end table
  9514. Default is @var{sc}.
  9515. @item combdbg
  9516. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  9517. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  9518. Available values are:
  9519. @table @samp
  9520. @item none
  9521. No forced calculation.
  9522. @item pcn
  9523. Force p/c/n calculations.
  9524. @item pcnub
  9525. Force p/c/n/u/b calculations.
  9526. @end table
  9527. Default value is @var{none}.
  9528. @item cthresh
  9529. This is the area combing threshold used for combed frame detection. This
  9530. essentially controls how "strong" or "visible" combing must be to be detected.
  9531. Larger values mean combing must be more visible and smaller values mean combing
  9532. can be less visible or strong and still be detected. Valid settings are from
  9533. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  9534. be detected as combed). This is basically a pixel difference value. A good
  9535. range is @code{[8, 12]}.
  9536. Default value is @code{9}.
  9537. @item chroma
  9538. Sets whether or not chroma is considered in the combed frame decision. Only
  9539. disable this if your source has chroma problems (rainbowing, etc.) that are
  9540. causing problems for the combed frame detection with chroma enabled. Actually,
  9541. using @option{chroma}=@var{0} is usually more reliable, except for the case
  9542. where there is chroma only combing in the source.
  9543. Default value is @code{0}.
  9544. @item blockx
  9545. @item blocky
  9546. Respectively set the x-axis and y-axis size of the window used during combed
  9547. frame detection. This has to do with the size of the area in which
  9548. @option{combpel} pixels are required to be detected as combed for a frame to be
  9549. declared combed. See the @option{combpel} parameter description for more info.
  9550. Possible values are any number that is a power of 2 starting at 4 and going up
  9551. to 512.
  9552. Default value is @code{16}.
  9553. @item combpel
  9554. The number of combed pixels inside any of the @option{blocky} by
  9555. @option{blockx} size blocks on the frame for the frame to be detected as
  9556. combed. While @option{cthresh} controls how "visible" the combing must be, this
  9557. setting controls "how much" combing there must be in any localized area (a
  9558. window defined by the @option{blockx} and @option{blocky} settings) on the
  9559. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  9560. which point no frames will ever be detected as combed). This setting is known
  9561. as @option{MI} in TFM/VFM vocabulary.
  9562. Default value is @code{80}.
  9563. @end table
  9564. @anchor{p/c/n/u/b meaning}
  9565. @subsection p/c/n/u/b meaning
  9566. @subsubsection p/c/n
  9567. We assume the following telecined stream:
  9568. @example
  9569. Top fields: 1 2 2 3 4
  9570. Bottom fields: 1 2 3 4 4
  9571. @end example
  9572. The numbers correspond to the progressive frame the fields relate to. Here, the
  9573. first two frames are progressive, the 3rd and 4th are combed, and so on.
  9574. When @code{fieldmatch} is configured to run a matching from bottom
  9575. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  9576. @example
  9577. Input stream:
  9578. T 1 2 2 3 4
  9579. B 1 2 3 4 4 <-- matching reference
  9580. Matches: c c n n c
  9581. Output stream:
  9582. T 1 2 3 4 4
  9583. B 1 2 3 4 4
  9584. @end example
  9585. As a result of the field matching, we can see that some frames get duplicated.
  9586. To perform a complete inverse telecine, you need to rely on a decimation filter
  9587. after this operation. See for instance the @ref{decimate} filter.
  9588. The same operation now matching from top fields (@option{field}=@var{top})
  9589. looks like this:
  9590. @example
  9591. Input stream:
  9592. T 1 2 2 3 4 <-- matching reference
  9593. B 1 2 3 4 4
  9594. Matches: c c p p c
  9595. Output stream:
  9596. T 1 2 2 3 4
  9597. B 1 2 2 3 4
  9598. @end example
  9599. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  9600. basically, they refer to the frame and field of the opposite parity:
  9601. @itemize
  9602. @item @var{p} matches the field of the opposite parity in the previous frame
  9603. @item @var{c} matches the field of the opposite parity in the current frame
  9604. @item @var{n} matches the field of the opposite parity in the next frame
  9605. @end itemize
  9606. @subsubsection u/b
  9607. The @var{u} and @var{b} matching are a bit special in the sense that they match
  9608. from the opposite parity flag. In the following examples, we assume that we are
  9609. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  9610. 'x' is placed above and below each matched fields.
  9611. With bottom matching (@option{field}=@var{bottom}):
  9612. @example
  9613. Match: c p n b u
  9614. x x x x x
  9615. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  9616. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  9617. x x x x x
  9618. Output frames:
  9619. 2 1 2 2 2
  9620. 2 2 2 1 3
  9621. @end example
  9622. With top matching (@option{field}=@var{top}):
  9623. @example
  9624. Match: c p n b u
  9625. x x x x x
  9626. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  9627. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  9628. x x x x x
  9629. Output frames:
  9630. 2 2 2 1 2
  9631. 2 1 3 2 2
  9632. @end example
  9633. @subsection Examples
  9634. Simple IVTC of a top field first telecined stream:
  9635. @example
  9636. fieldmatch=order=tff:combmatch=none, decimate
  9637. @end example
  9638. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  9639. @example
  9640. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  9641. @end example
  9642. @section fieldorder
  9643. Transform the field order of the input video.
  9644. It accepts the following parameters:
  9645. @table @option
  9646. @item order
  9647. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  9648. for bottom field first.
  9649. @end table
  9650. The default value is @samp{tff}.
  9651. The transformation is done by shifting the picture content up or down
  9652. by one line, and filling the remaining line with appropriate picture content.
  9653. This method is consistent with most broadcast field order converters.
  9654. If the input video is not flagged as being interlaced, or it is already
  9655. flagged as being of the required output field order, then this filter does
  9656. not alter the incoming video.
  9657. It is very useful when converting to or from PAL DV material,
  9658. which is bottom field first.
  9659. For example:
  9660. @example
  9661. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  9662. @end example
  9663. @section fifo, afifo
  9664. Buffer input images and send them when they are requested.
  9665. It is mainly useful when auto-inserted by the libavfilter
  9666. framework.
  9667. It does not take parameters.
  9668. @section fillborders
  9669. Fill borders of the input video, without changing video stream dimensions.
  9670. Sometimes video can have garbage at the four edges and you may not want to
  9671. crop video input to keep size multiple of some number.
  9672. This filter accepts the following options:
  9673. @table @option
  9674. @item left
  9675. Number of pixels to fill from left border.
  9676. @item right
  9677. Number of pixels to fill from right border.
  9678. @item top
  9679. Number of pixels to fill from top border.
  9680. @item bottom
  9681. Number of pixels to fill from bottom border.
  9682. @item mode
  9683. Set fill mode.
  9684. It accepts the following values:
  9685. @table @samp
  9686. @item smear
  9687. fill pixels using outermost pixels
  9688. @item mirror
  9689. fill pixels using mirroring (half sample symmetric)
  9690. @item fixed
  9691. fill pixels with constant value
  9692. @item reflect
  9693. fill pixels using reflecting (whole sample symmetric)
  9694. @item wrap
  9695. fill pixels using wrapping
  9696. @item fade
  9697. fade pixels to constant value
  9698. @item margins
  9699. fill pixels at top and bottom with weighted averages pixels near borders
  9700. @end table
  9701. Default is @var{smear}.
  9702. @item color
  9703. Set color for pixels in fixed or fade mode. Default is @var{black}.
  9704. @end table
  9705. @subsection Commands
  9706. This filter supports same @ref{commands} as options.
  9707. The command accepts the same syntax of the corresponding option.
  9708. If the specified expression is not valid, it is kept at its current
  9709. value.
  9710. @section find_rect
  9711. Find a rectangular object
  9712. It accepts the following options:
  9713. @table @option
  9714. @item object
  9715. Filepath of the object image, needs to be in gray8.
  9716. @item threshold
  9717. Detection threshold, default is 0.5.
  9718. @item mipmaps
  9719. Number of mipmaps, default is 3.
  9720. @item xmin, ymin, xmax, ymax
  9721. Specifies the rectangle in which to search.
  9722. @item discard
  9723. Discard frames where object is not detected. Default is disabled.
  9724. @end table
  9725. @subsection Examples
  9726. @itemize
  9727. @item
  9728. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  9729. @example
  9730. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  9731. @end example
  9732. @end itemize
  9733. @section floodfill
  9734. Flood area with values of same pixel components with another values.
  9735. It accepts the following options:
  9736. @table @option
  9737. @item x
  9738. Set pixel x coordinate.
  9739. @item y
  9740. Set pixel y coordinate.
  9741. @item s0
  9742. Set source #0 component value.
  9743. @item s1
  9744. Set source #1 component value.
  9745. @item s2
  9746. Set source #2 component value.
  9747. @item s3
  9748. Set source #3 component value.
  9749. @item d0
  9750. Set destination #0 component value.
  9751. @item d1
  9752. Set destination #1 component value.
  9753. @item d2
  9754. Set destination #2 component value.
  9755. @item d3
  9756. Set destination #3 component value.
  9757. @end table
  9758. @anchor{format}
  9759. @section format
  9760. Convert the input video to one of the specified pixel formats.
  9761. Libavfilter will try to pick one that is suitable as input to
  9762. the next filter.
  9763. It accepts the following parameters:
  9764. @table @option
  9765. @item pix_fmts
  9766. A '|'-separated list of pixel format names, such as
  9767. "pix_fmts=yuv420p|monow|rgb24".
  9768. @end table
  9769. @subsection Examples
  9770. @itemize
  9771. @item
  9772. Convert the input video to the @var{yuv420p} format
  9773. @example
  9774. format=pix_fmts=yuv420p
  9775. @end example
  9776. Convert the input video to any of the formats in the list
  9777. @example
  9778. format=pix_fmts=yuv420p|yuv444p|yuv410p
  9779. @end example
  9780. @end itemize
  9781. @anchor{fps}
  9782. @section fps
  9783. Convert the video to specified constant frame rate by duplicating or dropping
  9784. frames as necessary.
  9785. It accepts the following parameters:
  9786. @table @option
  9787. @item fps
  9788. The desired output frame rate. It accepts expressions containing the following
  9789. constants:
  9790. @table @samp
  9791. @item source_fps
  9792. The input's frame rate
  9793. @item ntsc
  9794. NTSC frame rate of @code{30000/1001}
  9795. @item pal
  9796. PAL frame rate of @code{25.0}
  9797. @item film
  9798. Film frame rate of @code{24.0}
  9799. @item ntsc_film
  9800. NTSC-film frame rate of @code{24000/1001}
  9801. @end table
  9802. The default is @code{25}.
  9803. @item start_time
  9804. Assume the first PTS should be the given value, in seconds. This allows for
  9805. padding/trimming at the start of stream. By default, no assumption is made
  9806. about the first frame's expected PTS, so no padding or trimming is done.
  9807. For example, this could be set to 0 to pad the beginning with duplicates of
  9808. the first frame if a video stream starts after the audio stream or to trim any
  9809. frames with a negative PTS.
  9810. @item round
  9811. Timestamp (PTS) rounding method.
  9812. Possible values are:
  9813. @table @option
  9814. @item zero
  9815. round towards 0
  9816. @item inf
  9817. round away from 0
  9818. @item down
  9819. round towards -infinity
  9820. @item up
  9821. round towards +infinity
  9822. @item near
  9823. round to nearest
  9824. @end table
  9825. The default is @code{near}.
  9826. @item eof_action
  9827. Action performed when reading the last frame.
  9828. Possible values are:
  9829. @table @option
  9830. @item round
  9831. Use same timestamp rounding method as used for other frames.
  9832. @item pass
  9833. Pass through last frame if input duration has not been reached yet.
  9834. @end table
  9835. The default is @code{round}.
  9836. @end table
  9837. Alternatively, the options can be specified as a flat string:
  9838. @var{fps}[:@var{start_time}[:@var{round}]].
  9839. See also the @ref{setpts} filter.
  9840. @subsection Examples
  9841. @itemize
  9842. @item
  9843. A typical usage in order to set the fps to 25:
  9844. @example
  9845. fps=fps=25
  9846. @end example
  9847. @item
  9848. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  9849. @example
  9850. fps=fps=film:round=near
  9851. @end example
  9852. @end itemize
  9853. @section framepack
  9854. Pack two different video streams into a stereoscopic video, setting proper
  9855. metadata on supported codecs. The two views should have the same size and
  9856. framerate and processing will stop when the shorter video ends. Please note
  9857. that you may conveniently adjust view properties with the @ref{scale} and
  9858. @ref{fps} filters.
  9859. It accepts the following parameters:
  9860. @table @option
  9861. @item format
  9862. The desired packing format. Supported values are:
  9863. @table @option
  9864. @item sbs
  9865. The views are next to each other (default).
  9866. @item tab
  9867. The views are on top of each other.
  9868. @item lines
  9869. The views are packed by line.
  9870. @item columns
  9871. The views are packed by column.
  9872. @item frameseq
  9873. The views are temporally interleaved.
  9874. @end table
  9875. @end table
  9876. Some examples:
  9877. @example
  9878. # Convert left and right views into a frame-sequential video
  9879. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  9880. # Convert views into a side-by-side video with the same output resolution as the input
  9881. 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
  9882. @end example
  9883. @section framerate
  9884. Change the frame rate by interpolating new video output frames from the source
  9885. frames.
  9886. This filter is not designed to function correctly with interlaced media. If
  9887. you wish to change the frame rate of interlaced media then you are required
  9888. to deinterlace before this filter and re-interlace after this filter.
  9889. A description of the accepted options follows.
  9890. @table @option
  9891. @item fps
  9892. Specify the output frames per second. This option can also be specified
  9893. as a value alone. The default is @code{50}.
  9894. @item interp_start
  9895. Specify the start of a range where the output frame will be created as a
  9896. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  9897. the default is @code{15}.
  9898. @item interp_end
  9899. Specify the end of a range where the output frame will be created as a
  9900. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  9901. the default is @code{240}.
  9902. @item scene
  9903. Specify the level at which a scene change is detected as a value between
  9904. 0 and 100 to indicate a new scene; a low value reflects a low
  9905. probability for the current frame to introduce a new scene, while a higher
  9906. value means the current frame is more likely to be one.
  9907. The default is @code{8.2}.
  9908. @item flags
  9909. Specify flags influencing the filter process.
  9910. Available value for @var{flags} is:
  9911. @table @option
  9912. @item scene_change_detect, scd
  9913. Enable scene change detection using the value of the option @var{scene}.
  9914. This flag is enabled by default.
  9915. @end table
  9916. @end table
  9917. @section framestep
  9918. Select one frame every N-th frame.
  9919. This filter accepts the following option:
  9920. @table @option
  9921. @item step
  9922. Select frame after every @code{step} frames.
  9923. Allowed values are positive integers higher than 0. Default value is @code{1}.
  9924. @end table
  9925. @section freezedetect
  9926. Detect frozen video.
  9927. This filter logs a message and sets frame metadata when it detects that the
  9928. input video has no significant change in content during a specified duration.
  9929. Video freeze detection calculates the mean average absolute difference of all
  9930. the components of video frames and compares it to a noise floor.
  9931. The printed times and duration are expressed in seconds. The
  9932. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  9933. whose timestamp equals or exceeds the detection duration and it contains the
  9934. timestamp of the first frame of the freeze. The
  9935. @code{lavfi.freezedetect.freeze_duration} and
  9936. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  9937. after the freeze.
  9938. The filter accepts the following options:
  9939. @table @option
  9940. @item noise, n
  9941. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  9942. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  9943. 0.001.
  9944. @item duration, d
  9945. Set freeze duration until notification (default is 2 seconds).
  9946. @end table
  9947. @section freezeframes
  9948. Freeze video frames.
  9949. This filter freezes video frames using frame from 2nd input.
  9950. The filter accepts the following options:
  9951. @table @option
  9952. @item first
  9953. Set number of first frame from which to start freeze.
  9954. @item last
  9955. Set number of last frame from which to end freeze.
  9956. @item replace
  9957. Set number of frame from 2nd input which will be used instead of replaced frames.
  9958. @end table
  9959. @anchor{frei0r}
  9960. @section frei0r
  9961. Apply a frei0r effect to the input video.
  9962. To enable the compilation of this filter, you need to install the frei0r
  9963. header and configure FFmpeg with @code{--enable-frei0r}.
  9964. It accepts the following parameters:
  9965. @table @option
  9966. @item filter_name
  9967. The name of the frei0r effect to load. If the environment variable
  9968. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  9969. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  9970. Otherwise, the standard frei0r paths are searched, in this order:
  9971. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  9972. @file{/usr/lib/frei0r-1/}.
  9973. @item filter_params
  9974. A '|'-separated list of parameters to pass to the frei0r effect.
  9975. @end table
  9976. A frei0r effect parameter can be a boolean (its value is either
  9977. "y" or "n"), a double, a color (specified as
  9978. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  9979. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  9980. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  9981. a position (specified as @var{X}/@var{Y}, where
  9982. @var{X} and @var{Y} are floating point numbers) and/or a string.
  9983. The number and types of parameters depend on the loaded effect. If an
  9984. effect parameter is not specified, the default value is set.
  9985. @subsection Examples
  9986. @itemize
  9987. @item
  9988. Apply the distort0r effect, setting the first two double parameters:
  9989. @example
  9990. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  9991. @end example
  9992. @item
  9993. Apply the colordistance effect, taking a color as the first parameter:
  9994. @example
  9995. frei0r=colordistance:0.2/0.3/0.4
  9996. frei0r=colordistance:violet
  9997. frei0r=colordistance:0x112233
  9998. @end example
  9999. @item
  10000. Apply the perspective effect, specifying the top left and top right image
  10001. positions:
  10002. @example
  10003. frei0r=perspective:0.2/0.2|0.8/0.2
  10004. @end example
  10005. @end itemize
  10006. For more information, see
  10007. @url{http://frei0r.dyne.org}
  10008. @subsection Commands
  10009. This filter supports the @option{filter_params} option as @ref{commands}.
  10010. @section fspp
  10011. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  10012. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  10013. processing filter, one of them is performed once per block, not per pixel.
  10014. This allows for much higher speed.
  10015. The filter accepts the following options:
  10016. @table @option
  10017. @item quality
  10018. Set quality. This option defines the number of levels for averaging. It accepts
  10019. an integer in the range 4-5. Default value is @code{4}.
  10020. @item qp
  10021. Force a constant quantization parameter. It accepts an integer in range 0-63.
  10022. If not set, the filter will use the QP from the video stream (if available).
  10023. @item strength
  10024. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  10025. more details but also more artifacts, while higher values make the image smoother
  10026. but also blurrier. Default value is @code{0} − PSNR optimal.
  10027. @item use_bframe_qp
  10028. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  10029. option may cause flicker since the B-Frames have often larger QP. Default is
  10030. @code{0} (not enabled).
  10031. @end table
  10032. @section gblur
  10033. Apply Gaussian blur filter.
  10034. The filter accepts the following options:
  10035. @table @option
  10036. @item sigma
  10037. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  10038. @item steps
  10039. Set number of steps for Gaussian approximation. Default is @code{1}.
  10040. @item planes
  10041. Set which planes to filter. By default all planes are filtered.
  10042. @item sigmaV
  10043. Set vertical sigma, if negative it will be same as @code{sigma}.
  10044. Default is @code{-1}.
  10045. @end table
  10046. @subsection Commands
  10047. This filter supports same commands as options.
  10048. The command accepts the same syntax of the corresponding option.
  10049. If the specified expression is not valid, it is kept at its current
  10050. value.
  10051. @section geq
  10052. Apply generic equation to each pixel.
  10053. The filter accepts the following options:
  10054. @table @option
  10055. @item lum_expr, lum
  10056. Set the luminance expression.
  10057. @item cb_expr, cb
  10058. Set the chrominance blue expression.
  10059. @item cr_expr, cr
  10060. Set the chrominance red expression.
  10061. @item alpha_expr, a
  10062. Set the alpha expression.
  10063. @item red_expr, r
  10064. Set the red expression.
  10065. @item green_expr, g
  10066. Set the green expression.
  10067. @item blue_expr, b
  10068. Set the blue expression.
  10069. @end table
  10070. The colorspace is selected according to the specified options. If one
  10071. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  10072. options is specified, the filter will automatically select a YCbCr
  10073. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  10074. @option{blue_expr} options is specified, it will select an RGB
  10075. colorspace.
  10076. If one of the chrominance expression is not defined, it falls back on the other
  10077. one. If no alpha expression is specified it will evaluate to opaque value.
  10078. If none of chrominance expressions are specified, they will evaluate
  10079. to the luminance expression.
  10080. The expressions can use the following variables and functions:
  10081. @table @option
  10082. @item N
  10083. The sequential number of the filtered frame, starting from @code{0}.
  10084. @item X
  10085. @item Y
  10086. The coordinates of the current sample.
  10087. @item W
  10088. @item H
  10089. The width and height of the image.
  10090. @item SW
  10091. @item SH
  10092. Width and height scale depending on the currently filtered plane. It is the
  10093. ratio between the corresponding luma plane number of pixels and the current
  10094. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  10095. @code{0.5,0.5} for chroma planes.
  10096. @item T
  10097. Time of the current frame, expressed in seconds.
  10098. @item p(x, y)
  10099. Return the value of the pixel at location (@var{x},@var{y}) of the current
  10100. plane.
  10101. @item lum(x, y)
  10102. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  10103. plane.
  10104. @item cb(x, y)
  10105. Return the value of the pixel at location (@var{x},@var{y}) of the
  10106. blue-difference chroma plane. Return 0 if there is no such plane.
  10107. @item cr(x, y)
  10108. Return the value of the pixel at location (@var{x},@var{y}) of the
  10109. red-difference chroma plane. Return 0 if there is no such plane.
  10110. @item r(x, y)
  10111. @item g(x, y)
  10112. @item b(x, y)
  10113. Return the value of the pixel at location (@var{x},@var{y}) of the
  10114. red/green/blue component. Return 0 if there is no such component.
  10115. @item alpha(x, y)
  10116. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  10117. plane. Return 0 if there is no such plane.
  10118. @item psum(x,y), lumsum(x, y), cbsum(x,y), crsum(x,y), rsum(x,y), gsum(x,y), bsum(x,y), alphasum(x,y)
  10119. Sum of sample values in the rectangle from (0,0) to (x,y), this allows obtaining
  10120. sums of samples within a rectangle. See the functions without the sum postfix.
  10121. @item interpolation
  10122. Set one of interpolation methods:
  10123. @table @option
  10124. @item nearest, n
  10125. @item bilinear, b
  10126. @end table
  10127. Default is bilinear.
  10128. @end table
  10129. For functions, if @var{x} and @var{y} are outside the area, the value will be
  10130. automatically clipped to the closer edge.
  10131. Please note that this filter can use multiple threads in which case each slice
  10132. will have its own expression state. If you want to use only a single expression
  10133. state because your expressions depend on previous state then you should limit
  10134. the number of filter threads to 1.
  10135. @subsection Examples
  10136. @itemize
  10137. @item
  10138. Flip the image horizontally:
  10139. @example
  10140. geq=p(W-X\,Y)
  10141. @end example
  10142. @item
  10143. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  10144. wavelength of 100 pixels:
  10145. @example
  10146. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  10147. @end example
  10148. @item
  10149. Generate a fancy enigmatic moving light:
  10150. @example
  10151. 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
  10152. @end example
  10153. @item
  10154. Generate a quick emboss effect:
  10155. @example
  10156. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  10157. @end example
  10158. @item
  10159. Modify RGB components depending on pixel position:
  10160. @example
  10161. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  10162. @end example
  10163. @item
  10164. Create a radial gradient that is the same size as the input (also see
  10165. the @ref{vignette} filter):
  10166. @example
  10167. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  10168. @end example
  10169. @end itemize
  10170. @section gradfun
  10171. Fix the banding artifacts that are sometimes introduced into nearly flat
  10172. regions by truncation to 8-bit color depth.
  10173. Interpolate the gradients that should go where the bands are, and
  10174. dither them.
  10175. It is designed for playback only. Do not use it prior to
  10176. lossy compression, because compression tends to lose the dither and
  10177. bring back the bands.
  10178. It accepts the following parameters:
  10179. @table @option
  10180. @item strength
  10181. The maximum amount by which the filter will change any one pixel. This is also
  10182. the threshold for detecting nearly flat regions. Acceptable values range from
  10183. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  10184. valid range.
  10185. @item radius
  10186. The neighborhood to fit the gradient to. A larger radius makes for smoother
  10187. gradients, but also prevents the filter from modifying the pixels near detailed
  10188. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  10189. values will be clipped to the valid range.
  10190. @end table
  10191. Alternatively, the options can be specified as a flat string:
  10192. @var{strength}[:@var{radius}]
  10193. @subsection Examples
  10194. @itemize
  10195. @item
  10196. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  10197. @example
  10198. gradfun=3.5:8
  10199. @end example
  10200. @item
  10201. Specify radius, omitting the strength (which will fall-back to the default
  10202. value):
  10203. @example
  10204. gradfun=radius=8
  10205. @end example
  10206. @end itemize
  10207. @anchor{graphmonitor}
  10208. @section graphmonitor
  10209. Show various filtergraph stats.
  10210. With this filter one can debug complete filtergraph.
  10211. Especially issues with links filling with queued frames.
  10212. The filter accepts the following options:
  10213. @table @option
  10214. @item size, s
  10215. Set video output size. Default is @var{hd720}.
  10216. @item opacity, o
  10217. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  10218. @item mode, m
  10219. Set output mode, can be @var{fulll} or @var{compact}.
  10220. In @var{compact} mode only filters with some queued frames have displayed stats.
  10221. @item flags, f
  10222. Set flags which enable which stats are shown in video.
  10223. Available values for flags are:
  10224. @table @samp
  10225. @item queue
  10226. Display number of queued frames in each link.
  10227. @item frame_count_in
  10228. Display number of frames taken from filter.
  10229. @item frame_count_out
  10230. Display number of frames given out from filter.
  10231. @item pts
  10232. Display current filtered frame pts.
  10233. @item time
  10234. Display current filtered frame time.
  10235. @item timebase
  10236. Display time base for filter link.
  10237. @item format
  10238. Display used format for filter link.
  10239. @item size
  10240. Display video size or number of audio channels in case of audio used by filter link.
  10241. @item rate
  10242. Display video frame rate or sample rate in case of audio used by filter link.
  10243. @item eof
  10244. Display link output status.
  10245. @item sample_count_in
  10246. Display number of samples taken from filter.
  10247. @item sample_count_out
  10248. Display number of samples given out from filter.
  10249. @end table
  10250. @item rate, r
  10251. Set upper limit for video rate of output stream, Default value is @var{25}.
  10252. This guarantee that output video frame rate will not be higher than this value.
  10253. @end table
  10254. @section grayworld
  10255. A color constancy filter that applies color correction based on the grayworld assumption
  10256. See: @url{https://www.researchgate.net/publication/275213614_A_New_Color_Correction_Method_for_Underwater_Imaging}
  10257. The algorithm uses linear light, so input
  10258. data should be linearized beforehand (and possibly correctly tagged).
  10259. @example
  10260. ffmpeg -i INPUT -vf zscale=transfer=linear,grayworld,zscale=transfer=bt709,format=yuv420p OUTPUT
  10261. @end example
  10262. @section greyedge
  10263. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  10264. and corrects the scene colors accordingly.
  10265. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  10266. The filter accepts the following options:
  10267. @table @option
  10268. @item difford
  10269. The order of differentiation to be applied on the scene. Must be chosen in the range
  10270. [0,2] and default value is 1.
  10271. @item minknorm
  10272. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  10273. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  10274. max value instead of calculating Minkowski distance.
  10275. @item sigma
  10276. The standard deviation of Gaussian blur to be applied on the scene. Must be
  10277. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  10278. can't be equal to 0 if @var{difford} is greater than 0.
  10279. @end table
  10280. @subsection Examples
  10281. @itemize
  10282. @item
  10283. Grey Edge:
  10284. @example
  10285. greyedge=difford=1:minknorm=5:sigma=2
  10286. @end example
  10287. @item
  10288. Max Edge:
  10289. @example
  10290. greyedge=difford=1:minknorm=0:sigma=2
  10291. @end example
  10292. @end itemize
  10293. @section guided
  10294. Apply guided filter for edge-preserving smoothing, dehazing and so on.
  10295. The filter accepts the following options:
  10296. @table @option
  10297. @item radius
  10298. Set the box radius in pixels.
  10299. Allowed range is 1 to 20. Default is 3.
  10300. @item eps
  10301. Set regularization parameter (with square).
  10302. Allowed range is 0 to 1. Default is 0.01.
  10303. @item mode
  10304. Set filter mode. Can be @code{basic} or @code{fast}.
  10305. Default is @code{basic}.
  10306. @item sub
  10307. Set subsampling ratio for @code{fast} mode.
  10308. Range is 2 to 64. Default is 4.
  10309. No subsampling occurs in @code{basic} mode.
  10310. @item guidance
  10311. Set guidance mode. Can be @code{off} or @code{on}. Default is @code{off}.
  10312. If @code{off}, single input is required.
  10313. If @code{on}, two inputs of the same resolution and pixel format are required.
  10314. The second input serves as the guidance.
  10315. @item planes
  10316. Set planes to filter. Default is first only.
  10317. @end table
  10318. @subsection Commands
  10319. This filter supports the all above options as @ref{commands}.
  10320. @subsection Examples
  10321. @itemize
  10322. @item
  10323. Edge-preserving smoothing with guided filter:
  10324. @example
  10325. ffmpeg -i in.png -vf guided out.png
  10326. @end example
  10327. @item
  10328. Dehazing, structure-transferring filtering, detail enhancement with guided filter.
  10329. For the generation of guidance image, refer to paper "Guided Image Filtering".
  10330. See: @url{http://kaiminghe.com/publications/pami12guidedfilter.pdf}.
  10331. @example
  10332. ffmpeg -i in.png -i guidance.png -filter_complex guided=guidance=on out.png
  10333. @end example
  10334. @end itemize
  10335. @anchor{haldclut}
  10336. @section haldclut
  10337. Apply a Hald CLUT to a video stream.
  10338. First input is the video stream to process, and second one is the Hald CLUT.
  10339. The Hald CLUT input can be a simple picture or a complete video stream.
  10340. The filter accepts the following options:
  10341. @table @option
  10342. @item shortest
  10343. Force termination when the shortest input terminates. Default is @code{0}.
  10344. @item repeatlast
  10345. Continue applying the last CLUT after the end of the stream. A value of
  10346. @code{0} disable the filter after the last frame of the CLUT is reached.
  10347. Default is @code{1}.
  10348. @end table
  10349. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  10350. filters share the same internals).
  10351. This filter also supports the @ref{framesync} options.
  10352. More information about the Hald CLUT can be found on Eskil Steenberg's website
  10353. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  10354. @subsection Commands
  10355. This filter supports the @code{interp} option as @ref{commands}.
  10356. @subsection Workflow examples
  10357. @subsubsection Hald CLUT video stream
  10358. Generate an identity Hald CLUT stream altered with various effects:
  10359. @example
  10360. 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
  10361. @end example
  10362. Note: make sure you use a lossless codec.
  10363. Then use it with @code{haldclut} to apply it on some random stream:
  10364. @example
  10365. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  10366. @end example
  10367. The Hald CLUT will be applied to the 10 first seconds (duration of
  10368. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  10369. to the remaining frames of the @code{mandelbrot} stream.
  10370. @subsubsection Hald CLUT with preview
  10371. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  10372. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  10373. biggest possible square starting at the top left of the picture. The remaining
  10374. padding pixels (bottom or right) will be ignored. This area can be used to add
  10375. a preview of the Hald CLUT.
  10376. Typically, the following generated Hald CLUT will be supported by the
  10377. @code{haldclut} filter:
  10378. @example
  10379. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  10380. pad=iw+320 [padded_clut];
  10381. smptebars=s=320x256, split [a][b];
  10382. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  10383. [main][b] overlay=W-320" -frames:v 1 clut.png
  10384. @end example
  10385. It contains the original and a preview of the effect of the CLUT: SMPTE color
  10386. bars are displayed on the right-top, and below the same color bars processed by
  10387. the color changes.
  10388. Then, the effect of this Hald CLUT can be visualized with:
  10389. @example
  10390. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  10391. @end example
  10392. @section hflip
  10393. Flip the input video horizontally.
  10394. For example, to horizontally flip the input video with @command{ffmpeg}:
  10395. @example
  10396. ffmpeg -i in.avi -vf "hflip" out.avi
  10397. @end example
  10398. @section histeq
  10399. This filter applies a global color histogram equalization on a
  10400. per-frame basis.
  10401. It can be used to correct video that has a compressed range of pixel
  10402. intensities. The filter redistributes the pixel intensities to
  10403. equalize their distribution across the intensity range. It may be
  10404. viewed as an "automatically adjusting contrast filter". This filter is
  10405. useful only for correcting degraded or poorly captured source
  10406. video.
  10407. The filter accepts the following options:
  10408. @table @option
  10409. @item strength
  10410. Determine the amount of equalization to be applied. As the strength
  10411. is reduced, the distribution of pixel intensities more-and-more
  10412. approaches that of the input frame. The value must be a float number
  10413. in the range [0,1] and defaults to 0.200.
  10414. @item intensity
  10415. Set the maximum intensity that can generated and scale the output
  10416. values appropriately. The strength should be set as desired and then
  10417. the intensity can be limited if needed to avoid washing-out. The value
  10418. must be a float number in the range [0,1] and defaults to 0.210.
  10419. @item antibanding
  10420. Set the antibanding level. If enabled the filter will randomly vary
  10421. the luminance of output pixels by a small amount to avoid banding of
  10422. the histogram. Possible values are @code{none}, @code{weak} or
  10423. @code{strong}. It defaults to @code{none}.
  10424. @end table
  10425. @anchor{histogram}
  10426. @section histogram
  10427. Compute and draw a color distribution histogram for the input video.
  10428. The computed histogram is a representation of the color component
  10429. distribution in an image.
  10430. Standard histogram displays the color components distribution in an image.
  10431. Displays color graph for each color component. Shows distribution of
  10432. the Y, U, V, A or R, G, B components, depending on input format, in the
  10433. current frame. Below each graph a color component scale meter is shown.
  10434. The filter accepts the following options:
  10435. @table @option
  10436. @item level_height
  10437. Set height of level. Default value is @code{200}.
  10438. Allowed range is [50, 2048].
  10439. @item scale_height
  10440. Set height of color scale. Default value is @code{12}.
  10441. Allowed range is [0, 40].
  10442. @item display_mode
  10443. Set display mode.
  10444. It accepts the following values:
  10445. @table @samp
  10446. @item stack
  10447. Per color component graphs are placed below each other.
  10448. @item parade
  10449. Per color component graphs are placed side by side.
  10450. @item overlay
  10451. Presents information identical to that in the @code{parade}, except
  10452. that the graphs representing color components are superimposed directly
  10453. over one another.
  10454. @end table
  10455. Default is @code{stack}.
  10456. @item levels_mode
  10457. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  10458. Default is @code{linear}.
  10459. @item components
  10460. Set what color components to display.
  10461. Default is @code{7}.
  10462. @item fgopacity
  10463. Set foreground opacity. Default is @code{0.7}.
  10464. @item bgopacity
  10465. Set background opacity. Default is @code{0.5}.
  10466. @item colors_mode
  10467. Set colors mode.
  10468. It accepts the following values:
  10469. @table @samp
  10470. @item whiteonblack
  10471. @item blackonwhite
  10472. @item whiteongray
  10473. @item blackongray
  10474. @item coloronblack
  10475. @item coloronwhite
  10476. @item colorongray
  10477. @item blackoncolor
  10478. @item whiteoncolor
  10479. @item grayoncolor
  10480. @end table
  10481. Default is @code{whiteonblack}.
  10482. @end table
  10483. @subsection Examples
  10484. @itemize
  10485. @item
  10486. Calculate and draw histogram:
  10487. @example
  10488. ffplay -i input -vf histogram
  10489. @end example
  10490. @end itemize
  10491. @anchor{hqdn3d}
  10492. @section hqdn3d
  10493. This is a high precision/quality 3d denoise filter. It aims to reduce
  10494. image noise, producing smooth images and making still images really
  10495. still. It should enhance compressibility.
  10496. It accepts the following optional parameters:
  10497. @table @option
  10498. @item luma_spatial
  10499. A non-negative floating point number which specifies spatial luma strength.
  10500. It defaults to 4.0.
  10501. @item chroma_spatial
  10502. A non-negative floating point number which specifies spatial chroma strength.
  10503. It defaults to 3.0*@var{luma_spatial}/4.0.
  10504. @item luma_tmp
  10505. A floating point number which specifies luma temporal strength. It defaults to
  10506. 6.0*@var{luma_spatial}/4.0.
  10507. @item chroma_tmp
  10508. A floating point number which specifies chroma temporal strength. It defaults to
  10509. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  10510. @end table
  10511. @subsection Commands
  10512. This filter supports same @ref{commands} as options.
  10513. The command accepts the same syntax of the corresponding option.
  10514. If the specified expression is not valid, it is kept at its current
  10515. value.
  10516. @anchor{hwdownload}
  10517. @section hwdownload
  10518. Download hardware frames to system memory.
  10519. The input must be in hardware frames, and the output a non-hardware format.
  10520. Not all formats will be supported on the output - it may be necessary to insert
  10521. an additional @option{format} filter immediately following in the graph to get
  10522. the output in a supported format.
  10523. @section hwmap
  10524. Map hardware frames to system memory or to another device.
  10525. This filter has several different modes of operation; which one is used depends
  10526. on the input and output formats:
  10527. @itemize
  10528. @item
  10529. Hardware frame input, normal frame output
  10530. Map the input frames to system memory and pass them to the output. If the
  10531. original hardware frame is later required (for example, after overlaying
  10532. something else on part of it), the @option{hwmap} filter can be used again
  10533. in the next mode to retrieve it.
  10534. @item
  10535. Normal frame input, hardware frame output
  10536. If the input is actually a software-mapped hardware frame, then unmap it -
  10537. that is, return the original hardware frame.
  10538. Otherwise, a device must be provided. Create new hardware surfaces on that
  10539. device for the output, then map them back to the software format at the input
  10540. and give those frames to the preceding filter. This will then act like the
  10541. @option{hwupload} filter, but may be able to avoid an additional copy when
  10542. the input is already in a compatible format.
  10543. @item
  10544. Hardware frame input and output
  10545. A device must be supplied for the output, either directly or with the
  10546. @option{derive_device} option. The input and output devices must be of
  10547. different types and compatible - the exact meaning of this is
  10548. system-dependent, but typically it means that they must refer to the same
  10549. underlying hardware context (for example, refer to the same graphics card).
  10550. If the input frames were originally created on the output device, then unmap
  10551. to retrieve the original frames.
  10552. Otherwise, map the frames to the output device - create new hardware frames
  10553. on the output corresponding to the frames on the input.
  10554. @end itemize
  10555. The following additional parameters are accepted:
  10556. @table @option
  10557. @item mode
  10558. Set the frame mapping mode. Some combination of:
  10559. @table @var
  10560. @item read
  10561. The mapped frame should be readable.
  10562. @item write
  10563. The mapped frame should be writeable.
  10564. @item overwrite
  10565. The mapping will always overwrite the entire frame.
  10566. This may improve performance in some cases, as the original contents of the
  10567. frame need not be loaded.
  10568. @item direct
  10569. The mapping must not involve any copying.
  10570. Indirect mappings to copies of frames are created in some cases where either
  10571. direct mapping is not possible or it would have unexpected properties.
  10572. Setting this flag ensures that the mapping is direct and will fail if that is
  10573. not possible.
  10574. @end table
  10575. Defaults to @var{read+write} if not specified.
  10576. @item derive_device @var{type}
  10577. Rather than using the device supplied at initialisation, instead derive a new
  10578. device of type @var{type} from the device the input frames exist on.
  10579. @item reverse
  10580. In a hardware to hardware mapping, map in reverse - create frames in the sink
  10581. and map them back to the source. This may be necessary in some cases where
  10582. a mapping in one direction is required but only the opposite direction is
  10583. supported by the devices being used.
  10584. This option is dangerous - it may break the preceding filter in undefined
  10585. ways if there are any additional constraints on that filter's output.
  10586. Do not use it without fully understanding the implications of its use.
  10587. @end table
  10588. @anchor{hwupload}
  10589. @section hwupload
  10590. Upload system memory frames to hardware surfaces.
  10591. The device to upload to must be supplied when the filter is initialised. If
  10592. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  10593. option or with the @option{derive_device} option. The input and output devices
  10594. must be of different types and compatible - the exact meaning of this is
  10595. system-dependent, but typically it means that they must refer to the same
  10596. underlying hardware context (for example, refer to the same graphics card).
  10597. The following additional parameters are accepted:
  10598. @table @option
  10599. @item derive_device @var{type}
  10600. Rather than using the device supplied at initialisation, instead derive a new
  10601. device of type @var{type} from the device the input frames exist on.
  10602. @end table
  10603. @anchor{hwupload_cuda}
  10604. @section hwupload_cuda
  10605. Upload system memory frames to a CUDA device.
  10606. It accepts the following optional parameters:
  10607. @table @option
  10608. @item device
  10609. The number of the CUDA device to use
  10610. @end table
  10611. @section hqx
  10612. Apply a high-quality magnification filter designed for pixel art. This filter
  10613. was originally created by Maxim Stepin.
  10614. It accepts the following option:
  10615. @table @option
  10616. @item n
  10617. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  10618. @code{hq3x} and @code{4} for @code{hq4x}.
  10619. Default is @code{3}.
  10620. @end table
  10621. @section hstack
  10622. Stack input videos horizontally.
  10623. All streams must be of same pixel format and of same height.
  10624. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  10625. to create same output.
  10626. The filter accepts the following option:
  10627. @table @option
  10628. @item inputs
  10629. Set number of input streams. Default is 2.
  10630. @item shortest
  10631. If set to 1, force the output to terminate when the shortest input
  10632. terminates. Default value is 0.
  10633. @end table
  10634. @section hsvhold
  10635. Turns a certain HSV range into gray values.
  10636. This filter measures color difference between set HSV color in options
  10637. and ones measured in video stream. Depending on options, output
  10638. colors can be changed to be gray or not.
  10639. The filter accepts the following options:
  10640. @table @option
  10641. @item hue
  10642. Set the hue value which will be used in color difference calculation.
  10643. Allowed range is from -360 to 360. Default value is 0.
  10644. @item sat
  10645. Set the saturation value which will be used in color difference calculation.
  10646. Allowed range is from -1 to 1. Default value is 0.
  10647. @item val
  10648. Set the value which will be used in color difference calculation.
  10649. Allowed range is from -1 to 1. Default value is 0.
  10650. @item similarity
  10651. Set similarity percentage with the key color.
  10652. Allowed range is from 0 to 1. Default value is 0.01.
  10653. 0.00001 matches only the exact key color, while 1.0 matches everything.
  10654. @item blend
  10655. Blend percentage.
  10656. Allowed range is from 0 to 1. Default value is 0.
  10657. 0.0 makes pixels either fully gray, or not gray at all.
  10658. Higher values result in more gray pixels, with a higher gray pixel
  10659. the more similar the pixels color is to the key color.
  10660. @end table
  10661. @section hsvkey
  10662. Turns a certain HSV range into transparency.
  10663. This filter measures color difference between set HSV color in options
  10664. and ones measured in video stream. Depending on options, output
  10665. colors can be changed to transparent by adding alpha channel.
  10666. The filter accepts the following options:
  10667. @table @option
  10668. @item hue
  10669. Set the hue value which will be used in color difference calculation.
  10670. Allowed range is from -360 to 360. Default value is 0.
  10671. @item sat
  10672. Set the saturation value which will be used in color difference calculation.
  10673. Allowed range is from -1 to 1. Default value is 0.
  10674. @item val
  10675. Set the value which will be used in color difference calculation.
  10676. Allowed range is from -1 to 1. Default value is 0.
  10677. @item similarity
  10678. Set similarity percentage with the key color.
  10679. Allowed range is from 0 to 1. Default value is 0.01.
  10680. 0.00001 matches only the exact key color, while 1.0 matches everything.
  10681. @item blend
  10682. Blend percentage.
  10683. Allowed range is from 0 to 1. Default value is 0.
  10684. 0.0 makes pixels either fully transparent, or not transparent at all.
  10685. Higher values result in semi-transparent pixels, with a higher transparency
  10686. the more similar the pixels color is to the key color.
  10687. @end table
  10688. @section hue
  10689. Modify the hue and/or the saturation of the input.
  10690. It accepts the following parameters:
  10691. @table @option
  10692. @item h
  10693. Specify the hue angle as a number of degrees. It accepts an expression,
  10694. and defaults to "0".
  10695. @item s
  10696. Specify the saturation in the [-10,10] range. It accepts an expression and
  10697. defaults to "1".
  10698. @item H
  10699. Specify the hue angle as a number of radians. It accepts an
  10700. expression, and defaults to "0".
  10701. @item b
  10702. Specify the brightness in the [-10,10] range. It accepts an expression and
  10703. defaults to "0".
  10704. @end table
  10705. @option{h} and @option{H} are mutually exclusive, and can't be
  10706. specified at the same time.
  10707. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  10708. expressions containing the following constants:
  10709. @table @option
  10710. @item n
  10711. frame count of the input frame starting from 0
  10712. @item pts
  10713. presentation timestamp of the input frame expressed in time base units
  10714. @item r
  10715. frame rate of the input video, NAN if the input frame rate is unknown
  10716. @item t
  10717. timestamp expressed in seconds, NAN if the input timestamp is unknown
  10718. @item tb
  10719. time base of the input video
  10720. @end table
  10721. @subsection Examples
  10722. @itemize
  10723. @item
  10724. Set the hue to 90 degrees and the saturation to 1.0:
  10725. @example
  10726. hue=h=90:s=1
  10727. @end example
  10728. @item
  10729. Same command but expressing the hue in radians:
  10730. @example
  10731. hue=H=PI/2:s=1
  10732. @end example
  10733. @item
  10734. Rotate hue and make the saturation swing between 0
  10735. and 2 over a period of 1 second:
  10736. @example
  10737. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  10738. @end example
  10739. @item
  10740. Apply a 3 seconds saturation fade-in effect starting at 0:
  10741. @example
  10742. hue="s=min(t/3\,1)"
  10743. @end example
  10744. The general fade-in expression can be written as:
  10745. @example
  10746. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  10747. @end example
  10748. @item
  10749. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  10750. @example
  10751. hue="s=max(0\, min(1\, (8-t)/3))"
  10752. @end example
  10753. The general fade-out expression can be written as:
  10754. @example
  10755. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  10756. @end example
  10757. @end itemize
  10758. @subsection Commands
  10759. This filter supports the following commands:
  10760. @table @option
  10761. @item b
  10762. @item s
  10763. @item h
  10764. @item H
  10765. Modify the hue and/or the saturation and/or brightness of the input video.
  10766. The command accepts the same syntax of the corresponding option.
  10767. If the specified expression is not valid, it is kept at its current
  10768. value.
  10769. @end table
  10770. @section huesaturation
  10771. Apply hue-saturation-intensity adjustments to input video stream.
  10772. This filter operates in RGB colorspace.
  10773. This filter accepts the following options:
  10774. @table @option
  10775. @item hue
  10776. Set the hue shift in degrees to apply. Default is 0.
  10777. Allowed range is from -180 to 180.
  10778. @item saturation
  10779. Set the saturation shift. Default is 0.
  10780. Allowed range is from -1 to 1.
  10781. @item intensity
  10782. Set the intensity shift. Default is 0.
  10783. Allowed range is from -1 to 1.
  10784. @item colors
  10785. Set which primary and complementary colors are going to be adjusted.
  10786. This options is set by providing one or multiple values.
  10787. This can select multiple colors at once. By default all colors are selected.
  10788. @table @samp
  10789. @item r
  10790. Adjust reds.
  10791. @item y
  10792. Adjust yellows.
  10793. @item g
  10794. Adjust greens.
  10795. @item c
  10796. Adjust cyans.
  10797. @item b
  10798. Adjust blues.
  10799. @item m
  10800. Adjust magentas.
  10801. @item a
  10802. Adjust all colors.
  10803. @end table
  10804. @item strength
  10805. Set strength of filtering. Allowed range is from 0 to 100.
  10806. Default value is 1.
  10807. @item rw, gw, bw
  10808. Set weight for each RGB component. Allowed range is from 0 to 1.
  10809. By default is set to 0.333, 0.334, 0.333.
  10810. Those options are used in saturation and lightess processing.
  10811. @item lightness
  10812. Set preserving lightness, by default is disabled.
  10813. Adjusting hues can change lightness from original RGB triplet,
  10814. with this option enabled lightness is kept at same value.
  10815. @end table
  10816. @section hysteresis
  10817. Grow first stream into second stream by connecting components.
  10818. This makes it possible to build more robust edge masks.
  10819. This filter accepts the following options:
  10820. @table @option
  10821. @item planes
  10822. Set which planes will be processed as bitmap, unprocessed planes will be
  10823. copied from first stream.
  10824. By default value 0xf, all planes will be processed.
  10825. @item threshold
  10826. Set threshold which is used in filtering. If pixel component value is higher than
  10827. this value filter algorithm for connecting components is activated.
  10828. By default value is 0.
  10829. @end table
  10830. The @code{hysteresis} filter also supports the @ref{framesync} options.
  10831. @section identity
  10832. Obtain the identity score between two input videos.
  10833. This filter takes two input videos.
  10834. Both input videos must have the same resolution and pixel format for
  10835. this filter to work correctly. Also it assumes that both inputs
  10836. have the same number of frames, which are compared one by one.
  10837. The obtained per component, average, min and max identity score is printed through
  10838. the logging system.
  10839. The filter stores the calculated identity scores of each frame in frame metadata.
  10840. In the below example the input file @file{main.mpg} being processed is compared
  10841. with the reference file @file{ref.mpg}.
  10842. @example
  10843. ffmpeg -i main.mpg -i ref.mpg -lavfi identity -f null -
  10844. @end example
  10845. @section idet
  10846. Detect video interlacing type.
  10847. This filter tries to detect if the input frames are interlaced, progressive,
  10848. top or bottom field first. It will also try to detect fields that are
  10849. repeated between adjacent frames (a sign of telecine).
  10850. Single frame detection considers only immediately adjacent frames when classifying each frame.
  10851. Multiple frame detection incorporates the classification history of previous frames.
  10852. The filter will log these metadata values:
  10853. @table @option
  10854. @item single.current_frame
  10855. Detected type of current frame using single-frame detection. One of:
  10856. ``tff'' (top field first), ``bff'' (bottom field first),
  10857. ``progressive'', or ``undetermined''
  10858. @item single.tff
  10859. Cumulative number of frames detected as top field first using single-frame detection.
  10860. @item multiple.tff
  10861. Cumulative number of frames detected as top field first using multiple-frame detection.
  10862. @item single.bff
  10863. Cumulative number of frames detected as bottom field first using single-frame detection.
  10864. @item multiple.current_frame
  10865. Detected type of current frame using multiple-frame detection. One of:
  10866. ``tff'' (top field first), ``bff'' (bottom field first),
  10867. ``progressive'', or ``undetermined''
  10868. @item multiple.bff
  10869. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  10870. @item single.progressive
  10871. Cumulative number of frames detected as progressive using single-frame detection.
  10872. @item multiple.progressive
  10873. Cumulative number of frames detected as progressive using multiple-frame detection.
  10874. @item single.undetermined
  10875. Cumulative number of frames that could not be classified using single-frame detection.
  10876. @item multiple.undetermined
  10877. Cumulative number of frames that could not be classified using multiple-frame detection.
  10878. @item repeated.current_frame
  10879. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  10880. @item repeated.neither
  10881. Cumulative number of frames with no repeated field.
  10882. @item repeated.top
  10883. Cumulative number of frames with the top field repeated from the previous frame's top field.
  10884. @item repeated.bottom
  10885. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  10886. @end table
  10887. The filter accepts the following options:
  10888. @table @option
  10889. @item intl_thres
  10890. Set interlacing threshold.
  10891. @item prog_thres
  10892. Set progressive threshold.
  10893. @item rep_thres
  10894. Threshold for repeated field detection.
  10895. @item half_life
  10896. Number of frames after which a given frame's contribution to the
  10897. statistics is halved (i.e., it contributes only 0.5 to its
  10898. classification). The default of 0 means that all frames seen are given
  10899. full weight of 1.0 forever.
  10900. @item analyze_interlaced_flag
  10901. When this is not 0 then idet will use the specified number of frames to determine
  10902. if the interlaced flag is accurate, it will not count undetermined frames.
  10903. If the flag is found to be accurate it will be used without any further
  10904. computations, if it is found to be inaccurate it will be cleared without any
  10905. further computations. This allows inserting the idet filter as a low computational
  10906. method to clean up the interlaced flag
  10907. @end table
  10908. @section il
  10909. Deinterleave or interleave fields.
  10910. This filter allows one to process interlaced images fields without
  10911. deinterlacing them. Deinterleaving splits the input frame into 2
  10912. fields (so called half pictures). Odd lines are moved to the top
  10913. half of the output image, even lines to the bottom half.
  10914. You can process (filter) them independently and then re-interleave them.
  10915. The filter accepts the following options:
  10916. @table @option
  10917. @item luma_mode, l
  10918. @item chroma_mode, c
  10919. @item alpha_mode, a
  10920. Available values for @var{luma_mode}, @var{chroma_mode} and
  10921. @var{alpha_mode} are:
  10922. @table @samp
  10923. @item none
  10924. Do nothing.
  10925. @item deinterleave, d
  10926. Deinterleave fields, placing one above the other.
  10927. @item interleave, i
  10928. Interleave fields. Reverse the effect of deinterleaving.
  10929. @end table
  10930. Default value is @code{none}.
  10931. @item luma_swap, ls
  10932. @item chroma_swap, cs
  10933. @item alpha_swap, as
  10934. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  10935. @end table
  10936. @subsection Commands
  10937. This filter supports the all above options as @ref{commands}.
  10938. @section inflate
  10939. Apply inflate effect to the video.
  10940. This filter replaces the pixel by the local(3x3) average by taking into account
  10941. only values higher than the pixel.
  10942. It accepts the following options:
  10943. @table @option
  10944. @item threshold0
  10945. @item threshold1
  10946. @item threshold2
  10947. @item threshold3
  10948. Limit the maximum change for each plane, default is 65535.
  10949. If 0, plane will remain unchanged.
  10950. @end table
  10951. @subsection Commands
  10952. This filter supports the all above options as @ref{commands}.
  10953. @section interlace
  10954. Simple interlacing filter from progressive contents. This interleaves upper (or
  10955. lower) lines from odd frames with lower (or upper) lines from even frames,
  10956. halving the frame rate and preserving image height.
  10957. @example
  10958. Original Original New Frame
  10959. Frame 'j' Frame 'j+1' (tff)
  10960. ========== =========== ==================
  10961. Line 0 --------------------> Frame 'j' Line 0
  10962. Line 1 Line 1 ----> Frame 'j+1' Line 1
  10963. Line 2 ---------------------> Frame 'j' Line 2
  10964. Line 3 Line 3 ----> Frame 'j+1' Line 3
  10965. ... ... ...
  10966. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  10967. @end example
  10968. It accepts the following optional parameters:
  10969. @table @option
  10970. @item scan
  10971. This determines whether the interlaced frame is taken from the even
  10972. (tff - default) or odd (bff) lines of the progressive frame.
  10973. @item lowpass
  10974. Vertical lowpass filter to avoid twitter interlacing and
  10975. reduce moire patterns.
  10976. @table @samp
  10977. @item 0, off
  10978. Disable vertical lowpass filter
  10979. @item 1, linear
  10980. Enable linear filter (default)
  10981. @item 2, complex
  10982. Enable complex filter. This will slightly less reduce twitter and moire
  10983. but better retain detail and subjective sharpness impression.
  10984. @end table
  10985. @end table
  10986. @section kerndeint
  10987. Deinterlace input video by applying Donald Graft's adaptive kernel
  10988. deinterling. Work on interlaced parts of a video to produce
  10989. progressive frames.
  10990. The description of the accepted parameters follows.
  10991. @table @option
  10992. @item thresh
  10993. Set the threshold which affects the filter's tolerance when
  10994. determining if a pixel line must be processed. It must be an integer
  10995. in the range [0,255] and defaults to 10. A value of 0 will result in
  10996. applying the process on every pixels.
  10997. @item map
  10998. Paint pixels exceeding the threshold value to white if set to 1.
  10999. Default is 0.
  11000. @item order
  11001. Set the fields order. Swap fields if set to 1, leave fields alone if
  11002. 0. Default is 0.
  11003. @item sharp
  11004. Enable additional sharpening if set to 1. Default is 0.
  11005. @item twoway
  11006. Enable twoway sharpening if set to 1. Default is 0.
  11007. @end table
  11008. @subsection Examples
  11009. @itemize
  11010. @item
  11011. Apply default values:
  11012. @example
  11013. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  11014. @end example
  11015. @item
  11016. Enable additional sharpening:
  11017. @example
  11018. kerndeint=sharp=1
  11019. @end example
  11020. @item
  11021. Paint processed pixels in white:
  11022. @example
  11023. kerndeint=map=1
  11024. @end example
  11025. @end itemize
  11026. @section kirsch
  11027. Apply kirsch operator to input video stream.
  11028. The filter accepts the following option:
  11029. @table @option
  11030. @item planes
  11031. Set which planes will be processed, unprocessed planes will be copied.
  11032. By default value 0xf, all planes will be processed.
  11033. @item scale
  11034. Set value which will be multiplied with filtered result.
  11035. @item delta
  11036. Set value which will be added to filtered result.
  11037. @end table
  11038. @subsection Commands
  11039. This filter supports the all above options as @ref{commands}.
  11040. @section lagfun
  11041. Slowly update darker pixels.
  11042. This filter makes short flashes of light appear longer.
  11043. This filter accepts the following options:
  11044. @table @option
  11045. @item decay
  11046. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  11047. @item planes
  11048. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  11049. @end table
  11050. @subsection Commands
  11051. This filter supports the all above options as @ref{commands}.
  11052. @section lenscorrection
  11053. Correct radial lens distortion
  11054. This filter can be used to correct for radial distortion as can result from the use
  11055. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  11056. one can use tools available for example as part of opencv or simply trial-and-error.
  11057. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  11058. and extract the k1 and k2 coefficients from the resulting matrix.
  11059. Note that effectively the same filter is available in the open-source tools Krita and
  11060. Digikam from the KDE project.
  11061. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  11062. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  11063. brightness distribution, so you may want to use both filters together in certain
  11064. cases, though you will have to take care of ordering, i.e. whether vignetting should
  11065. be applied before or after lens correction.
  11066. @subsection Options
  11067. The filter accepts the following options:
  11068. @table @option
  11069. @item cx
  11070. Relative x-coordinate of the focal point of the image, and thereby the center of the
  11071. distortion. This value has a range [0,1] and is expressed as fractions of the image
  11072. width. Default is 0.5.
  11073. @item cy
  11074. Relative y-coordinate of the focal point of the image, and thereby the center of the
  11075. distortion. This value has a range [0,1] and is expressed as fractions of the image
  11076. height. Default is 0.5.
  11077. @item k1
  11078. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  11079. no correction. Default is 0.
  11080. @item k2
  11081. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  11082. 0 means no correction. Default is 0.
  11083. @item i
  11084. Set interpolation type. Can be @code{nearest} or @code{bilinear}.
  11085. Default is @code{nearest}.
  11086. @item fc
  11087. Specify the color of the unmapped pixels. For the syntax of this option,
  11088. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  11089. manual,ffmpeg-utils}. Default color is @code{black@@0}.
  11090. @end table
  11091. The formula that generates the correction is:
  11092. @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)
  11093. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  11094. distances from the focal point in the source and target images, respectively.
  11095. @subsection Commands
  11096. This filter supports the all above options as @ref{commands}.
  11097. @section lensfun
  11098. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  11099. The @code{lensfun} filter requires the camera make, camera model, and lens model
  11100. to apply the lens correction. The filter will load the lensfun database and
  11101. query it to find the corresponding camera and lens entries in the database. As
  11102. long as these entries can be found with the given options, the filter can
  11103. perform corrections on frames. Note that incomplete strings will result in the
  11104. filter choosing the best match with the given options, and the filter will
  11105. output the chosen camera and lens models (logged with level "info"). You must
  11106. provide the make, camera model, and lens model as they are required.
  11107. The filter accepts the following options:
  11108. @table @option
  11109. @item make
  11110. The make of the camera (for example, "Canon"). This option is required.
  11111. @item model
  11112. The model of the camera (for example, "Canon EOS 100D"). This option is
  11113. required.
  11114. @item lens_model
  11115. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  11116. option is required.
  11117. @item mode
  11118. The type of correction to apply. The following values are valid options:
  11119. @table @samp
  11120. @item vignetting
  11121. Enables fixing lens vignetting.
  11122. @item geometry
  11123. Enables fixing lens geometry. This is the default.
  11124. @item subpixel
  11125. Enables fixing chromatic aberrations.
  11126. @item vig_geo
  11127. Enables fixing lens vignetting and lens geometry.
  11128. @item vig_subpixel
  11129. Enables fixing lens vignetting and chromatic aberrations.
  11130. @item distortion
  11131. Enables fixing both lens geometry and chromatic aberrations.
  11132. @item all
  11133. Enables all possible corrections.
  11134. @end table
  11135. @item focal_length
  11136. The focal length of the image/video (zoom; expected constant for video). For
  11137. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  11138. range should be chosen when using that lens. Default 18.
  11139. @item aperture
  11140. The aperture of the image/video (expected constant for video). Note that
  11141. aperture is only used for vignetting correction. Default 3.5.
  11142. @item focus_distance
  11143. The focus distance of the image/video (expected constant for video). Note that
  11144. focus distance is only used for vignetting and only slightly affects the
  11145. vignetting correction process. If unknown, leave it at the default value (which
  11146. is 1000).
  11147. @item scale
  11148. The scale factor which is applied after transformation. After correction the
  11149. video is no longer necessarily rectangular. This parameter controls how much of
  11150. the resulting image is visible. The value 0 means that a value will be chosen
  11151. automatically such that there is little or no unmapped area in the output
  11152. image. 1.0 means that no additional scaling is done. Lower values may result
  11153. in more of the corrected image being visible, while higher values may avoid
  11154. unmapped areas in the output.
  11155. @item target_geometry
  11156. The target geometry of the output image/video. The following values are valid
  11157. options:
  11158. @table @samp
  11159. @item rectilinear (default)
  11160. @item fisheye
  11161. @item panoramic
  11162. @item equirectangular
  11163. @item fisheye_orthographic
  11164. @item fisheye_stereographic
  11165. @item fisheye_equisolid
  11166. @item fisheye_thoby
  11167. @end table
  11168. @item reverse
  11169. Apply the reverse of image correction (instead of correcting distortion, apply
  11170. it).
  11171. @item interpolation
  11172. The type of interpolation used when correcting distortion. The following values
  11173. are valid options:
  11174. @table @samp
  11175. @item nearest
  11176. @item linear (default)
  11177. @item lanczos
  11178. @end table
  11179. @end table
  11180. @subsection Examples
  11181. @itemize
  11182. @item
  11183. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  11184. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  11185. aperture of "8.0".
  11186. @example
  11187. 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
  11188. @end example
  11189. @item
  11190. Apply the same as before, but only for the first 5 seconds of video.
  11191. @example
  11192. 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
  11193. @end example
  11194. @end itemize
  11195. @section libvmaf
  11196. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  11197. score between two input videos.
  11198. The first input is the encoded video, and the second input is the reference video.
  11199. The obtained VMAF score is printed through the logging system.
  11200. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  11201. After installing the library it can be enabled using:
  11202. @code{./configure --enable-libvmaf}.
  11203. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  11204. The filter has following options:
  11205. @table @option
  11206. @item model_path
  11207. Set the model path which is to be used for SVM.
  11208. Default value: @code{"/usr/local/share/model/vmaf_v0.6.1.pkl"}
  11209. @item log_path
  11210. Set the file path to be used to store logs.
  11211. @item log_fmt
  11212. Set the format of the log file (csv, json or xml).
  11213. @item enable_transform
  11214. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  11215. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  11216. Default value: @code{false}
  11217. @item phone_model
  11218. Invokes the phone model which will generate VMAF scores higher than in the
  11219. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  11220. Default value: @code{false}
  11221. @item psnr
  11222. Enables computing psnr along with vmaf.
  11223. Default value: @code{false}
  11224. @item ssim
  11225. Enables computing ssim along with vmaf.
  11226. Default value: @code{false}
  11227. @item ms_ssim
  11228. Enables computing ms_ssim along with vmaf.
  11229. Default value: @code{false}
  11230. @item pool
  11231. Set the pool method to be used for computing vmaf.
  11232. Options are @code{min}, @code{harmonic_mean} or @code{mean} (default).
  11233. @item n_threads
  11234. Set number of threads to be used when computing vmaf.
  11235. Default value: @code{0}, which makes use of all available logical processors.
  11236. @item n_subsample
  11237. Set interval for frame subsampling used when computing vmaf.
  11238. Default value: @code{1}
  11239. @item enable_conf_interval
  11240. Enables confidence interval.
  11241. Default value: @code{false}
  11242. @end table
  11243. This filter also supports the @ref{framesync} options.
  11244. @subsection Examples
  11245. @itemize
  11246. @item
  11247. On the below examples the input file @file{main.mpg} being processed is
  11248. compared with the reference file @file{ref.mpg}.
  11249. @example
  11250. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  11251. @end example
  11252. @item
  11253. Example with options:
  11254. @example
  11255. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  11256. @end example
  11257. @item
  11258. Example with options and different containers:
  11259. @example
  11260. ffmpeg -i main.mpg -i ref.mkv -lavfi "[0:v]settb=AVTB,setpts=PTS-STARTPTS[main];[1:v]settb=AVTB,setpts=PTS-STARTPTS[ref];[main][ref]libvmaf=psnr=1:log_fmt=json" -f null -
  11261. @end example
  11262. @end itemize
  11263. @section limitdiff
  11264. Apply limited difference filter using second and optionally third video stream.
  11265. The filter accepts the following options:
  11266. @table @option
  11267. @item threshold
  11268. Set the threshold to use when allowing certain differences between video streams.
  11269. Any absolute difference value lower or exact than this threshold will pick pixel components from
  11270. first video stream.
  11271. @item elasticity
  11272. Set the elasticity of soft thresholding when processing video streams.
  11273. This value multiplied with first one sets second threshold.
  11274. Any absolute difference value greater or exact than second threshold will pick pixel components
  11275. from second video stream. For values between those two threshold
  11276. linear interpolation between first and second video stream will be used.
  11277. @item reference
  11278. Enable the reference (third) video stream processing. By default is disabled.
  11279. If set, this video stream will be used for calculating absolute difference with first video
  11280. stream.
  11281. @item planes
  11282. Specify which planes will be processed. Defaults to all available.
  11283. @end table
  11284. @subsection Commands
  11285. This filter supports the all above options as @ref{commands} except option @samp{reference}.
  11286. @section limiter
  11287. Limits the pixel components values to the specified range [min, max].
  11288. The filter accepts the following options:
  11289. @table @option
  11290. @item min
  11291. Lower bound. Defaults to the lowest allowed value for the input.
  11292. @item max
  11293. Upper bound. Defaults to the highest allowed value for the input.
  11294. @item planes
  11295. Specify which planes will be processed. Defaults to all available.
  11296. @end table
  11297. @subsection Commands
  11298. This filter supports the all above options as @ref{commands}.
  11299. @section loop
  11300. Loop video frames.
  11301. The filter accepts the following options:
  11302. @table @option
  11303. @item loop
  11304. Set the number of loops. Setting this value to -1 will result in infinite loops.
  11305. Default is 0.
  11306. @item size
  11307. Set maximal size in number of frames. Default is 0.
  11308. @item start
  11309. Set first frame of loop. Default is 0.
  11310. @end table
  11311. @subsection Examples
  11312. @itemize
  11313. @item
  11314. Loop single first frame infinitely:
  11315. @example
  11316. loop=loop=-1:size=1:start=0
  11317. @end example
  11318. @item
  11319. Loop single first frame 10 times:
  11320. @example
  11321. loop=loop=10:size=1:start=0
  11322. @end example
  11323. @item
  11324. Loop 10 first frames 5 times:
  11325. @example
  11326. loop=loop=5:size=10:start=0
  11327. @end example
  11328. @end itemize
  11329. @section lut1d
  11330. Apply a 1D LUT to an input video.
  11331. The filter accepts the following options:
  11332. @table @option
  11333. @item file
  11334. Set the 1D LUT file name.
  11335. Currently supported formats:
  11336. @table @samp
  11337. @item cube
  11338. Iridas
  11339. @item csp
  11340. cineSpace
  11341. @end table
  11342. @item interp
  11343. Select interpolation mode.
  11344. Available values are:
  11345. @table @samp
  11346. @item nearest
  11347. Use values from the nearest defined point.
  11348. @item linear
  11349. Interpolate values using the linear interpolation.
  11350. @item cosine
  11351. Interpolate values using the cosine interpolation.
  11352. @item cubic
  11353. Interpolate values using the cubic interpolation.
  11354. @item spline
  11355. Interpolate values using the spline interpolation.
  11356. @end table
  11357. @end table
  11358. @subsection Commands
  11359. This filter supports the all above options as @ref{commands}.
  11360. @anchor{lut3d}
  11361. @section lut3d
  11362. Apply a 3D LUT to an input video.
  11363. The filter accepts the following options:
  11364. @table @option
  11365. @item file
  11366. Set the 3D LUT file name.
  11367. Currently supported formats:
  11368. @table @samp
  11369. @item 3dl
  11370. AfterEffects
  11371. @item cube
  11372. Iridas
  11373. @item dat
  11374. DaVinci
  11375. @item m3d
  11376. Pandora
  11377. @item csp
  11378. cineSpace
  11379. @end table
  11380. @item interp
  11381. Select interpolation mode.
  11382. Available values are:
  11383. @table @samp
  11384. @item nearest
  11385. Use values from the nearest defined point.
  11386. @item trilinear
  11387. Interpolate values using the 8 points defining a cube.
  11388. @item tetrahedral
  11389. Interpolate values using a tetrahedron.
  11390. @item pyramid
  11391. Interpolate values using a pyramid.
  11392. @item prism
  11393. Interpolate values using a prism.
  11394. @end table
  11395. @end table
  11396. @subsection Commands
  11397. This filter supports the @code{interp} option as @ref{commands}.
  11398. @section lumakey
  11399. Turn certain luma values into transparency.
  11400. The filter accepts the following options:
  11401. @table @option
  11402. @item threshold
  11403. Set the luma which will be used as base for transparency.
  11404. Default value is @code{0}.
  11405. @item tolerance
  11406. Set the range of luma values to be keyed out.
  11407. Default value is @code{0.01}.
  11408. @item softness
  11409. Set the range of softness. Default value is @code{0}.
  11410. Use this to control gradual transition from zero to full transparency.
  11411. @end table
  11412. @subsection Commands
  11413. This filter supports same @ref{commands} as options.
  11414. The command accepts the same syntax of the corresponding option.
  11415. If the specified expression is not valid, it is kept at its current
  11416. value.
  11417. @section lut, lutrgb, lutyuv
  11418. Compute a look-up table for binding each pixel component input value
  11419. to an output value, and apply it to the input video.
  11420. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  11421. to an RGB input video.
  11422. These filters accept the following parameters:
  11423. @table @option
  11424. @item c0
  11425. set first pixel component expression
  11426. @item c1
  11427. set second pixel component expression
  11428. @item c2
  11429. set third pixel component expression
  11430. @item c3
  11431. set fourth pixel component expression, corresponds to the alpha component
  11432. @item r
  11433. set red component expression
  11434. @item g
  11435. set green component expression
  11436. @item b
  11437. set blue component expression
  11438. @item a
  11439. alpha component expression
  11440. @item y
  11441. set Y/luminance component expression
  11442. @item u
  11443. set U/Cb component expression
  11444. @item v
  11445. set V/Cr component expression
  11446. @end table
  11447. Each of them specifies the expression to use for computing the lookup table for
  11448. the corresponding pixel component values.
  11449. The exact component associated to each of the @var{c*} options depends on the
  11450. format in input.
  11451. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  11452. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  11453. The expressions can contain the following constants and functions:
  11454. @table @option
  11455. @item w
  11456. @item h
  11457. The input width and height.
  11458. @item val
  11459. The input value for the pixel component.
  11460. @item clipval
  11461. The input value, clipped to the @var{minval}-@var{maxval} range.
  11462. @item maxval
  11463. The maximum value for the pixel component.
  11464. @item minval
  11465. The minimum value for the pixel component.
  11466. @item negval
  11467. The negated value for the pixel component value, clipped to the
  11468. @var{minval}-@var{maxval} range; it corresponds to the expression
  11469. "maxval-clipval+minval".
  11470. @item clip(val)
  11471. The computed value in @var{val}, clipped to the
  11472. @var{minval}-@var{maxval} range.
  11473. @item gammaval(gamma)
  11474. The computed gamma correction value of the pixel component value,
  11475. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  11476. expression
  11477. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  11478. @end table
  11479. All expressions default to "val".
  11480. @subsection Commands
  11481. This filter supports same @ref{commands} as options.
  11482. @subsection Examples
  11483. @itemize
  11484. @item
  11485. Negate input video:
  11486. @example
  11487. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  11488. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  11489. @end example
  11490. The above is the same as:
  11491. @example
  11492. lutrgb="r=negval:g=negval:b=negval"
  11493. lutyuv="y=negval:u=negval:v=negval"
  11494. @end example
  11495. @item
  11496. Negate luminance:
  11497. @example
  11498. lutyuv=y=negval
  11499. @end example
  11500. @item
  11501. Remove chroma components, turning the video into a graytone image:
  11502. @example
  11503. lutyuv="u=128:v=128"
  11504. @end example
  11505. @item
  11506. Apply a luma burning effect:
  11507. @example
  11508. lutyuv="y=2*val"
  11509. @end example
  11510. @item
  11511. Remove green and blue components:
  11512. @example
  11513. lutrgb="g=0:b=0"
  11514. @end example
  11515. @item
  11516. Set a constant alpha channel value on input:
  11517. @example
  11518. format=rgba,lutrgb=a="maxval-minval/2"
  11519. @end example
  11520. @item
  11521. Correct luminance gamma by a factor of 0.5:
  11522. @example
  11523. lutyuv=y=gammaval(0.5)
  11524. @end example
  11525. @item
  11526. Discard least significant bits of luma:
  11527. @example
  11528. lutyuv=y='bitand(val, 128+64+32)'
  11529. @end example
  11530. @item
  11531. Technicolor like effect:
  11532. @example
  11533. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  11534. @end example
  11535. @end itemize
  11536. @section lut2, tlut2
  11537. The @code{lut2} filter takes two input streams and outputs one
  11538. stream.
  11539. The @code{tlut2} (time lut2) filter takes two consecutive frames
  11540. from one single stream.
  11541. This filter accepts the following parameters:
  11542. @table @option
  11543. @item c0
  11544. set first pixel component expression
  11545. @item c1
  11546. set second pixel component expression
  11547. @item c2
  11548. set third pixel component expression
  11549. @item c3
  11550. set fourth pixel component expression, corresponds to the alpha component
  11551. @item d
  11552. set output bit depth, only available for @code{lut2} filter. By default is 0,
  11553. which means bit depth is automatically picked from first input format.
  11554. @end table
  11555. The @code{lut2} filter also supports the @ref{framesync} options.
  11556. Each of them specifies the expression to use for computing the lookup table for
  11557. the corresponding pixel component values.
  11558. The exact component associated to each of the @var{c*} options depends on the
  11559. format in inputs.
  11560. The expressions can contain the following constants:
  11561. @table @option
  11562. @item w
  11563. @item h
  11564. The input width and height.
  11565. @item x
  11566. The first input value for the pixel component.
  11567. @item y
  11568. The second input value for the pixel component.
  11569. @item bdx
  11570. The first input video bit depth.
  11571. @item bdy
  11572. The second input video bit depth.
  11573. @end table
  11574. All expressions default to "x".
  11575. @subsection Commands
  11576. This filter supports the all above options as @ref{commands} except option @code{d}.
  11577. @subsection Examples
  11578. @itemize
  11579. @item
  11580. Highlight differences between two RGB video streams:
  11581. @example
  11582. 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)'
  11583. @end example
  11584. @item
  11585. Highlight differences between two YUV video streams:
  11586. @example
  11587. 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)'
  11588. @end example
  11589. @item
  11590. Show max difference between two video streams:
  11591. @example
  11592. 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)))'
  11593. @end example
  11594. @end itemize
  11595. @section maskedclamp
  11596. Clamp the first input stream with the second input and third input stream.
  11597. Returns the value of first stream to be between second input
  11598. stream - @code{undershoot} and third input stream + @code{overshoot}.
  11599. This filter accepts the following options:
  11600. @table @option
  11601. @item undershoot
  11602. Default value is @code{0}.
  11603. @item overshoot
  11604. Default value is @code{0}.
  11605. @item planes
  11606. Set which planes will be processed as bitmap, unprocessed planes will be
  11607. copied from first stream.
  11608. By default value 0xf, all planes will be processed.
  11609. @end table
  11610. @subsection Commands
  11611. This filter supports the all above options as @ref{commands}.
  11612. @section maskedmax
  11613. Merge the second and third input stream into output stream using absolute differences
  11614. between second input stream and first input stream and absolute difference between
  11615. third input stream and first input stream. The picked value will be from second input
  11616. stream if second absolute difference is greater than first one or from third input stream
  11617. otherwise.
  11618. This filter accepts the following options:
  11619. @table @option
  11620. @item planes
  11621. Set which planes will be processed as bitmap, unprocessed planes will be
  11622. copied from first stream.
  11623. By default value 0xf, all planes will be processed.
  11624. @end table
  11625. @subsection Commands
  11626. This filter supports the all above options as @ref{commands}.
  11627. @section maskedmerge
  11628. Merge the first input stream with the second input stream using per pixel
  11629. weights in the third input stream.
  11630. A value of 0 in the third stream pixel component means that pixel component
  11631. from first stream is returned unchanged, while maximum value (eg. 255 for
  11632. 8-bit videos) means that pixel component from second stream is returned
  11633. unchanged. Intermediate values define the amount of merging between both
  11634. input stream's pixel components.
  11635. This filter accepts the following options:
  11636. @table @option
  11637. @item planes
  11638. Set which planes will be processed as bitmap, unprocessed planes will be
  11639. copied from first stream.
  11640. By default value 0xf, all planes will be processed.
  11641. @end table
  11642. @subsection Commands
  11643. This filter supports the all above options as @ref{commands}.
  11644. @section maskedmin
  11645. Merge the second and third input stream into output stream using absolute differences
  11646. between second input stream and first input stream and absolute difference between
  11647. third input stream and first input stream. The picked value will be from second input
  11648. stream if second absolute difference is less than first one or from third input stream
  11649. otherwise.
  11650. This filter accepts the following options:
  11651. @table @option
  11652. @item planes
  11653. Set which planes will be processed as bitmap, unprocessed planes will be
  11654. copied from first stream.
  11655. By default value 0xf, all planes will be processed.
  11656. @end table
  11657. @subsection Commands
  11658. This filter supports the all above options as @ref{commands}.
  11659. @section maskedthreshold
  11660. Pick pixels comparing absolute difference of two video streams with fixed
  11661. threshold.
  11662. If absolute difference between pixel component of first and second video
  11663. stream is equal or lower than user supplied threshold than pixel component
  11664. from first video stream is picked, otherwise pixel component from second
  11665. video stream is picked.
  11666. This filter accepts the following options:
  11667. @table @option
  11668. @item threshold
  11669. Set threshold used when picking pixels from absolute difference from two input
  11670. video streams.
  11671. @item planes
  11672. Set which planes will be processed as bitmap, unprocessed planes will be
  11673. copied from second stream.
  11674. By default value 0xf, all planes will be processed.
  11675. @end table
  11676. @subsection Commands
  11677. This filter supports the all above options as @ref{commands}.
  11678. @section maskfun
  11679. Create mask from input video.
  11680. For example it is useful to create motion masks after @code{tblend} filter.
  11681. This filter accepts the following options:
  11682. @table @option
  11683. @item low
  11684. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  11685. @item high
  11686. Set high threshold. Any pixel component higher than this value will be set to max value
  11687. allowed for current pixel format.
  11688. @item planes
  11689. Set planes to filter, by default all available planes are filtered.
  11690. @item fill
  11691. Fill all frame pixels with this value.
  11692. @item sum
  11693. Set max average pixel value for frame. If sum of all pixel components is higher that this
  11694. average, output frame will be completely filled with value set by @var{fill} option.
  11695. Typically useful for scene changes when used in combination with @code{tblend} filter.
  11696. @end table
  11697. @subsection Commands
  11698. This filter supports the all above options as @ref{commands}.
  11699. @section mcdeint
  11700. Apply motion-compensation deinterlacing.
  11701. It needs one field per frame as input and must thus be used together
  11702. with yadif=1/3 or equivalent.
  11703. This filter is only available in ffmpeg version 4.4 or earlier.
  11704. This filter accepts the following options:
  11705. @table @option
  11706. @item mode
  11707. Set the deinterlacing mode.
  11708. It accepts one of the following values:
  11709. @table @samp
  11710. @item fast
  11711. @item medium
  11712. @item slow
  11713. use iterative motion estimation
  11714. @item extra_slow
  11715. like @samp{slow}, but use multiple reference frames.
  11716. @end table
  11717. Default value is @samp{fast}.
  11718. @item parity
  11719. Set the picture field parity assumed for the input video. It must be
  11720. one of the following values:
  11721. @table @samp
  11722. @item 0, tff
  11723. assume top field first
  11724. @item 1, bff
  11725. assume bottom field first
  11726. @end table
  11727. Default value is @samp{bff}.
  11728. @item qp
  11729. Set per-block quantization parameter (QP) used by the internal
  11730. encoder.
  11731. Higher values should result in a smoother motion vector field but less
  11732. optimal individual vectors. Default value is 1.
  11733. @end table
  11734. @section median
  11735. Pick median pixel from certain rectangle defined by radius.
  11736. This filter accepts the following options:
  11737. @table @option
  11738. @item radius
  11739. Set horizontal radius size. Default value is @code{1}.
  11740. Allowed range is integer from 1 to 127.
  11741. @item planes
  11742. Set which planes to process. Default is @code{15}, which is all available planes.
  11743. @item radiusV
  11744. Set vertical radius size. Default value is @code{0}.
  11745. Allowed range is integer from 0 to 127.
  11746. If it is 0, value will be picked from horizontal @code{radius} option.
  11747. @item percentile
  11748. Set median percentile. Default value is @code{0.5}.
  11749. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  11750. minimum values, and @code{1} maximum values.
  11751. @end table
  11752. @subsection Commands
  11753. This filter supports same @ref{commands} as options.
  11754. The command accepts the same syntax of the corresponding option.
  11755. If the specified expression is not valid, it is kept at its current
  11756. value.
  11757. @section mergeplanes
  11758. Merge color channel components from several video streams.
  11759. The filter accepts up to 4 input streams, and merge selected input
  11760. planes to the output video.
  11761. This filter accepts the following options:
  11762. @table @option
  11763. @item mapping
  11764. Set input to output plane mapping. Default is @code{0}.
  11765. The mappings is specified as a bitmap. It should be specified as a
  11766. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  11767. mapping for the first plane of the output stream. 'A' sets the number of
  11768. the input stream to use (from 0 to 3), and 'a' the plane number of the
  11769. corresponding input to use (from 0 to 3). The rest of the mappings is
  11770. similar, 'Bb' describes the mapping for the output stream second
  11771. plane, 'Cc' describes the mapping for the output stream third plane and
  11772. 'Dd' describes the mapping for the output stream fourth plane.
  11773. @item format
  11774. Set output pixel format. Default is @code{yuva444p}.
  11775. @end table
  11776. @subsection Examples
  11777. @itemize
  11778. @item
  11779. Merge three gray video streams of same width and height into single video stream:
  11780. @example
  11781. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  11782. @end example
  11783. @item
  11784. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  11785. @example
  11786. [a0][a1]mergeplanes=0x00010210:yuva444p
  11787. @end example
  11788. @item
  11789. Swap Y and A plane in yuva444p stream:
  11790. @example
  11791. format=yuva444p,mergeplanes=0x03010200:yuva444p
  11792. @end example
  11793. @item
  11794. Swap U and V plane in yuv420p stream:
  11795. @example
  11796. format=yuv420p,mergeplanes=0x000201:yuv420p
  11797. @end example
  11798. @item
  11799. Cast a rgb24 clip to yuv444p:
  11800. @example
  11801. format=rgb24,mergeplanes=0x000102:yuv444p
  11802. @end example
  11803. @end itemize
  11804. @section mestimate
  11805. Estimate and export motion vectors using block matching algorithms.
  11806. Motion vectors are stored in frame side data to be used by other filters.
  11807. This filter accepts the following options:
  11808. @table @option
  11809. @item method
  11810. Specify the motion estimation method. Accepts one of the following values:
  11811. @table @samp
  11812. @item esa
  11813. Exhaustive search algorithm.
  11814. @item tss
  11815. Three step search algorithm.
  11816. @item tdls
  11817. Two dimensional logarithmic search algorithm.
  11818. @item ntss
  11819. New three step search algorithm.
  11820. @item fss
  11821. Four step search algorithm.
  11822. @item ds
  11823. Diamond search algorithm.
  11824. @item hexbs
  11825. Hexagon-based search algorithm.
  11826. @item epzs
  11827. Enhanced predictive zonal search algorithm.
  11828. @item umh
  11829. Uneven multi-hexagon search algorithm.
  11830. @end table
  11831. Default value is @samp{esa}.
  11832. @item mb_size
  11833. Macroblock size. Default @code{16}.
  11834. @item search_param
  11835. Search parameter. Default @code{7}.
  11836. @end table
  11837. @section midequalizer
  11838. Apply Midway Image Equalization effect using two video streams.
  11839. Midway Image Equalization adjusts a pair of images to have the same
  11840. histogram, while maintaining their dynamics as much as possible. It's
  11841. useful for e.g. matching exposures from a pair of stereo cameras.
  11842. This filter has two inputs and one output, which must be of same pixel format, but
  11843. may be of different sizes. The output of filter is first input adjusted with
  11844. midway histogram of both inputs.
  11845. This filter accepts the following option:
  11846. @table @option
  11847. @item planes
  11848. Set which planes to process. Default is @code{15}, which is all available planes.
  11849. @end table
  11850. @section minterpolate
  11851. Convert the video to specified frame rate using motion interpolation.
  11852. This filter accepts the following options:
  11853. @table @option
  11854. @item fps
  11855. 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}.
  11856. @item mi_mode
  11857. Motion interpolation mode. Following values are accepted:
  11858. @table @samp
  11859. @item dup
  11860. Duplicate previous or next frame for interpolating new ones.
  11861. @item blend
  11862. Blend source frames. Interpolated frame is mean of previous and next frames.
  11863. @item mci
  11864. Motion compensated interpolation. Following options are effective when this mode is selected:
  11865. @table @samp
  11866. @item mc_mode
  11867. Motion compensation mode. Following values are accepted:
  11868. @table @samp
  11869. @item obmc
  11870. Overlapped block motion compensation.
  11871. @item aobmc
  11872. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  11873. @end table
  11874. Default mode is @samp{obmc}.
  11875. @item me_mode
  11876. Motion estimation mode. Following values are accepted:
  11877. @table @samp
  11878. @item bidir
  11879. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  11880. @item bilat
  11881. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  11882. @end table
  11883. Default mode is @samp{bilat}.
  11884. @item me
  11885. The algorithm to be used for motion estimation. Following values are accepted:
  11886. @table @samp
  11887. @item esa
  11888. Exhaustive search algorithm.
  11889. @item tss
  11890. Three step search algorithm.
  11891. @item tdls
  11892. Two dimensional logarithmic search algorithm.
  11893. @item ntss
  11894. New three step search algorithm.
  11895. @item fss
  11896. Four step search algorithm.
  11897. @item ds
  11898. Diamond search algorithm.
  11899. @item hexbs
  11900. Hexagon-based search algorithm.
  11901. @item epzs
  11902. Enhanced predictive zonal search algorithm.
  11903. @item umh
  11904. Uneven multi-hexagon search algorithm.
  11905. @end table
  11906. Default algorithm is @samp{epzs}.
  11907. @item mb_size
  11908. Macroblock size. Default @code{16}.
  11909. @item search_param
  11910. Motion estimation search parameter. Default @code{32}.
  11911. @item vsbmc
  11912. 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).
  11913. @end table
  11914. @end table
  11915. @item scd
  11916. 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:
  11917. @table @samp
  11918. @item none
  11919. Disable scene change detection.
  11920. @item fdiff
  11921. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  11922. @end table
  11923. Default method is @samp{fdiff}.
  11924. @item scd_threshold
  11925. Scene change detection threshold. Default is @code{10.}.
  11926. @end table
  11927. @section mix
  11928. Mix several video input streams into one video stream.
  11929. A description of the accepted options follows.
  11930. @table @option
  11931. @item inputs
  11932. The number of inputs. If unspecified, it defaults to 2.
  11933. @item weights
  11934. Specify weight of each input video stream as sequence.
  11935. Each weight is separated by space. If number of weights
  11936. is smaller than number of @var{frames} last specified
  11937. weight will be used for all remaining unset weights.
  11938. @item scale
  11939. Specify scale, if it is set it will be multiplied with sum
  11940. of each weight multiplied with pixel values to give final destination
  11941. pixel value. By default @var{scale} is auto scaled to sum of weights.
  11942. @item duration
  11943. Specify how end of stream is determined.
  11944. @table @samp
  11945. @item longest
  11946. The duration of the longest input. (default)
  11947. @item shortest
  11948. The duration of the shortest input.
  11949. @item first
  11950. The duration of the first input.
  11951. @end table
  11952. @end table
  11953. @subsection Commands
  11954. This filter supports the following commands:
  11955. @table @option
  11956. @item weights
  11957. @item scale
  11958. Syntax is same as option with same name.
  11959. @end table
  11960. @section monochrome
  11961. Convert video to gray using custom color filter.
  11962. A description of the accepted options follows.
  11963. @table @option
  11964. @item cb
  11965. Set the chroma blue spot. Allowed range is from -1 to 1.
  11966. Default value is 0.
  11967. @item cr
  11968. Set the chroma red spot. Allowed range is from -1 to 1.
  11969. Default value is 0.
  11970. @item size
  11971. Set the color filter size. Allowed range is from .1 to 10.
  11972. Default value is 1.
  11973. @item high
  11974. Set the highlights strength. Allowed range is from 0 to 1.
  11975. Default value is 0.
  11976. @end table
  11977. @subsection Commands
  11978. This filter supports the all above options as @ref{commands}.
  11979. @section morpho
  11980. This filter allows to apply main morphological grayscale transforms,
  11981. erode and dilate with arbitrary structures set in second input stream.
  11982. Unlike naive implementation and much slower performance in @ref{erosion}
  11983. and @ref{dilation} filters, when speed is critical @code{morpho} filter
  11984. should be used instead.
  11985. A description of accepted options follows,
  11986. @table @option
  11987. @item mode
  11988. Set morphological transform to apply, can be:
  11989. @table @samp
  11990. @item erode
  11991. @item dilate
  11992. @item open
  11993. @item close
  11994. @item gradient
  11995. @item tophat
  11996. @item blackhat
  11997. @end table
  11998. Default is @code{erode}.
  11999. @item planes
  12000. Set planes to filter, by default all planes except alpha are filtered.
  12001. @item structure
  12002. Set which structure video frames will be processed from second input stream,
  12003. can be @var{first} or @var{all}. Default is @var{all}.
  12004. @end table
  12005. The @code{morpho} filter also supports the @ref{framesync} options.
  12006. @subsection Commands
  12007. This filter supports same @ref{commands} as options.
  12008. @section mpdecimate
  12009. Drop frames that do not differ greatly from the previous frame in
  12010. order to reduce frame rate.
  12011. The main use of this filter is for very-low-bitrate encoding
  12012. (e.g. streaming over dialup modem), but it could in theory be used for
  12013. fixing movies that were inverse-telecined incorrectly.
  12014. A description of the accepted options follows.
  12015. @table @option
  12016. @item max
  12017. Set the maximum number of consecutive frames which can be dropped (if
  12018. positive), or the minimum interval between dropped frames (if
  12019. negative). If the value is 0, the frame is dropped disregarding the
  12020. number of previous sequentially dropped frames.
  12021. Default value is 0.
  12022. @item hi
  12023. @item lo
  12024. @item frac
  12025. Set the dropping threshold values.
  12026. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  12027. represent actual pixel value differences, so a threshold of 64
  12028. corresponds to 1 unit of difference for each pixel, or the same spread
  12029. out differently over the block.
  12030. A frame is a candidate for dropping if no 8x8 blocks differ by more
  12031. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  12032. meaning the whole image) differ by more than a threshold of @option{lo}.
  12033. Default value for @option{hi} is 64*12, default value for @option{lo} is
  12034. 64*5, and default value for @option{frac} is 0.33.
  12035. @end table
  12036. @section msad
  12037. Obtain the MSAD (Mean Sum of Absolute Differences) between two input videos.
  12038. This filter takes two input videos.
  12039. Both input videos must have the same resolution and pixel format for
  12040. this filter to work correctly. Also it assumes that both inputs
  12041. have the same number of frames, which are compared one by one.
  12042. The obtained per component, average, min and max MSAD is printed through
  12043. the logging system.
  12044. The filter stores the calculated MSAD of each frame in frame metadata.
  12045. In the below example the input file @file{main.mpg} being processed is compared
  12046. with the reference file @file{ref.mpg}.
  12047. @example
  12048. ffmpeg -i main.mpg -i ref.mpg -lavfi msad -f null -
  12049. @end example
  12050. @section negate
  12051. Negate (invert) the input video.
  12052. It accepts the following option:
  12053. @table @option
  12054. @item components
  12055. Set components to negate.
  12056. Available values for components are:
  12057. @table @samp
  12058. @item y
  12059. @item u
  12060. @item v
  12061. @item a
  12062. @item r
  12063. @item g
  12064. @item b
  12065. @end table
  12066. @item negate_alpha
  12067. With value 1, it negates the alpha component, if present. Default value is 0.
  12068. @end table
  12069. @subsection Commands
  12070. This filter supports same @ref{commands} as options.
  12071. @anchor{nlmeans}
  12072. @section nlmeans
  12073. Denoise frames using Non-Local Means algorithm.
  12074. Each pixel is adjusted by looking for other pixels with similar contexts. This
  12075. context similarity is defined by comparing their surrounding patches of size
  12076. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  12077. around the pixel.
  12078. Note that the research area defines centers for patches, which means some
  12079. patches will be made of pixels outside that research area.
  12080. The filter accepts the following options.
  12081. @table @option
  12082. @item s
  12083. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  12084. @item p
  12085. Set patch size. Default is 7. Must be odd number in range [0, 99].
  12086. @item pc
  12087. Same as @option{p} but for chroma planes.
  12088. The default value is @var{0} and means automatic.
  12089. @item r
  12090. Set research size. Default is 15. Must be odd number in range [0, 99].
  12091. @item rc
  12092. Same as @option{r} but for chroma planes.
  12093. The default value is @var{0} and means automatic.
  12094. @end table
  12095. @section nnedi
  12096. Deinterlace video using neural network edge directed interpolation.
  12097. This filter accepts the following options:
  12098. @table @option
  12099. @item weights
  12100. Mandatory option, without binary file filter can not work.
  12101. Currently file can be found here:
  12102. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  12103. @item deint
  12104. Set which frames to deinterlace, by default it is @code{all}.
  12105. Can be @code{all} or @code{interlaced}.
  12106. @item field
  12107. Set mode of operation.
  12108. Can be one of the following:
  12109. @table @samp
  12110. @item af
  12111. Use frame flags, both fields.
  12112. @item a
  12113. Use frame flags, single field.
  12114. @item t
  12115. Use top field only.
  12116. @item b
  12117. Use bottom field only.
  12118. @item tf
  12119. Use both fields, top first.
  12120. @item bf
  12121. Use both fields, bottom first.
  12122. @end table
  12123. @item planes
  12124. Set which planes to process, by default filter process all frames.
  12125. @item nsize
  12126. Set size of local neighborhood around each pixel, used by the predictor neural
  12127. network.
  12128. Can be one of the following:
  12129. @table @samp
  12130. @item s8x6
  12131. @item s16x6
  12132. @item s32x6
  12133. @item s48x6
  12134. @item s8x4
  12135. @item s16x4
  12136. @item s32x4
  12137. @end table
  12138. @item nns
  12139. Set the number of neurons in predictor neural network.
  12140. Can be one of the following:
  12141. @table @samp
  12142. @item n16
  12143. @item n32
  12144. @item n64
  12145. @item n128
  12146. @item n256
  12147. @end table
  12148. @item qual
  12149. Controls the number of different neural network predictions that are blended
  12150. together to compute the final output value. Can be @code{fast}, default or
  12151. @code{slow}.
  12152. @item etype
  12153. Set which set of weights to use in the predictor.
  12154. Can be one of the following:
  12155. @table @samp
  12156. @item a, abs
  12157. weights trained to minimize absolute error
  12158. @item s, mse
  12159. weights trained to minimize squared error
  12160. @end table
  12161. @item pscrn
  12162. Controls whether or not the prescreener neural network is used to decide
  12163. which pixels should be processed by the predictor neural network and which
  12164. can be handled by simple cubic interpolation.
  12165. The prescreener is trained to know whether cubic interpolation will be
  12166. sufficient for a pixel or whether it should be predicted by the predictor nn.
  12167. The computational complexity of the prescreener nn is much less than that of
  12168. the predictor nn. Since most pixels can be handled by cubic interpolation,
  12169. using the prescreener generally results in much faster processing.
  12170. The prescreener is pretty accurate, so the difference between using it and not
  12171. using it is almost always unnoticeable.
  12172. Can be one of the following:
  12173. @table @samp
  12174. @item none
  12175. @item original
  12176. @item new
  12177. @item new2
  12178. @item new3
  12179. @end table
  12180. Default is @code{new}.
  12181. @end table
  12182. @subsection Commands
  12183. This filter supports same @ref{commands} as options, excluding @var{weights} option.
  12184. @section noformat
  12185. Force libavfilter not to use any of the specified pixel formats for the
  12186. input to the next filter.
  12187. It accepts the following parameters:
  12188. @table @option
  12189. @item pix_fmts
  12190. A '|'-separated list of pixel format names, such as
  12191. pix_fmts=yuv420p|monow|rgb24".
  12192. @end table
  12193. @subsection Examples
  12194. @itemize
  12195. @item
  12196. Force libavfilter to use a format different from @var{yuv420p} for the
  12197. input to the vflip filter:
  12198. @example
  12199. noformat=pix_fmts=yuv420p,vflip
  12200. @end example
  12201. @item
  12202. Convert the input video to any of the formats not contained in the list:
  12203. @example
  12204. noformat=yuv420p|yuv444p|yuv410p
  12205. @end example
  12206. @end itemize
  12207. @section noise
  12208. Add noise on video input frame.
  12209. The filter accepts the following options:
  12210. @table @option
  12211. @item all_seed
  12212. @item c0_seed
  12213. @item c1_seed
  12214. @item c2_seed
  12215. @item c3_seed
  12216. Set noise seed for specific pixel component or all pixel components in case
  12217. of @var{all_seed}. Default value is @code{123457}.
  12218. @item all_strength, alls
  12219. @item c0_strength, c0s
  12220. @item c1_strength, c1s
  12221. @item c2_strength, c2s
  12222. @item c3_strength, c3s
  12223. Set noise strength for specific pixel component or all pixel components in case
  12224. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  12225. @item all_flags, allf
  12226. @item c0_flags, c0f
  12227. @item c1_flags, c1f
  12228. @item c2_flags, c2f
  12229. @item c3_flags, c3f
  12230. Set pixel component flags or set flags for all components if @var{all_flags}.
  12231. Available values for component flags are:
  12232. @table @samp
  12233. @item a
  12234. averaged temporal noise (smoother)
  12235. @item p
  12236. mix random noise with a (semi)regular pattern
  12237. @item t
  12238. temporal noise (noise pattern changes between frames)
  12239. @item u
  12240. uniform noise (gaussian otherwise)
  12241. @end table
  12242. @end table
  12243. @subsection Examples
  12244. Add temporal and uniform noise to input video:
  12245. @example
  12246. noise=alls=20:allf=t+u
  12247. @end example
  12248. @section normalize
  12249. Normalize RGB video (aka histogram stretching, contrast stretching).
  12250. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  12251. For each channel of each frame, the filter computes the input range and maps
  12252. it linearly to the user-specified output range. The output range defaults
  12253. to the full dynamic range from pure black to pure white.
  12254. Temporal smoothing can be used on the input range to reduce flickering (rapid
  12255. changes in brightness) caused when small dark or bright objects enter or leave
  12256. the scene. This is similar to the auto-exposure (automatic gain control) on a
  12257. video camera, and, like a video camera, it may cause a period of over- or
  12258. under-exposure of the video.
  12259. The R,G,B channels can be normalized independently, which may cause some
  12260. color shifting, or linked together as a single channel, which prevents
  12261. color shifting. Linked normalization preserves hue. Independent normalization
  12262. does not, so it can be used to remove some color casts. Independent and linked
  12263. normalization can be combined in any ratio.
  12264. The normalize filter accepts the following options:
  12265. @table @option
  12266. @item blackpt
  12267. @item whitept
  12268. Colors which define the output range. The minimum input value is mapped to
  12269. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  12270. The defaults are black and white respectively. Specifying white for
  12271. @var{blackpt} and black for @var{whitept} will give color-inverted,
  12272. normalized video. Shades of grey can be used to reduce the dynamic range
  12273. (contrast). Specifying saturated colors here can create some interesting
  12274. effects.
  12275. @item smoothing
  12276. The number of previous frames to use for temporal smoothing. The input range
  12277. of each channel is smoothed using a rolling average over the current frame
  12278. and the @var{smoothing} previous frames. The default is 0 (no temporal
  12279. smoothing).
  12280. @item independence
  12281. Controls the ratio of independent (color shifting) channel normalization to
  12282. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  12283. independent. Defaults to 1.0 (fully independent).
  12284. @item strength
  12285. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  12286. expensive no-op. Defaults to 1.0 (full strength).
  12287. @end table
  12288. @subsection Commands
  12289. This filter supports same @ref{commands} as options, excluding @var{smoothing} option.
  12290. The command accepts the same syntax of the corresponding option.
  12291. If the specified expression is not valid, it is kept at its current
  12292. value.
  12293. @subsection Examples
  12294. Stretch video contrast to use the full dynamic range, with no temporal
  12295. smoothing; may flicker depending on the source content:
  12296. @example
  12297. normalize=blackpt=black:whitept=white:smoothing=0
  12298. @end example
  12299. As above, but with 50 frames of temporal smoothing; flicker should be
  12300. reduced, depending on the source content:
  12301. @example
  12302. normalize=blackpt=black:whitept=white:smoothing=50
  12303. @end example
  12304. As above, but with hue-preserving linked channel normalization:
  12305. @example
  12306. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  12307. @end example
  12308. As above, but with half strength:
  12309. @example
  12310. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  12311. @end example
  12312. Map the darkest input color to red, the brightest input color to cyan:
  12313. @example
  12314. normalize=blackpt=red:whitept=cyan
  12315. @end example
  12316. @section null
  12317. Pass the video source unchanged to the output.
  12318. @section ocr
  12319. Optical Character Recognition
  12320. This filter uses Tesseract for optical character recognition. To enable
  12321. compilation of this filter, you need to configure FFmpeg with
  12322. @code{--enable-libtesseract}.
  12323. It accepts the following options:
  12324. @table @option
  12325. @item datapath
  12326. Set datapath to tesseract data. Default is to use whatever was
  12327. set at installation.
  12328. @item language
  12329. Set language, default is "eng".
  12330. @item whitelist
  12331. Set character whitelist.
  12332. @item blacklist
  12333. Set character blacklist.
  12334. @end table
  12335. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  12336. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  12337. @section ocv
  12338. Apply a video transform using libopencv.
  12339. To enable this filter, install the libopencv library and headers and
  12340. configure FFmpeg with @code{--enable-libopencv}.
  12341. It accepts the following parameters:
  12342. @table @option
  12343. @item filter_name
  12344. The name of the libopencv filter to apply.
  12345. @item filter_params
  12346. The parameters to pass to the libopencv filter. If not specified, the default
  12347. values are assumed.
  12348. @end table
  12349. Refer to the official libopencv documentation for more precise
  12350. information:
  12351. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  12352. Several libopencv filters are supported; see the following subsections.
  12353. @anchor{dilate}
  12354. @subsection dilate
  12355. Dilate an image by using a specific structuring element.
  12356. It corresponds to the libopencv function @code{cvDilate}.
  12357. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  12358. @var{struct_el} represents a structuring element, and has the syntax:
  12359. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  12360. @var{cols} and @var{rows} represent the number of columns and rows of
  12361. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  12362. point, and @var{shape} the shape for the structuring element. @var{shape}
  12363. must be "rect", "cross", "ellipse", or "custom".
  12364. If the value for @var{shape} is "custom", it must be followed by a
  12365. string of the form "=@var{filename}". The file with name
  12366. @var{filename} is assumed to represent a binary image, with each
  12367. printable character corresponding to a bright pixel. When a custom
  12368. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  12369. or columns and rows of the read file are assumed instead.
  12370. The default value for @var{struct_el} is "3x3+0x0/rect".
  12371. @var{nb_iterations} specifies the number of times the transform is
  12372. applied to the image, and defaults to 1.
  12373. Some examples:
  12374. @example
  12375. # Use the default values
  12376. ocv=dilate
  12377. # Dilate using a structuring element with a 5x5 cross, iterating two times
  12378. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  12379. # Read the shape from the file diamond.shape, iterating two times.
  12380. # The file diamond.shape may contain a pattern of characters like this
  12381. # *
  12382. # ***
  12383. # *****
  12384. # ***
  12385. # *
  12386. # The specified columns and rows are ignored
  12387. # but the anchor point coordinates are not
  12388. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  12389. @end example
  12390. @subsection erode
  12391. Erode an image by using a specific structuring element.
  12392. It corresponds to the libopencv function @code{cvErode}.
  12393. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  12394. with the same syntax and semantics as the @ref{dilate} filter.
  12395. @subsection smooth
  12396. Smooth the input video.
  12397. The filter takes the following parameters:
  12398. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  12399. @var{type} is the type of smooth filter to apply, and must be one of
  12400. the following values: "blur", "blur_no_scale", "median", "gaussian",
  12401. or "bilateral". The default value is "gaussian".
  12402. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  12403. depends on the smooth type. @var{param1} and
  12404. @var{param2} accept integer positive values or 0. @var{param3} and
  12405. @var{param4} accept floating point values.
  12406. The default value for @var{param1} is 3. The default value for the
  12407. other parameters is 0.
  12408. These parameters correspond to the parameters assigned to the
  12409. libopencv function @code{cvSmooth}.
  12410. @section oscilloscope
  12411. 2D Video Oscilloscope.
  12412. Useful to measure spatial impulse, step responses, chroma delays, etc.
  12413. It accepts the following parameters:
  12414. @table @option
  12415. @item x
  12416. Set scope center x position.
  12417. @item y
  12418. Set scope center y position.
  12419. @item s
  12420. Set scope size, relative to frame diagonal.
  12421. @item t
  12422. Set scope tilt/rotation.
  12423. @item o
  12424. Set trace opacity.
  12425. @item tx
  12426. Set trace center x position.
  12427. @item ty
  12428. Set trace center y position.
  12429. @item tw
  12430. Set trace width, relative to width of frame.
  12431. @item th
  12432. Set trace height, relative to height of frame.
  12433. @item c
  12434. Set which components to trace. By default it traces first three components.
  12435. @item g
  12436. Draw trace grid. By default is enabled.
  12437. @item st
  12438. Draw some statistics. By default is enabled.
  12439. @item sc
  12440. Draw scope. By default is enabled.
  12441. @end table
  12442. @subsection Commands
  12443. This filter supports same @ref{commands} as options.
  12444. The command accepts the same syntax of the corresponding option.
  12445. If the specified expression is not valid, it is kept at its current
  12446. value.
  12447. @subsection Examples
  12448. @itemize
  12449. @item
  12450. Inspect full first row of video frame.
  12451. @example
  12452. oscilloscope=x=0.5:y=0:s=1
  12453. @end example
  12454. @item
  12455. Inspect full last row of video frame.
  12456. @example
  12457. oscilloscope=x=0.5:y=1:s=1
  12458. @end example
  12459. @item
  12460. Inspect full 5th line of video frame of height 1080.
  12461. @example
  12462. oscilloscope=x=0.5:y=5/1080:s=1
  12463. @end example
  12464. @item
  12465. Inspect full last column of video frame.
  12466. @example
  12467. oscilloscope=x=1:y=0.5:s=1:t=1
  12468. @end example
  12469. @end itemize
  12470. @anchor{overlay}
  12471. @section overlay
  12472. Overlay one video on top of another.
  12473. It takes two inputs and has one output. The first input is the "main"
  12474. video on which the second input is overlaid.
  12475. It accepts the following parameters:
  12476. A description of the accepted options follows.
  12477. @table @option
  12478. @item x
  12479. @item y
  12480. Set the expression for the x and y coordinates of the overlaid video
  12481. on the main video. Default value is "0" for both expressions. In case
  12482. the expression is invalid, it is set to a huge value (meaning that the
  12483. overlay will not be displayed within the output visible area).
  12484. @item eof_action
  12485. See @ref{framesync}.
  12486. @item eval
  12487. Set when the expressions for @option{x}, and @option{y} are evaluated.
  12488. It accepts the following values:
  12489. @table @samp
  12490. @item init
  12491. only evaluate expressions once during the filter initialization or
  12492. when a command is processed
  12493. @item frame
  12494. evaluate expressions for each incoming frame
  12495. @end table
  12496. Default value is @samp{frame}.
  12497. @item shortest
  12498. See @ref{framesync}.
  12499. @item format
  12500. Set the format for the output video.
  12501. It accepts the following values:
  12502. @table @samp
  12503. @item yuv420
  12504. force YUV420 output
  12505. @item yuv420p10
  12506. force YUV420p10 output
  12507. @item yuv422
  12508. force YUV422 output
  12509. @item yuv422p10
  12510. force YUV422p10 output
  12511. @item yuv444
  12512. force YUV444 output
  12513. @item rgb
  12514. force packed RGB output
  12515. @item gbrp
  12516. force planar RGB output
  12517. @item auto
  12518. automatically pick format
  12519. @end table
  12520. Default value is @samp{yuv420}.
  12521. @item repeatlast
  12522. See @ref{framesync}.
  12523. @item alpha
  12524. Set format of alpha of the overlaid video, it can be @var{straight} or
  12525. @var{premultiplied}. Default is @var{straight}.
  12526. @end table
  12527. The @option{x}, and @option{y} expressions can contain the following
  12528. parameters.
  12529. @table @option
  12530. @item main_w, W
  12531. @item main_h, H
  12532. The main input width and height.
  12533. @item overlay_w, w
  12534. @item overlay_h, h
  12535. The overlay input width and height.
  12536. @item x
  12537. @item y
  12538. The computed values for @var{x} and @var{y}. They are evaluated for
  12539. each new frame.
  12540. @item hsub
  12541. @item vsub
  12542. horizontal and vertical chroma subsample values of the output
  12543. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  12544. @var{vsub} is 1.
  12545. @item n
  12546. the number of input frame, starting from 0
  12547. @item pos
  12548. the position in the file of the input frame, NAN if unknown
  12549. @item t
  12550. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  12551. @end table
  12552. This filter also supports the @ref{framesync} options.
  12553. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  12554. when evaluation is done @emph{per frame}, and will evaluate to NAN
  12555. when @option{eval} is set to @samp{init}.
  12556. Be aware that frames are taken from each input video in timestamp
  12557. order, hence, if their initial timestamps differ, it is a good idea
  12558. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  12559. have them begin in the same zero timestamp, as the example for
  12560. the @var{movie} filter does.
  12561. You can chain together more overlays but you should test the
  12562. efficiency of such approach.
  12563. @subsection Commands
  12564. This filter supports the following commands:
  12565. @table @option
  12566. @item x
  12567. @item y
  12568. Modify the x and y of the overlay input.
  12569. The command accepts the same syntax of the corresponding option.
  12570. If the specified expression is not valid, it is kept at its current
  12571. value.
  12572. @end table
  12573. @subsection Examples
  12574. @itemize
  12575. @item
  12576. Draw the overlay at 10 pixels from the bottom right corner of the main
  12577. video:
  12578. @example
  12579. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  12580. @end example
  12581. Using named options the example above becomes:
  12582. @example
  12583. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  12584. @end example
  12585. @item
  12586. Insert a transparent PNG logo in the bottom left corner of the input,
  12587. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  12588. @example
  12589. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  12590. @end example
  12591. @item
  12592. Insert 2 different transparent PNG logos (second logo on bottom
  12593. right corner) using the @command{ffmpeg} tool:
  12594. @example
  12595. 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
  12596. @end example
  12597. @item
  12598. Add a transparent color layer on top of the main video; @code{WxH}
  12599. must specify the size of the main input to the overlay filter:
  12600. @example
  12601. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  12602. @end example
  12603. @item
  12604. Play an original video and a filtered version (here with the deshake
  12605. filter) side by side using the @command{ffplay} tool:
  12606. @example
  12607. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  12608. @end example
  12609. The above command is the same as:
  12610. @example
  12611. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  12612. @end example
  12613. @item
  12614. Make a sliding overlay appearing from the left to the right top part of the
  12615. screen starting since time 2:
  12616. @example
  12617. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  12618. @end example
  12619. @item
  12620. Compose output by putting two input videos side to side:
  12621. @example
  12622. ffmpeg -i left.avi -i right.avi -filter_complex "
  12623. nullsrc=size=200x100 [background];
  12624. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  12625. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  12626. [background][left] overlay=shortest=1 [background+left];
  12627. [background+left][right] overlay=shortest=1:x=100 [left+right]
  12628. "
  12629. @end example
  12630. @item
  12631. Mask 10-20 seconds of a video by applying the delogo filter to a section
  12632. @example
  12633. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  12634. -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]'
  12635. masked.avi
  12636. @end example
  12637. @item
  12638. Chain several overlays in cascade:
  12639. @example
  12640. nullsrc=s=200x200 [bg];
  12641. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  12642. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  12643. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  12644. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  12645. [in3] null, [mid2] overlay=100:100 [out0]
  12646. @end example
  12647. @end itemize
  12648. @anchor{overlay_cuda}
  12649. @section overlay_cuda
  12650. Overlay one video on top of another.
  12651. This is the CUDA variant of the @ref{overlay} filter.
  12652. It only accepts CUDA frames. The underlying input pixel formats have to match.
  12653. It takes two inputs and has one output. The first input is the "main"
  12654. video on which the second input is overlaid.
  12655. It accepts the following parameters:
  12656. @table @option
  12657. @item x
  12658. @item y
  12659. Set expressions for the x and y coordinates of the overlaid video
  12660. on the main video.
  12661. They can contain the following parameters:
  12662. @table @option
  12663. @item main_w, W
  12664. @item main_h, H
  12665. The main input width and height.
  12666. @item overlay_w, w
  12667. @item overlay_h, h
  12668. The overlay input width and height.
  12669. @item x
  12670. @item y
  12671. The computed values for @var{x} and @var{y}. They are evaluated for
  12672. each new frame.
  12673. @item n
  12674. The ordinal index of the main input frame, starting from 0.
  12675. @item pos
  12676. The byte offset position in the file of the main input frame, NAN if unknown.
  12677. @item t
  12678. The timestamp of the main input frame, expressed in seconds, NAN if unknown.
  12679. @end table
  12680. Default value is "0" for both expressions.
  12681. @item eval
  12682. Set when the expressions for @option{x} and @option{y} are evaluated.
  12683. It accepts the following values:
  12684. @table @option
  12685. @item init
  12686. Evaluate expressions once during filter initialization or
  12687. when a command is processed.
  12688. @item frame
  12689. Evaluate expressions for each incoming frame
  12690. @end table
  12691. Default value is @option{frame}.
  12692. @item eof_action
  12693. See @ref{framesync}.
  12694. @item shortest
  12695. See @ref{framesync}.
  12696. @item repeatlast
  12697. See @ref{framesync}.
  12698. @end table
  12699. This filter also supports the @ref{framesync} options.
  12700. @section owdenoise
  12701. Apply Overcomplete Wavelet denoiser.
  12702. The filter accepts the following options:
  12703. @table @option
  12704. @item depth
  12705. Set depth.
  12706. Larger depth values will denoise lower frequency components more, but
  12707. slow down filtering.
  12708. Must be an int in the range 8-16, default is @code{8}.
  12709. @item luma_strength, ls
  12710. Set luma strength.
  12711. Must be a double value in the range 0-1000, default is @code{1.0}.
  12712. @item chroma_strength, cs
  12713. Set chroma strength.
  12714. Must be a double value in the range 0-1000, default is @code{1.0}.
  12715. @end table
  12716. @anchor{pad}
  12717. @section pad
  12718. Add paddings to the input image, and place the original input at the
  12719. provided @var{x}, @var{y} coordinates.
  12720. It accepts the following parameters:
  12721. @table @option
  12722. @item width, w
  12723. @item height, h
  12724. Specify an expression for the size of the output image with the
  12725. paddings added. If the value for @var{width} or @var{height} is 0, the
  12726. corresponding input size is used for the output.
  12727. The @var{width} expression can reference the value set by the
  12728. @var{height} expression, and vice versa.
  12729. The default value of @var{width} and @var{height} is 0.
  12730. @item x
  12731. @item y
  12732. Specify the offsets to place the input image at within the padded area,
  12733. with respect to the top/left border of the output image.
  12734. The @var{x} expression can reference the value set by the @var{y}
  12735. expression, and vice versa.
  12736. The default value of @var{x} and @var{y} is 0.
  12737. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  12738. so the input image is centered on the padded area.
  12739. @item color
  12740. Specify the color of the padded area. For the syntax of this option,
  12741. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  12742. manual,ffmpeg-utils}.
  12743. The default value of @var{color} is "black".
  12744. @item eval
  12745. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  12746. It accepts the following values:
  12747. @table @samp
  12748. @item init
  12749. Only evaluate expressions once during the filter initialization or when
  12750. a command is processed.
  12751. @item frame
  12752. Evaluate expressions for each incoming frame.
  12753. @end table
  12754. Default value is @samp{init}.
  12755. @item aspect
  12756. Pad to aspect instead to a resolution.
  12757. @end table
  12758. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  12759. options are expressions containing the following constants:
  12760. @table @option
  12761. @item in_w
  12762. @item in_h
  12763. The input video width and height.
  12764. @item iw
  12765. @item ih
  12766. These are the same as @var{in_w} and @var{in_h}.
  12767. @item out_w
  12768. @item out_h
  12769. The output width and height (the size of the padded area), as
  12770. specified by the @var{width} and @var{height} expressions.
  12771. @item ow
  12772. @item oh
  12773. These are the same as @var{out_w} and @var{out_h}.
  12774. @item x
  12775. @item y
  12776. The x and y offsets as specified by the @var{x} and @var{y}
  12777. expressions, or NAN if not yet specified.
  12778. @item a
  12779. same as @var{iw} / @var{ih}
  12780. @item sar
  12781. input sample aspect ratio
  12782. @item dar
  12783. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  12784. @item hsub
  12785. @item vsub
  12786. The horizontal and vertical chroma subsample values. For example for the
  12787. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12788. @end table
  12789. @subsection Examples
  12790. @itemize
  12791. @item
  12792. Add paddings with the color "violet" to the input video. The output video
  12793. size is 640x480, and the top-left corner of the input video is placed at
  12794. column 0, row 40
  12795. @example
  12796. pad=640:480:0:40:violet
  12797. @end example
  12798. The example above is equivalent to the following command:
  12799. @example
  12800. pad=width=640:height=480:x=0:y=40:color=violet
  12801. @end example
  12802. @item
  12803. Pad the input to get an output with dimensions increased by 3/2,
  12804. and put the input video at the center of the padded area:
  12805. @example
  12806. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  12807. @end example
  12808. @item
  12809. Pad the input to get a squared output with size equal to the maximum
  12810. value between the input width and height, and put the input video at
  12811. the center of the padded area:
  12812. @example
  12813. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  12814. @end example
  12815. @item
  12816. Pad the input to get a final w/h ratio of 16:9:
  12817. @example
  12818. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  12819. @end example
  12820. @item
  12821. In case of anamorphic video, in order to set the output display aspect
  12822. correctly, it is necessary to use @var{sar} in the expression,
  12823. according to the relation:
  12824. @example
  12825. (ih * X / ih) * sar = output_dar
  12826. X = output_dar / sar
  12827. @end example
  12828. Thus the previous example needs to be modified to:
  12829. @example
  12830. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  12831. @end example
  12832. @item
  12833. Double the output size and put the input video in the bottom-right
  12834. corner of the output padded area:
  12835. @example
  12836. pad="2*iw:2*ih:ow-iw:oh-ih"
  12837. @end example
  12838. @end itemize
  12839. @anchor{palettegen}
  12840. @section palettegen
  12841. Generate one palette for a whole video stream.
  12842. It accepts the following options:
  12843. @table @option
  12844. @item max_colors
  12845. Set the maximum number of colors to quantize in the palette.
  12846. Note: the palette will still contain 256 colors; the unused palette entries
  12847. will be black.
  12848. @item reserve_transparent
  12849. Create a palette of 255 colors maximum and reserve the last one for
  12850. transparency. Reserving the transparency color is useful for GIF optimization.
  12851. If not set, the maximum of colors in the palette will be 256. You probably want
  12852. to disable this option for a standalone image.
  12853. Set by default.
  12854. @item transparency_color
  12855. Set the color that will be used as background for transparency.
  12856. @item stats_mode
  12857. Set statistics mode.
  12858. It accepts the following values:
  12859. @table @samp
  12860. @item full
  12861. Compute full frame histograms.
  12862. @item diff
  12863. Compute histograms only for the part that differs from previous frame. This
  12864. might be relevant to give more importance to the moving part of your input if
  12865. the background is static.
  12866. @item single
  12867. Compute new histogram for each frame.
  12868. @end table
  12869. Default value is @var{full}.
  12870. @item use_alpha
  12871. Create a palette of colors with alpha components.
  12872. Setting this, will automatically disable 'reserve_transparent'.
  12873. @end table
  12874. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  12875. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  12876. color quantization of the palette. This information is also visible at
  12877. @var{info} logging level.
  12878. @subsection Examples
  12879. @itemize
  12880. @item
  12881. Generate a representative palette of a given video using @command{ffmpeg}:
  12882. @example
  12883. ffmpeg -i input.mkv -vf palettegen palette.png
  12884. @end example
  12885. @end itemize
  12886. @section paletteuse
  12887. Use a palette to downsample an input video stream.
  12888. The filter takes two inputs: one video stream and a palette. The palette must
  12889. be a 256 pixels image.
  12890. It accepts the following options:
  12891. @table @option
  12892. @item dither
  12893. Select dithering mode. Available algorithms are:
  12894. @table @samp
  12895. @item bayer
  12896. Ordered 8x8 bayer dithering (deterministic)
  12897. @item heckbert
  12898. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  12899. Note: this dithering is sometimes considered "wrong" and is included as a
  12900. reference.
  12901. @item floyd_steinberg
  12902. Floyd and Steingberg dithering (error diffusion)
  12903. @item sierra2
  12904. Frankie Sierra dithering v2 (error diffusion)
  12905. @item sierra2_4a
  12906. Frankie Sierra dithering v2 "Lite" (error diffusion)
  12907. @end table
  12908. Default is @var{sierra2_4a}.
  12909. @item bayer_scale
  12910. When @var{bayer} dithering is selected, this option defines the scale of the
  12911. pattern (how much the crosshatch pattern is visible). A low value means more
  12912. visible pattern for less banding, and higher value means less visible pattern
  12913. at the cost of more banding.
  12914. The option must be an integer value in the range [0,5]. Default is @var{2}.
  12915. @item diff_mode
  12916. If set, define the zone to process
  12917. @table @samp
  12918. @item rectangle
  12919. Only the changing rectangle will be reprocessed. This is similar to GIF
  12920. cropping/offsetting compression mechanism. This option can be useful for speed
  12921. if only a part of the image is changing, and has use cases such as limiting the
  12922. scope of the error diffusal @option{dither} to the rectangle that bounds the
  12923. moving scene (it leads to more deterministic output if the scene doesn't change
  12924. much, and as a result less moving noise and better GIF compression).
  12925. @end table
  12926. Default is @var{none}.
  12927. @item new
  12928. Take new palette for each output frame.
  12929. @item alpha_threshold
  12930. Sets the alpha threshold for transparency. Alpha values above this threshold
  12931. will be treated as completely opaque, and values below this threshold will be
  12932. treated as completely transparent.
  12933. The option must be an integer value in the range [0,255]. Default is @var{128}.
  12934. @item use_alpha
  12935. Apply the palette by taking alpha values into account. Only useful with
  12936. palettes that are containing multiple colors with alpha components.
  12937. Setting this will automatically disable 'alpha_treshold'.
  12938. @end table
  12939. @subsection Examples
  12940. @itemize
  12941. @item
  12942. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  12943. using @command{ffmpeg}:
  12944. @example
  12945. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  12946. @end example
  12947. @end itemize
  12948. @section perspective
  12949. Correct perspective of video not recorded perpendicular to the screen.
  12950. A description of the accepted parameters follows.
  12951. @table @option
  12952. @item x0
  12953. @item y0
  12954. @item x1
  12955. @item y1
  12956. @item x2
  12957. @item y2
  12958. @item x3
  12959. @item y3
  12960. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  12961. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  12962. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  12963. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  12964. then the corners of the source will be sent to the specified coordinates.
  12965. The expressions can use the following variables:
  12966. @table @option
  12967. @item W
  12968. @item H
  12969. the width and height of video frame.
  12970. @item in
  12971. Input frame count.
  12972. @item on
  12973. Output frame count.
  12974. @end table
  12975. @item interpolation
  12976. Set interpolation for perspective correction.
  12977. It accepts the following values:
  12978. @table @samp
  12979. @item linear
  12980. @item cubic
  12981. @end table
  12982. Default value is @samp{linear}.
  12983. @item sense
  12984. Set interpretation of coordinate options.
  12985. It accepts the following values:
  12986. @table @samp
  12987. @item 0, source
  12988. Send point in the source specified by the given coordinates to
  12989. the corners of the destination.
  12990. @item 1, destination
  12991. Send the corners of the source to the point in the destination specified
  12992. by the given coordinates.
  12993. Default value is @samp{source}.
  12994. @end table
  12995. @item eval
  12996. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  12997. It accepts the following values:
  12998. @table @samp
  12999. @item init
  13000. only evaluate expressions once during the filter initialization or
  13001. when a command is processed
  13002. @item frame
  13003. evaluate expressions for each incoming frame
  13004. @end table
  13005. Default value is @samp{init}.
  13006. @end table
  13007. @section phase
  13008. Delay interlaced video by one field time so that the field order changes.
  13009. The intended use is to fix PAL movies that have been captured with the
  13010. opposite field order to the film-to-video transfer.
  13011. A description of the accepted parameters follows.
  13012. @table @option
  13013. @item mode
  13014. Set phase mode.
  13015. It accepts the following values:
  13016. @table @samp
  13017. @item t
  13018. Capture field order top-first, transfer bottom-first.
  13019. Filter will delay the bottom field.
  13020. @item b
  13021. Capture field order bottom-first, transfer top-first.
  13022. Filter will delay the top field.
  13023. @item p
  13024. Capture and transfer with the same field order. This mode only exists
  13025. for the documentation of the other options to refer to, but if you
  13026. actually select it, the filter will faithfully do nothing.
  13027. @item a
  13028. Capture field order determined automatically by field flags, transfer
  13029. opposite.
  13030. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  13031. basis using field flags. If no field information is available,
  13032. then this works just like @samp{u}.
  13033. @item u
  13034. Capture unknown or varying, transfer opposite.
  13035. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  13036. analyzing the images and selecting the alternative that produces best
  13037. match between the fields.
  13038. @item T
  13039. Capture top-first, transfer unknown or varying.
  13040. Filter selects among @samp{t} and @samp{p} using image analysis.
  13041. @item B
  13042. Capture bottom-first, transfer unknown or varying.
  13043. Filter selects among @samp{b} and @samp{p} using image analysis.
  13044. @item A
  13045. Capture determined by field flags, transfer unknown or varying.
  13046. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  13047. image analysis. If no field information is available, then this works just
  13048. like @samp{U}. This is the default mode.
  13049. @item U
  13050. Both capture and transfer unknown or varying.
  13051. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  13052. @end table
  13053. @end table
  13054. @subsection Commands
  13055. This filter supports the all above options as @ref{commands}.
  13056. @section photosensitivity
  13057. Reduce various flashes in video, so to help users with epilepsy.
  13058. It accepts the following options:
  13059. @table @option
  13060. @item frames, f
  13061. Set how many frames to use when filtering. Default is 30.
  13062. @item threshold, t
  13063. Set detection threshold factor. Default is 1.
  13064. Lower is stricter.
  13065. @item skip
  13066. Set how many pixels to skip when sampling frames. Default is 1.
  13067. Allowed range is from 1 to 1024.
  13068. @item bypass
  13069. Leave frames unchanged. Default is disabled.
  13070. @end table
  13071. @section pixdesctest
  13072. Pixel format descriptor test filter, mainly useful for internal
  13073. testing. The output video should be equal to the input video.
  13074. For example:
  13075. @example
  13076. format=monow, pixdesctest
  13077. @end example
  13078. can be used to test the monowhite pixel format descriptor definition.
  13079. @section pixscope
  13080. Display sample values of color channels. Mainly useful for checking color
  13081. and levels. Minimum supported resolution is 640x480.
  13082. The filters accept the following options:
  13083. @table @option
  13084. @item x
  13085. Set scope X position, relative offset on X axis.
  13086. @item y
  13087. Set scope Y position, relative offset on Y axis.
  13088. @item w
  13089. Set scope width.
  13090. @item h
  13091. Set scope height.
  13092. @item o
  13093. Set window opacity. This window also holds statistics about pixel area.
  13094. @item wx
  13095. Set window X position, relative offset on X axis.
  13096. @item wy
  13097. Set window Y position, relative offset on Y axis.
  13098. @end table
  13099. @subsection Commands
  13100. This filter supports same @ref{commands} as options.
  13101. @section pp
  13102. Enable the specified chain of postprocessing subfilters using libpostproc. This
  13103. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  13104. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  13105. Each subfilter and some options have a short and a long name that can be used
  13106. interchangeably, i.e. dr/dering are the same.
  13107. The filters accept the following options:
  13108. @table @option
  13109. @item subfilters
  13110. Set postprocessing subfilters string.
  13111. @end table
  13112. All subfilters share common options to determine their scope:
  13113. @table @option
  13114. @item a/autoq
  13115. Honor the quality commands for this subfilter.
  13116. @item c/chrom
  13117. Do chrominance filtering, too (default).
  13118. @item y/nochrom
  13119. Do luminance filtering only (no chrominance).
  13120. @item n/noluma
  13121. Do chrominance filtering only (no luminance).
  13122. @end table
  13123. These options can be appended after the subfilter name, separated by a '|'.
  13124. Available subfilters are:
  13125. @table @option
  13126. @item hb/hdeblock[|difference[|flatness]]
  13127. Horizontal deblocking filter
  13128. @table @option
  13129. @item difference
  13130. Difference factor where higher values mean more deblocking (default: @code{32}).
  13131. @item flatness
  13132. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  13133. @end table
  13134. @item vb/vdeblock[|difference[|flatness]]
  13135. Vertical deblocking filter
  13136. @table @option
  13137. @item difference
  13138. Difference factor where higher values mean more deblocking (default: @code{32}).
  13139. @item flatness
  13140. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  13141. @end table
  13142. @item ha/hadeblock[|difference[|flatness]]
  13143. Accurate horizontal deblocking filter
  13144. @table @option
  13145. @item difference
  13146. Difference factor where higher values mean more deblocking (default: @code{32}).
  13147. @item flatness
  13148. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  13149. @end table
  13150. @item va/vadeblock[|difference[|flatness]]
  13151. Accurate vertical deblocking filter
  13152. @table @option
  13153. @item difference
  13154. Difference factor where higher values mean more deblocking (default: @code{32}).
  13155. @item flatness
  13156. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  13157. @end table
  13158. @end table
  13159. The horizontal and vertical deblocking filters share the difference and
  13160. flatness values so you cannot set different horizontal and vertical
  13161. thresholds.
  13162. @table @option
  13163. @item h1/x1hdeblock
  13164. Experimental horizontal deblocking filter
  13165. @item v1/x1vdeblock
  13166. Experimental vertical deblocking filter
  13167. @item dr/dering
  13168. Deringing filter
  13169. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  13170. @table @option
  13171. @item threshold1
  13172. larger -> stronger filtering
  13173. @item threshold2
  13174. larger -> stronger filtering
  13175. @item threshold3
  13176. larger -> stronger filtering
  13177. @end table
  13178. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  13179. @table @option
  13180. @item f/fullyrange
  13181. Stretch luminance to @code{0-255}.
  13182. @end table
  13183. @item lb/linblenddeint
  13184. Linear blend deinterlacing filter that deinterlaces the given block by
  13185. filtering all lines with a @code{(1 2 1)} filter.
  13186. @item li/linipoldeint
  13187. Linear interpolating deinterlacing filter that deinterlaces the given block by
  13188. linearly interpolating every second line.
  13189. @item ci/cubicipoldeint
  13190. Cubic interpolating deinterlacing filter deinterlaces the given block by
  13191. cubically interpolating every second line.
  13192. @item md/mediandeint
  13193. Median deinterlacing filter that deinterlaces the given block by applying a
  13194. median filter to every second line.
  13195. @item fd/ffmpegdeint
  13196. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  13197. second line with a @code{(-1 4 2 4 -1)} filter.
  13198. @item l5/lowpass5
  13199. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  13200. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  13201. @item fq/forceQuant[|quantizer]
  13202. Overrides the quantizer table from the input with the constant quantizer you
  13203. specify.
  13204. @table @option
  13205. @item quantizer
  13206. Quantizer to use
  13207. @end table
  13208. @item de/default
  13209. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  13210. @item fa/fast
  13211. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  13212. @item ac
  13213. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  13214. @end table
  13215. @subsection Examples
  13216. @itemize
  13217. @item
  13218. Apply horizontal and vertical deblocking, deringing and automatic
  13219. brightness/contrast:
  13220. @example
  13221. pp=hb/vb/dr/al
  13222. @end example
  13223. @item
  13224. Apply default filters without brightness/contrast correction:
  13225. @example
  13226. pp=de/-al
  13227. @end example
  13228. @item
  13229. Apply default filters and temporal denoiser:
  13230. @example
  13231. pp=default/tmpnoise|1|2|3
  13232. @end example
  13233. @item
  13234. Apply deblocking on luminance only, and switch vertical deblocking on or off
  13235. automatically depending on available CPU time:
  13236. @example
  13237. pp=hb|y/vb|a
  13238. @end example
  13239. @end itemize
  13240. @section pp7
  13241. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  13242. similar to spp = 6 with 7 point DCT, where only the center sample is
  13243. used after IDCT.
  13244. The filter accepts the following options:
  13245. @table @option
  13246. @item qp
  13247. Force a constant quantization parameter. It accepts an integer in range
  13248. 0 to 63. If not set, the filter will use the QP from the video stream
  13249. (if available).
  13250. @item mode
  13251. Set thresholding mode. Available modes are:
  13252. @table @samp
  13253. @item hard
  13254. Set hard thresholding.
  13255. @item soft
  13256. Set soft thresholding (better de-ringing effect, but likely blurrier).
  13257. @item medium
  13258. Set medium thresholding (good results, default).
  13259. @end table
  13260. @end table
  13261. @section premultiply
  13262. Apply alpha premultiply effect to input video stream using first plane
  13263. of second stream as alpha.
  13264. Both streams must have same dimensions and same pixel format.
  13265. The filter accepts the following option:
  13266. @table @option
  13267. @item planes
  13268. Set which planes will be processed, unprocessed planes will be copied.
  13269. By default value 0xf, all planes will be processed.
  13270. @item inplace
  13271. Do not require 2nd input for processing, instead use alpha plane from input stream.
  13272. @end table
  13273. @section prewitt
  13274. Apply prewitt operator to input video stream.
  13275. The filter accepts the following option:
  13276. @table @option
  13277. @item planes
  13278. Set which planes will be processed, unprocessed planes will be copied.
  13279. By default value 0xf, all planes will be processed.
  13280. @item scale
  13281. Set value which will be multiplied with filtered result.
  13282. @item delta
  13283. Set value which will be added to filtered result.
  13284. @end table
  13285. @subsection Commands
  13286. This filter supports the all above options as @ref{commands}.
  13287. @section pseudocolor
  13288. Alter frame colors in video with pseudocolors.
  13289. This filter accepts the following options:
  13290. @table @option
  13291. @item c0
  13292. set pixel first component expression
  13293. @item c1
  13294. set pixel second component expression
  13295. @item c2
  13296. set pixel third component expression
  13297. @item c3
  13298. set pixel fourth component expression, corresponds to the alpha component
  13299. @item index, i
  13300. set component to use as base for altering colors
  13301. @item preset, p
  13302. Pick one of built-in LUTs. By default is set to none.
  13303. Available LUTs:
  13304. @table @samp
  13305. @item magma
  13306. @item inferno
  13307. @item plasma
  13308. @item viridis
  13309. @item turbo
  13310. @item cividis
  13311. @item range1
  13312. @item range2
  13313. @item shadows
  13314. @item highlights
  13315. @item solar
  13316. @item nominal
  13317. @item preferred
  13318. @item total
  13319. @end table
  13320. @item opacity
  13321. Set opacity of output colors. Allowed range is from 0 to 1.
  13322. Default value is set to 1.
  13323. @end table
  13324. Each of the expression options specifies the expression to use for computing
  13325. the lookup table for the corresponding pixel component values.
  13326. The expressions can contain the following constants and functions:
  13327. @table @option
  13328. @item w
  13329. @item h
  13330. The input width and height.
  13331. @item val
  13332. The input value for the pixel component.
  13333. @item ymin, umin, vmin, amin
  13334. The minimum allowed component value.
  13335. @item ymax, umax, vmax, amax
  13336. The maximum allowed component value.
  13337. @end table
  13338. All expressions default to "val".
  13339. @subsection Commands
  13340. This filter supports the all above options as @ref{commands}.
  13341. @subsection Examples
  13342. @itemize
  13343. @item
  13344. Change too high luma values to gradient:
  13345. @example
  13346. 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'"
  13347. @end example
  13348. @end itemize
  13349. @section psnr
  13350. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  13351. Ratio) between two input videos.
  13352. This filter takes in input two input videos, the first input is
  13353. considered the "main" source and is passed unchanged to the
  13354. output. The second input is used as a "reference" video for computing
  13355. the PSNR.
  13356. Both video inputs must have the same resolution and pixel format for
  13357. this filter to work correctly. Also it assumes that both inputs
  13358. have the same number of frames, which are compared one by one.
  13359. The obtained average PSNR is printed through the logging system.
  13360. The filter stores the accumulated MSE (mean squared error) of each
  13361. frame, and at the end of the processing it is averaged across all frames
  13362. equally, and the following formula is applied to obtain the PSNR:
  13363. @example
  13364. PSNR = 10*log10(MAX^2/MSE)
  13365. @end example
  13366. Where MAX is the average of the maximum values of each component of the
  13367. image.
  13368. The description of the accepted parameters follows.
  13369. @table @option
  13370. @item stats_file, f
  13371. If specified the filter will use the named file to save the PSNR of
  13372. each individual frame. When filename equals "-" the data is sent to
  13373. standard output.
  13374. @item stats_version
  13375. Specifies which version of the stats file format to use. Details of
  13376. each format are written below.
  13377. Default value is 1.
  13378. @item stats_add_max
  13379. Determines whether the max value is output to the stats log.
  13380. Default value is 0.
  13381. Requires stats_version >= 2. If this is set and stats_version < 2,
  13382. the filter will return an error.
  13383. @end table
  13384. This filter also supports the @ref{framesync} options.
  13385. The file printed if @var{stats_file} is selected, contains a sequence of
  13386. key/value pairs of the form @var{key}:@var{value} for each compared
  13387. couple of frames.
  13388. If a @var{stats_version} greater than 1 is specified, a header line precedes
  13389. the list of per-frame-pair stats, with key value pairs following the frame
  13390. format with the following parameters:
  13391. @table @option
  13392. @item psnr_log_version
  13393. The version of the log file format. Will match @var{stats_version}.
  13394. @item fields
  13395. A comma separated list of the per-frame-pair parameters included in
  13396. the log.
  13397. @end table
  13398. A description of each shown per-frame-pair parameter follows:
  13399. @table @option
  13400. @item n
  13401. sequential number of the input frame, starting from 1
  13402. @item mse_avg
  13403. Mean Square Error pixel-by-pixel average difference of the compared
  13404. frames, averaged over all the image components.
  13405. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  13406. Mean Square Error pixel-by-pixel average difference of the compared
  13407. frames for the component specified by the suffix.
  13408. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  13409. Peak Signal to Noise ratio of the compared frames for the component
  13410. specified by the suffix.
  13411. @item max_avg, max_y, max_u, max_v
  13412. Maximum allowed value for each channel, and average over all
  13413. channels.
  13414. @end table
  13415. @subsection Examples
  13416. @itemize
  13417. @item
  13418. For example:
  13419. @example
  13420. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  13421. [main][ref] psnr="stats_file=stats.log" [out]
  13422. @end example
  13423. On this example the input file being processed is compared with the
  13424. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  13425. is stored in @file{stats.log}.
  13426. @item
  13427. Another example with different containers:
  13428. @example
  13429. ffmpeg -i main.mpg -i ref.mkv -lavfi "[0:v]settb=AVTB,setpts=PTS-STARTPTS[main];[1:v]settb=AVTB,setpts=PTS-STARTPTS[ref];[main][ref]psnr" -f null -
  13430. @end example
  13431. @end itemize
  13432. @anchor{pullup}
  13433. @section pullup
  13434. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  13435. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  13436. content.
  13437. The pullup filter is designed to take advantage of future context in making
  13438. its decisions. This filter is stateless in the sense that it does not lock
  13439. onto a pattern to follow, but it instead looks forward to the following
  13440. fields in order to identify matches and rebuild progressive frames.
  13441. To produce content with an even framerate, insert the fps filter after
  13442. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  13443. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  13444. The filter accepts the following options:
  13445. @table @option
  13446. @item jl
  13447. @item jr
  13448. @item jt
  13449. @item jb
  13450. These options set the amount of "junk" to ignore at the left, right, top, and
  13451. bottom of the image, respectively. Left and right are in units of 8 pixels,
  13452. while top and bottom are in units of 2 lines.
  13453. The default is 8 pixels on each side.
  13454. @item sb
  13455. Set the strict breaks. Setting this option to 1 will reduce the chances of
  13456. filter generating an occasional mismatched frame, but it may also cause an
  13457. excessive number of frames to be dropped during high motion sequences.
  13458. Conversely, setting it to -1 will make filter match fields more easily.
  13459. This may help processing of video where there is slight blurring between
  13460. the fields, but may also cause there to be interlaced frames in the output.
  13461. Default value is @code{0}.
  13462. @item mp
  13463. Set the metric plane to use. It accepts the following values:
  13464. @table @samp
  13465. @item l
  13466. Use luma plane.
  13467. @item u
  13468. Use chroma blue plane.
  13469. @item v
  13470. Use chroma red plane.
  13471. @end table
  13472. This option may be set to use chroma plane instead of the default luma plane
  13473. for doing filter's computations. This may improve accuracy on very clean
  13474. source material, but more likely will decrease accuracy, especially if there
  13475. is chroma noise (rainbow effect) or any grayscale video.
  13476. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  13477. load and make pullup usable in realtime on slow machines.
  13478. @end table
  13479. For best results (without duplicated frames in the output file) it is
  13480. necessary to change the output frame rate. For example, to inverse
  13481. telecine NTSC input:
  13482. @example
  13483. ffmpeg -i input -vf pullup -r 24000/1001 ...
  13484. @end example
  13485. @section qp
  13486. Change video quantization parameters (QP).
  13487. The filter accepts the following option:
  13488. @table @option
  13489. @item qp
  13490. Set expression for quantization parameter.
  13491. @end table
  13492. The expression is evaluated through the eval API and can contain, among others,
  13493. the following constants:
  13494. @table @var
  13495. @item known
  13496. 1 if index is not 129, 0 otherwise.
  13497. @item qp
  13498. Sequential index starting from -129 to 128.
  13499. @end table
  13500. @subsection Examples
  13501. @itemize
  13502. @item
  13503. Some equation like:
  13504. @example
  13505. qp=2+2*sin(PI*qp)
  13506. @end example
  13507. @end itemize
  13508. @section random
  13509. Flush video frames from internal cache of frames into a random order.
  13510. No frame is discarded.
  13511. Inspired by @ref{frei0r} nervous filter.
  13512. @table @option
  13513. @item frames
  13514. Set size in number of frames of internal cache, in range from @code{2} to
  13515. @code{512}. Default is @code{30}.
  13516. @item seed
  13517. Set seed for random number generator, must be an integer included between
  13518. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  13519. less than @code{0}, the filter will try to use a good random seed on a
  13520. best effort basis.
  13521. @end table
  13522. @section readeia608
  13523. Read closed captioning (EIA-608) information from the top lines of a video frame.
  13524. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  13525. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  13526. with EIA-608 data (starting from 0). A description of each metadata value follows:
  13527. @table @option
  13528. @item lavfi.readeia608.X.cc
  13529. The two bytes stored as EIA-608 data (printed in hexadecimal).
  13530. @item lavfi.readeia608.X.line
  13531. The number of the line on which the EIA-608 data was identified and read.
  13532. @end table
  13533. This filter accepts the following options:
  13534. @table @option
  13535. @item scan_min
  13536. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  13537. @item scan_max
  13538. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  13539. @item spw
  13540. Set the ratio of width reserved for sync code detection.
  13541. Default is @code{0.27}. Allowed range is @code{[0.1 - 0.7]}.
  13542. @item chp
  13543. Enable checking the parity bit. In the event of a parity error, the filter will output
  13544. @code{0x00} for that character. Default is false.
  13545. @item lp
  13546. Lowpass lines prior to further processing. Default is enabled.
  13547. @end table
  13548. @subsection Commands
  13549. This filter supports the all above options as @ref{commands}.
  13550. @subsection Examples
  13551. @itemize
  13552. @item
  13553. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  13554. @example
  13555. ffprobe -f lavfi -i movie=captioned_video.mov,readeia608 -show_entries frame=pts_time:frame_tags=lavfi.readeia608.0.cc,lavfi.readeia608.1.cc -of csv
  13556. @end example
  13557. @end itemize
  13558. @section readvitc
  13559. Read vertical interval timecode (VITC) information from the top lines of a
  13560. video frame.
  13561. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  13562. timecode value, if a valid timecode has been detected. Further metadata key
  13563. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  13564. timecode data has been found or not.
  13565. This filter accepts the following options:
  13566. @table @option
  13567. @item scan_max
  13568. Set the maximum number of lines to scan for VITC data. If the value is set to
  13569. @code{-1} the full video frame is scanned. Default is @code{45}.
  13570. @item thr_b
  13571. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  13572. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  13573. @item thr_w
  13574. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  13575. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  13576. @end table
  13577. @subsection Examples
  13578. @itemize
  13579. @item
  13580. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  13581. draw @code{--:--:--:--} as a placeholder:
  13582. @example
  13583. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  13584. @end example
  13585. @end itemize
  13586. @section remap
  13587. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  13588. Destination pixel at position (X, Y) will be picked from source (x, y) position
  13589. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  13590. value for pixel will be used for destination pixel.
  13591. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  13592. will have Xmap/Ymap video stream dimensions.
  13593. Xmap and Ymap input video streams are 16bit depth, single channel.
  13594. @table @option
  13595. @item format
  13596. Specify pixel format of output from this filter. Can be @code{color} or @code{gray}.
  13597. Default is @code{color}.
  13598. @item fill
  13599. Specify the color of the unmapped pixels. For the syntax of this option,
  13600. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  13601. manual,ffmpeg-utils}. Default color is @code{black}.
  13602. @end table
  13603. @section removegrain
  13604. The removegrain filter is a spatial denoiser for progressive video.
  13605. @table @option
  13606. @item m0
  13607. Set mode for the first plane.
  13608. @item m1
  13609. Set mode for the second plane.
  13610. @item m2
  13611. Set mode for the third plane.
  13612. @item m3
  13613. Set mode for the fourth plane.
  13614. @end table
  13615. Range of mode is from 0 to 24. Description of each mode follows:
  13616. @table @var
  13617. @item 0
  13618. Leave input plane unchanged. Default.
  13619. @item 1
  13620. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  13621. @item 2
  13622. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  13623. @item 3
  13624. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  13625. @item 4
  13626. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  13627. This is equivalent to a median filter.
  13628. @item 5
  13629. Line-sensitive clipping giving the minimal change.
  13630. @item 6
  13631. Line-sensitive clipping, intermediate.
  13632. @item 7
  13633. Line-sensitive clipping, intermediate.
  13634. @item 8
  13635. Line-sensitive clipping, intermediate.
  13636. @item 9
  13637. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  13638. @item 10
  13639. Replaces the target pixel with the closest neighbour.
  13640. @item 11
  13641. [1 2 1] horizontal and vertical kernel blur.
  13642. @item 12
  13643. Same as mode 11.
  13644. @item 13
  13645. Bob mode, interpolates top field from the line where the neighbours
  13646. pixels are the closest.
  13647. @item 14
  13648. Bob mode, interpolates bottom field from the line where the neighbours
  13649. pixels are the closest.
  13650. @item 15
  13651. Bob mode, interpolates top field. Same as 13 but with a more complicated
  13652. interpolation formula.
  13653. @item 16
  13654. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  13655. interpolation formula.
  13656. @item 17
  13657. Clips the pixel with the minimum and maximum of respectively the maximum and
  13658. minimum of each pair of opposite neighbour pixels.
  13659. @item 18
  13660. Line-sensitive clipping using opposite neighbours whose greatest distance from
  13661. the current pixel is minimal.
  13662. @item 19
  13663. Replaces the pixel with the average of its 8 neighbours.
  13664. @item 20
  13665. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  13666. @item 21
  13667. Clips pixels using the averages of opposite neighbour.
  13668. @item 22
  13669. Same as mode 21 but simpler and faster.
  13670. @item 23
  13671. Small edge and halo removal, but reputed useless.
  13672. @item 24
  13673. Similar as 23.
  13674. @end table
  13675. @section removelogo
  13676. Suppress a TV station logo, using an image file to determine which
  13677. pixels comprise the logo. It works by filling in the pixels that
  13678. comprise the logo with neighboring pixels.
  13679. The filter accepts the following options:
  13680. @table @option
  13681. @item filename, f
  13682. Set the filter bitmap file, which can be any image format supported by
  13683. libavformat. The width and height of the image file must match those of the
  13684. video stream being processed.
  13685. @end table
  13686. Pixels in the provided bitmap image with a value of zero are not
  13687. considered part of the logo, non-zero pixels are considered part of
  13688. the logo. If you use white (255) for the logo and black (0) for the
  13689. rest, you will be safe. For making the filter bitmap, it is
  13690. recommended to take a screen capture of a black frame with the logo
  13691. visible, and then using a threshold filter followed by the erode
  13692. filter once or twice.
  13693. If needed, little splotches can be fixed manually. Remember that if
  13694. logo pixels are not covered, the filter quality will be much
  13695. reduced. Marking too many pixels as part of the logo does not hurt as
  13696. much, but it will increase the amount of blurring needed to cover over
  13697. the image and will destroy more information than necessary, and extra
  13698. pixels will slow things down on a large logo.
  13699. @section repeatfields
  13700. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  13701. fields based on its value.
  13702. @section reverse
  13703. Reverse a video clip.
  13704. Warning: This filter requires memory to buffer the entire clip, so trimming
  13705. is suggested.
  13706. @subsection Examples
  13707. @itemize
  13708. @item
  13709. Take the first 5 seconds of a clip, and reverse it.
  13710. @example
  13711. trim=end=5,reverse
  13712. @end example
  13713. @end itemize
  13714. @section rgbashift
  13715. Shift R/G/B/A pixels horizontally and/or vertically.
  13716. The filter accepts the following options:
  13717. @table @option
  13718. @item rh
  13719. Set amount to shift red horizontally.
  13720. @item rv
  13721. Set amount to shift red vertically.
  13722. @item gh
  13723. Set amount to shift green horizontally.
  13724. @item gv
  13725. Set amount to shift green vertically.
  13726. @item bh
  13727. Set amount to shift blue horizontally.
  13728. @item bv
  13729. Set amount to shift blue vertically.
  13730. @item ah
  13731. Set amount to shift alpha horizontally.
  13732. @item av
  13733. Set amount to shift alpha vertically.
  13734. @item edge
  13735. Set edge mode, can be @var{smear}, default, or @var{warp}.
  13736. @end table
  13737. @subsection Commands
  13738. This filter supports the all above options as @ref{commands}.
  13739. @section roberts
  13740. Apply roberts cross operator to input video stream.
  13741. The filter accepts the following option:
  13742. @table @option
  13743. @item planes
  13744. Set which planes will be processed, unprocessed planes will be copied.
  13745. By default value 0xf, all planes will be processed.
  13746. @item scale
  13747. Set value which will be multiplied with filtered result.
  13748. @item delta
  13749. Set value which will be added to filtered result.
  13750. @end table
  13751. @subsection Commands
  13752. This filter supports the all above options as @ref{commands}.
  13753. @section rotate
  13754. Rotate video by an arbitrary angle expressed in radians.
  13755. The filter accepts the following options:
  13756. A description of the optional parameters follows.
  13757. @table @option
  13758. @item angle, a
  13759. Set an expression for the angle by which to rotate the input video
  13760. clockwise, expressed as a number of radians. A negative value will
  13761. result in a counter-clockwise rotation. By default it is set to "0".
  13762. This expression is evaluated for each frame.
  13763. @item out_w, ow
  13764. Set the output width expression, default value is "iw".
  13765. This expression is evaluated just once during configuration.
  13766. @item out_h, oh
  13767. Set the output height expression, default value is "ih".
  13768. This expression is evaluated just once during configuration.
  13769. @item bilinear
  13770. Enable bilinear interpolation if set to 1, a value of 0 disables
  13771. it. Default value is 1.
  13772. @item fillcolor, c
  13773. Set the color used to fill the output area not covered by the rotated
  13774. image. For the general syntax of this option, check the
  13775. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13776. If the special value "none" is selected then no
  13777. background is printed (useful for example if the background is never shown).
  13778. Default value is "black".
  13779. @end table
  13780. The expressions for the angle and the output size can contain the
  13781. following constants and functions:
  13782. @table @option
  13783. @item n
  13784. sequential number of the input frame, starting from 0. It is always NAN
  13785. before the first frame is filtered.
  13786. @item t
  13787. time in seconds of the input frame, it is set to 0 when the filter is
  13788. configured. It is always NAN before the first frame is filtered.
  13789. @item hsub
  13790. @item vsub
  13791. horizontal and vertical chroma subsample values. For example for the
  13792. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13793. @item in_w, iw
  13794. @item in_h, ih
  13795. the input video width and height
  13796. @item out_w, ow
  13797. @item out_h, oh
  13798. the output width and height, that is the size of the padded area as
  13799. specified by the @var{width} and @var{height} expressions
  13800. @item rotw(a)
  13801. @item roth(a)
  13802. the minimal width/height required for completely containing the input
  13803. video rotated by @var{a} radians.
  13804. These are only available when computing the @option{out_w} and
  13805. @option{out_h} expressions.
  13806. @end table
  13807. @subsection Examples
  13808. @itemize
  13809. @item
  13810. Rotate the input by PI/6 radians clockwise:
  13811. @example
  13812. rotate=PI/6
  13813. @end example
  13814. @item
  13815. Rotate the input by PI/6 radians counter-clockwise:
  13816. @example
  13817. rotate=-PI/6
  13818. @end example
  13819. @item
  13820. Rotate the input by 45 degrees clockwise:
  13821. @example
  13822. rotate=45*PI/180
  13823. @end example
  13824. @item
  13825. Apply a constant rotation with period T, starting from an angle of PI/3:
  13826. @example
  13827. rotate=PI/3+2*PI*t/T
  13828. @end example
  13829. @item
  13830. Make the input video rotation oscillating with a period of T
  13831. seconds and an amplitude of A radians:
  13832. @example
  13833. rotate=A*sin(2*PI/T*t)
  13834. @end example
  13835. @item
  13836. Rotate the video, output size is chosen so that the whole rotating
  13837. input video is always completely contained in the output:
  13838. @example
  13839. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  13840. @end example
  13841. @item
  13842. Rotate the video, reduce the output size so that no background is ever
  13843. shown:
  13844. @example
  13845. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  13846. @end example
  13847. @end itemize
  13848. @subsection Commands
  13849. The filter supports the following commands:
  13850. @table @option
  13851. @item a, angle
  13852. Set the angle expression.
  13853. The command accepts the same syntax of the corresponding option.
  13854. If the specified expression is not valid, it is kept at its current
  13855. value.
  13856. @end table
  13857. @section sab
  13858. Apply Shape Adaptive Blur.
  13859. The filter accepts the following options:
  13860. @table @option
  13861. @item luma_radius, lr
  13862. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  13863. value is 1.0. A greater value will result in a more blurred image, and
  13864. in slower processing.
  13865. @item luma_pre_filter_radius, lpfr
  13866. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  13867. value is 1.0.
  13868. @item luma_strength, ls
  13869. Set luma maximum difference between pixels to still be considered, must
  13870. be a value in the 0.1-100.0 range, default value is 1.0.
  13871. @item chroma_radius, cr
  13872. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  13873. greater value will result in a more blurred image, and in slower
  13874. processing.
  13875. @item chroma_pre_filter_radius, cpfr
  13876. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  13877. @item chroma_strength, cs
  13878. Set chroma maximum difference between pixels to still be considered,
  13879. must be a value in the -0.9-100.0 range.
  13880. @end table
  13881. Each chroma option value, if not explicitly specified, is set to the
  13882. corresponding luma option value.
  13883. @anchor{scale}
  13884. @section scale
  13885. Scale (resize) the input video, using the libswscale library.
  13886. The scale filter forces the output display aspect ratio to be the same
  13887. of the input, by changing the output sample aspect ratio.
  13888. If the input image format is different from the format requested by
  13889. the next filter, the scale filter will convert the input to the
  13890. requested format.
  13891. @subsection Options
  13892. The filter accepts the following options, or any of the options
  13893. supported by the libswscale scaler.
  13894. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  13895. the complete list of scaler options.
  13896. @table @option
  13897. @item width, w
  13898. @item height, h
  13899. Set the output video dimension expression. Default value is the input
  13900. dimension.
  13901. If the @var{width} or @var{w} value is 0, the input width is used for
  13902. the output. If the @var{height} or @var{h} value is 0, the input height
  13903. is used for the output.
  13904. If one and only one of the values is -n with n >= 1, the scale filter
  13905. will use a value that maintains the aspect ratio of the input image,
  13906. calculated from the other specified dimension. After that it will,
  13907. however, make sure that the calculated dimension is divisible by n and
  13908. adjust the value if necessary.
  13909. If both values are -n with n >= 1, the behavior will be identical to
  13910. both values being set to 0 as previously detailed.
  13911. See below for the list of accepted constants for use in the dimension
  13912. expression.
  13913. @item eval
  13914. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  13915. @table @samp
  13916. @item init
  13917. Only evaluate expressions once during the filter initialization or when a command is processed.
  13918. @item frame
  13919. Evaluate expressions for each incoming frame.
  13920. @end table
  13921. Default value is @samp{init}.
  13922. @item interl
  13923. Set the interlacing mode. It accepts the following values:
  13924. @table @samp
  13925. @item 1
  13926. Force interlaced aware scaling.
  13927. @item 0
  13928. Do not apply interlaced scaling.
  13929. @item -1
  13930. Select interlaced aware scaling depending on whether the source frames
  13931. are flagged as interlaced or not.
  13932. @end table
  13933. Default value is @samp{0}.
  13934. @item flags
  13935. Set libswscale scaling flags. See
  13936. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  13937. complete list of values. If not explicitly specified the filter applies
  13938. the default flags.
  13939. @item param0, param1
  13940. Set libswscale input parameters for scaling algorithms that need them. See
  13941. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  13942. complete documentation. If not explicitly specified the filter applies
  13943. empty parameters.
  13944. @item size, s
  13945. Set the video size. For the syntax of this option, check the
  13946. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13947. @item in_color_matrix
  13948. @item out_color_matrix
  13949. Set in/output YCbCr color space type.
  13950. This allows the autodetected value to be overridden as well as allows forcing
  13951. a specific value used for the output and encoder.
  13952. If not specified, the color space type depends on the pixel format.
  13953. Possible values:
  13954. @table @samp
  13955. @item auto
  13956. Choose automatically.
  13957. @item bt709
  13958. Format conforming to International Telecommunication Union (ITU)
  13959. Recommendation BT.709.
  13960. @item fcc
  13961. Set color space conforming to the United States Federal Communications
  13962. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  13963. @item bt601
  13964. @item bt470
  13965. @item smpte170m
  13966. Set color space conforming to:
  13967. @itemize
  13968. @item
  13969. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  13970. @item
  13971. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  13972. @item
  13973. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  13974. @end itemize
  13975. @item smpte240m
  13976. Set color space conforming to SMPTE ST 240:1999.
  13977. @item bt2020
  13978. Set color space conforming to ITU-R BT.2020 non-constant luminance system.
  13979. @end table
  13980. @item in_range
  13981. @item out_range
  13982. Set in/output YCbCr sample range.
  13983. This allows the autodetected value to be overridden as well as allows forcing
  13984. a specific value used for the output and encoder. If not specified, the
  13985. range depends on the pixel format. Possible values:
  13986. @table @samp
  13987. @item auto/unknown
  13988. Choose automatically.
  13989. @item jpeg/full/pc
  13990. Set full range (0-255 in case of 8-bit luma).
  13991. @item mpeg/limited/tv
  13992. Set "MPEG" range (16-235 in case of 8-bit luma).
  13993. @end table
  13994. @item force_original_aspect_ratio
  13995. Enable decreasing or increasing output video width or height if necessary to
  13996. keep the original aspect ratio. Possible values:
  13997. @table @samp
  13998. @item disable
  13999. Scale the video as specified and disable this feature.
  14000. @item decrease
  14001. The output video dimensions will automatically be decreased if needed.
  14002. @item increase
  14003. The output video dimensions will automatically be increased if needed.
  14004. @end table
  14005. One useful instance of this option is that when you know a specific device's
  14006. maximum allowed resolution, you can use this to limit the output video to
  14007. that, while retaining the aspect ratio. For example, device A allows
  14008. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  14009. decrease) and specifying 1280x720 to the command line makes the output
  14010. 1280x533.
  14011. Please note that this is a different thing than specifying -1 for @option{w}
  14012. or @option{h}, you still need to specify the output resolution for this option
  14013. to work.
  14014. @item force_divisible_by
  14015. Ensures that both the output dimensions, width and height, are divisible by the
  14016. given integer when used together with @option{force_original_aspect_ratio}. This
  14017. works similar to using @code{-n} in the @option{w} and @option{h} options.
  14018. This option respects the value set for @option{force_original_aspect_ratio},
  14019. increasing or decreasing the resolution accordingly. The video's aspect ratio
  14020. may be slightly modified.
  14021. This option can be handy if you need to have a video fit within or exceed
  14022. a defined resolution using @option{force_original_aspect_ratio} but also have
  14023. encoder restrictions on width or height divisibility.
  14024. @end table
  14025. The values of the @option{w} and @option{h} options are expressions
  14026. containing the following constants:
  14027. @table @var
  14028. @item in_w
  14029. @item in_h
  14030. The input width and height
  14031. @item iw
  14032. @item ih
  14033. These are the same as @var{in_w} and @var{in_h}.
  14034. @item out_w
  14035. @item out_h
  14036. The output (scaled) width and height
  14037. @item ow
  14038. @item oh
  14039. These are the same as @var{out_w} and @var{out_h}
  14040. @item a
  14041. The same as @var{iw} / @var{ih}
  14042. @item sar
  14043. input sample aspect ratio
  14044. @item dar
  14045. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  14046. @item hsub
  14047. @item vsub
  14048. horizontal and vertical input chroma subsample values. For example for the
  14049. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14050. @item ohsub
  14051. @item ovsub
  14052. horizontal and vertical output chroma subsample values. For example for the
  14053. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14054. @item n
  14055. The (sequential) number of the input frame, starting from 0.
  14056. Only available with @code{eval=frame}.
  14057. @item t
  14058. The presentation timestamp of the input frame, expressed as a number of
  14059. seconds. Only available with @code{eval=frame}.
  14060. @item pos
  14061. The position (byte offset) of the frame in the input stream, or NaN if
  14062. this information is unavailable and/or meaningless (for example in case of synthetic video).
  14063. Only available with @code{eval=frame}.
  14064. @end table
  14065. @subsection Examples
  14066. @itemize
  14067. @item
  14068. Scale the input video to a size of 200x100
  14069. @example
  14070. scale=w=200:h=100
  14071. @end example
  14072. This is equivalent to:
  14073. @example
  14074. scale=200:100
  14075. @end example
  14076. or:
  14077. @example
  14078. scale=200x100
  14079. @end example
  14080. @item
  14081. Specify a size abbreviation for the output size:
  14082. @example
  14083. scale=qcif
  14084. @end example
  14085. which can also be written as:
  14086. @example
  14087. scale=size=qcif
  14088. @end example
  14089. @item
  14090. Scale the input to 2x:
  14091. @example
  14092. scale=w=2*iw:h=2*ih
  14093. @end example
  14094. @item
  14095. The above is the same as:
  14096. @example
  14097. scale=2*in_w:2*in_h
  14098. @end example
  14099. @item
  14100. Scale the input to 2x with forced interlaced scaling:
  14101. @example
  14102. scale=2*iw:2*ih:interl=1
  14103. @end example
  14104. @item
  14105. Scale the input to half size:
  14106. @example
  14107. scale=w=iw/2:h=ih/2
  14108. @end example
  14109. @item
  14110. Increase the width, and set the height to the same size:
  14111. @example
  14112. scale=3/2*iw:ow
  14113. @end example
  14114. @item
  14115. Seek Greek harmony:
  14116. @example
  14117. scale=iw:1/PHI*iw
  14118. scale=ih*PHI:ih
  14119. @end example
  14120. @item
  14121. Increase the height, and set the width to 3/2 of the height:
  14122. @example
  14123. scale=w=3/2*oh:h=3/5*ih
  14124. @end example
  14125. @item
  14126. Increase the size, making the size a multiple of the chroma
  14127. subsample values:
  14128. @example
  14129. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  14130. @end example
  14131. @item
  14132. Increase the width to a maximum of 500 pixels,
  14133. keeping the same aspect ratio as the input:
  14134. @example
  14135. scale=w='min(500\, iw*3/2):h=-1'
  14136. @end example
  14137. @item
  14138. Make pixels square by combining scale and setsar:
  14139. @example
  14140. scale='trunc(ih*dar):ih',setsar=1/1
  14141. @end example
  14142. @item
  14143. Make pixels square by combining scale and setsar,
  14144. making sure the resulting resolution is even (required by some codecs):
  14145. @example
  14146. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  14147. @end example
  14148. @end itemize
  14149. @subsection Commands
  14150. This filter supports the following commands:
  14151. @table @option
  14152. @item width, w
  14153. @item height, h
  14154. Set the output video dimension expression.
  14155. The command accepts the same syntax of the corresponding option.
  14156. If the specified expression is not valid, it is kept at its current
  14157. value.
  14158. @end table
  14159. @section scale_cuda
  14160. Scale (resize) and convert (pixel format) the input video, using accelerated CUDA kernels.
  14161. Setting the output width and height works in the same way as for the @ref{scale} filter.
  14162. The filter accepts the following options:
  14163. @table @option
  14164. @item w
  14165. @item h
  14166. Set the output video dimension expression. Default value is the input dimension.
  14167. Allows for the same expressions as the @ref{scale} filter.
  14168. @item interp_algo
  14169. Sets the algorithm used for scaling:
  14170. @table @var
  14171. @item nearest
  14172. Nearest neighbour
  14173. Used by default if input parameters match the desired output.
  14174. @item bilinear
  14175. Bilinear
  14176. @item bicubic
  14177. Bicubic
  14178. This is the default.
  14179. @item lanczos
  14180. Lanczos
  14181. @end table
  14182. @item format
  14183. Controls the output pixel format. By default, or if none is specified, the input
  14184. pixel format is used.
  14185. The filter does not support converting between YUV and RGB pixel formats.
  14186. @item passthrough
  14187. If set to 0, every frame is processed, even if no conversion is neccesary.
  14188. This mode can be useful to use the filter as a buffer for a downstream
  14189. frame-consumer that exhausts the limited decoder frame pool.
  14190. If set to 1, frames are passed through as-is if they match the desired output
  14191. parameters. This is the default behaviour.
  14192. @item param
  14193. Algorithm-Specific parameter.
  14194. Affects the curves of the bicubic algorithm.
  14195. @item force_original_aspect_ratio
  14196. @item force_divisible_by
  14197. Work the same as the identical @ref{scale} filter options.
  14198. @end table
  14199. @subsection Examples
  14200. @itemize
  14201. @item
  14202. Scale input to 720p, keeping aspect ratio and ensuring the output is yuv420p.
  14203. @example
  14204. scale_cuda=-2:720:format=yuv420p
  14205. @end example
  14206. @item
  14207. Upscale to 4K using nearest neighbour algorithm.
  14208. @example
  14209. scale_cuda=4096:2160:interp_algo=nearest
  14210. @end example
  14211. @item
  14212. Don't do any conversion or scaling, but copy all input frames into newly allocated ones.
  14213. This can be useful to deal with a filter and encode chain that otherwise exhausts the
  14214. decoders frame pool.
  14215. @example
  14216. scale_cuda=passthrough=0
  14217. @end example
  14218. @end itemize
  14219. @anchor{scale_npp}
  14220. @section scale_npp
  14221. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  14222. format conversion on CUDA video frames. Setting the output width and height
  14223. works in the same way as for the @var{scale} filter.
  14224. The following additional options are accepted:
  14225. @table @option
  14226. @item format
  14227. The pixel format of the output CUDA frames. If set to the string "same" (the
  14228. default), the input format will be kept. Note that automatic format negotiation
  14229. and conversion is not yet supported for hardware frames
  14230. @item interp_algo
  14231. The interpolation algorithm used for resizing. One of the following:
  14232. @table @option
  14233. @item nn
  14234. Nearest neighbour.
  14235. @item linear
  14236. @item cubic
  14237. @item cubic2p_bspline
  14238. 2-parameter cubic (B=1, C=0)
  14239. @item cubic2p_catmullrom
  14240. 2-parameter cubic (B=0, C=1/2)
  14241. @item cubic2p_b05c03
  14242. 2-parameter cubic (B=1/2, C=3/10)
  14243. @item super
  14244. Supersampling
  14245. @item lanczos
  14246. @end table
  14247. @item force_original_aspect_ratio
  14248. Enable decreasing or increasing output video width or height if necessary to
  14249. keep the original aspect ratio. Possible values:
  14250. @table @samp
  14251. @item disable
  14252. Scale the video as specified and disable this feature.
  14253. @item decrease
  14254. The output video dimensions will automatically be decreased if needed.
  14255. @item increase
  14256. The output video dimensions will automatically be increased if needed.
  14257. @end table
  14258. One useful instance of this option is that when you know a specific device's
  14259. maximum allowed resolution, you can use this to limit the output video to
  14260. that, while retaining the aspect ratio. For example, device A allows
  14261. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  14262. decrease) and specifying 1280x720 to the command line makes the output
  14263. 1280x533.
  14264. Please note that this is a different thing than specifying -1 for @option{w}
  14265. or @option{h}, you still need to specify the output resolution for this option
  14266. to work.
  14267. @item force_divisible_by
  14268. Ensures that both the output dimensions, width and height, are divisible by the
  14269. given integer when used together with @option{force_original_aspect_ratio}. This
  14270. works similar to using @code{-n} in the @option{w} and @option{h} options.
  14271. This option respects the value set for @option{force_original_aspect_ratio},
  14272. increasing or decreasing the resolution accordingly. The video's aspect ratio
  14273. may be slightly modified.
  14274. This option can be handy if you need to have a video fit within or exceed
  14275. a defined resolution using @option{force_original_aspect_ratio} but also have
  14276. encoder restrictions on width or height divisibility.
  14277. @item eval
  14278. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  14279. @table @samp
  14280. @item init
  14281. Only evaluate expressions once during the filter initialization or when a command is processed.
  14282. @item frame
  14283. Evaluate expressions for each incoming frame.
  14284. @end table
  14285. @end table
  14286. The values of the @option{w} and @option{h} options are expressions
  14287. containing the following constants:
  14288. @table @var
  14289. @item in_w
  14290. @item in_h
  14291. The input width and height
  14292. @item iw
  14293. @item ih
  14294. These are the same as @var{in_w} and @var{in_h}.
  14295. @item out_w
  14296. @item out_h
  14297. The output (scaled) width and height
  14298. @item ow
  14299. @item oh
  14300. These are the same as @var{out_w} and @var{out_h}
  14301. @item a
  14302. The same as @var{iw} / @var{ih}
  14303. @item sar
  14304. input sample aspect ratio
  14305. @item dar
  14306. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  14307. @item n
  14308. The (sequential) number of the input frame, starting from 0.
  14309. Only available with @code{eval=frame}.
  14310. @item t
  14311. The presentation timestamp of the input frame, expressed as a number of
  14312. seconds. Only available with @code{eval=frame}.
  14313. @item pos
  14314. The position (byte offset) of the frame in the input stream, or NaN if
  14315. this information is unavailable and/or meaningless (for example in case of synthetic video).
  14316. Only available with @code{eval=frame}.
  14317. @end table
  14318. @section scale2ref
  14319. Scale (resize) the input video, based on a reference video.
  14320. See the scale filter for available options, scale2ref supports the same but
  14321. uses the reference video instead of the main input as basis. scale2ref also
  14322. supports the following additional constants for the @option{w} and
  14323. @option{h} options:
  14324. @table @var
  14325. @item main_w
  14326. @item main_h
  14327. The main input video's width and height
  14328. @item main_a
  14329. The same as @var{main_w} / @var{main_h}
  14330. @item main_sar
  14331. The main input video's sample aspect ratio
  14332. @item main_dar, mdar
  14333. The main input video's display aspect ratio. Calculated from
  14334. @code{(main_w / main_h) * main_sar}.
  14335. @item main_hsub
  14336. @item main_vsub
  14337. The main input video's horizontal and vertical chroma subsample values.
  14338. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  14339. is 1.
  14340. @item main_n
  14341. The (sequential) number of the main input frame, starting from 0.
  14342. Only available with @code{eval=frame}.
  14343. @item main_t
  14344. The presentation timestamp of the main input frame, expressed as a number of
  14345. seconds. Only available with @code{eval=frame}.
  14346. @item main_pos
  14347. The position (byte offset) of the frame in the main input stream, or NaN if
  14348. this information is unavailable and/or meaningless (for example in case of synthetic video).
  14349. Only available with @code{eval=frame}.
  14350. @end table
  14351. @subsection Examples
  14352. @itemize
  14353. @item
  14354. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  14355. @example
  14356. 'scale2ref[b][a];[a][b]overlay'
  14357. @end example
  14358. @item
  14359. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  14360. @example
  14361. [logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]
  14362. @end example
  14363. @end itemize
  14364. @subsection Commands
  14365. This filter supports the following commands:
  14366. @table @option
  14367. @item width, w
  14368. @item height, h
  14369. Set the output video dimension expression.
  14370. The command accepts the same syntax of the corresponding option.
  14371. If the specified expression is not valid, it is kept at its current
  14372. value.
  14373. @end table
  14374. @section scale2ref_npp
  14375. Use the NVIDIA Performance Primitives (libnpp) to scale (resize) the input
  14376. video, based on a reference video.
  14377. See the @ref{scale_npp} filter for available options, scale2ref_npp supports the same
  14378. but uses the reference video instead of the main input as basis. scale2ref_npp
  14379. also supports the following additional constants for the @option{w} and
  14380. @option{h} options:
  14381. @table @var
  14382. @item main_w
  14383. @item main_h
  14384. The main input video's width and height
  14385. @item main_a
  14386. The same as @var{main_w} / @var{main_h}
  14387. @item main_sar
  14388. The main input video's sample aspect ratio
  14389. @item main_dar, mdar
  14390. The main input video's display aspect ratio. Calculated from
  14391. @code{(main_w / main_h) * main_sar}.
  14392. @item main_n
  14393. The (sequential) number of the main input frame, starting from 0.
  14394. Only available with @code{eval=frame}.
  14395. @item main_t
  14396. The presentation timestamp of the main input frame, expressed as a number of
  14397. seconds. Only available with @code{eval=frame}.
  14398. @item main_pos
  14399. The position (byte offset) of the frame in the main input stream, or NaN if
  14400. this information is unavailable and/or meaningless (for example in case of synthetic video).
  14401. Only available with @code{eval=frame}.
  14402. @end table
  14403. @subsection Examples
  14404. @itemize
  14405. @item
  14406. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  14407. @example
  14408. 'scale2ref_npp[b][a];[a][b]overlay_cuda'
  14409. @end example
  14410. @item
  14411. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  14412. @example
  14413. [logo-in][video-in]scale2ref_npp=w=oh*mdar:h=ih/10[logo-out][video-out]
  14414. @end example
  14415. @end itemize
  14416. @section scharr
  14417. Apply scharr operator to input video stream.
  14418. The filter accepts the following option:
  14419. @table @option
  14420. @item planes
  14421. Set which planes will be processed, unprocessed planes will be copied.
  14422. By default value 0xf, all planes will be processed.
  14423. @item scale
  14424. Set value which will be multiplied with filtered result.
  14425. @item delta
  14426. Set value which will be added to filtered result.
  14427. @end table
  14428. @subsection Commands
  14429. This filter supports the all above options as @ref{commands}.
  14430. @section scroll
  14431. Scroll input video horizontally and/or vertically by constant speed.
  14432. The filter accepts the following options:
  14433. @table @option
  14434. @item horizontal, h
  14435. Set the horizontal scrolling speed. Default is 0. Allowed range is from -1 to 1.
  14436. Negative values changes scrolling direction.
  14437. @item vertical, v
  14438. Set the vertical scrolling speed. Default is 0. Allowed range is from -1 to 1.
  14439. Negative values changes scrolling direction.
  14440. @item hpos
  14441. Set the initial horizontal scrolling position. Default is 0. Allowed range is from 0 to 1.
  14442. @item vpos
  14443. Set the initial vertical scrolling position. Default is 0. Allowed range is from 0 to 1.
  14444. @end table
  14445. @subsection Commands
  14446. This filter supports the following @ref{commands}:
  14447. @table @option
  14448. @item horizontal, h
  14449. Set the horizontal scrolling speed.
  14450. @item vertical, v
  14451. Set the vertical scrolling speed.
  14452. @end table
  14453. @anchor{scdet}
  14454. @section scdet
  14455. Detect video scene change.
  14456. This filter sets frame metadata with mafd between frame, the scene score, and
  14457. forward the frame to the next filter, so they can use these metadata to detect
  14458. scene change or others.
  14459. In addition, this filter logs a message and sets frame metadata when it detects
  14460. a scene change by @option{threshold}.
  14461. @code{lavfi.scd.mafd} metadata keys are set with mafd for every frame.
  14462. @code{lavfi.scd.score} metadata keys are set with scene change score for every frame
  14463. to detect scene change.
  14464. @code{lavfi.scd.time} metadata keys are set with current filtered frame time which
  14465. detect scene change with @option{threshold}.
  14466. The filter accepts the following options:
  14467. @table @option
  14468. @item threshold, t
  14469. Set the scene change detection threshold as a percentage of maximum change. Good
  14470. values are in the @code{[8.0, 14.0]} range. The range for @option{threshold} is
  14471. @code{[0., 100.]}.
  14472. Default value is @code{10.}.
  14473. @item sc_pass, s
  14474. Set the flag to pass scene change frames to the next filter. Default value is @code{0}
  14475. You can enable it if you want to get snapshot of scene change frames only.
  14476. @end table
  14477. @anchor{selectivecolor}
  14478. @section selectivecolor
  14479. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  14480. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  14481. by the "purity" of the color (that is, how saturated it already is).
  14482. This filter is similar to the Adobe Photoshop Selective Color tool.
  14483. The filter accepts the following options:
  14484. @table @option
  14485. @item correction_method
  14486. Select color correction method.
  14487. Available values are:
  14488. @table @samp
  14489. @item absolute
  14490. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  14491. component value).
  14492. @item relative
  14493. Specified adjustments are relative to the original component value.
  14494. @end table
  14495. Default is @code{absolute}.
  14496. @item reds
  14497. Adjustments for red pixels (pixels where the red component is the maximum)
  14498. @item yellows
  14499. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  14500. @item greens
  14501. Adjustments for green pixels (pixels where the green component is the maximum)
  14502. @item cyans
  14503. Adjustments for cyan pixels (pixels where the red component is the minimum)
  14504. @item blues
  14505. Adjustments for blue pixels (pixels where the blue component is the maximum)
  14506. @item magentas
  14507. Adjustments for magenta pixels (pixels where the green component is the minimum)
  14508. @item whites
  14509. Adjustments for white pixels (pixels where all components are greater than 128)
  14510. @item neutrals
  14511. Adjustments for all pixels except pure black and pure white
  14512. @item blacks
  14513. Adjustments for black pixels (pixels where all components are lesser than 128)
  14514. @item psfile
  14515. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  14516. @end table
  14517. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  14518. 4 space separated floating point adjustment values in the [-1,1] range,
  14519. respectively to adjust the amount of cyan, magenta, yellow and black for the
  14520. pixels of its range.
  14521. @subsection Examples
  14522. @itemize
  14523. @item
  14524. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  14525. increase magenta by 27% in blue areas:
  14526. @example
  14527. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  14528. @end example
  14529. @item
  14530. Use a Photoshop selective color preset:
  14531. @example
  14532. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  14533. @end example
  14534. @end itemize
  14535. @anchor{separatefields}
  14536. @section separatefields
  14537. The @code{separatefields} takes a frame-based video input and splits
  14538. each frame into its components fields, producing a new half height clip
  14539. with twice the frame rate and twice the frame count.
  14540. This filter use field-dominance information in frame to decide which
  14541. of each pair of fields to place first in the output.
  14542. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  14543. @section setdar, setsar
  14544. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  14545. output video.
  14546. This is done by changing the specified Sample (aka Pixel) Aspect
  14547. Ratio, according to the following equation:
  14548. @example
  14549. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  14550. @end example
  14551. Keep in mind that the @code{setdar} filter does not modify the pixel
  14552. dimensions of the video frame. Also, the display aspect ratio set by
  14553. this filter may be changed by later filters in the filterchain,
  14554. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  14555. applied.
  14556. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  14557. the filter output video.
  14558. Note that as a consequence of the application of this filter, the
  14559. output display aspect ratio will change according to the equation
  14560. above.
  14561. Keep in mind that the sample aspect ratio set by the @code{setsar}
  14562. filter may be changed by later filters in the filterchain, e.g. if
  14563. another "setsar" or a "setdar" filter is applied.
  14564. It accepts the following parameters:
  14565. @table @option
  14566. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  14567. Set the aspect ratio used by the filter.
  14568. The parameter can be a floating point number string, an expression, or
  14569. a string of the form @var{num}:@var{den}, where @var{num} and
  14570. @var{den} are the numerator and denominator of the aspect ratio. If
  14571. the parameter is not specified, it is assumed the value "0".
  14572. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  14573. should be escaped.
  14574. @item max
  14575. Set the maximum integer value to use for expressing numerator and
  14576. denominator when reducing the expressed aspect ratio to a rational.
  14577. Default value is @code{100}.
  14578. @end table
  14579. The parameter @var{sar} is an expression containing
  14580. the following constants:
  14581. @table @option
  14582. @item E, PI, PHI
  14583. These are approximated values for the mathematical constants e
  14584. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  14585. @item w, h
  14586. The input width and height.
  14587. @item a
  14588. These are the same as @var{w} / @var{h}.
  14589. @item sar
  14590. The input sample aspect ratio.
  14591. @item dar
  14592. The input display aspect ratio. It is the same as
  14593. (@var{w} / @var{h}) * @var{sar}.
  14594. @item hsub, vsub
  14595. Horizontal and vertical chroma subsample values. For example, for the
  14596. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14597. @end table
  14598. @subsection Examples
  14599. @itemize
  14600. @item
  14601. To change the display aspect ratio to 16:9, specify one of the following:
  14602. @example
  14603. setdar=dar=1.77777
  14604. setdar=dar=16/9
  14605. @end example
  14606. @item
  14607. To change the sample aspect ratio to 10:11, specify:
  14608. @example
  14609. setsar=sar=10/11
  14610. @end example
  14611. @item
  14612. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  14613. 1000 in the aspect ratio reduction, use the command:
  14614. @example
  14615. setdar=ratio=16/9:max=1000
  14616. @end example
  14617. @end itemize
  14618. @anchor{setfield}
  14619. @section setfield
  14620. Force field for the output video frame.
  14621. The @code{setfield} filter marks the interlace type field for the
  14622. output frames. It does not change the input frame, but only sets the
  14623. corresponding property, which affects how the frame is treated by
  14624. following filters (e.g. @code{fieldorder} or @code{yadif}).
  14625. The filter accepts the following options:
  14626. @table @option
  14627. @item mode
  14628. Available values are:
  14629. @table @samp
  14630. @item auto
  14631. Keep the same field property.
  14632. @item bff
  14633. Mark the frame as bottom-field-first.
  14634. @item tff
  14635. Mark the frame as top-field-first.
  14636. @item prog
  14637. Mark the frame as progressive.
  14638. @end table
  14639. @end table
  14640. @anchor{setparams}
  14641. @section setparams
  14642. Force frame parameter for the output video frame.
  14643. The @code{setparams} filter marks interlace and color range for the
  14644. output frames. It does not change the input frame, but only sets the
  14645. corresponding property, which affects how the frame is treated by
  14646. filters/encoders.
  14647. @table @option
  14648. @item field_mode
  14649. Available values are:
  14650. @table @samp
  14651. @item auto
  14652. Keep the same field property (default).
  14653. @item bff
  14654. Mark the frame as bottom-field-first.
  14655. @item tff
  14656. Mark the frame as top-field-first.
  14657. @item prog
  14658. Mark the frame as progressive.
  14659. @end table
  14660. @item range
  14661. Available values are:
  14662. @table @samp
  14663. @item auto
  14664. Keep the same color range property (default).
  14665. @item unspecified, unknown
  14666. Mark the frame as unspecified color range.
  14667. @item limited, tv, mpeg
  14668. Mark the frame as limited range.
  14669. @item full, pc, jpeg
  14670. Mark the frame as full range.
  14671. @end table
  14672. @item color_primaries
  14673. Set the color primaries.
  14674. Available values are:
  14675. @table @samp
  14676. @item auto
  14677. Keep the same color primaries property (default).
  14678. @item bt709
  14679. @item unknown
  14680. @item bt470m
  14681. @item bt470bg
  14682. @item smpte170m
  14683. @item smpte240m
  14684. @item film
  14685. @item bt2020
  14686. @item smpte428
  14687. @item smpte431
  14688. @item smpte432
  14689. @item jedec-p22
  14690. @end table
  14691. @item color_trc
  14692. Set the color transfer.
  14693. Available values are:
  14694. @table @samp
  14695. @item auto
  14696. Keep the same color trc property (default).
  14697. @item bt709
  14698. @item unknown
  14699. @item bt470m
  14700. @item bt470bg
  14701. @item smpte170m
  14702. @item smpte240m
  14703. @item linear
  14704. @item log100
  14705. @item log316
  14706. @item iec61966-2-4
  14707. @item bt1361e
  14708. @item iec61966-2-1
  14709. @item bt2020-10
  14710. @item bt2020-12
  14711. @item smpte2084
  14712. @item smpte428
  14713. @item arib-std-b67
  14714. @end table
  14715. @item colorspace
  14716. Set the colorspace.
  14717. Available values are:
  14718. @table @samp
  14719. @item auto
  14720. Keep the same colorspace property (default).
  14721. @item gbr
  14722. @item bt709
  14723. @item unknown
  14724. @item fcc
  14725. @item bt470bg
  14726. @item smpte170m
  14727. @item smpte240m
  14728. @item ycgco
  14729. @item bt2020nc
  14730. @item bt2020c
  14731. @item smpte2085
  14732. @item chroma-derived-nc
  14733. @item chroma-derived-c
  14734. @item ictcp
  14735. @end table
  14736. @end table
  14737. @section sharpen_npp
  14738. Use the NVIDIA Performance Primitives (libnpp) to perform image sharpening with
  14739. border control.
  14740. The following additional options are accepted:
  14741. @table @option
  14742. @item border_type
  14743. Type of sampling to be used ad frame borders. One of the following:
  14744. @table @option
  14745. @item replicate
  14746. Replicate pixel values.
  14747. @end table
  14748. @end table
  14749. @section shear
  14750. Apply shear transform to input video.
  14751. This filter supports the following options:
  14752. @table @option
  14753. @item shx
  14754. Shear factor in X-direction. Default value is 0.
  14755. Allowed range is from -2 to 2.
  14756. @item shy
  14757. Shear factor in Y-direction. Default value is 0.
  14758. Allowed range is from -2 to 2.
  14759. @item fillcolor, c
  14760. Set the color used to fill the output area not covered by the transformed
  14761. video. For the general syntax of this option, check the
  14762. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14763. If the special value "none" is selected then no
  14764. background is printed (useful for example if the background is never shown).
  14765. Default value is "black".
  14766. @item interp
  14767. Set interpolation type. Can be @code{bilinear} or @code{nearest}. Default is @code{bilinear}.
  14768. @end table
  14769. @subsection Commands
  14770. This filter supports the all above options as @ref{commands}.
  14771. @section showinfo
  14772. Show a line containing various information for each input video frame.
  14773. The input video is not modified.
  14774. This filter supports the following options:
  14775. @table @option
  14776. @item checksum
  14777. Calculate checksums of each plane. By default enabled.
  14778. @end table
  14779. The shown line contains a sequence of key/value pairs of the form
  14780. @var{key}:@var{value}.
  14781. The following values are shown in the output:
  14782. @table @option
  14783. @item n
  14784. The (sequential) number of the input frame, starting from 0.
  14785. @item pts
  14786. The Presentation TimeStamp of the input frame, expressed as a number of
  14787. time base units. The time base unit depends on the filter input pad.
  14788. @item pts_time
  14789. The Presentation TimeStamp of the input frame, expressed as a number of
  14790. seconds.
  14791. @item pos
  14792. The position of the frame in the input stream, or -1 if this information is
  14793. unavailable and/or meaningless (for example in case of synthetic video).
  14794. @item fmt
  14795. The pixel format name.
  14796. @item sar
  14797. The sample aspect ratio of the input frame, expressed in the form
  14798. @var{num}/@var{den}.
  14799. @item s
  14800. The size of the input frame. For the syntax of this option, check the
  14801. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14802. @item i
  14803. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  14804. for bottom field first).
  14805. @item iskey
  14806. This is 1 if the frame is a key frame, 0 otherwise.
  14807. @item type
  14808. The picture type of the input frame ("I" for an I-frame, "P" for a
  14809. P-frame, "B" for a B-frame, or "?" for an unknown type).
  14810. Also refer to the documentation of the @code{AVPictureType} enum and of
  14811. the @code{av_get_picture_type_char} function defined in
  14812. @file{libavutil/avutil.h}.
  14813. @item checksum
  14814. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  14815. @item plane_checksum
  14816. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  14817. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  14818. @item mean
  14819. The mean value of pixels in each plane of the input frame, expressed in the form
  14820. "[@var{mean0} @var{mean1} @var{mean2} @var{mean3}]".
  14821. @item stdev
  14822. The standard deviation of pixel values in each plane of the input frame, expressed
  14823. in the form "[@var{stdev0} @var{stdev1} @var{stdev2} @var{stdev3}]".
  14824. @end table
  14825. @section showpalette
  14826. Displays the 256 colors palette of each frame. This filter is only relevant for
  14827. @var{pal8} pixel format frames.
  14828. It accepts the following option:
  14829. @table @option
  14830. @item s
  14831. Set the size of the box used to represent one palette color entry. Default is
  14832. @code{30} (for a @code{30x30} pixel box).
  14833. @end table
  14834. @section shuffleframes
  14835. Reorder and/or duplicate and/or drop video frames.
  14836. It accepts the following parameters:
  14837. @table @option
  14838. @item mapping
  14839. Set the destination indexes of input frames.
  14840. This is space or '|' separated list of indexes that maps input frames to output
  14841. frames. Number of indexes also sets maximal value that each index may have.
  14842. '-1' index have special meaning and that is to drop frame.
  14843. @end table
  14844. The first frame has the index 0. The default is to keep the input unchanged.
  14845. @subsection Examples
  14846. @itemize
  14847. @item
  14848. Swap second and third frame of every three frames of the input:
  14849. @example
  14850. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  14851. @end example
  14852. @item
  14853. Swap 10th and 1st frame of every ten frames of the input:
  14854. @example
  14855. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  14856. @end example
  14857. @end itemize
  14858. @section shufflepixels
  14859. Reorder pixels in video frames.
  14860. This filter accepts the following options:
  14861. @table @option
  14862. @item direction, d
  14863. Set shuffle direction. Can be forward or inverse direction.
  14864. Default direction is forward.
  14865. @item mode, m
  14866. Set shuffle mode. Can be horizontal, vertical or block mode.
  14867. @item width, w
  14868. @item height, h
  14869. Set shuffle block_size. In case of horizontal shuffle mode only width
  14870. part of size is used, and in case of vertical shuffle mode only height
  14871. part of size is used.
  14872. @item seed, s
  14873. Set random seed used with shuffling pixels. Mainly useful to set to be able
  14874. to reverse filtering process to get original input.
  14875. For example, to reverse forward shuffle you need to use same parameters
  14876. and exact same seed and to set direction to inverse.
  14877. @end table
  14878. @section shuffleplanes
  14879. Reorder and/or duplicate video planes.
  14880. It accepts the following parameters:
  14881. @table @option
  14882. @item map0
  14883. The index of the input plane to be used as the first output plane.
  14884. @item map1
  14885. The index of the input plane to be used as the second output plane.
  14886. @item map2
  14887. The index of the input plane to be used as the third output plane.
  14888. @item map3
  14889. The index of the input plane to be used as the fourth output plane.
  14890. @end table
  14891. The first plane has the index 0. The default is to keep the input unchanged.
  14892. @subsection Examples
  14893. @itemize
  14894. @item
  14895. Swap the second and third planes of the input:
  14896. @example
  14897. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  14898. @end example
  14899. @end itemize
  14900. @anchor{signalstats}
  14901. @section signalstats
  14902. Evaluate various visual metrics that assist in determining issues associated
  14903. with the digitization of analog video media.
  14904. By default the filter will log these metadata values:
  14905. @table @option
  14906. @item YMIN
  14907. Display the minimal Y value contained within the input frame. Expressed in
  14908. range of [0-255].
  14909. @item YLOW
  14910. Display the Y value at the 10% percentile within the input frame. Expressed in
  14911. range of [0-255].
  14912. @item YAVG
  14913. Display the average Y value within the input frame. Expressed in range of
  14914. [0-255].
  14915. @item YHIGH
  14916. Display the Y value at the 90% percentile within the input frame. Expressed in
  14917. range of [0-255].
  14918. @item YMAX
  14919. Display the maximum Y value contained within the input frame. Expressed in
  14920. range of [0-255].
  14921. @item UMIN
  14922. Display the minimal U value contained within the input frame. Expressed in
  14923. range of [0-255].
  14924. @item ULOW
  14925. Display the U value at the 10% percentile within the input frame. Expressed in
  14926. range of [0-255].
  14927. @item UAVG
  14928. Display the average U value within the input frame. Expressed in range of
  14929. [0-255].
  14930. @item UHIGH
  14931. Display the U value at the 90% percentile within the input frame. Expressed in
  14932. range of [0-255].
  14933. @item UMAX
  14934. Display the maximum U value contained within the input frame. Expressed in
  14935. range of [0-255].
  14936. @item VMIN
  14937. Display the minimal V value contained within the input frame. Expressed in
  14938. range of [0-255].
  14939. @item VLOW
  14940. Display the V value at the 10% percentile within the input frame. Expressed in
  14941. range of [0-255].
  14942. @item VAVG
  14943. Display the average V value within the input frame. Expressed in range of
  14944. [0-255].
  14945. @item VHIGH
  14946. Display the V value at the 90% percentile within the input frame. Expressed in
  14947. range of [0-255].
  14948. @item VMAX
  14949. Display the maximum V value contained within the input frame. Expressed in
  14950. range of [0-255].
  14951. @item SATMIN
  14952. Display the minimal saturation value contained within the input frame.
  14953. Expressed in range of [0-~181.02].
  14954. @item SATLOW
  14955. Display the saturation value at the 10% percentile within the input frame.
  14956. Expressed in range of [0-~181.02].
  14957. @item SATAVG
  14958. Display the average saturation value within the input frame. Expressed in range
  14959. of [0-~181.02].
  14960. @item SATHIGH
  14961. Display the saturation value at the 90% percentile within the input frame.
  14962. Expressed in range of [0-~181.02].
  14963. @item SATMAX
  14964. Display the maximum saturation value contained within the input frame.
  14965. Expressed in range of [0-~181.02].
  14966. @item HUEMED
  14967. Display the median value for hue within the input frame. Expressed in range of
  14968. [0-360].
  14969. @item HUEAVG
  14970. Display the average value for hue within the input frame. Expressed in range of
  14971. [0-360].
  14972. @item YDIF
  14973. Display the average of sample value difference between all values of the Y
  14974. plane in the current frame and corresponding values of the previous input frame.
  14975. Expressed in range of [0-255].
  14976. @item UDIF
  14977. Display the average of sample value difference between all values of the U
  14978. plane in the current frame and corresponding values of the previous input frame.
  14979. Expressed in range of [0-255].
  14980. @item VDIF
  14981. Display the average of sample value difference between all values of the V
  14982. plane in the current frame and corresponding values of the previous input frame.
  14983. Expressed in range of [0-255].
  14984. @item YBITDEPTH
  14985. Display bit depth of Y plane in current frame.
  14986. Expressed in range of [0-16].
  14987. @item UBITDEPTH
  14988. Display bit depth of U plane in current frame.
  14989. Expressed in range of [0-16].
  14990. @item VBITDEPTH
  14991. Display bit depth of V plane in current frame.
  14992. Expressed in range of [0-16].
  14993. @end table
  14994. The filter accepts the following options:
  14995. @table @option
  14996. @item stat
  14997. @item out
  14998. @option{stat} specify an additional form of image analysis.
  14999. @option{out} output video with the specified type of pixel highlighted.
  15000. Both options accept the following values:
  15001. @table @samp
  15002. @item tout
  15003. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  15004. unlike the neighboring pixels of the same field. Examples of temporal outliers
  15005. include the results of video dropouts, head clogs, or tape tracking issues.
  15006. @item vrep
  15007. Identify @var{vertical line repetition}. Vertical line repetition includes
  15008. similar rows of pixels within a frame. In born-digital video vertical line
  15009. repetition is common, but this pattern is uncommon in video digitized from an
  15010. analog source. When it occurs in video that results from the digitization of an
  15011. analog source it can indicate concealment from a dropout compensator.
  15012. @item brng
  15013. Identify pixels that fall outside of legal broadcast range.
  15014. @end table
  15015. @item color, c
  15016. Set the highlight color for the @option{out} option. The default color is
  15017. yellow.
  15018. @end table
  15019. @subsection Examples
  15020. @itemize
  15021. @item
  15022. Output data of various video metrics:
  15023. @example
  15024. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  15025. @end example
  15026. @item
  15027. Output specific data about the minimum and maximum values of the Y plane per frame:
  15028. @example
  15029. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  15030. @end example
  15031. @item
  15032. Playback video while highlighting pixels that are outside of broadcast range in red.
  15033. @example
  15034. ffplay example.mov -vf signalstats="out=brng:color=red"
  15035. @end example
  15036. @item
  15037. Playback video with signalstats metadata drawn over the frame.
  15038. @example
  15039. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  15040. @end example
  15041. The contents of signalstat_drawtext.txt used in the command are:
  15042. @example
  15043. time %@{pts:hms@}
  15044. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  15045. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  15046. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  15047. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  15048. @end example
  15049. @end itemize
  15050. @anchor{signature}
  15051. @section signature
  15052. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  15053. input. In this case the matching between the inputs can be calculated additionally.
  15054. The filter always passes through the first input. The signature of each stream can
  15055. be written into a file.
  15056. It accepts the following options:
  15057. @table @option
  15058. @item detectmode
  15059. Enable or disable the matching process.
  15060. Available values are:
  15061. @table @samp
  15062. @item off
  15063. Disable the calculation of a matching (default).
  15064. @item full
  15065. Calculate the matching for the whole video and output whether the whole video
  15066. matches or only parts.
  15067. @item fast
  15068. Calculate only until a matching is found or the video ends. Should be faster in
  15069. some cases.
  15070. @end table
  15071. @item nb_inputs
  15072. Set the number of inputs. The option value must be a non negative integer.
  15073. Default value is 1.
  15074. @item filename
  15075. Set the path to which the output is written. If there is more than one input,
  15076. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  15077. integer), that will be replaced with the input number. If no filename is
  15078. specified, no output will be written. This is the default.
  15079. @item format
  15080. Choose the output format.
  15081. Available values are:
  15082. @table @samp
  15083. @item binary
  15084. Use the specified binary representation (default).
  15085. @item xml
  15086. Use the specified xml representation.
  15087. @end table
  15088. @item th_d
  15089. Set threshold to detect one word as similar. The option value must be an integer
  15090. greater than zero. The default value is 9000.
  15091. @item th_dc
  15092. Set threshold to detect all words as similar. The option value must be an integer
  15093. greater than zero. The default value is 60000.
  15094. @item th_xh
  15095. Set threshold to detect frames as similar. The option value must be an integer
  15096. greater than zero. The default value is 116.
  15097. @item th_di
  15098. Set the minimum length of a sequence in frames to recognize it as matching
  15099. sequence. The option value must be a non negative integer value.
  15100. The default value is 0.
  15101. @item th_it
  15102. Set the minimum relation, that matching frames to all frames must have.
  15103. The option value must be a double value between 0 and 1. The default value is 0.5.
  15104. @end table
  15105. @subsection Examples
  15106. @itemize
  15107. @item
  15108. To calculate the signature of an input video and store it in signature.bin:
  15109. @example
  15110. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  15111. @end example
  15112. @item
  15113. To detect whether two videos match and store the signatures in XML format in
  15114. signature0.xml and signature1.xml:
  15115. @example
  15116. 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 -
  15117. @end example
  15118. @end itemize
  15119. @anchor{smartblur}
  15120. @section smartblur
  15121. Blur the input video without impacting the outlines.
  15122. It accepts the following options:
  15123. @table @option
  15124. @item luma_radius, lr
  15125. Set the luma radius. The option value must be a float number in
  15126. the range [0.1,5.0] that specifies the variance of the gaussian filter
  15127. used to blur the image (slower if larger). Default value is 1.0.
  15128. @item luma_strength, ls
  15129. Set the luma strength. The option value must be a float number
  15130. in the range [-1.0,1.0] that configures the blurring. A value included
  15131. in [0.0,1.0] will blur the image whereas a value included in
  15132. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  15133. @item luma_threshold, lt
  15134. Set the luma threshold used as a coefficient to determine
  15135. whether a pixel should be blurred or not. The option value must be an
  15136. integer in the range [-30,30]. A value of 0 will filter all the image,
  15137. a value included in [0,30] will filter flat areas and a value included
  15138. in [-30,0] will filter edges. Default value is 0.
  15139. @item chroma_radius, cr
  15140. Set the chroma radius. The option value must be a float number in
  15141. the range [0.1,5.0] that specifies the variance of the gaussian filter
  15142. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  15143. @item chroma_strength, cs
  15144. Set the chroma strength. The option value must be a float number
  15145. in the range [-1.0,1.0] that configures the blurring. A value included
  15146. in [0.0,1.0] will blur the image whereas a value included in
  15147. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  15148. @item chroma_threshold, ct
  15149. Set the chroma threshold used as a coefficient to determine
  15150. whether a pixel should be blurred or not. The option value must be an
  15151. integer in the range [-30,30]. A value of 0 will filter all the image,
  15152. a value included in [0,30] will filter flat areas and a value included
  15153. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  15154. @end table
  15155. If a chroma option is not explicitly set, the corresponding luma value
  15156. is set.
  15157. @section sobel
  15158. Apply sobel operator to input video stream.
  15159. The filter accepts the following option:
  15160. @table @option
  15161. @item planes
  15162. Set which planes will be processed, unprocessed planes will be copied.
  15163. By default value 0xf, all planes will be processed.
  15164. @item scale
  15165. Set value which will be multiplied with filtered result.
  15166. @item delta
  15167. Set value which will be added to filtered result.
  15168. @end table
  15169. @subsection Commands
  15170. This filter supports the all above options as @ref{commands}.
  15171. @anchor{spp}
  15172. @section spp
  15173. Apply a simple postprocessing filter that compresses and decompresses the image
  15174. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  15175. and average the results.
  15176. The filter accepts the following options:
  15177. @table @option
  15178. @item quality
  15179. Set quality. This option defines the number of levels for averaging. It accepts
  15180. an integer in the range 0-6. If set to @code{0}, the filter will have no
  15181. effect. A value of @code{6} means the higher quality. For each increment of
  15182. that value the speed drops by a factor of approximately 2. Default value is
  15183. @code{3}.
  15184. @item qp
  15185. Force a constant quantization parameter. If not set, the filter will use the QP
  15186. from the video stream (if available).
  15187. @item mode
  15188. Set thresholding mode. Available modes are:
  15189. @table @samp
  15190. @item hard
  15191. Set hard thresholding (default).
  15192. @item soft
  15193. Set soft thresholding (better de-ringing effect, but likely blurrier).
  15194. @end table
  15195. @item use_bframe_qp
  15196. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  15197. option may cause flicker since the B-Frames have often larger QP. Default is
  15198. @code{0} (not enabled).
  15199. @end table
  15200. @subsection Commands
  15201. This filter supports the following commands:
  15202. @table @option
  15203. @item quality, level
  15204. Set quality level. The value @code{max} can be used to set the maximum level,
  15205. currently @code{6}.
  15206. @end table
  15207. @anchor{sr}
  15208. @section sr
  15209. Scale the input by applying one of the super-resolution methods based on
  15210. convolutional neural networks. Supported models:
  15211. @itemize
  15212. @item
  15213. Super-Resolution Convolutional Neural Network model (SRCNN).
  15214. See @url{https://arxiv.org/abs/1501.00092}.
  15215. @item
  15216. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  15217. See @url{https://arxiv.org/abs/1609.05158}.
  15218. @end itemize
  15219. Training scripts as well as scripts for model file (.pb) saving can be found at
  15220. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  15221. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  15222. Native model files (.model) can be generated from TensorFlow model
  15223. files (.pb) by using tools/python/convert.py
  15224. The filter accepts the following options:
  15225. @table @option
  15226. @item dnn_backend
  15227. Specify which DNN backend to use for model loading and execution. This option accepts
  15228. the following values:
  15229. @table @samp
  15230. @item native
  15231. Native implementation of DNN loading and execution.
  15232. @item tensorflow
  15233. TensorFlow backend. To enable this backend you
  15234. need to install the TensorFlow for C library (see
  15235. @url{https://www.tensorflow.org/install/lang_c}) and configure FFmpeg with
  15236. @code{--enable-libtensorflow}
  15237. @end table
  15238. Default value is @samp{native}.
  15239. @item model
  15240. Set path to model file specifying network architecture and its parameters.
  15241. Note that different backends use different file formats. TensorFlow backend
  15242. can load files for both formats, while native backend can load files for only
  15243. its format.
  15244. @item scale_factor
  15245. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  15246. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  15247. input upscaled using bicubic upscaling with proper scale factor.
  15248. @end table
  15249. To get full functionality (such as async execution), please use the @ref{dnn_processing} filter.
  15250. @section ssim
  15251. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  15252. This filter takes in input two input videos, the first input is
  15253. considered the "main" source and is passed unchanged to the
  15254. output. The second input is used as a "reference" video for computing
  15255. the SSIM.
  15256. Both video inputs must have the same resolution and pixel format for
  15257. this filter to work correctly. Also it assumes that both inputs
  15258. have the same number of frames, which are compared one by one.
  15259. The filter stores the calculated SSIM of each frame.
  15260. The description of the accepted parameters follows.
  15261. @table @option
  15262. @item stats_file, f
  15263. If specified the filter will use the named file to save the SSIM of
  15264. each individual frame. When filename equals "-" the data is sent to
  15265. standard output.
  15266. @end table
  15267. The file printed if @var{stats_file} is selected, contains a sequence of
  15268. key/value pairs of the form @var{key}:@var{value} for each compared
  15269. couple of frames.
  15270. A description of each shown parameter follows:
  15271. @table @option
  15272. @item n
  15273. sequential number of the input frame, starting from 1
  15274. @item Y, U, V, R, G, B
  15275. SSIM of the compared frames for the component specified by the suffix.
  15276. @item All
  15277. SSIM of the compared frames for the whole frame.
  15278. @item dB
  15279. Same as above but in dB representation.
  15280. @end table
  15281. This filter also supports the @ref{framesync} options.
  15282. @subsection Examples
  15283. @itemize
  15284. @item
  15285. For example:
  15286. @example
  15287. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  15288. [main][ref] ssim="stats_file=stats.log" [out]
  15289. @end example
  15290. On this example the input file being processed is compared with the
  15291. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  15292. is stored in @file{stats.log}.
  15293. @item
  15294. Another example with both psnr and ssim at same time:
  15295. @example
  15296. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  15297. @end example
  15298. @item
  15299. Another example with different containers:
  15300. @example
  15301. ffmpeg -i main.mpg -i ref.mkv -lavfi "[0:v]settb=AVTB,setpts=PTS-STARTPTS[main];[1:v]settb=AVTB,setpts=PTS-STARTPTS[ref];[main][ref]ssim" -f null -
  15302. @end example
  15303. @end itemize
  15304. @section stereo3d
  15305. Convert between different stereoscopic image formats.
  15306. The filters accept the following options:
  15307. @table @option
  15308. @item in
  15309. Set stereoscopic image format of input.
  15310. Available values for input image formats are:
  15311. @table @samp
  15312. @item sbsl
  15313. side by side parallel (left eye left, right eye right)
  15314. @item sbsr
  15315. side by side crosseye (right eye left, left eye right)
  15316. @item sbs2l
  15317. side by side parallel with half width resolution
  15318. (left eye left, right eye right)
  15319. @item sbs2r
  15320. side by side crosseye with half width resolution
  15321. (right eye left, left eye right)
  15322. @item abl
  15323. @item tbl
  15324. above-below (left eye above, right eye below)
  15325. @item abr
  15326. @item tbr
  15327. above-below (right eye above, left eye below)
  15328. @item ab2l
  15329. @item tb2l
  15330. above-below with half height resolution
  15331. (left eye above, right eye below)
  15332. @item ab2r
  15333. @item tb2r
  15334. above-below with half height resolution
  15335. (right eye above, left eye below)
  15336. @item al
  15337. alternating frames (left eye first, right eye second)
  15338. @item ar
  15339. alternating frames (right eye first, left eye second)
  15340. @item irl
  15341. interleaved rows (left eye has top row, right eye starts on next row)
  15342. @item irr
  15343. interleaved rows (right eye has top row, left eye starts on next row)
  15344. @item icl
  15345. interleaved columns, left eye first
  15346. @item icr
  15347. interleaved columns, right eye first
  15348. Default value is @samp{sbsl}.
  15349. @end table
  15350. @item out
  15351. Set stereoscopic image format of output.
  15352. @table @samp
  15353. @item sbsl
  15354. side by side parallel (left eye left, right eye right)
  15355. @item sbsr
  15356. side by side crosseye (right eye left, left eye right)
  15357. @item sbs2l
  15358. side by side parallel with half width resolution
  15359. (left eye left, right eye right)
  15360. @item sbs2r
  15361. side by side crosseye with half width resolution
  15362. (right eye left, left eye right)
  15363. @item abl
  15364. @item tbl
  15365. above-below (left eye above, right eye below)
  15366. @item abr
  15367. @item tbr
  15368. above-below (right eye above, left eye below)
  15369. @item ab2l
  15370. @item tb2l
  15371. above-below with half height resolution
  15372. (left eye above, right eye below)
  15373. @item ab2r
  15374. @item tb2r
  15375. above-below with half height resolution
  15376. (right eye above, left eye below)
  15377. @item al
  15378. alternating frames (left eye first, right eye second)
  15379. @item ar
  15380. alternating frames (right eye first, left eye second)
  15381. @item irl
  15382. interleaved rows (left eye has top row, right eye starts on next row)
  15383. @item irr
  15384. interleaved rows (right eye has top row, left eye starts on next row)
  15385. @item arbg
  15386. anaglyph red/blue gray
  15387. (red filter on left eye, blue filter on right eye)
  15388. @item argg
  15389. anaglyph red/green gray
  15390. (red filter on left eye, green filter on right eye)
  15391. @item arcg
  15392. anaglyph red/cyan gray
  15393. (red filter on left eye, cyan filter on right eye)
  15394. @item arch
  15395. anaglyph red/cyan half colored
  15396. (red filter on left eye, cyan filter on right eye)
  15397. @item arcc
  15398. anaglyph red/cyan color
  15399. (red filter on left eye, cyan filter on right eye)
  15400. @item arcd
  15401. anaglyph red/cyan color optimized with the least squares projection of dubois
  15402. (red filter on left eye, cyan filter on right eye)
  15403. @item agmg
  15404. anaglyph green/magenta gray
  15405. (green filter on left eye, magenta filter on right eye)
  15406. @item agmh
  15407. anaglyph green/magenta half colored
  15408. (green filter on left eye, magenta filter on right eye)
  15409. @item agmc
  15410. anaglyph green/magenta colored
  15411. (green filter on left eye, magenta filter on right eye)
  15412. @item agmd
  15413. anaglyph green/magenta color optimized with the least squares projection of dubois
  15414. (green filter on left eye, magenta filter on right eye)
  15415. @item aybg
  15416. anaglyph yellow/blue gray
  15417. (yellow filter on left eye, blue filter on right eye)
  15418. @item aybh
  15419. anaglyph yellow/blue half colored
  15420. (yellow filter on left eye, blue filter on right eye)
  15421. @item aybc
  15422. anaglyph yellow/blue colored
  15423. (yellow filter on left eye, blue filter on right eye)
  15424. @item aybd
  15425. anaglyph yellow/blue color optimized with the least squares projection of dubois
  15426. (yellow filter on left eye, blue filter on right eye)
  15427. @item ml
  15428. mono output (left eye only)
  15429. @item mr
  15430. mono output (right eye only)
  15431. @item chl
  15432. checkerboard, left eye first
  15433. @item chr
  15434. checkerboard, right eye first
  15435. @item icl
  15436. interleaved columns, left eye first
  15437. @item icr
  15438. interleaved columns, right eye first
  15439. @item hdmi
  15440. HDMI frame pack
  15441. @end table
  15442. Default value is @samp{arcd}.
  15443. @end table
  15444. @subsection Examples
  15445. @itemize
  15446. @item
  15447. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  15448. @example
  15449. stereo3d=sbsl:aybd
  15450. @end example
  15451. @item
  15452. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  15453. @example
  15454. stereo3d=abl:sbsr
  15455. @end example
  15456. @end itemize
  15457. @section streamselect, astreamselect
  15458. Select video or audio streams.
  15459. The filter accepts the following options:
  15460. @table @option
  15461. @item inputs
  15462. Set number of inputs. Default is 2.
  15463. @item map
  15464. Set input indexes to remap to outputs.
  15465. @end table
  15466. @subsection Commands
  15467. The @code{streamselect} and @code{astreamselect} filter supports the following
  15468. commands:
  15469. @table @option
  15470. @item map
  15471. Set input indexes to remap to outputs.
  15472. @end table
  15473. @subsection Examples
  15474. @itemize
  15475. @item
  15476. Select first 5 seconds 1st stream and rest of time 2nd stream:
  15477. @example
  15478. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  15479. @end example
  15480. @item
  15481. Same as above, but for audio:
  15482. @example
  15483. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  15484. @end example
  15485. @end itemize
  15486. @anchor{subtitles}
  15487. @section subtitles
  15488. Draw subtitles on top of input video using the libass library.
  15489. To enable compilation of this filter you need to configure FFmpeg with
  15490. @code{--enable-libass}. This filter also requires a build with libavcodec and
  15491. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  15492. Alpha) subtitles format.
  15493. The filter accepts the following options:
  15494. @table @option
  15495. @item filename, f
  15496. Set the filename of the subtitle file to read. It must be specified.
  15497. @item original_size
  15498. Specify the size of the original video, the video for which the ASS file
  15499. was composed. For the syntax of this option, check the
  15500. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15501. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  15502. correctly scale the fonts if the aspect ratio has been changed.
  15503. @item fontsdir
  15504. Set a directory path containing fonts that can be used by the filter.
  15505. These fonts will be used in addition to whatever the font provider uses.
  15506. @item alpha
  15507. Process alpha channel, by default alpha channel is untouched.
  15508. @item charenc
  15509. Set subtitles input character encoding. @code{subtitles} filter only. Only
  15510. useful if not UTF-8.
  15511. @item stream_index, si
  15512. Set subtitles stream index. @code{subtitles} filter only.
  15513. @item force_style
  15514. Override default style or script info parameters of the subtitles. It accepts a
  15515. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  15516. @end table
  15517. If the first key is not specified, it is assumed that the first value
  15518. specifies the @option{filename}.
  15519. For example, to render the file @file{sub.srt} on top of the input
  15520. video, use the command:
  15521. @example
  15522. subtitles=sub.srt
  15523. @end example
  15524. which is equivalent to:
  15525. @example
  15526. subtitles=filename=sub.srt
  15527. @end example
  15528. To render the default subtitles stream from file @file{video.mkv}, use:
  15529. @example
  15530. subtitles=video.mkv
  15531. @end example
  15532. To render the second subtitles stream from that file, use:
  15533. @example
  15534. subtitles=video.mkv:si=1
  15535. @end example
  15536. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  15537. @code{DejaVu Serif}, use:
  15538. @example
  15539. subtitles=sub.srt:force_style='Fontname=DejaVu Serif,PrimaryColour=&HCCFF0000'
  15540. @end example
  15541. @section super2xsai
  15542. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  15543. Interpolate) pixel art scaling algorithm.
  15544. Useful for enlarging pixel art images without reducing sharpness.
  15545. @section swaprect
  15546. Swap two rectangular objects in video.
  15547. This filter accepts the following options:
  15548. @table @option
  15549. @item w
  15550. Set object width.
  15551. @item h
  15552. Set object height.
  15553. @item x1
  15554. Set 1st rect x coordinate.
  15555. @item y1
  15556. Set 1st rect y coordinate.
  15557. @item x2
  15558. Set 2nd rect x coordinate.
  15559. @item y2
  15560. Set 2nd rect y coordinate.
  15561. All expressions are evaluated once for each frame.
  15562. @end table
  15563. The all options are expressions containing the following constants:
  15564. @table @option
  15565. @item w
  15566. @item h
  15567. The input width and height.
  15568. @item a
  15569. same as @var{w} / @var{h}
  15570. @item sar
  15571. input sample aspect ratio
  15572. @item dar
  15573. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  15574. @item n
  15575. The number of the input frame, starting from 0.
  15576. @item t
  15577. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  15578. @item pos
  15579. the position in the file of the input frame, NAN if unknown
  15580. @end table
  15581. @subsection Commands
  15582. This filter supports the all above options as @ref{commands}.
  15583. @section swapuv
  15584. Swap U & V plane.
  15585. @section tblend
  15586. Blend successive video frames.
  15587. See @ref{blend}
  15588. @section telecine
  15589. Apply telecine process to the video.
  15590. This filter accepts the following options:
  15591. @table @option
  15592. @item first_field
  15593. @table @samp
  15594. @item top, t
  15595. top field first
  15596. @item bottom, b
  15597. bottom field first
  15598. The default value is @code{top}.
  15599. @end table
  15600. @item pattern
  15601. A string of numbers representing the pulldown pattern you wish to apply.
  15602. The default value is @code{23}.
  15603. @end table
  15604. @example
  15605. Some typical patterns:
  15606. NTSC output (30i):
  15607. 27.5p: 32222
  15608. 24p: 23 (classic)
  15609. 24p: 2332 (preferred)
  15610. 20p: 33
  15611. 18p: 334
  15612. 16p: 3444
  15613. PAL output (25i):
  15614. 27.5p: 12222
  15615. 24p: 222222222223 ("Euro pulldown")
  15616. 16.67p: 33
  15617. 16p: 33333334
  15618. @end example
  15619. @section thistogram
  15620. Compute and draw a color distribution histogram for the input video across time.
  15621. Unlike @ref{histogram} video filter which only shows histogram of single input frame
  15622. at certain time, this filter shows also past histograms of number of frames defined
  15623. by @code{width} option.
  15624. The computed histogram is a representation of the color component
  15625. distribution in an image.
  15626. The filter accepts the following options:
  15627. @table @option
  15628. @item width, w
  15629. Set width of single color component output. Default value is @code{0}.
  15630. Value of @code{0} means width will be picked from input video.
  15631. This also set number of passed histograms to keep.
  15632. Allowed range is [0, 8192].
  15633. @item display_mode, d
  15634. Set display mode.
  15635. It accepts the following values:
  15636. @table @samp
  15637. @item stack
  15638. Per color component graphs are placed below each other.
  15639. @item parade
  15640. Per color component graphs are placed side by side.
  15641. @item overlay
  15642. Presents information identical to that in the @code{parade}, except
  15643. that the graphs representing color components are superimposed directly
  15644. over one another.
  15645. @end table
  15646. Default is @code{stack}.
  15647. @item levels_mode, m
  15648. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  15649. Default is @code{linear}.
  15650. @item components, c
  15651. Set what color components to display.
  15652. Default is @code{7}.
  15653. @item bgopacity, b
  15654. Set background opacity. Default is @code{0.9}.
  15655. @item envelope, e
  15656. Show envelope. Default is disabled.
  15657. @item ecolor, ec
  15658. Set envelope color. Default is @code{gold}.
  15659. @item slide
  15660. Set slide mode.
  15661. Available values for slide is:
  15662. @table @samp
  15663. @item frame
  15664. Draw new frame when right border is reached.
  15665. @item replace
  15666. Replace old columns with new ones.
  15667. @item scroll
  15668. Scroll from right to left.
  15669. @item rscroll
  15670. Scroll from left to right.
  15671. @item picture
  15672. Draw single picture.
  15673. @end table
  15674. Default is @code{replace}.
  15675. @end table
  15676. @section threshold
  15677. Apply threshold effect to video stream.
  15678. This filter needs four video streams to perform thresholding.
  15679. First stream is stream we are filtering.
  15680. Second stream is holding threshold values, third stream is holding min values,
  15681. and last, fourth stream is holding max values.
  15682. The filter accepts the following option:
  15683. @table @option
  15684. @item planes
  15685. Set which planes will be processed, unprocessed planes will be copied.
  15686. By default value 0xf, all planes will be processed.
  15687. @end table
  15688. For example if first stream pixel's component value is less then threshold value
  15689. of pixel component from 2nd threshold stream, third stream value will picked,
  15690. otherwise fourth stream pixel component value will be picked.
  15691. Using color source filter one can perform various types of thresholding:
  15692. @subsection Commands
  15693. This filter supports the all options as @ref{commands}.
  15694. @subsection Examples
  15695. @itemize
  15696. @item
  15697. Binary threshold, using gray color as threshold:
  15698. @example
  15699. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  15700. @end example
  15701. @item
  15702. Inverted binary threshold, using gray color as threshold:
  15703. @example
  15704. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  15705. @end example
  15706. @item
  15707. Truncate binary threshold, using gray color as threshold:
  15708. @example
  15709. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  15710. @end example
  15711. @item
  15712. Threshold to zero, using gray color as threshold:
  15713. @example
  15714. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  15715. @end example
  15716. @item
  15717. Inverted threshold to zero, using gray color as threshold:
  15718. @example
  15719. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  15720. @end example
  15721. @end itemize
  15722. @section thumbnail
  15723. Select the most representative frame in a given sequence of consecutive frames.
  15724. The filter accepts the following options:
  15725. @table @option
  15726. @item n
  15727. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  15728. will pick one of them, and then handle the next batch of @var{n} frames until
  15729. the end. Default is @code{100}.
  15730. @end table
  15731. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  15732. value will result in a higher memory usage, so a high value is not recommended.
  15733. @subsection Examples
  15734. @itemize
  15735. @item
  15736. Extract one picture each 50 frames:
  15737. @example
  15738. thumbnail=50
  15739. @end example
  15740. @item
  15741. Complete example of a thumbnail creation with @command{ffmpeg}:
  15742. @example
  15743. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  15744. @end example
  15745. @end itemize
  15746. @anchor{tile}
  15747. @section tile
  15748. Tile several successive frames together.
  15749. The @ref{untile} filter can do the reverse.
  15750. The filter accepts the following options:
  15751. @table @option
  15752. @item layout
  15753. Set the grid size (i.e. the number of lines and columns). For the syntax of
  15754. this option, check the
  15755. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15756. @item nb_frames
  15757. Set the maximum number of frames to render in the given area. It must be less
  15758. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  15759. the area will be used.
  15760. @item margin
  15761. Set the outer border margin in pixels.
  15762. @item padding
  15763. Set the inner border thickness (i.e. the number of pixels between frames). For
  15764. more advanced padding options (such as having different values for the edges),
  15765. refer to the pad video filter.
  15766. @item color
  15767. Specify the color of the unused area. For the syntax of this option, check the
  15768. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15769. The default value of @var{color} is "black".
  15770. @item overlap
  15771. Set the number of frames to overlap when tiling several successive frames together.
  15772. The value must be between @code{0} and @var{nb_frames - 1}.
  15773. @item init_padding
  15774. Set the number of frames to initially be empty before displaying first output frame.
  15775. This controls how soon will one get first output frame.
  15776. The value must be between @code{0} and @var{nb_frames - 1}.
  15777. @end table
  15778. @subsection Examples
  15779. @itemize
  15780. @item
  15781. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  15782. @example
  15783. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  15784. @end example
  15785. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  15786. duplicating each output frame to accommodate the originally detected frame
  15787. rate.
  15788. @item
  15789. Display @code{5} pictures in an area of @code{3x2} frames,
  15790. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  15791. mixed flat and named options:
  15792. @example
  15793. tile=3x2:nb_frames=5:padding=7:margin=2
  15794. @end example
  15795. @end itemize
  15796. @section tinterlace
  15797. Perform various types of temporal field interlacing.
  15798. Frames are counted starting from 1, so the first input frame is
  15799. considered odd.
  15800. The filter accepts the following options:
  15801. @table @option
  15802. @item mode
  15803. Specify the mode of the interlacing. This option can also be specified
  15804. as a value alone. See below for a list of values for this option.
  15805. Available values are:
  15806. @table @samp
  15807. @item merge, 0
  15808. Move odd frames into the upper field, even into the lower field,
  15809. generating a double height frame at half frame rate.
  15810. @example
  15811. ------> time
  15812. Input:
  15813. Frame 1 Frame 2 Frame 3 Frame 4
  15814. 11111 22222 33333 44444
  15815. 11111 22222 33333 44444
  15816. 11111 22222 33333 44444
  15817. 11111 22222 33333 44444
  15818. Output:
  15819. 11111 33333
  15820. 22222 44444
  15821. 11111 33333
  15822. 22222 44444
  15823. 11111 33333
  15824. 22222 44444
  15825. 11111 33333
  15826. 22222 44444
  15827. @end example
  15828. @item drop_even, 1
  15829. Only output odd frames, even frames are dropped, generating a frame with
  15830. unchanged height at half frame rate.
  15831. @example
  15832. ------> time
  15833. Input:
  15834. Frame 1 Frame 2 Frame 3 Frame 4
  15835. 11111 22222 33333 44444
  15836. 11111 22222 33333 44444
  15837. 11111 22222 33333 44444
  15838. 11111 22222 33333 44444
  15839. Output:
  15840. 11111 33333
  15841. 11111 33333
  15842. 11111 33333
  15843. 11111 33333
  15844. @end example
  15845. @item drop_odd, 2
  15846. Only output even frames, odd frames are dropped, generating a frame with
  15847. unchanged height at half frame rate.
  15848. @example
  15849. ------> time
  15850. Input:
  15851. Frame 1 Frame 2 Frame 3 Frame 4
  15852. 11111 22222 33333 44444
  15853. 11111 22222 33333 44444
  15854. 11111 22222 33333 44444
  15855. 11111 22222 33333 44444
  15856. Output:
  15857. 22222 44444
  15858. 22222 44444
  15859. 22222 44444
  15860. 22222 44444
  15861. @end example
  15862. @item pad, 3
  15863. Expand each frame to full height, but pad alternate lines with black,
  15864. generating a frame with double height at the same input frame rate.
  15865. @example
  15866. ------> time
  15867. Input:
  15868. Frame 1 Frame 2 Frame 3 Frame 4
  15869. 11111 22222 33333 44444
  15870. 11111 22222 33333 44444
  15871. 11111 22222 33333 44444
  15872. 11111 22222 33333 44444
  15873. Output:
  15874. 11111 ..... 33333 .....
  15875. ..... 22222 ..... 44444
  15876. 11111 ..... 33333 .....
  15877. ..... 22222 ..... 44444
  15878. 11111 ..... 33333 .....
  15879. ..... 22222 ..... 44444
  15880. 11111 ..... 33333 .....
  15881. ..... 22222 ..... 44444
  15882. @end example
  15883. @item interleave_top, 4
  15884. Interleave the upper field from odd frames with the lower field from
  15885. even frames, generating a frame with unchanged height at half frame rate.
  15886. @example
  15887. ------> time
  15888. Input:
  15889. Frame 1 Frame 2 Frame 3 Frame 4
  15890. 11111<- 22222 33333<- 44444
  15891. 11111 22222<- 33333 44444<-
  15892. 11111<- 22222 33333<- 44444
  15893. 11111 22222<- 33333 44444<-
  15894. Output:
  15895. 11111 33333
  15896. 22222 44444
  15897. 11111 33333
  15898. 22222 44444
  15899. @end example
  15900. @item interleave_bottom, 5
  15901. Interleave the lower field from odd frames with the upper field from
  15902. even frames, generating a frame with unchanged height at half frame rate.
  15903. @example
  15904. ------> time
  15905. Input:
  15906. Frame 1 Frame 2 Frame 3 Frame 4
  15907. 11111 22222<- 33333 44444<-
  15908. 11111<- 22222 33333<- 44444
  15909. 11111 22222<- 33333 44444<-
  15910. 11111<- 22222 33333<- 44444
  15911. Output:
  15912. 22222 44444
  15913. 11111 33333
  15914. 22222 44444
  15915. 11111 33333
  15916. @end example
  15917. @item interlacex2, 6
  15918. Double frame rate with unchanged height. Frames are inserted each
  15919. containing the second temporal field from the previous input frame and
  15920. the first temporal field from the next input frame. This mode relies on
  15921. the top_field_first flag. Useful for interlaced video displays with no
  15922. field synchronisation.
  15923. @example
  15924. ------> time
  15925. Input:
  15926. Frame 1 Frame 2 Frame 3 Frame 4
  15927. 11111 22222 33333 44444
  15928. 11111 22222 33333 44444
  15929. 11111 22222 33333 44444
  15930. 11111 22222 33333 44444
  15931. Output:
  15932. 11111 22222 22222 33333 33333 44444 44444
  15933. 11111 11111 22222 22222 33333 33333 44444
  15934. 11111 22222 22222 33333 33333 44444 44444
  15935. 11111 11111 22222 22222 33333 33333 44444
  15936. @end example
  15937. @item mergex2, 7
  15938. Move odd frames into the upper field, even into the lower field,
  15939. generating a double height frame at same frame rate.
  15940. @example
  15941. ------> time
  15942. Input:
  15943. Frame 1 Frame 2 Frame 3 Frame 4
  15944. 11111 22222 33333 44444
  15945. 11111 22222 33333 44444
  15946. 11111 22222 33333 44444
  15947. 11111 22222 33333 44444
  15948. Output:
  15949. 11111 33333 33333 55555
  15950. 22222 22222 44444 44444
  15951. 11111 33333 33333 55555
  15952. 22222 22222 44444 44444
  15953. 11111 33333 33333 55555
  15954. 22222 22222 44444 44444
  15955. 11111 33333 33333 55555
  15956. 22222 22222 44444 44444
  15957. @end example
  15958. @end table
  15959. Numeric values are deprecated but are accepted for backward
  15960. compatibility reasons.
  15961. Default mode is @code{merge}.
  15962. @item flags
  15963. Specify flags influencing the filter process.
  15964. Available value for @var{flags} is:
  15965. @table @option
  15966. @item low_pass_filter, vlpf
  15967. Enable linear vertical low-pass filtering in the filter.
  15968. Vertical low-pass filtering is required when creating an interlaced
  15969. destination from a progressive source which contains high-frequency
  15970. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  15971. patterning.
  15972. @item complex_filter, cvlpf
  15973. Enable complex vertical low-pass filtering.
  15974. This will slightly less reduce interlace 'twitter' and Moire
  15975. patterning but better retain detail and subjective sharpness impression.
  15976. @item bypass_il
  15977. Bypass already interlaced frames, only adjust the frame rate.
  15978. @end table
  15979. Vertical low-pass filtering and bypassing already interlaced frames can only be
  15980. enabled for @option{mode} @var{interleave_top} and @var{interleave_bottom}.
  15981. @end table
  15982. @section tmedian
  15983. Pick median pixels from several successive input video frames.
  15984. The filter accepts the following options:
  15985. @table @option
  15986. @item radius
  15987. Set radius of median filter.
  15988. Default is 1. Allowed range is from 1 to 127.
  15989. @item planes
  15990. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  15991. @item percentile
  15992. Set median percentile. Default value is @code{0.5}.
  15993. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  15994. minimum values, and @code{1} maximum values.
  15995. @end table
  15996. @subsection Commands
  15997. This filter supports all above options as @ref{commands}, excluding option @code{radius}.
  15998. @section tmidequalizer
  15999. Apply Temporal Midway Video Equalization effect.
  16000. Midway Video Equalization adjusts a sequence of video frames to have the same
  16001. histograms, while maintaining their dynamics as much as possible. It's
  16002. useful for e.g. matching exposures from a video frames sequence.
  16003. This filter accepts the following option:
  16004. @table @option
  16005. @item radius
  16006. Set filtering radius. Default is @code{5}. Allowed range is from 1 to 127.
  16007. @item sigma
  16008. Set filtering sigma. Default is @code{0.5}. This controls strength of filtering.
  16009. Setting this option to 0 effectively does nothing.
  16010. @item planes
  16011. Set which planes to process. Default is @code{15}, which is all available planes.
  16012. @end table
  16013. @section tmix
  16014. Mix successive video frames.
  16015. A description of the accepted options follows.
  16016. @table @option
  16017. @item frames
  16018. The number of successive frames to mix. If unspecified, it defaults to 3.
  16019. @item weights
  16020. Specify weight of each input video frame.
  16021. Each weight is separated by space. If number of weights is smaller than
  16022. number of @var{frames} last specified weight will be used for all remaining
  16023. unset weights.
  16024. @item scale
  16025. Specify scale, if it is set it will be multiplied with sum
  16026. of each weight multiplied with pixel values to give final destination
  16027. pixel value. By default @var{scale} is auto scaled to sum of weights.
  16028. @end table
  16029. @subsection Examples
  16030. @itemize
  16031. @item
  16032. Average 7 successive frames:
  16033. @example
  16034. tmix=frames=7:weights="1 1 1 1 1 1 1"
  16035. @end example
  16036. @item
  16037. Apply simple temporal convolution:
  16038. @example
  16039. tmix=frames=3:weights="-1 3 -1"
  16040. @end example
  16041. @item
  16042. Similar as above but only showing temporal differences:
  16043. @example
  16044. tmix=frames=3:weights="-1 2 -1":scale=1
  16045. @end example
  16046. @end itemize
  16047. @subsection Commands
  16048. This filter supports the following commands:
  16049. @table @option
  16050. @item weights
  16051. @item scale
  16052. Syntax is same as option with same name.
  16053. @end table
  16054. @anchor{tonemap}
  16055. @section tonemap
  16056. Tone map colors from different dynamic ranges.
  16057. This filter expects data in single precision floating point, as it needs to
  16058. operate on (and can output) out-of-range values. Another filter, such as
  16059. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  16060. The tonemapping algorithms implemented only work on linear light, so input
  16061. data should be linearized beforehand (and possibly correctly tagged).
  16062. @example
  16063. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  16064. @end example
  16065. @subsection Options
  16066. The filter accepts the following options.
  16067. @table @option
  16068. @item tonemap
  16069. Set the tone map algorithm to use.
  16070. Possible values are:
  16071. @table @var
  16072. @item none
  16073. Do not apply any tone map, only desaturate overbright pixels.
  16074. @item clip
  16075. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  16076. in-range values, while distorting out-of-range values.
  16077. @item linear
  16078. Stretch the entire reference gamut to a linear multiple of the display.
  16079. @item gamma
  16080. Fit a logarithmic transfer between the tone curves.
  16081. @item reinhard
  16082. Preserve overall image brightness with a simple curve, using nonlinear
  16083. contrast, which results in flattening details and degrading color accuracy.
  16084. @item hable
  16085. Preserve both dark and bright details better than @var{reinhard}, at the cost
  16086. of slightly darkening everything. Use it when detail preservation is more
  16087. important than color and brightness accuracy.
  16088. @item mobius
  16089. Smoothly map out-of-range values, while retaining contrast and colors for
  16090. in-range material as much as possible. Use it when color accuracy is more
  16091. important than detail preservation.
  16092. @end table
  16093. Default is none.
  16094. @item param
  16095. Tune the tone mapping algorithm.
  16096. This affects the following algorithms:
  16097. @table @var
  16098. @item none
  16099. Ignored.
  16100. @item linear
  16101. Specifies the scale factor to use while stretching.
  16102. Default to 1.0.
  16103. @item gamma
  16104. Specifies the exponent of the function.
  16105. Default to 1.8.
  16106. @item clip
  16107. Specify an extra linear coefficient to multiply into the signal before clipping.
  16108. Default to 1.0.
  16109. @item reinhard
  16110. Specify the local contrast coefficient at the display peak.
  16111. Default to 0.5, which means that in-gamut values will be about half as bright
  16112. as when clipping.
  16113. @item hable
  16114. Ignored.
  16115. @item mobius
  16116. Specify the transition point from linear to mobius transform. Every value
  16117. below this point is guaranteed to be mapped 1:1. The higher the value, the
  16118. more accurate the result will be, at the cost of losing bright details.
  16119. Default to 0.3, which due to the steep initial slope still preserves in-range
  16120. colors fairly accurately.
  16121. @end table
  16122. @item desat
  16123. Apply desaturation for highlights that exceed this level of brightness. The
  16124. higher the parameter, the more color information will be preserved. This
  16125. setting helps prevent unnaturally blown-out colors for super-highlights, by
  16126. (smoothly) turning into white instead. This makes images feel more natural,
  16127. at the cost of reducing information about out-of-range colors.
  16128. The default of 2.0 is somewhat conservative and will mostly just apply to
  16129. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  16130. This option works only if the input frame has a supported color tag.
  16131. @item peak
  16132. Override signal/nominal/reference peak with this value. Useful when the
  16133. embedded peak information in display metadata is not reliable or when tone
  16134. mapping from a lower range to a higher range.
  16135. @end table
  16136. @section tpad
  16137. Temporarily pad video frames.
  16138. The filter accepts the following options:
  16139. @table @option
  16140. @item start
  16141. Specify number of delay frames before input video stream. Default is 0.
  16142. @item stop
  16143. Specify number of padding frames after input video stream.
  16144. Set to -1 to pad indefinitely. Default is 0.
  16145. @item start_mode
  16146. Set kind of frames added to beginning of stream.
  16147. Can be either @var{add} or @var{clone}.
  16148. With @var{add} frames of solid-color are added.
  16149. With @var{clone} frames are clones of first frame.
  16150. Default is @var{add}.
  16151. @item stop_mode
  16152. Set kind of frames added to end of stream.
  16153. Can be either @var{add} or @var{clone}.
  16154. With @var{add} frames of solid-color are added.
  16155. With @var{clone} frames are clones of last frame.
  16156. Default is @var{add}.
  16157. @item start_duration, stop_duration
  16158. Specify the duration of the start/stop delay. See
  16159. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  16160. for the accepted syntax.
  16161. These options override @var{start} and @var{stop}. Default is 0.
  16162. @item color
  16163. Specify the color of the padded area. For the syntax of this option,
  16164. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  16165. manual,ffmpeg-utils}.
  16166. The default value of @var{color} is "black".
  16167. @end table
  16168. @anchor{transpose}
  16169. @section transpose
  16170. Transpose rows with columns in the input video and optionally flip it.
  16171. It accepts the following parameters:
  16172. @table @option
  16173. @item dir
  16174. Specify the transposition direction.
  16175. Can assume the following values:
  16176. @table @samp
  16177. @item 0, 4, cclock_flip
  16178. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  16179. @example
  16180. L.R L.l
  16181. . . -> . .
  16182. l.r R.r
  16183. @end example
  16184. @item 1, 5, clock
  16185. Rotate by 90 degrees clockwise, that is:
  16186. @example
  16187. L.R l.L
  16188. . . -> . .
  16189. l.r r.R
  16190. @end example
  16191. @item 2, 6, cclock
  16192. Rotate by 90 degrees counterclockwise, that is:
  16193. @example
  16194. L.R R.r
  16195. . . -> . .
  16196. l.r L.l
  16197. @end example
  16198. @item 3, 7, clock_flip
  16199. Rotate by 90 degrees clockwise and vertically flip, that is:
  16200. @example
  16201. L.R r.R
  16202. . . -> . .
  16203. l.r l.L
  16204. @end example
  16205. @end table
  16206. For values between 4-7, the transposition is only done if the input
  16207. video geometry is portrait and not landscape. These values are
  16208. deprecated, the @code{passthrough} option should be used instead.
  16209. Numerical values are deprecated, and should be dropped in favor of
  16210. symbolic constants.
  16211. @item passthrough
  16212. Do not apply the transposition if the input geometry matches the one
  16213. specified by the specified value. It accepts the following values:
  16214. @table @samp
  16215. @item none
  16216. Always apply transposition.
  16217. @item portrait
  16218. Preserve portrait geometry (when @var{height} >= @var{width}).
  16219. @item landscape
  16220. Preserve landscape geometry (when @var{width} >= @var{height}).
  16221. @end table
  16222. Default value is @code{none}.
  16223. @end table
  16224. For example to rotate by 90 degrees clockwise and preserve portrait
  16225. layout:
  16226. @example
  16227. transpose=dir=1:passthrough=portrait
  16228. @end example
  16229. The command above can also be specified as:
  16230. @example
  16231. transpose=1:portrait
  16232. @end example
  16233. @section transpose_npp
  16234. Transpose rows with columns in the input video and optionally flip it.
  16235. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  16236. It accepts the following parameters:
  16237. @table @option
  16238. @item dir
  16239. Specify the transposition direction.
  16240. Can assume the following values:
  16241. @table @samp
  16242. @item cclock_flip
  16243. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  16244. @item clock
  16245. Rotate by 90 degrees clockwise.
  16246. @item cclock
  16247. Rotate by 90 degrees counterclockwise.
  16248. @item clock_flip
  16249. Rotate by 90 degrees clockwise and vertically flip.
  16250. @end table
  16251. @item passthrough
  16252. Do not apply the transposition if the input geometry matches the one
  16253. specified by the specified value. It accepts the following values:
  16254. @table @samp
  16255. @item none
  16256. Always apply transposition. (default)
  16257. @item portrait
  16258. Preserve portrait geometry (when @var{height} >= @var{width}).
  16259. @item landscape
  16260. Preserve landscape geometry (when @var{width} >= @var{height}).
  16261. @end table
  16262. @end table
  16263. @section trim
  16264. Trim the input so that the output contains one continuous subpart of the input.
  16265. It accepts the following parameters:
  16266. @table @option
  16267. @item start
  16268. Specify the time of the start of the kept section, i.e. the frame with the
  16269. timestamp @var{start} will be the first frame in the output.
  16270. @item end
  16271. Specify the time of the first frame that will be dropped, i.e. the frame
  16272. immediately preceding the one with the timestamp @var{end} will be the last
  16273. frame in the output.
  16274. @item start_pts
  16275. This is the same as @var{start}, except this option sets the start timestamp
  16276. in timebase units instead of seconds.
  16277. @item end_pts
  16278. This is the same as @var{end}, except this option sets the end timestamp
  16279. in timebase units instead of seconds.
  16280. @item duration
  16281. The maximum duration of the output in seconds.
  16282. @item start_frame
  16283. The number of the first frame that should be passed to the output.
  16284. @item end_frame
  16285. The number of the first frame that should be dropped.
  16286. @end table
  16287. @option{start}, @option{end}, and @option{duration} are expressed as time
  16288. duration specifications; see
  16289. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  16290. for the accepted syntax.
  16291. Note that the first two sets of the start/end options and the @option{duration}
  16292. option look at the frame timestamp, while the _frame variants simply count the
  16293. frames that pass through the filter. Also note that this filter does not modify
  16294. the timestamps. If you wish for the output timestamps to start at zero, insert a
  16295. setpts filter after the trim filter.
  16296. If multiple start or end options are set, this filter tries to be greedy and
  16297. keep all the frames that match at least one of the specified constraints. To keep
  16298. only the part that matches all the constraints at once, chain multiple trim
  16299. filters.
  16300. The defaults are such that all the input is kept. So it is possible to set e.g.
  16301. just the end values to keep everything before the specified time.
  16302. Examples:
  16303. @itemize
  16304. @item
  16305. Drop everything except the second minute of input:
  16306. @example
  16307. ffmpeg -i INPUT -vf trim=60:120
  16308. @end example
  16309. @item
  16310. Keep only the first second:
  16311. @example
  16312. ffmpeg -i INPUT -vf trim=duration=1
  16313. @end example
  16314. @end itemize
  16315. @section unpremultiply
  16316. Apply alpha unpremultiply effect to input video stream using first plane
  16317. of second stream as alpha.
  16318. Both streams must have same dimensions and same pixel format.
  16319. The filter accepts the following option:
  16320. @table @option
  16321. @item planes
  16322. Set which planes will be processed, unprocessed planes will be copied.
  16323. By default value 0xf, all planes will be processed.
  16324. If the format has 1 or 2 components, then luma is bit 0.
  16325. If the format has 3 or 4 components:
  16326. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  16327. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  16328. If present, the alpha channel is always the last bit.
  16329. @item inplace
  16330. Do not require 2nd input for processing, instead use alpha plane from input stream.
  16331. @end table
  16332. @anchor{unsharp}
  16333. @section unsharp
  16334. Sharpen or blur the input video.
  16335. It accepts the following parameters:
  16336. @table @option
  16337. @item luma_msize_x, lx
  16338. Set the luma matrix horizontal size. It must be an odd integer between
  16339. 3 and 23. The default value is 5.
  16340. @item luma_msize_y, ly
  16341. Set the luma matrix vertical size. It must be an odd integer between 3
  16342. and 23. The default value is 5.
  16343. @item luma_amount, la
  16344. Set the luma effect strength. It must be a floating point number, reasonable
  16345. values lay between -1.5 and 1.5.
  16346. Negative values will blur the input video, while positive values will
  16347. sharpen it, a value of zero will disable the effect.
  16348. Default value is 1.0.
  16349. @item chroma_msize_x, cx
  16350. Set the chroma matrix horizontal size. It must be an odd integer
  16351. between 3 and 23. The default value is 5.
  16352. @item chroma_msize_y, cy
  16353. Set the chroma matrix vertical size. It must be an odd integer
  16354. between 3 and 23. The default value is 5.
  16355. @item chroma_amount, ca
  16356. Set the chroma effect strength. It must be a floating point number, reasonable
  16357. values lay between -1.5 and 1.5.
  16358. Negative values will blur the input video, while positive values will
  16359. sharpen it, a value of zero will disable the effect.
  16360. Default value is 0.0.
  16361. @end table
  16362. All parameters are optional and default to the equivalent of the
  16363. string '5:5:1.0:5:5:0.0'.
  16364. @subsection Examples
  16365. @itemize
  16366. @item
  16367. Apply strong luma sharpen effect:
  16368. @example
  16369. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  16370. @end example
  16371. @item
  16372. Apply a strong blur of both luma and chroma parameters:
  16373. @example
  16374. unsharp=7:7:-2:7:7:-2
  16375. @end example
  16376. @end itemize
  16377. @anchor{untile}
  16378. @section untile
  16379. Decompose a video made of tiled images into the individual images.
  16380. The frame rate of the output video is the frame rate of the input video
  16381. multiplied by the number of tiles.
  16382. This filter does the reverse of @ref{tile}.
  16383. The filter accepts the following options:
  16384. @table @option
  16385. @item layout
  16386. Set the grid size (i.e. the number of lines and columns). For the syntax of
  16387. this option, check the
  16388. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16389. @end table
  16390. @subsection Examples
  16391. @itemize
  16392. @item
  16393. Produce a 1-second video from a still image file made of 25 frames stacked
  16394. vertically, like an analogic film reel:
  16395. @example
  16396. ffmpeg -r 1 -i image.jpg -vf untile=1x25 movie.mkv
  16397. @end example
  16398. @end itemize
  16399. @section uspp
  16400. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  16401. the image at several (or - in the case of @option{quality} level @code{8} - all)
  16402. shifts and average the results.
  16403. The way this differs from the behavior of spp is that uspp actually encodes &
  16404. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  16405. DCT similar to MJPEG.
  16406. This filter is only available in ffmpeg version 4.4 or earlier.
  16407. The filter accepts the following options:
  16408. @table @option
  16409. @item quality
  16410. Set quality. This option defines the number of levels for averaging. It accepts
  16411. an integer in the range 0-8. If set to @code{0}, the filter will have no
  16412. effect. A value of @code{8} means the higher quality. For each increment of
  16413. that value the speed drops by a factor of approximately 2. Default value is
  16414. @code{3}.
  16415. @item qp
  16416. Force a constant quantization parameter. If not set, the filter will use the QP
  16417. from the video stream (if available).
  16418. @end table
  16419. @section v360
  16420. Convert 360 videos between various formats.
  16421. The filter accepts the following options:
  16422. @table @option
  16423. @item input
  16424. @item output
  16425. Set format of the input/output video.
  16426. Available formats:
  16427. @table @samp
  16428. @item e
  16429. @item equirect
  16430. Equirectangular projection.
  16431. @item c3x2
  16432. @item c6x1
  16433. @item c1x6
  16434. Cubemap with 3x2/6x1/1x6 layout.
  16435. Format specific options:
  16436. @table @option
  16437. @item in_pad
  16438. @item out_pad
  16439. Set padding proportion for the input/output cubemap. Values in decimals.
  16440. Example values:
  16441. @table @samp
  16442. @item 0
  16443. No padding.
  16444. @item 0.01
  16445. 1% of face is padding. For example, with 1920x1280 resolution face size would be 640x640 and padding would be 3 pixels from each side. (640 * 0.01 = 6 pixels)
  16446. @end table
  16447. Default value is @b{@samp{0}}.
  16448. Maximum value is @b{@samp{0.1}}.
  16449. @item fin_pad
  16450. @item fout_pad
  16451. Set fixed padding for the input/output cubemap. Values in pixels.
  16452. Default value is @b{@samp{0}}. If greater than zero it overrides other padding options.
  16453. @item in_forder
  16454. @item out_forder
  16455. Set order of faces for the input/output cubemap. Choose one direction for each position.
  16456. Designation of directions:
  16457. @table @samp
  16458. @item r
  16459. right
  16460. @item l
  16461. left
  16462. @item u
  16463. up
  16464. @item d
  16465. down
  16466. @item f
  16467. forward
  16468. @item b
  16469. back
  16470. @end table
  16471. Default value is @b{@samp{rludfb}}.
  16472. @item in_frot
  16473. @item out_frot
  16474. Set rotation of faces for the input/output cubemap. Choose one angle for each position.
  16475. Designation of angles:
  16476. @table @samp
  16477. @item 0
  16478. 0 degrees clockwise
  16479. @item 1
  16480. 90 degrees clockwise
  16481. @item 2
  16482. 180 degrees clockwise
  16483. @item 3
  16484. 270 degrees clockwise
  16485. @end table
  16486. Default value is @b{@samp{000000}}.
  16487. @end table
  16488. @item eac
  16489. Equi-Angular Cubemap.
  16490. @item flat
  16491. @item gnomonic
  16492. @item rectilinear
  16493. Regular video.
  16494. Format specific options:
  16495. @table @option
  16496. @item h_fov
  16497. @item v_fov
  16498. @item d_fov
  16499. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  16500. If diagonal field of view is set it overrides horizontal and vertical field of view.
  16501. @item ih_fov
  16502. @item iv_fov
  16503. @item id_fov
  16504. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  16505. If diagonal field of view is set it overrides horizontal and vertical field of view.
  16506. @end table
  16507. @item dfisheye
  16508. Dual fisheye.
  16509. Format specific options:
  16510. @table @option
  16511. @item h_fov
  16512. @item v_fov
  16513. @item d_fov
  16514. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  16515. If diagonal field of view is set it overrides horizontal and vertical field of view.
  16516. @item ih_fov
  16517. @item iv_fov
  16518. @item id_fov
  16519. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  16520. If diagonal field of view is set it overrides horizontal and vertical field of view.
  16521. @end table
  16522. @item barrel
  16523. @item fb
  16524. @item barrelsplit
  16525. Facebook's 360 formats.
  16526. @item sg
  16527. Stereographic format.
  16528. Format specific options:
  16529. @table @option
  16530. @item h_fov
  16531. @item v_fov
  16532. @item d_fov
  16533. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  16534. If diagonal field of view is set it overrides horizontal and vertical field of view.
  16535. @item ih_fov
  16536. @item iv_fov
  16537. @item id_fov
  16538. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  16539. If diagonal field of view is set it overrides horizontal and vertical field of view.
  16540. @end table
  16541. @item mercator
  16542. Mercator format.
  16543. @item ball
  16544. Ball format, gives significant distortion toward the back.
  16545. @item hammer
  16546. Hammer-Aitoff map projection format.
  16547. @item sinusoidal
  16548. Sinusoidal map projection format.
  16549. @item fisheye
  16550. Fisheye projection.
  16551. Format specific options:
  16552. @table @option
  16553. @item h_fov
  16554. @item v_fov
  16555. @item d_fov
  16556. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  16557. If diagonal field of view is set it overrides horizontal and vertical field of view.
  16558. @item ih_fov
  16559. @item iv_fov
  16560. @item id_fov
  16561. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  16562. If diagonal field of view is set it overrides horizontal and vertical field of view.
  16563. @end table
  16564. @item pannini
  16565. Pannini projection.
  16566. Format specific options:
  16567. @table @option
  16568. @item h_fov
  16569. Set output pannini parameter.
  16570. @item ih_fov
  16571. Set input pannini parameter.
  16572. @end table
  16573. @item cylindrical
  16574. Cylindrical projection.
  16575. Format specific options:
  16576. @table @option
  16577. @item h_fov
  16578. @item v_fov
  16579. @item d_fov
  16580. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  16581. If diagonal field of view is set it overrides horizontal and vertical field of view.
  16582. @item ih_fov
  16583. @item iv_fov
  16584. @item id_fov
  16585. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  16586. If diagonal field of view is set it overrides horizontal and vertical field of view.
  16587. @end table
  16588. @item perspective
  16589. Perspective projection. @i{(output only)}
  16590. Format specific options:
  16591. @table @option
  16592. @item v_fov
  16593. Set perspective parameter.
  16594. @end table
  16595. @item tetrahedron
  16596. Tetrahedron projection.
  16597. @item tsp
  16598. Truncated square pyramid projection.
  16599. @item he
  16600. @item hequirect
  16601. Half equirectangular projection.
  16602. @item equisolid
  16603. Equisolid format.
  16604. Format specific options:
  16605. @table @option
  16606. @item h_fov
  16607. @item v_fov
  16608. @item d_fov
  16609. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  16610. If diagonal field of view is set it overrides horizontal and vertical field of view.
  16611. @item ih_fov
  16612. @item iv_fov
  16613. @item id_fov
  16614. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  16615. If diagonal field of view is set it overrides horizontal and vertical field of view.
  16616. @end table
  16617. @item og
  16618. Orthographic format.
  16619. Format specific options:
  16620. @table @option
  16621. @item h_fov
  16622. @item v_fov
  16623. @item d_fov
  16624. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  16625. If diagonal field of view is set it overrides horizontal and vertical field of view.
  16626. @item ih_fov
  16627. @item iv_fov
  16628. @item id_fov
  16629. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  16630. If diagonal field of view is set it overrides horizontal and vertical field of view.
  16631. @end table
  16632. @item octahedron
  16633. Octahedron projection.
  16634. @item cylindricalea
  16635. Cylindrical Equal Area projection.
  16636. @end table
  16637. @item interp
  16638. Set interpolation method.@*
  16639. @i{Note: more complex interpolation methods require much more memory to run.}
  16640. Available methods:
  16641. @table @samp
  16642. @item near
  16643. @item nearest
  16644. Nearest neighbour.
  16645. @item line
  16646. @item linear
  16647. Bilinear interpolation.
  16648. @item lagrange9
  16649. Lagrange9 interpolation.
  16650. @item cube
  16651. @item cubic
  16652. Bicubic interpolation.
  16653. @item lanc
  16654. @item lanczos
  16655. Lanczos interpolation.
  16656. @item sp16
  16657. @item spline16
  16658. Spline16 interpolation.
  16659. @item gauss
  16660. @item gaussian
  16661. Gaussian interpolation.
  16662. @item mitchell
  16663. Mitchell interpolation.
  16664. @end table
  16665. Default value is @b{@samp{line}}.
  16666. @item w
  16667. @item h
  16668. Set the output video resolution.
  16669. Default resolution depends on formats.
  16670. @item in_stereo
  16671. @item out_stereo
  16672. Set the input/output stereo format.
  16673. @table @samp
  16674. @item 2d
  16675. 2D mono
  16676. @item sbs
  16677. Side by side
  16678. @item tb
  16679. Top bottom
  16680. @end table
  16681. Default value is @b{@samp{2d}} for input and output format.
  16682. @item yaw
  16683. @item pitch
  16684. @item roll
  16685. Set rotation for the output video. Values in degrees.
  16686. @item rorder
  16687. Set rotation order for the output video. Choose one item for each position.
  16688. @table @samp
  16689. @item y, Y
  16690. yaw
  16691. @item p, P
  16692. pitch
  16693. @item r, R
  16694. roll
  16695. @end table
  16696. Default value is @b{@samp{ypr}}.
  16697. @item h_flip
  16698. @item v_flip
  16699. @item d_flip
  16700. Flip the output video horizontally(swaps left-right)/vertically(swaps up-down)/in-depth(swaps back-forward). Boolean values.
  16701. @item ih_flip
  16702. @item iv_flip
  16703. Set if input video is flipped horizontally/vertically. Boolean values.
  16704. @item in_trans
  16705. Set if input video is transposed. Boolean value, by default disabled.
  16706. @item out_trans
  16707. Set if output video needs to be transposed. Boolean value, by default disabled.
  16708. @item h_offset
  16709. @item v_offset
  16710. Set output horizontal/vertical off-axis offset. Default is set to 0.
  16711. Allowed range is from -1 to 1.
  16712. @item alpha_mask
  16713. Build mask in alpha plane for all unmapped pixels by marking them fully transparent. Boolean value, by default disabled.
  16714. @item reset_rot
  16715. Reset rotation of output video. Boolean value, by default disabled.
  16716. @end table
  16717. @subsection Examples
  16718. @itemize
  16719. @item
  16720. Convert equirectangular video to cubemap with 3x2 layout and 1% padding using bicubic interpolation:
  16721. @example
  16722. ffmpeg -i input.mkv -vf v360=e:c3x2:cubic:out_pad=0.01 output.mkv
  16723. @end example
  16724. @item
  16725. Extract back view of Equi-Angular Cubemap:
  16726. @example
  16727. ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
  16728. @end example
  16729. @item
  16730. Convert transposed and horizontally flipped Equi-Angular Cubemap in side-by-side stereo format to equirectangular top-bottom stereo format:
  16731. @example
  16732. v360=eac:equirect:in_stereo=sbs:in_trans=1:ih_flip=1:out_stereo=tb
  16733. @end example
  16734. @end itemize
  16735. @subsection Commands
  16736. This filter supports subset of above options as @ref{commands}.
  16737. @section vaguedenoiser
  16738. Apply a wavelet based denoiser.
  16739. It transforms each frame from the video input into the wavelet domain,
  16740. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  16741. the obtained coefficients. It does an inverse wavelet transform after.
  16742. Due to wavelet properties, it should give a nice smoothed result, and
  16743. reduced noise, without blurring picture features.
  16744. This filter accepts the following options:
  16745. @table @option
  16746. @item threshold
  16747. The filtering strength. The higher, the more filtered the video will be.
  16748. Hard thresholding can use a higher threshold than soft thresholding
  16749. before the video looks overfiltered. Default value is 2.
  16750. @item method
  16751. The filtering method the filter will use.
  16752. It accepts the following values:
  16753. @table @samp
  16754. @item hard
  16755. All values under the threshold will be zeroed.
  16756. @item soft
  16757. All values under the threshold will be zeroed. All values above will be
  16758. reduced by the threshold.
  16759. @item garrote
  16760. Scales or nullifies coefficients - intermediary between (more) soft and
  16761. (less) hard thresholding.
  16762. @end table
  16763. Default is garrote.
  16764. @item nsteps
  16765. Number of times, the wavelet will decompose the picture. Picture can't
  16766. be decomposed beyond a particular point (typically, 8 for a 640x480
  16767. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  16768. @item percent
  16769. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  16770. @item planes
  16771. A list of the planes to process. By default all planes are processed.
  16772. @item type
  16773. The threshold type the filter will use.
  16774. It accepts the following values:
  16775. @table @samp
  16776. @item universal
  16777. Threshold used is same for all decompositions.
  16778. @item bayes
  16779. Threshold used depends also on each decomposition coefficients.
  16780. @end table
  16781. Default is universal.
  16782. @end table
  16783. @section varblur
  16784. Apply variable blur filter by using 2nd video stream to set blur radius.
  16785. The 2nd stream must have the same dimensions.
  16786. This filter accepts the following options:
  16787. @table @option
  16788. @item min_r
  16789. Set min allowed radius. Allowed range is from 0 to 254. Default is 0.
  16790. @item max_r
  16791. Set max allowed radius. Allowed range is from 1 to 255. Default is 8.
  16792. @item planes
  16793. Set which planes to process. By default, all are used.
  16794. @end table
  16795. The @code{varblur} filter also supports the @ref{framesync} options.
  16796. @subsection Commands
  16797. This filter supports all the above options as @ref{commands}.
  16798. @section vectorscope
  16799. Display 2 color component values in the two dimensional graph (which is called
  16800. a vectorscope).
  16801. This filter accepts the following options:
  16802. @table @option
  16803. @item mode, m
  16804. Set vectorscope mode.
  16805. It accepts the following values:
  16806. @table @samp
  16807. @item gray
  16808. @item tint
  16809. Gray values are displayed on graph, higher brightness means more pixels have
  16810. same component color value on location in graph. This is the default mode.
  16811. @item color
  16812. Gray values are displayed on graph. Surrounding pixels values which are not
  16813. present in video frame are drawn in gradient of 2 color components which are
  16814. set by option @code{x} and @code{y}. The 3rd color component is static.
  16815. @item color2
  16816. Actual color components values present in video frame are displayed on graph.
  16817. @item color3
  16818. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  16819. on graph increases value of another color component, which is luminance by
  16820. default values of @code{x} and @code{y}.
  16821. @item color4
  16822. Actual colors present in video frame are displayed on graph. If two different
  16823. colors map to same position on graph then color with higher value of component
  16824. not present in graph is picked.
  16825. @item color5
  16826. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  16827. component picked from radial gradient.
  16828. @end table
  16829. @item x
  16830. Set which color component will be represented on X-axis. Default is @code{1}.
  16831. @item y
  16832. Set which color component will be represented on Y-axis. Default is @code{2}.
  16833. @item intensity, i
  16834. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  16835. of color component which represents frequency of (X, Y) location in graph.
  16836. @item envelope, e
  16837. @table @samp
  16838. @item none
  16839. No envelope, this is default.
  16840. @item instant
  16841. Instant envelope, even darkest single pixel will be clearly highlighted.
  16842. @item peak
  16843. Hold maximum and minimum values presented in graph over time. This way you
  16844. can still spot out of range values without constantly looking at vectorscope.
  16845. @item peak+instant
  16846. Peak and instant envelope combined together.
  16847. @end table
  16848. @item graticule, g
  16849. Set what kind of graticule to draw.
  16850. @table @samp
  16851. @item none
  16852. @item green
  16853. @item color
  16854. @item invert
  16855. @end table
  16856. @item opacity, o
  16857. Set graticule opacity.
  16858. @item flags, f
  16859. Set graticule flags.
  16860. @table @samp
  16861. @item white
  16862. Draw graticule for white point.
  16863. @item black
  16864. Draw graticule for black point.
  16865. @item name
  16866. Draw color points short names.
  16867. @end table
  16868. @item bgopacity, b
  16869. Set background opacity.
  16870. @item lthreshold, l
  16871. Set low threshold for color component not represented on X or Y axis.
  16872. Values lower than this value will be ignored. Default is 0.
  16873. Note this value is multiplied with actual max possible value one pixel component
  16874. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  16875. is 0.1 * 255 = 25.
  16876. @item hthreshold, h
  16877. Set high threshold for color component not represented on X or Y axis.
  16878. Values higher than this value will be ignored. Default is 1.
  16879. Note this value is multiplied with actual max possible value one pixel component
  16880. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  16881. is 0.9 * 255 = 230.
  16882. @item colorspace, c
  16883. Set what kind of colorspace to use when drawing graticule.
  16884. @table @samp
  16885. @item auto
  16886. @item 601
  16887. @item 709
  16888. @end table
  16889. Default is auto.
  16890. @item tint0, t0
  16891. @item tint1, t1
  16892. Set color tint for gray/tint vectorscope mode. By default both options are zero.
  16893. This means no tint, and output will remain gray.
  16894. @end table
  16895. @anchor{vidstabdetect}
  16896. @section vidstabdetect
  16897. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  16898. @ref{vidstabtransform} for pass 2.
  16899. This filter generates a file with relative translation and rotation
  16900. transform information about subsequent frames, which is then used by
  16901. the @ref{vidstabtransform} filter.
  16902. To enable compilation of this filter you need to configure FFmpeg with
  16903. @code{--enable-libvidstab}.
  16904. This filter accepts the following options:
  16905. @table @option
  16906. @item result
  16907. Set the path to the file used to write the transforms information.
  16908. Default value is @file{transforms.trf}.
  16909. @item shakiness
  16910. Set how shaky the video is and how quick the camera is. It accepts an
  16911. integer in the range 1-10, a value of 1 means little shakiness, a
  16912. value of 10 means strong shakiness. Default value is 5.
  16913. @item accuracy
  16914. Set the accuracy of the detection process. It must be a value in the
  16915. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  16916. accuracy. Default value is 15.
  16917. @item stepsize
  16918. Set stepsize of the search process. The region around minimum is
  16919. scanned with 1 pixel resolution. Default value is 6.
  16920. @item mincontrast
  16921. Set minimum contrast. Below this value a local measurement field is
  16922. discarded. Must be a floating point value in the range 0-1. Default
  16923. value is 0.3.
  16924. @item tripod
  16925. Set reference frame number for tripod mode.
  16926. If enabled, the motion of the frames is compared to a reference frame
  16927. in the filtered stream, identified by the specified number. The idea
  16928. is to compensate all movements in a more-or-less static scene and keep
  16929. the camera view absolutely still.
  16930. If set to 0, it is disabled. The frames are counted starting from 1.
  16931. @item show
  16932. Show fields and transforms in the resulting frames. It accepts an
  16933. integer in the range 0-2. Default value is 0, which disables any
  16934. visualization.
  16935. @end table
  16936. @subsection Examples
  16937. @itemize
  16938. @item
  16939. Use default values:
  16940. @example
  16941. vidstabdetect
  16942. @end example
  16943. @item
  16944. Analyze strongly shaky movie and put the results in file
  16945. @file{mytransforms.trf}:
  16946. @example
  16947. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  16948. @end example
  16949. @item
  16950. Visualize the result of internal transformations in the resulting
  16951. video:
  16952. @example
  16953. vidstabdetect=show=1
  16954. @end example
  16955. @item
  16956. Analyze a video with medium shakiness using @command{ffmpeg}:
  16957. @example
  16958. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  16959. @end example
  16960. @end itemize
  16961. @anchor{vidstabtransform}
  16962. @section vidstabtransform
  16963. Video stabilization/deshaking: pass 2 of 2,
  16964. see @ref{vidstabdetect} for pass 1.
  16965. Read a file with transform information for each frame and
  16966. apply/compensate them. Together with the @ref{vidstabdetect}
  16967. filter this can be used to deshake videos. See also
  16968. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  16969. the @ref{unsharp} filter, see below.
  16970. To enable compilation of this filter you need to configure FFmpeg with
  16971. @code{--enable-libvidstab}.
  16972. @subsection Options
  16973. @table @option
  16974. @item input
  16975. Set path to the file used to read the transforms. Default value is
  16976. @file{transforms.trf}.
  16977. @item smoothing
  16978. Set the number of frames (value*2 + 1) used for lowpass filtering the
  16979. camera movements. Default value is 10.
  16980. For example a number of 10 means that 21 frames are used (10 in the
  16981. past and 10 in the future) to smoothen the motion in the video. A
  16982. larger value leads to a smoother video, but limits the acceleration of
  16983. the camera (pan/tilt movements). 0 is a special case where a static
  16984. camera is simulated.
  16985. @item optalgo
  16986. Set the camera path optimization algorithm.
  16987. Accepted values are:
  16988. @table @samp
  16989. @item gauss
  16990. gaussian kernel low-pass filter on camera motion (default)
  16991. @item avg
  16992. averaging on transformations
  16993. @end table
  16994. @item maxshift
  16995. Set maximal number of pixels to translate frames. Default value is -1,
  16996. meaning no limit.
  16997. @item maxangle
  16998. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  16999. value is -1, meaning no limit.
  17000. @item crop
  17001. Specify how to deal with borders that may be visible due to movement
  17002. compensation.
  17003. Available values are:
  17004. @table @samp
  17005. @item keep
  17006. keep image information from previous frame (default)
  17007. @item black
  17008. fill the border black
  17009. @end table
  17010. @item invert
  17011. Invert transforms if set to 1. Default value is 0.
  17012. @item relative
  17013. Consider transforms as relative to previous frame if set to 1,
  17014. absolute if set to 0. Default value is 0.
  17015. @item zoom
  17016. Set percentage to zoom. A positive value will result in a zoom-in
  17017. effect, a negative value in a zoom-out effect. Default value is 0 (no
  17018. zoom).
  17019. @item optzoom
  17020. Set optimal zooming to avoid borders.
  17021. Accepted values are:
  17022. @table @samp
  17023. @item 0
  17024. disabled
  17025. @item 1
  17026. optimal static zoom value is determined (only very strong movements
  17027. will lead to visible borders) (default)
  17028. @item 2
  17029. optimal adaptive zoom value is determined (no borders will be
  17030. visible), see @option{zoomspeed}
  17031. @end table
  17032. Note that the value given at zoom is added to the one calculated here.
  17033. @item zoomspeed
  17034. Set percent to zoom maximally each frame (enabled when
  17035. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  17036. 0.25.
  17037. @item interpol
  17038. Specify type of interpolation.
  17039. Available values are:
  17040. @table @samp
  17041. @item no
  17042. no interpolation
  17043. @item linear
  17044. linear only horizontal
  17045. @item bilinear
  17046. linear in both directions (default)
  17047. @item bicubic
  17048. cubic in both directions (slow)
  17049. @end table
  17050. @item tripod
  17051. Enable virtual tripod mode if set to 1, which is equivalent to
  17052. @code{relative=0:smoothing=0}. Default value is 0.
  17053. Use also @code{tripod} option of @ref{vidstabdetect}.
  17054. @item debug
  17055. Increase log verbosity if set to 1. Also the detected global motions
  17056. are written to the temporary file @file{global_motions.trf}. Default
  17057. value is 0.
  17058. @end table
  17059. @subsection Examples
  17060. @itemize
  17061. @item
  17062. Use @command{ffmpeg} for a typical stabilization with default values:
  17063. @example
  17064. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  17065. @end example
  17066. Note the use of the @ref{unsharp} filter which is always recommended.
  17067. @item
  17068. Zoom in a bit more and load transform data from a given file:
  17069. @example
  17070. vidstabtransform=zoom=5:input="mytransforms.trf"
  17071. @end example
  17072. @item
  17073. Smoothen the video even more:
  17074. @example
  17075. vidstabtransform=smoothing=30
  17076. @end example
  17077. @end itemize
  17078. @section vflip
  17079. Flip the input video vertically.
  17080. For example, to vertically flip a video with @command{ffmpeg}:
  17081. @example
  17082. ffmpeg -i in.avi -vf "vflip" out.avi
  17083. @end example
  17084. @section vfrdet
  17085. Detect variable frame rate video.
  17086. This filter tries to detect if the input is variable or constant frame rate.
  17087. At end it will output number of frames detected as having variable delta pts,
  17088. and ones with constant delta pts.
  17089. If there was frames with variable delta, than it will also show min, max and
  17090. average delta encountered.
  17091. @section vibrance
  17092. Boost or alter saturation.
  17093. The filter accepts the following options:
  17094. @table @option
  17095. @item intensity
  17096. Set strength of boost if positive value or strength of alter if negative value.
  17097. Default is 0. Allowed range is from -2 to 2.
  17098. @item rbal
  17099. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  17100. @item gbal
  17101. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  17102. @item bbal
  17103. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  17104. @item rlum
  17105. Set the red luma coefficient.
  17106. @item glum
  17107. Set the green luma coefficient.
  17108. @item blum
  17109. Set the blue luma coefficient.
  17110. @item alternate
  17111. If @code{intensity} is negative and this is set to 1, colors will change,
  17112. otherwise colors will be less saturated, more towards gray.
  17113. @end table
  17114. @subsection Commands
  17115. This filter supports the all above options as @ref{commands}.
  17116. @section vif
  17117. Obtain the average VIF (Visual Information Fidelity) between two input videos.
  17118. This filter takes two input videos.
  17119. Both input videos must have the same resolution and pixel format for
  17120. this filter to work correctly. Also it assumes that both inputs
  17121. have the same number of frames, which are compared one by one.
  17122. The obtained average VIF score is printed through the logging system.
  17123. The filter stores the calculated VIF score of each frame.
  17124. In the below example the input file @file{main.mpg} being processed is compared
  17125. with the reference file @file{ref.mpg}.
  17126. @example
  17127. ffmpeg -i main.mpg -i ref.mpg -lavfi vif -f null -
  17128. @end example
  17129. @anchor{vignette}
  17130. @section vignette
  17131. Make or reverse a natural vignetting effect.
  17132. The filter accepts the following options:
  17133. @table @option
  17134. @item angle, a
  17135. Set lens angle expression as a number of radians.
  17136. The value is clipped in the @code{[0,PI/2]} range.
  17137. Default value: @code{"PI/5"}
  17138. @item x0
  17139. @item y0
  17140. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  17141. by default.
  17142. @item mode
  17143. Set forward/backward mode.
  17144. Available modes are:
  17145. @table @samp
  17146. @item forward
  17147. The larger the distance from the central point, the darker the image becomes.
  17148. @item backward
  17149. The larger the distance from the central point, the brighter the image becomes.
  17150. This can be used to reverse a vignette effect, though there is no automatic
  17151. detection to extract the lens @option{angle} and other settings (yet). It can
  17152. also be used to create a burning effect.
  17153. @end table
  17154. Default value is @samp{forward}.
  17155. @item eval
  17156. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  17157. It accepts the following values:
  17158. @table @samp
  17159. @item init
  17160. Evaluate expressions only once during the filter initialization.
  17161. @item frame
  17162. Evaluate expressions for each incoming frame. This is way slower than the
  17163. @samp{init} mode since it requires all the scalers to be re-computed, but it
  17164. allows advanced dynamic expressions.
  17165. @end table
  17166. Default value is @samp{init}.
  17167. @item dither
  17168. Set dithering to reduce the circular banding effects. Default is @code{1}
  17169. (enabled).
  17170. @item aspect
  17171. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  17172. Setting this value to the SAR of the input will make a rectangular vignetting
  17173. following the dimensions of the video.
  17174. Default is @code{1/1}.
  17175. @end table
  17176. @subsection Expressions
  17177. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  17178. following parameters.
  17179. @table @option
  17180. @item w
  17181. @item h
  17182. input width and height
  17183. @item n
  17184. the number of input frame, starting from 0
  17185. @item pts
  17186. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  17187. @var{TB} units, NAN if undefined
  17188. @item r
  17189. frame rate of the input video, NAN if the input frame rate is unknown
  17190. @item t
  17191. the PTS (Presentation TimeStamp) of the filtered video frame,
  17192. expressed in seconds, NAN if undefined
  17193. @item tb
  17194. time base of the input video
  17195. @end table
  17196. @subsection Examples
  17197. @itemize
  17198. @item
  17199. Apply simple strong vignetting effect:
  17200. @example
  17201. vignette=PI/4
  17202. @end example
  17203. @item
  17204. Make a flickering vignetting:
  17205. @example
  17206. vignette='PI/4+random(1)*PI/50':eval=frame
  17207. @end example
  17208. @end itemize
  17209. @section vmafmotion
  17210. Obtain the average VMAF motion score of a video.
  17211. It is one of the component metrics of VMAF.
  17212. The obtained average motion score is printed through the logging system.
  17213. The filter accepts the following options:
  17214. @table @option
  17215. @item stats_file
  17216. If specified, the filter will use the named file to save the motion score of
  17217. each frame with respect to the previous frame.
  17218. When filename equals "-" the data is sent to standard output.
  17219. @end table
  17220. Example:
  17221. @example
  17222. ffmpeg -i ref.mpg -vf vmafmotion -f null -
  17223. @end example
  17224. @section vstack
  17225. Stack input videos vertically.
  17226. All streams must be of same pixel format and of same width.
  17227. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  17228. to create same output.
  17229. The filter accepts the following options:
  17230. @table @option
  17231. @item inputs
  17232. Set number of input streams. Default is 2.
  17233. @item shortest
  17234. If set to 1, force the output to terminate when the shortest input
  17235. terminates. Default value is 0.
  17236. @end table
  17237. @section w3fdif
  17238. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  17239. Deinterlacing Filter").
  17240. Based on the process described by Martin Weston for BBC R&D, and
  17241. implemented based on the de-interlace algorithm written by Jim
  17242. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  17243. uses filter coefficients calculated by BBC R&D.
  17244. This filter uses field-dominance information in frame to decide which
  17245. of each pair of fields to place first in the output.
  17246. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  17247. There are two sets of filter coefficients, so called "simple"
  17248. and "complex". Which set of filter coefficients is used can
  17249. be set by passing an optional parameter:
  17250. @table @option
  17251. @item filter
  17252. Set the interlacing filter coefficients. Accepts one of the following values:
  17253. @table @samp
  17254. @item simple
  17255. Simple filter coefficient set.
  17256. @item complex
  17257. More-complex filter coefficient set.
  17258. @end table
  17259. Default value is @samp{complex}.
  17260. @item mode
  17261. The interlacing mode to adopt. It accepts one of the following values:
  17262. @table @option
  17263. @item frame
  17264. Output one frame for each frame.
  17265. @item field
  17266. Output one frame for each field.
  17267. @end table
  17268. The default value is @code{field}.
  17269. @item parity
  17270. The picture field parity assumed for the input interlaced video. It accepts one
  17271. of the following values:
  17272. @table @option
  17273. @item tff
  17274. Assume the top field is first.
  17275. @item bff
  17276. Assume the bottom field is first.
  17277. @item auto
  17278. Enable automatic detection of field parity.
  17279. @end table
  17280. The default value is @code{auto}.
  17281. If the interlacing is unknown or the decoder does not export this information,
  17282. top field first will be assumed.
  17283. @item deint
  17284. Specify which frames to deinterlace. Accepts one of the following values:
  17285. @table @samp
  17286. @item all
  17287. Deinterlace all frames,
  17288. @item interlaced
  17289. Only deinterlace frames marked as interlaced.
  17290. @end table
  17291. Default value is @samp{all}.
  17292. @end table
  17293. @subsection Commands
  17294. This filter supports same @ref{commands} as options.
  17295. @section waveform
  17296. Video waveform monitor.
  17297. The waveform monitor plots color component intensity. By default luminance
  17298. only. Each column of the waveform corresponds to a column of pixels in the
  17299. source video.
  17300. It accepts the following options:
  17301. @table @option
  17302. @item mode, m
  17303. Can be either @code{row}, or @code{column}. Default is @code{column}.
  17304. In row mode, the graph on the left side represents color component value 0 and
  17305. the right side represents value = 255. In column mode, the top side represents
  17306. color component value = 0 and bottom side represents value = 255.
  17307. @item intensity, i
  17308. Set intensity. Smaller values are useful to find out how many values of the same
  17309. luminance are distributed across input rows/columns.
  17310. Default value is @code{0.04}. Allowed range is [0, 1].
  17311. @item mirror, r
  17312. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  17313. In mirrored mode, higher values will be represented on the left
  17314. side for @code{row} mode and at the top for @code{column} mode. Default is
  17315. @code{1} (mirrored).
  17316. @item display, d
  17317. Set display mode.
  17318. It accepts the following values:
  17319. @table @samp
  17320. @item overlay
  17321. Presents information identical to that in the @code{parade}, except
  17322. that the graphs representing color components are superimposed directly
  17323. over one another.
  17324. This display mode makes it easier to spot relative differences or similarities
  17325. in overlapping areas of the color components that are supposed to be identical,
  17326. such as neutral whites, grays, or blacks.
  17327. @item stack
  17328. Display separate graph for the color components side by side in
  17329. @code{row} mode or one below the other in @code{column} mode.
  17330. @item parade
  17331. Display separate graph for the color components side by side in
  17332. @code{column} mode or one below the other in @code{row} mode.
  17333. Using this display mode makes it easy to spot color casts in the highlights
  17334. and shadows of an image, by comparing the contours of the top and the bottom
  17335. graphs of each waveform. Since whites, grays, and blacks are characterized
  17336. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  17337. should display three waveforms of roughly equal width/height. If not, the
  17338. correction is easy to perform by making level adjustments the three waveforms.
  17339. @end table
  17340. Default is @code{stack}.
  17341. @item components, c
  17342. Set which color components to display. Default is 1, which means only luminance
  17343. or red color component if input is in RGB colorspace. If is set for example to
  17344. 7 it will display all 3 (if) available color components.
  17345. @item envelope, e
  17346. @table @samp
  17347. @item none
  17348. No envelope, this is default.
  17349. @item instant
  17350. Instant envelope, minimum and maximum values presented in graph will be easily
  17351. visible even with small @code{step} value.
  17352. @item peak
  17353. Hold minimum and maximum values presented in graph across time. This way you
  17354. can still spot out of range values without constantly looking at waveforms.
  17355. @item peak+instant
  17356. Peak and instant envelope combined together.
  17357. @end table
  17358. @item filter, f
  17359. @table @samp
  17360. @item lowpass
  17361. No filtering, this is default.
  17362. @item flat
  17363. Luma and chroma combined together.
  17364. @item aflat
  17365. Similar as above, but shows difference between blue and red chroma.
  17366. @item xflat
  17367. Similar as above, but use different colors.
  17368. @item yflat
  17369. Similar as above, but again with different colors.
  17370. @item chroma
  17371. Displays only chroma.
  17372. @item color
  17373. Displays actual color value on waveform.
  17374. @item acolor
  17375. Similar as above, but with luma showing frequency of chroma values.
  17376. @end table
  17377. @item graticule, g
  17378. Set which graticule to display.
  17379. @table @samp
  17380. @item none
  17381. Do not display graticule.
  17382. @item green
  17383. Display green graticule showing legal broadcast ranges.
  17384. @item orange
  17385. Display orange graticule showing legal broadcast ranges.
  17386. @item invert
  17387. Display invert graticule showing legal broadcast ranges.
  17388. @end table
  17389. @item opacity, o
  17390. Set graticule opacity.
  17391. @item flags, fl
  17392. Set graticule flags.
  17393. @table @samp
  17394. @item numbers
  17395. Draw numbers above lines. By default enabled.
  17396. @item dots
  17397. Draw dots instead of lines.
  17398. @end table
  17399. @item scale, s
  17400. Set scale used for displaying graticule.
  17401. @table @samp
  17402. @item digital
  17403. @item millivolts
  17404. @item ire
  17405. @end table
  17406. Default is digital.
  17407. @item bgopacity, b
  17408. Set background opacity.
  17409. @item tint0, t0
  17410. @item tint1, t1
  17411. Set tint for output.
  17412. Only used with lowpass filter and when display is not overlay and input
  17413. pixel formats are not RGB.
  17414. @item fitmode, fm
  17415. Set sample aspect ratio of video output frames.
  17416. Can be used to configure waveform so it is not
  17417. streched too much in one of directions.
  17418. @table @samp
  17419. @item none
  17420. Set sample aspect ration to 1/1.
  17421. @item size
  17422. Set sample aspect ratio to match input size of video
  17423. @end table
  17424. Default is @samp{none}.
  17425. @end table
  17426. @section weave, doubleweave
  17427. The @code{weave} takes a field-based video input and join
  17428. each two sequential fields into single frame, producing a new double
  17429. height clip with half the frame rate and half the frame count.
  17430. The @code{doubleweave} works same as @code{weave} but without
  17431. halving frame rate and frame count.
  17432. It accepts the following option:
  17433. @table @option
  17434. @item first_field
  17435. Set first field. Available values are:
  17436. @table @samp
  17437. @item top, t
  17438. Set the frame as top-field-first.
  17439. @item bottom, b
  17440. Set the frame as bottom-field-first.
  17441. @end table
  17442. @end table
  17443. @subsection Examples
  17444. @itemize
  17445. @item
  17446. Interlace video using @ref{select} and @ref{separatefields} filter:
  17447. @example
  17448. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  17449. @end example
  17450. @end itemize
  17451. @section xbr
  17452. Apply the xBR high-quality magnification filter which is designed for pixel
  17453. art. It follows a set of edge-detection rules, see
  17454. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  17455. It accepts the following option:
  17456. @table @option
  17457. @item n
  17458. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  17459. @code{3xBR} and @code{4} for @code{4xBR}.
  17460. Default is @code{3}.
  17461. @end table
  17462. @section xcorrelate
  17463. Apply normalized cross-correlation between first and second input video stream.
  17464. Second input video stream dimensions must be lower than first input video stream.
  17465. The filter accepts the following options:
  17466. @table @option
  17467. @item planes
  17468. Set which planes to process.
  17469. @item secondary
  17470. Set which secondary video frames will be processed from second input video stream,
  17471. can be @var{first} or @var{all}. Default is @var{all}.
  17472. @end table
  17473. The @code{xcorrelate} filter also supports the @ref{framesync} options.
  17474. @section xfade
  17475. Apply cross fade from one input video stream to another input video stream.
  17476. The cross fade is applied for specified duration.
  17477. Both inputs must be constant frame-rate and have the same resolution, pixel format,
  17478. frame rate and timebase.
  17479. The filter accepts the following options:
  17480. @table @option
  17481. @item transition
  17482. Set one of available transition effects:
  17483. @table @samp
  17484. @item custom
  17485. @item fade
  17486. @item wipeleft
  17487. @item wiperight
  17488. @item wipeup
  17489. @item wipedown
  17490. @item slideleft
  17491. @item slideright
  17492. @item slideup
  17493. @item slidedown
  17494. @item circlecrop
  17495. @item rectcrop
  17496. @item distance
  17497. @item fadeblack
  17498. @item fadewhite
  17499. @item radial
  17500. @item smoothleft
  17501. @item smoothright
  17502. @item smoothup
  17503. @item smoothdown
  17504. @item circleopen
  17505. @item circleclose
  17506. @item vertopen
  17507. @item vertclose
  17508. @item horzopen
  17509. @item horzclose
  17510. @item dissolve
  17511. @item pixelize
  17512. @item diagtl
  17513. @item diagtr
  17514. @item diagbl
  17515. @item diagbr
  17516. @item hlslice
  17517. @item hrslice
  17518. @item vuslice
  17519. @item vdslice
  17520. @item hblur
  17521. @item fadegrays
  17522. @item wipetl
  17523. @item wipetr
  17524. @item wipebl
  17525. @item wipebr
  17526. @item squeezeh
  17527. @item squeezev
  17528. @item zoomin
  17529. @end table
  17530. Default transition effect is fade.
  17531. @item duration
  17532. Set cross fade duration in seconds.
  17533. Range is 0 to 60 seconds.
  17534. Default duration is 1 second.
  17535. @item offset
  17536. Set cross fade start relative to first input stream in seconds.
  17537. Default offset is 0.
  17538. @item expr
  17539. Set expression for custom transition effect.
  17540. The expressions can use the following variables and functions:
  17541. @table @option
  17542. @item X
  17543. @item Y
  17544. The coordinates of the current sample.
  17545. @item W
  17546. @item H
  17547. The width and height of the image.
  17548. @item P
  17549. Progress of transition effect.
  17550. @item PLANE
  17551. Currently processed plane.
  17552. @item A
  17553. Return value of first input at current location and plane.
  17554. @item B
  17555. Return value of second input at current location and plane.
  17556. @item a0(x, y)
  17557. @item a1(x, y)
  17558. @item a2(x, y)
  17559. @item a3(x, y)
  17560. Return the value of the pixel at location (@var{x},@var{y}) of the
  17561. first/second/third/fourth component of first input.
  17562. @item b0(x, y)
  17563. @item b1(x, y)
  17564. @item b2(x, y)
  17565. @item b3(x, y)
  17566. Return the value of the pixel at location (@var{x},@var{y}) of the
  17567. first/second/third/fourth component of second input.
  17568. @end table
  17569. @end table
  17570. @subsection Examples
  17571. @itemize
  17572. @item
  17573. Cross fade from one input video to another input video, with fade transition and duration of transition
  17574. of 2 seconds starting at offset of 5 seconds:
  17575. @example
  17576. ffmpeg -i first.mp4 -i second.mp4 -filter_complex xfade=transition=fade:duration=2:offset=5 output.mp4
  17577. @end example
  17578. @end itemize
  17579. @section xmedian
  17580. Pick median pixels from several input videos.
  17581. The filter accepts the following options:
  17582. @table @option
  17583. @item inputs
  17584. Set number of inputs.
  17585. Default is 3. Allowed range is from 3 to 255.
  17586. If number of inputs is even number, than result will be mean value between two median values.
  17587. @item planes
  17588. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  17589. @item percentile
  17590. Set median percentile. Default value is @code{0.5}.
  17591. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  17592. minimum values, and @code{1} maximum values.
  17593. @end table
  17594. @subsection Commands
  17595. This filter supports all above options as @ref{commands}, excluding option @code{inputs}.
  17596. @section xstack
  17597. Stack video inputs into custom layout.
  17598. All streams must be of same pixel format.
  17599. The filter accepts the following options:
  17600. @table @option
  17601. @item inputs
  17602. Set number of input streams. Default is 2.
  17603. @item layout
  17604. Specify layout of inputs.
  17605. This option requires the desired layout configuration to be explicitly set by the user.
  17606. This sets position of each video input in output. Each input
  17607. is separated by '|'.
  17608. The first number represents the column, and the second number represents the row.
  17609. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  17610. where X is video input from which to take width or height.
  17611. Multiple values can be used when separated by '+'. In such
  17612. case values are summed together.
  17613. Note that if inputs are of different sizes gaps may appear, as not all of
  17614. the output video frame will be filled. Similarly, videos can overlap each
  17615. other if their position doesn't leave enough space for the full frame of
  17616. adjoining videos.
  17617. For 2 inputs, a default layout of @code{0_0|w0_0} is set. In all other cases,
  17618. a layout must be set by the user.
  17619. @item shortest
  17620. If set to 1, force the output to terminate when the shortest input
  17621. terminates. Default value is 0.
  17622. @item fill
  17623. If set to valid color, all unused pixels will be filled with that color.
  17624. By default fill is set to none, so it is disabled.
  17625. @end table
  17626. @subsection Examples
  17627. @itemize
  17628. @item
  17629. Display 4 inputs into 2x2 grid.
  17630. Layout:
  17631. @example
  17632. input1(0, 0) | input3(w0, 0)
  17633. input2(0, h0) | input4(w0, h0)
  17634. @end example
  17635. @example
  17636. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  17637. @end example
  17638. Note that if inputs are of different sizes, gaps or overlaps may occur.
  17639. @item
  17640. Display 4 inputs into 1x4 grid.
  17641. Layout:
  17642. @example
  17643. input1(0, 0)
  17644. input2(0, h0)
  17645. input3(0, h0+h1)
  17646. input4(0, h0+h1+h2)
  17647. @end example
  17648. @example
  17649. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  17650. @end example
  17651. Note that if inputs are of different widths, unused space will appear.
  17652. @item
  17653. Display 9 inputs into 3x3 grid.
  17654. Layout:
  17655. @example
  17656. input1(0, 0) | input4(w0, 0) | input7(w0+w3, 0)
  17657. input2(0, h0) | input5(w0, h0) | input8(w0+w3, h0)
  17658. input3(0, h0+h1) | input6(w0, h0+h1) | input9(w0+w3, h0+h1)
  17659. @end example
  17660. @example
  17661. xstack=inputs=9:layout=0_0|0_h0|0_h0+h1|w0_0|w0_h0|w0_h0+h1|w0+w3_0|w0+w3_h0|w0+w3_h0+h1
  17662. @end example
  17663. Note that if inputs are of different sizes, gaps or overlaps may occur.
  17664. @item
  17665. Display 16 inputs into 4x4 grid.
  17666. Layout:
  17667. @example
  17668. input1(0, 0) | input5(w0, 0) | input9 (w0+w4, 0) | input13(w0+w4+w8, 0)
  17669. input2(0, h0) | input6(w0, h0) | input10(w0+w4, h0) | input14(w0+w4+w8, h0)
  17670. input3(0, h0+h1) | input7(w0, h0+h1) | input11(w0+w4, h0+h1) | input15(w0+w4+w8, h0+h1)
  17671. input4(0, h0+h1+h2)| input8(w0, h0+h1+h2)| input12(w0+w4, h0+h1+h2)| input16(w0+w4+w8, h0+h1+h2)
  17672. @end example
  17673. @example
  17674. xstack=inputs=16:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2|w0_0|w0_h0|w0_h0+h1|w0_h0+h1+h2|w0+w4_0|
  17675. w0+w4_h0|w0+w4_h0+h1|w0+w4_h0+h1+h2|w0+w4+w8_0|w0+w4+w8_h0|w0+w4+w8_h0+h1|w0+w4+w8_h0+h1+h2
  17676. @end example
  17677. Note that if inputs are of different sizes, gaps or overlaps may occur.
  17678. @end itemize
  17679. @anchor{yadif}
  17680. @section yadif
  17681. Deinterlace the input video ("yadif" means "yet another deinterlacing
  17682. filter").
  17683. It accepts the following parameters:
  17684. @table @option
  17685. @item mode
  17686. The interlacing mode to adopt. It accepts one of the following values:
  17687. @table @option
  17688. @item 0, send_frame
  17689. Output one frame for each frame.
  17690. @item 1, send_field
  17691. Output one frame for each field.
  17692. @item 2, send_frame_nospatial
  17693. Like @code{send_frame}, but it skips the spatial interlacing check.
  17694. @item 3, send_field_nospatial
  17695. Like @code{send_field}, but it skips the spatial interlacing check.
  17696. @end table
  17697. The default value is @code{send_frame}.
  17698. @item parity
  17699. The picture field parity assumed for the input interlaced video. It accepts one
  17700. of the following values:
  17701. @table @option
  17702. @item 0, tff
  17703. Assume the top field is first.
  17704. @item 1, bff
  17705. Assume the bottom field is first.
  17706. @item -1, auto
  17707. Enable automatic detection of field parity.
  17708. @end table
  17709. The default value is @code{auto}.
  17710. If the interlacing is unknown or the decoder does not export this information,
  17711. top field first will be assumed.
  17712. @item deint
  17713. Specify which frames to deinterlace. Accepts one of the following
  17714. values:
  17715. @table @option
  17716. @item 0, all
  17717. Deinterlace all frames.
  17718. @item 1, interlaced
  17719. Only deinterlace frames marked as interlaced.
  17720. @end table
  17721. The default value is @code{all}.
  17722. @end table
  17723. @section yadif_cuda
  17724. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  17725. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  17726. and/or nvenc.
  17727. It accepts the following parameters:
  17728. @table @option
  17729. @item mode
  17730. The interlacing mode to adopt. It accepts one of the following values:
  17731. @table @option
  17732. @item 0, send_frame
  17733. Output one frame for each frame.
  17734. @item 1, send_field
  17735. Output one frame for each field.
  17736. @item 2, send_frame_nospatial
  17737. Like @code{send_frame}, but it skips the spatial interlacing check.
  17738. @item 3, send_field_nospatial
  17739. Like @code{send_field}, but it skips the spatial interlacing check.
  17740. @end table
  17741. The default value is @code{send_frame}.
  17742. @item parity
  17743. The picture field parity assumed for the input interlaced video. It accepts one
  17744. of the following values:
  17745. @table @option
  17746. @item 0, tff
  17747. Assume the top field is first.
  17748. @item 1, bff
  17749. Assume the bottom field is first.
  17750. @item -1, auto
  17751. Enable automatic detection of field parity.
  17752. @end table
  17753. The default value is @code{auto}.
  17754. If the interlacing is unknown or the decoder does not export this information,
  17755. top field first will be assumed.
  17756. @item deint
  17757. Specify which frames to deinterlace. Accepts one of the following
  17758. values:
  17759. @table @option
  17760. @item 0, all
  17761. Deinterlace all frames.
  17762. @item 1, interlaced
  17763. Only deinterlace frames marked as interlaced.
  17764. @end table
  17765. The default value is @code{all}.
  17766. @end table
  17767. @section yaepblur
  17768. Apply blur filter while preserving edges ("yaepblur" means "yet another edge preserving blur filter").
  17769. The algorithm is described in
  17770. "J. S. Lee, Digital image enhancement and noise filtering by use of local statistics, IEEE Trans. Pattern Anal. Mach. Intell. PAMI-2, 1980."
  17771. It accepts the following parameters:
  17772. @table @option
  17773. @item radius, r
  17774. Set the window radius. Default value is 3.
  17775. @item planes, p
  17776. Set which planes to filter. Default is only the first plane.
  17777. @item sigma, s
  17778. Set blur strength. Default value is 128.
  17779. @end table
  17780. @subsection Commands
  17781. This filter supports same @ref{commands} as options.
  17782. @section zoompan
  17783. Apply Zoom & Pan effect.
  17784. This filter accepts the following options:
  17785. @table @option
  17786. @item zoom, z
  17787. Set the zoom expression. Range is 1-10. Default is 1.
  17788. @item x
  17789. @item y
  17790. Set the x and y expression. Default is 0.
  17791. @item d
  17792. Set the duration expression in number of frames.
  17793. This sets for how many number of frames effect will last for
  17794. single input image. Default is 90.
  17795. @item s
  17796. Set the output image size, default is 'hd720'.
  17797. @item fps
  17798. Set the output frame rate, default is '25'.
  17799. @end table
  17800. Each expression can contain the following constants:
  17801. @table @option
  17802. @item in_w, iw
  17803. Input width.
  17804. @item in_h, ih
  17805. Input height.
  17806. @item out_w, ow
  17807. Output width.
  17808. @item out_h, oh
  17809. Output height.
  17810. @item in
  17811. Input frame count.
  17812. @item on
  17813. Output frame count.
  17814. @item in_time, it
  17815. The input timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  17816. @item out_time, time, ot
  17817. The output timestamp expressed in seconds.
  17818. @item x
  17819. @item y
  17820. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  17821. for current input frame.
  17822. @item px
  17823. @item py
  17824. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  17825. not yet such frame (first input frame).
  17826. @item zoom
  17827. Last calculated zoom from 'z' expression for current input frame.
  17828. @item pzoom
  17829. Last calculated zoom of last output frame of previous input frame.
  17830. @item duration
  17831. Number of output frames for current input frame. Calculated from 'd' expression
  17832. for each input frame.
  17833. @item pduration
  17834. number of output frames created for previous input frame
  17835. @item a
  17836. Rational number: input width / input height
  17837. @item sar
  17838. sample aspect ratio
  17839. @item dar
  17840. display aspect ratio
  17841. @end table
  17842. @subsection Examples
  17843. @itemize
  17844. @item
  17845. Zoom in up to 1.5x and pan at same time to some spot near center of picture:
  17846. @example
  17847. 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
  17848. @end example
  17849. @item
  17850. Zoom in up to 1.5x and pan always at center of picture:
  17851. @example
  17852. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  17853. @end example
  17854. @item
  17855. Same as above but without pausing:
  17856. @example
  17857. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  17858. @end example
  17859. @item
  17860. Zoom in 2x into center of picture only for the first second of the input video:
  17861. @example
  17862. zoompan=z='if(between(in_time,0,1),2,1)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  17863. @end example
  17864. @end itemize
  17865. @anchor{zscale}
  17866. @section zscale
  17867. Scale (resize) the input video, using the z.lib library:
  17868. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  17869. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  17870. The zscale filter forces the output display aspect ratio to be the same
  17871. as the input, by changing the output sample aspect ratio.
  17872. If the input image format is different from the format requested by
  17873. the next filter, the zscale filter will convert the input to the
  17874. requested format.
  17875. @subsection Options
  17876. The filter accepts the following options.
  17877. @table @option
  17878. @item width, w
  17879. @item height, h
  17880. Set the output video dimension expression. Default value is the input
  17881. dimension.
  17882. If the @var{width} or @var{w} value is 0, the input width is used for
  17883. the output. If the @var{height} or @var{h} value is 0, the input height
  17884. is used for the output.
  17885. If one and only one of the values is -n with n >= 1, the zscale filter
  17886. will use a value that maintains the aspect ratio of the input image,
  17887. calculated from the other specified dimension. After that it will,
  17888. however, make sure that the calculated dimension is divisible by n and
  17889. adjust the value if necessary.
  17890. If both values are -n with n >= 1, the behavior will be identical to
  17891. both values being set to 0 as previously detailed.
  17892. See below for the list of accepted constants for use in the dimension
  17893. expression.
  17894. @item size, s
  17895. Set the video size. For the syntax of this option, check the
  17896. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17897. @item dither, d
  17898. Set the dither type.
  17899. Possible values are:
  17900. @table @var
  17901. @item none
  17902. @item ordered
  17903. @item random
  17904. @item error_diffusion
  17905. @end table
  17906. Default is none.
  17907. @item filter, f
  17908. Set the resize filter type.
  17909. Possible values are:
  17910. @table @var
  17911. @item point
  17912. @item bilinear
  17913. @item bicubic
  17914. @item spline16
  17915. @item spline36
  17916. @item lanczos
  17917. @end table
  17918. Default is bilinear.
  17919. @item range, r
  17920. Set the color range.
  17921. Possible values are:
  17922. @table @var
  17923. @item input
  17924. @item limited
  17925. @item full
  17926. @end table
  17927. Default is same as input.
  17928. @item primaries, p
  17929. Set the color primaries.
  17930. Possible values are:
  17931. @table @var
  17932. @item input
  17933. @item 709
  17934. @item unspecified
  17935. @item 170m
  17936. @item 240m
  17937. @item 2020
  17938. @end table
  17939. Default is same as input.
  17940. @item transfer, t
  17941. Set the transfer characteristics.
  17942. Possible values are:
  17943. @table @var
  17944. @item input
  17945. @item 709
  17946. @item unspecified
  17947. @item 601
  17948. @item linear
  17949. @item 2020_10
  17950. @item 2020_12
  17951. @item smpte2084
  17952. @item iec61966-2-1
  17953. @item arib-std-b67
  17954. @end table
  17955. Default is same as input.
  17956. @item matrix, m
  17957. Set the colorspace matrix.
  17958. Possible value are:
  17959. @table @var
  17960. @item input
  17961. @item 709
  17962. @item unspecified
  17963. @item 470bg
  17964. @item 170m
  17965. @item 2020_ncl
  17966. @item 2020_cl
  17967. @end table
  17968. Default is same as input.
  17969. @item rangein, rin
  17970. Set the input color range.
  17971. Possible values are:
  17972. @table @var
  17973. @item input
  17974. @item limited
  17975. @item full
  17976. @end table
  17977. Default is same as input.
  17978. @item primariesin, pin
  17979. Set the input color primaries.
  17980. Possible values are:
  17981. @table @var
  17982. @item input
  17983. @item 709
  17984. @item unspecified
  17985. @item 170m
  17986. @item 240m
  17987. @item 2020
  17988. @end table
  17989. Default is same as input.
  17990. @item transferin, tin
  17991. Set the input transfer characteristics.
  17992. Possible values are:
  17993. @table @var
  17994. @item input
  17995. @item 709
  17996. @item unspecified
  17997. @item 601
  17998. @item linear
  17999. @item 2020_10
  18000. @item 2020_12
  18001. @end table
  18002. Default is same as input.
  18003. @item matrixin, min
  18004. Set the input colorspace matrix.
  18005. Possible value are:
  18006. @table @var
  18007. @item input
  18008. @item 709
  18009. @item unspecified
  18010. @item 470bg
  18011. @item 170m
  18012. @item 2020_ncl
  18013. @item 2020_cl
  18014. @end table
  18015. @item chromal, c
  18016. Set the output chroma location.
  18017. Possible values are:
  18018. @table @var
  18019. @item input
  18020. @item left
  18021. @item center
  18022. @item topleft
  18023. @item top
  18024. @item bottomleft
  18025. @item bottom
  18026. @end table
  18027. @item chromalin, cin
  18028. Set the input chroma location.
  18029. Possible values are:
  18030. @table @var
  18031. @item input
  18032. @item left
  18033. @item center
  18034. @item topleft
  18035. @item top
  18036. @item bottomleft
  18037. @item bottom
  18038. @end table
  18039. @item npl
  18040. Set the nominal peak luminance.
  18041. @item param_a
  18042. Parameter A for scaling filters. Parameter "b" for bicubic, and the number of
  18043. filter taps for lanczos.
  18044. @item param_b
  18045. Parameter B for scaling filters. Parameter "c" for bicubic.
  18046. @end table
  18047. The values of the @option{w} and @option{h} options are expressions
  18048. containing the following constants:
  18049. @table @var
  18050. @item in_w
  18051. @item in_h
  18052. The input width and height
  18053. @item iw
  18054. @item ih
  18055. These are the same as @var{in_w} and @var{in_h}.
  18056. @item out_w
  18057. @item out_h
  18058. The output (scaled) width and height
  18059. @item ow
  18060. @item oh
  18061. These are the same as @var{out_w} and @var{out_h}
  18062. @item a
  18063. The same as @var{iw} / @var{ih}
  18064. @item sar
  18065. input sample aspect ratio
  18066. @item dar
  18067. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  18068. @item hsub
  18069. @item vsub
  18070. horizontal and vertical input chroma subsample values. For example for the
  18071. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  18072. @item ohsub
  18073. @item ovsub
  18074. horizontal and vertical output chroma subsample values. For example for the
  18075. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  18076. @end table
  18077. @subsection Commands
  18078. This filter supports the following commands:
  18079. @table @option
  18080. @item width, w
  18081. @item height, h
  18082. Set the output video dimension expression.
  18083. The command accepts the same syntax of the corresponding option.
  18084. If the specified expression is not valid, it is kept at its current
  18085. value.
  18086. @end table
  18087. @c man end VIDEO FILTERS
  18088. @chapter OpenCL Video Filters
  18089. @c man begin OPENCL VIDEO FILTERS
  18090. Below is a description of the currently available OpenCL video filters.
  18091. To enable compilation of these filters you need to configure FFmpeg with
  18092. @code{--enable-opencl}.
  18093. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  18094. @table @option
  18095. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  18096. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  18097. given device parameters.
  18098. @item -filter_hw_device @var{name}
  18099. Pass the hardware device called @var{name} to all filters in any filter graph.
  18100. @end table
  18101. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  18102. @itemize
  18103. @item
  18104. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  18105. @example
  18106. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  18107. @end example
  18108. @end itemize
  18109. 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.
  18110. @section avgblur_opencl
  18111. Apply average blur filter.
  18112. The filter accepts the following options:
  18113. @table @option
  18114. @item sizeX
  18115. Set horizontal radius size.
  18116. Range is @code{[1, 1024]} and default value is @code{1}.
  18117. @item planes
  18118. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  18119. @item sizeY
  18120. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  18121. @end table
  18122. @subsection Example
  18123. @itemize
  18124. @item
  18125. 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.
  18126. @example
  18127. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  18128. @end example
  18129. @end itemize
  18130. @section boxblur_opencl
  18131. Apply a boxblur algorithm to the input video.
  18132. It accepts the following parameters:
  18133. @table @option
  18134. @item luma_radius, lr
  18135. @item luma_power, lp
  18136. @item chroma_radius, cr
  18137. @item chroma_power, cp
  18138. @item alpha_radius, ar
  18139. @item alpha_power, ap
  18140. @end table
  18141. A description of the accepted options follows.
  18142. @table @option
  18143. @item luma_radius, lr
  18144. @item chroma_radius, cr
  18145. @item alpha_radius, ar
  18146. Set an expression for the box radius in pixels used for blurring the
  18147. corresponding input plane.
  18148. The radius value must be a non-negative number, and must not be
  18149. greater than the value of the expression @code{min(w,h)/2} for the
  18150. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  18151. planes.
  18152. Default value for @option{luma_radius} is "2". If not specified,
  18153. @option{chroma_radius} and @option{alpha_radius} default to the
  18154. corresponding value set for @option{luma_radius}.
  18155. The expressions can contain the following constants:
  18156. @table @option
  18157. @item w
  18158. @item h
  18159. The input width and height in pixels.
  18160. @item cw
  18161. @item ch
  18162. The input chroma image width and height in pixels.
  18163. @item hsub
  18164. @item vsub
  18165. The horizontal and vertical chroma subsample values. For example, for the
  18166. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  18167. @end table
  18168. @item luma_power, lp
  18169. @item chroma_power, cp
  18170. @item alpha_power, ap
  18171. Specify how many times the boxblur filter is applied to the
  18172. corresponding plane.
  18173. Default value for @option{luma_power} is 2. If not specified,
  18174. @option{chroma_power} and @option{alpha_power} default to the
  18175. corresponding value set for @option{luma_power}.
  18176. A value of 0 will disable the effect.
  18177. @end table
  18178. @subsection Examples
  18179. 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.
  18180. @itemize
  18181. @item
  18182. Apply a boxblur filter with the luma, chroma, and alpha radius
  18183. 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.
  18184. @example
  18185. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  18186. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  18187. @end example
  18188. @item
  18189. 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.
  18190. For the luma plane, a 2x2 box radius will be run once.
  18191. For the chroma plane, a 4x4 box radius will be run 5 times.
  18192. For the alpha plane, a 3x3 box radius will be run 7 times.
  18193. @example
  18194. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  18195. @end example
  18196. @end itemize
  18197. @section colorkey_opencl
  18198. RGB colorspace color keying.
  18199. The filter accepts the following options:
  18200. @table @option
  18201. @item color
  18202. The color which will be replaced with transparency.
  18203. @item similarity
  18204. Similarity percentage with the key color.
  18205. 0.01 matches only the exact key color, while 1.0 matches everything.
  18206. @item blend
  18207. Blend percentage.
  18208. 0.0 makes pixels either fully transparent, or not transparent at all.
  18209. Higher values result in semi-transparent pixels, with a higher transparency
  18210. the more similar the pixels color is to the key color.
  18211. @end table
  18212. @subsection Examples
  18213. @itemize
  18214. @item
  18215. Make every semi-green pixel in the input transparent with some slight blending:
  18216. @example
  18217. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  18218. @end example
  18219. @end itemize
  18220. @section convolution_opencl
  18221. Apply convolution of 3x3, 5x5, 7x7 matrix.
  18222. The filter accepts the following options:
  18223. @table @option
  18224. @item 0m
  18225. @item 1m
  18226. @item 2m
  18227. @item 3m
  18228. Set matrix for each plane.
  18229. Matrix is sequence of 9, 25 or 49 signed numbers.
  18230. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  18231. @item 0rdiv
  18232. @item 1rdiv
  18233. @item 2rdiv
  18234. @item 3rdiv
  18235. Set multiplier for calculated value for each plane.
  18236. If unset or 0, it will be sum of all matrix elements.
  18237. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  18238. @item 0bias
  18239. @item 1bias
  18240. @item 2bias
  18241. @item 3bias
  18242. Set bias for each plane. This value is added to the result of the multiplication.
  18243. Useful for making the overall image brighter or darker.
  18244. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  18245. @end table
  18246. @subsection Examples
  18247. @itemize
  18248. @item
  18249. Apply sharpen:
  18250. @example
  18251. -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
  18252. @end example
  18253. @item
  18254. Apply blur:
  18255. @example
  18256. -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
  18257. @end example
  18258. @item
  18259. Apply edge enhance:
  18260. @example
  18261. -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
  18262. @end example
  18263. @item
  18264. Apply edge detect:
  18265. @example
  18266. -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
  18267. @end example
  18268. @item
  18269. Apply laplacian edge detector which includes diagonals:
  18270. @example
  18271. -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
  18272. @end example
  18273. @item
  18274. Apply emboss:
  18275. @example
  18276. -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
  18277. @end example
  18278. @end itemize
  18279. @section erosion_opencl
  18280. Apply erosion effect to the video.
  18281. This filter replaces the pixel by the local(3x3) minimum.
  18282. It accepts the following options:
  18283. @table @option
  18284. @item threshold0
  18285. @item threshold1
  18286. @item threshold2
  18287. @item threshold3
  18288. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  18289. If @code{0}, plane will remain unchanged.
  18290. @item coordinates
  18291. Flag which specifies the pixel to refer to.
  18292. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  18293. Flags to local 3x3 coordinates region centered on @code{x}:
  18294. 1 2 3
  18295. 4 x 5
  18296. 6 7 8
  18297. @end table
  18298. @subsection Example
  18299. @itemize
  18300. @item
  18301. 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.
  18302. @example
  18303. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  18304. @end example
  18305. @end itemize
  18306. @section deshake_opencl
  18307. Feature-point based video stabilization filter.
  18308. The filter accepts the following options:
  18309. @table @option
  18310. @item tripod
  18311. Simulates a tripod by preventing any camera movement whatsoever from the original frame. Defaults to @code{0}.
  18312. @item debug
  18313. Whether or not additional debug info should be displayed, both in the processed output and in the console.
  18314. Note that in order to see console debug output you will also need to pass @code{-v verbose} to ffmpeg.
  18315. Viewing point matches in the output video is only supported for RGB input.
  18316. Defaults to @code{0}.
  18317. @item adaptive_crop
  18318. Whether or not to do a tiny bit of cropping at the borders to cut down on the amount of mirrored pixels.
  18319. Defaults to @code{1}.
  18320. @item refine_features
  18321. Whether or not feature points should be refined at a sub-pixel level.
  18322. This can be turned off for a slight performance gain at the cost of precision.
  18323. Defaults to @code{1}.
  18324. @item smooth_strength
  18325. The strength of the smoothing applied to the camera path from @code{0.0} to @code{1.0}.
  18326. @code{1.0} is the maximum smoothing strength while values less than that result in less smoothing.
  18327. @code{0.0} causes the filter to adaptively choose a smoothing strength on a per-frame basis.
  18328. Defaults to @code{0.0}.
  18329. @item smooth_window_multiplier
  18330. Controls the size of the smoothing window (the number of frames buffered to determine motion information from).
  18331. The size of the smoothing window is determined by multiplying the framerate of the video by this number.
  18332. Acceptable values range from @code{0.1} to @code{10.0}.
  18333. Larger values increase the amount of motion data available for determining how to smooth the camera path,
  18334. potentially improving smoothness, but also increase latency and memory usage.
  18335. Defaults to @code{2.0}.
  18336. @end table
  18337. @subsection Examples
  18338. @itemize
  18339. @item
  18340. Stabilize a video with a fixed, medium smoothing strength:
  18341. @example
  18342. -i INPUT -vf "hwupload, deshake_opencl=smooth_strength=0.5, hwdownload" OUTPUT
  18343. @end example
  18344. @item
  18345. Stabilize a video with debugging (both in console and in rendered video):
  18346. @example
  18347. -i INPUT -filter_complex "[0:v]format=rgba, hwupload, deshake_opencl=debug=1, hwdownload, format=rgba, format=yuv420p" -v verbose OUTPUT
  18348. @end example
  18349. @end itemize
  18350. @section dilation_opencl
  18351. Apply dilation effect to the video.
  18352. This filter replaces the pixel by the local(3x3) maximum.
  18353. It accepts the following options:
  18354. @table @option
  18355. @item threshold0
  18356. @item threshold1
  18357. @item threshold2
  18358. @item threshold3
  18359. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  18360. If @code{0}, plane will remain unchanged.
  18361. @item coordinates
  18362. Flag which specifies the pixel to refer to.
  18363. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  18364. Flags to local 3x3 coordinates region centered on @code{x}:
  18365. 1 2 3
  18366. 4 x 5
  18367. 6 7 8
  18368. @end table
  18369. @subsection Example
  18370. @itemize
  18371. @item
  18372. 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.
  18373. @example
  18374. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  18375. @end example
  18376. @end itemize
  18377. @section nlmeans_opencl
  18378. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  18379. @section overlay_opencl
  18380. Overlay one video on top of another.
  18381. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  18382. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  18383. The filter accepts the following options:
  18384. @table @option
  18385. @item x
  18386. Set the x coordinate of the overlaid video on the main video.
  18387. Default value is @code{0}.
  18388. @item y
  18389. Set the y coordinate of the overlaid video on the main video.
  18390. Default value is @code{0}.
  18391. @end table
  18392. @subsection Examples
  18393. @itemize
  18394. @item
  18395. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  18396. @example
  18397. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  18398. @end example
  18399. @item
  18400. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  18401. @example
  18402. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  18403. @end example
  18404. @end itemize
  18405. @section pad_opencl
  18406. Add paddings to the input image, and place the original input at the
  18407. provided @var{x}, @var{y} coordinates.
  18408. It accepts the following options:
  18409. @table @option
  18410. @item width, w
  18411. @item height, h
  18412. Specify an expression for the size of the output image with the
  18413. paddings added. If the value for @var{width} or @var{height} is 0, the
  18414. corresponding input size is used for the output.
  18415. The @var{width} expression can reference the value set by the
  18416. @var{height} expression, and vice versa.
  18417. The default value of @var{width} and @var{height} is 0.
  18418. @item x
  18419. @item y
  18420. Specify the offsets to place the input image at within the padded area,
  18421. with respect to the top/left border of the output image.
  18422. The @var{x} expression can reference the value set by the @var{y}
  18423. expression, and vice versa.
  18424. The default value of @var{x} and @var{y} is 0.
  18425. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  18426. so the input image is centered on the padded area.
  18427. @item color
  18428. Specify the color of the padded area. For the syntax of this option,
  18429. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  18430. manual,ffmpeg-utils}.
  18431. @item aspect
  18432. Pad to an aspect instead to a resolution.
  18433. @end table
  18434. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  18435. options are expressions containing the following constants:
  18436. @table @option
  18437. @item in_w
  18438. @item in_h
  18439. The input video width and height.
  18440. @item iw
  18441. @item ih
  18442. These are the same as @var{in_w} and @var{in_h}.
  18443. @item out_w
  18444. @item out_h
  18445. The output width and height (the size of the padded area), as
  18446. specified by the @var{width} and @var{height} expressions.
  18447. @item ow
  18448. @item oh
  18449. These are the same as @var{out_w} and @var{out_h}.
  18450. @item x
  18451. @item y
  18452. The x and y offsets as specified by the @var{x} and @var{y}
  18453. expressions, or NAN if not yet specified.
  18454. @item a
  18455. same as @var{iw} / @var{ih}
  18456. @item sar
  18457. input sample aspect ratio
  18458. @item dar
  18459. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  18460. @end table
  18461. @section prewitt_opencl
  18462. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  18463. The filter accepts the following option:
  18464. @table @option
  18465. @item planes
  18466. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  18467. @item scale
  18468. Set value which will be multiplied with filtered result.
  18469. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  18470. @item delta
  18471. Set value which will be added to filtered result.
  18472. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  18473. @end table
  18474. @subsection Example
  18475. @itemize
  18476. @item
  18477. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  18478. @example
  18479. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  18480. @end example
  18481. @end itemize
  18482. @anchor{program_opencl}
  18483. @section program_opencl
  18484. Filter video using an OpenCL program.
  18485. @table @option
  18486. @item source
  18487. OpenCL program source file.
  18488. @item kernel
  18489. Kernel name in program.
  18490. @item inputs
  18491. Number of inputs to the filter. Defaults to 1.
  18492. @item size, s
  18493. Size of output frames. Defaults to the same as the first input.
  18494. @end table
  18495. The @code{program_opencl} filter also supports the @ref{framesync} options.
  18496. The program source file must contain a kernel function with the given name,
  18497. which will be run once for each plane of the output. Each run on a plane
  18498. gets enqueued as a separate 2D global NDRange with one work-item for each
  18499. pixel to be generated. The global ID offset for each work-item is therefore
  18500. the coordinates of a pixel in the destination image.
  18501. The kernel function needs to take the following arguments:
  18502. @itemize
  18503. @item
  18504. Destination image, @var{__write_only image2d_t}.
  18505. This image will become the output; the kernel should write all of it.
  18506. @item
  18507. Frame index, @var{unsigned int}.
  18508. This is a counter starting from zero and increasing by one for each frame.
  18509. @item
  18510. Source images, @var{__read_only image2d_t}.
  18511. These are the most recent images on each input. The kernel may read from
  18512. them to generate the output, but they can't be written to.
  18513. @end itemize
  18514. Example programs:
  18515. @itemize
  18516. @item
  18517. Copy the input to the output (output must be the same size as the input).
  18518. @verbatim
  18519. __kernel void copy(__write_only image2d_t destination,
  18520. unsigned int index,
  18521. __read_only image2d_t source)
  18522. {
  18523. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  18524. int2 location = (int2)(get_global_id(0), get_global_id(1));
  18525. float4 value = read_imagef(source, sampler, location);
  18526. write_imagef(destination, location, value);
  18527. }
  18528. @end verbatim
  18529. @item
  18530. Apply a simple transformation, rotating the input by an amount increasing
  18531. with the index counter. Pixel values are linearly interpolated by the
  18532. sampler, and the output need not have the same dimensions as the input.
  18533. @verbatim
  18534. __kernel void rotate_image(__write_only image2d_t dst,
  18535. unsigned int index,
  18536. __read_only image2d_t src)
  18537. {
  18538. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  18539. CLK_FILTER_LINEAR);
  18540. float angle = (float)index / 100.0f;
  18541. float2 dst_dim = convert_float2(get_image_dim(dst));
  18542. float2 src_dim = convert_float2(get_image_dim(src));
  18543. float2 dst_cen = dst_dim / 2.0f;
  18544. float2 src_cen = src_dim / 2.0f;
  18545. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  18546. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  18547. float2 src_pos = {
  18548. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  18549. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  18550. };
  18551. src_pos = src_pos * src_dim / dst_dim;
  18552. float2 src_loc = src_pos + src_cen;
  18553. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  18554. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  18555. write_imagef(dst, dst_loc, 0.5f);
  18556. else
  18557. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  18558. }
  18559. @end verbatim
  18560. @item
  18561. Blend two inputs together, with the amount of each input used varying
  18562. with the index counter.
  18563. @verbatim
  18564. __kernel void blend_images(__write_only image2d_t dst,
  18565. unsigned int index,
  18566. __read_only image2d_t src1,
  18567. __read_only image2d_t src2)
  18568. {
  18569. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  18570. CLK_FILTER_LINEAR);
  18571. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  18572. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  18573. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  18574. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  18575. float4 val1 = read_imagef(src1, sampler, src1_loc);
  18576. float4 val2 = read_imagef(src2, sampler, src2_loc);
  18577. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  18578. }
  18579. @end verbatim
  18580. @end itemize
  18581. @section roberts_opencl
  18582. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  18583. The filter accepts the following option:
  18584. @table @option
  18585. @item planes
  18586. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  18587. @item scale
  18588. Set value which will be multiplied with filtered result.
  18589. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  18590. @item delta
  18591. Set value which will be added to filtered result.
  18592. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  18593. @end table
  18594. @subsection Example
  18595. @itemize
  18596. @item
  18597. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  18598. @example
  18599. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  18600. @end example
  18601. @end itemize
  18602. @section sobel_opencl
  18603. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  18604. The filter accepts the following option:
  18605. @table @option
  18606. @item planes
  18607. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  18608. @item scale
  18609. Set value which will be multiplied with filtered result.
  18610. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  18611. @item delta
  18612. Set value which will be added to filtered result.
  18613. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  18614. @end table
  18615. @subsection Example
  18616. @itemize
  18617. @item
  18618. Apply sobel operator with scale set to 2 and delta set to 10
  18619. @example
  18620. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  18621. @end example
  18622. @end itemize
  18623. @section tonemap_opencl
  18624. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  18625. It accepts the following parameters:
  18626. @table @option
  18627. @item tonemap
  18628. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  18629. @item param
  18630. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  18631. @item desat
  18632. Apply desaturation for highlights that exceed this level of brightness. The
  18633. higher the parameter, the more color information will be preserved. This
  18634. setting helps prevent unnaturally blown-out colors for super-highlights, by
  18635. (smoothly) turning into white instead. This makes images feel more natural,
  18636. at the cost of reducing information about out-of-range colors.
  18637. The default value is 0.5, and the algorithm here is a little different from
  18638. the cpu version tonemap currently. A setting of 0.0 disables this option.
  18639. @item threshold
  18640. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  18641. is used to detect whether the scene has changed or not. If the distance between
  18642. the current frame average brightness and the current running average exceeds
  18643. a threshold value, we would re-calculate scene average and peak brightness.
  18644. The default value is 0.2.
  18645. @item format
  18646. Specify the output pixel format.
  18647. Currently supported formats are:
  18648. @table @var
  18649. @item p010
  18650. @item nv12
  18651. @end table
  18652. @item range, r
  18653. Set the output color range.
  18654. Possible values are:
  18655. @table @var
  18656. @item tv/mpeg
  18657. @item pc/jpeg
  18658. @end table
  18659. Default is same as input.
  18660. @item primaries, p
  18661. Set the output color primaries.
  18662. Possible values are:
  18663. @table @var
  18664. @item bt709
  18665. @item bt2020
  18666. @end table
  18667. Default is same as input.
  18668. @item transfer, t
  18669. Set the output transfer characteristics.
  18670. Possible values are:
  18671. @table @var
  18672. @item bt709
  18673. @item bt2020
  18674. @end table
  18675. Default is bt709.
  18676. @item matrix, m
  18677. Set the output colorspace matrix.
  18678. Possible value are:
  18679. @table @var
  18680. @item bt709
  18681. @item bt2020
  18682. @end table
  18683. Default is same as input.
  18684. @end table
  18685. @subsection Example
  18686. @itemize
  18687. @item
  18688. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  18689. @example
  18690. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  18691. @end example
  18692. @end itemize
  18693. @section unsharp_opencl
  18694. Sharpen or blur the input video.
  18695. It accepts the following parameters:
  18696. @table @option
  18697. @item luma_msize_x, lx
  18698. Set the luma matrix horizontal size.
  18699. Range is @code{[1, 23]} and default value is @code{5}.
  18700. @item luma_msize_y, ly
  18701. Set the luma matrix vertical size.
  18702. Range is @code{[1, 23]} and default value is @code{5}.
  18703. @item luma_amount, la
  18704. Set the luma effect strength.
  18705. Range is @code{[-10, 10]} and default value is @code{1.0}.
  18706. Negative values will blur the input video, while positive values will
  18707. sharpen it, a value of zero will disable the effect.
  18708. @item chroma_msize_x, cx
  18709. Set the chroma matrix horizontal size.
  18710. Range is @code{[1, 23]} and default value is @code{5}.
  18711. @item chroma_msize_y, cy
  18712. Set the chroma matrix vertical size.
  18713. Range is @code{[1, 23]} and default value is @code{5}.
  18714. @item chroma_amount, ca
  18715. Set the chroma effect strength.
  18716. Range is @code{[-10, 10]} and default value is @code{0.0}.
  18717. Negative values will blur the input video, while positive values will
  18718. sharpen it, a value of zero will disable the effect.
  18719. @end table
  18720. All parameters are optional and default to the equivalent of the
  18721. string '5:5:1.0:5:5:0.0'.
  18722. @subsection Examples
  18723. @itemize
  18724. @item
  18725. Apply strong luma sharpen effect:
  18726. @example
  18727. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  18728. @end example
  18729. @item
  18730. Apply a strong blur of both luma and chroma parameters:
  18731. @example
  18732. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  18733. @end example
  18734. @end itemize
  18735. @section xfade_opencl
  18736. Cross fade two videos with custom transition effect by using OpenCL.
  18737. It accepts the following options:
  18738. @table @option
  18739. @item transition
  18740. Set one of possible transition effects.
  18741. @table @option
  18742. @item custom
  18743. Select custom transition effect, the actual transition description
  18744. will be picked from source and kernel options.
  18745. @item fade
  18746. @item wipeleft
  18747. @item wiperight
  18748. @item wipeup
  18749. @item wipedown
  18750. @item slideleft
  18751. @item slideright
  18752. @item slideup
  18753. @item slidedown
  18754. Default transition is fade.
  18755. @end table
  18756. @item source
  18757. OpenCL program source file for custom transition.
  18758. @item kernel
  18759. Set name of kernel to use for custom transition from program source file.
  18760. @item duration
  18761. Set duration of video transition.
  18762. @item offset
  18763. Set time of start of transition relative to first video.
  18764. @end table
  18765. The program source file must contain a kernel function with the given name,
  18766. which will be run once for each plane of the output. Each run on a plane
  18767. gets enqueued as a separate 2D global NDRange with one work-item for each
  18768. pixel to be generated. The global ID offset for each work-item is therefore
  18769. the coordinates of a pixel in the destination image.
  18770. The kernel function needs to take the following arguments:
  18771. @itemize
  18772. @item
  18773. Destination image, @var{__write_only image2d_t}.
  18774. This image will become the output; the kernel should write all of it.
  18775. @item
  18776. First Source image, @var{__read_only image2d_t}.
  18777. Second Source image, @var{__read_only image2d_t}.
  18778. These are the most recent images on each input. The kernel may read from
  18779. them to generate the output, but they can't be written to.
  18780. @item
  18781. Transition progress, @var{float}. This value is always between 0 and 1 inclusive.
  18782. @end itemize
  18783. Example programs:
  18784. @itemize
  18785. @item
  18786. Apply dots curtain transition effect:
  18787. @verbatim
  18788. __kernel void blend_images(__write_only image2d_t dst,
  18789. __read_only image2d_t src1,
  18790. __read_only image2d_t src2,
  18791. float progress)
  18792. {
  18793. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  18794. CLK_FILTER_LINEAR);
  18795. int2 p = (int2)(get_global_id(0), get_global_id(1));
  18796. float2 rp = (float2)(get_global_id(0), get_global_id(1));
  18797. float2 dim = (float2)(get_image_dim(src1).x, get_image_dim(src1).y);
  18798. rp = rp / dim;
  18799. float2 dots = (float2)(20.0, 20.0);
  18800. float2 center = (float2)(0,0);
  18801. float2 unused;
  18802. float4 val1 = read_imagef(src1, sampler, p);
  18803. float4 val2 = read_imagef(src2, sampler, p);
  18804. bool next = distance(fract(rp * dots, &unused), (float2)(0.5, 0.5)) < (progress / distance(rp, center));
  18805. write_imagef(dst, p, next ? val1 : val2);
  18806. }
  18807. @end verbatim
  18808. @end itemize
  18809. @c man end OPENCL VIDEO FILTERS
  18810. @chapter VAAPI Video Filters
  18811. @c man begin VAAPI VIDEO FILTERS
  18812. VAAPI Video filters are usually used with VAAPI decoder and VAAPI encoder. Below is a description of VAAPI video filters.
  18813. To enable compilation of these filters you need to configure FFmpeg with
  18814. @code{--enable-vaapi}.
  18815. To use vaapi filters, you need to setup the vaapi device correctly. For more information, please read @url{https://trac.ffmpeg.org/wiki/Hardware/VAAPI}
  18816. @section tonemap_vaapi
  18817. Perform HDR(High Dynamic Range) to SDR(Standard Dynamic Range) conversion with tone-mapping.
  18818. It maps the dynamic range of HDR10 content to the SDR content.
  18819. It currently only accepts HDR10 as input.
  18820. It accepts the following parameters:
  18821. @table @option
  18822. @item format
  18823. Specify the output pixel format.
  18824. Currently supported formats are:
  18825. @table @var
  18826. @item p010
  18827. @item nv12
  18828. @end table
  18829. Default is nv12.
  18830. @item primaries, p
  18831. Set the output color primaries.
  18832. Default is same as input.
  18833. @item transfer, t
  18834. Set the output transfer characteristics.
  18835. Default is bt709.
  18836. @item matrix, m
  18837. Set the output colorspace matrix.
  18838. Default is same as input.
  18839. @end table
  18840. @subsection Example
  18841. @itemize
  18842. @item
  18843. Convert HDR(HDR10) video to bt2020-transfer-characteristic p010 format
  18844. @example
  18845. tonemap_vaapi=format=p010:t=bt2020-10
  18846. @end example
  18847. @end itemize
  18848. @c man end VAAPI VIDEO FILTERS
  18849. @chapter Video Sources
  18850. @c man begin VIDEO SOURCES
  18851. Below is a description of the currently available video sources.
  18852. @section buffer
  18853. Buffer video frames, and make them available to the filter chain.
  18854. This source is mainly intended for a programmatic use, in particular
  18855. through the interface defined in @file{libavfilter/buffersrc.h}.
  18856. It accepts the following parameters:
  18857. @table @option
  18858. @item video_size
  18859. Specify the size (width and height) of the buffered video frames. For the
  18860. syntax of this option, check the
  18861. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18862. @item width
  18863. The input video width.
  18864. @item height
  18865. The input video height.
  18866. @item pix_fmt
  18867. A string representing the pixel format of the buffered video frames.
  18868. It may be a number corresponding to a pixel format, or a pixel format
  18869. name.
  18870. @item time_base
  18871. Specify the timebase assumed by the timestamps of the buffered frames.
  18872. @item frame_rate
  18873. Specify the frame rate expected for the video stream.
  18874. @item pixel_aspect, sar
  18875. The sample (pixel) aspect ratio of the input video.
  18876. @item sws_param
  18877. This option is deprecated and ignored. Prepend @code{sws_flags=@var{flags};}
  18878. to the filtergraph description to specify swscale flags for automatically
  18879. inserted scalers. See @ref{Filtergraph syntax}.
  18880. @item hw_frames_ctx
  18881. When using a hardware pixel format, this should be a reference to an
  18882. AVHWFramesContext describing input frames.
  18883. @end table
  18884. For example:
  18885. @example
  18886. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  18887. @end example
  18888. will instruct the source to accept video frames with size 320x240 and
  18889. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  18890. square pixels (1:1 sample aspect ratio).
  18891. Since the pixel format with name "yuv410p" corresponds to the number 6
  18892. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  18893. this example corresponds to:
  18894. @example
  18895. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  18896. @end example
  18897. Alternatively, the options can be specified as a flat string, but this
  18898. syntax is deprecated:
  18899. @var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}
  18900. @section cellauto
  18901. Create a pattern generated by an elementary cellular automaton.
  18902. The initial state of the cellular automaton can be defined through the
  18903. @option{filename} and @option{pattern} options. If such options are
  18904. not specified an initial state is created randomly.
  18905. At each new frame a new row in the video is filled with the result of
  18906. the cellular automaton next generation. The behavior when the whole
  18907. frame is filled is defined by the @option{scroll} option.
  18908. This source accepts the following options:
  18909. @table @option
  18910. @item filename, f
  18911. Read the initial cellular automaton state, i.e. the starting row, from
  18912. the specified file.
  18913. In the file, each non-whitespace character is considered an alive
  18914. cell, a newline will terminate the row, and further characters in the
  18915. file will be ignored.
  18916. @item pattern, p
  18917. Read the initial cellular automaton state, i.e. the starting row, from
  18918. the specified string.
  18919. Each non-whitespace character in the string is considered an alive
  18920. cell, a newline will terminate the row, and further characters in the
  18921. string will be ignored.
  18922. @item rate, r
  18923. Set the video rate, that is the number of frames generated per second.
  18924. Default is 25.
  18925. @item random_fill_ratio, ratio
  18926. Set the random fill ratio for the initial cellular automaton row. It
  18927. is a floating point number value ranging from 0 to 1, defaults to
  18928. 1/PHI.
  18929. This option is ignored when a file or a pattern is specified.
  18930. @item random_seed, seed
  18931. Set the seed for filling randomly the initial row, must be an integer
  18932. included between 0 and UINT32_MAX. If not specified, or if explicitly
  18933. set to -1, the filter will try to use a good random seed on a best
  18934. effort basis.
  18935. @item rule
  18936. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  18937. Default value is 110.
  18938. @item size, s
  18939. Set the size of the output video. For the syntax of this option, check the
  18940. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18941. If @option{filename} or @option{pattern} is specified, the size is set
  18942. by default to the width of the specified initial state row, and the
  18943. height is set to @var{width} * PHI.
  18944. If @option{size} is set, it must contain the width of the specified
  18945. pattern string, and the specified pattern will be centered in the
  18946. larger row.
  18947. If a filename or a pattern string is not specified, the size value
  18948. defaults to "320x518" (used for a randomly generated initial state).
  18949. @item scroll
  18950. If set to 1, scroll the output upward when all the rows in the output
  18951. have been already filled. If set to 0, the new generated row will be
  18952. written over the top row just after the bottom row is filled.
  18953. Defaults to 1.
  18954. @item start_full, full
  18955. If set to 1, completely fill the output with generated rows before
  18956. outputting the first frame.
  18957. This is the default behavior, for disabling set the value to 0.
  18958. @item stitch
  18959. If set to 1, stitch the left and right row edges together.
  18960. This is the default behavior, for disabling set the value to 0.
  18961. @end table
  18962. @subsection Examples
  18963. @itemize
  18964. @item
  18965. Read the initial state from @file{pattern}, and specify an output of
  18966. size 200x400.
  18967. @example
  18968. cellauto=f=pattern:s=200x400
  18969. @end example
  18970. @item
  18971. Generate a random initial row with a width of 200 cells, with a fill
  18972. ratio of 2/3:
  18973. @example
  18974. cellauto=ratio=2/3:s=200x200
  18975. @end example
  18976. @item
  18977. Create a pattern generated by rule 18 starting by a single alive cell
  18978. centered on an initial row with width 100:
  18979. @example
  18980. cellauto=p=@@:s=100x400:full=0:rule=18
  18981. @end example
  18982. @item
  18983. Specify a more elaborated initial pattern:
  18984. @example
  18985. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  18986. @end example
  18987. @end itemize
  18988. @anchor{coreimagesrc}
  18989. @section coreimagesrc
  18990. Video source generated on GPU using Apple's CoreImage API on OSX.
  18991. This video source is a specialized version of the @ref{coreimage} video filter.
  18992. Use a core image generator at the beginning of the applied filterchain to
  18993. generate the content.
  18994. The coreimagesrc video source accepts the following options:
  18995. @table @option
  18996. @item list_generators
  18997. List all available generators along with all their respective options as well as
  18998. possible minimum and maximum values along with the default values.
  18999. @example
  19000. list_generators=true
  19001. @end example
  19002. @item size, s
  19003. Specify the size of the sourced video. For the syntax of this option, check the
  19004. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19005. The default value is @code{320x240}.
  19006. @item rate, r
  19007. Specify the frame rate of the sourced video, as the number of frames
  19008. generated per second. It has to be a string in the format
  19009. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  19010. number or a valid video frame rate abbreviation. The default value is
  19011. "25".
  19012. @item sar
  19013. Set the sample aspect ratio of the sourced video.
  19014. @item duration, d
  19015. Set the duration of the sourced video. See
  19016. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  19017. for the accepted syntax.
  19018. If not specified, or the expressed duration is negative, the video is
  19019. supposed to be generated forever.
  19020. @end table
  19021. Additionally, all options of the @ref{coreimage} video filter are accepted.
  19022. A complete filterchain can be used for further processing of the
  19023. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  19024. and examples for details.
  19025. @subsection Examples
  19026. @itemize
  19027. @item
  19028. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  19029. given as complete and escaped command-line for Apple's standard bash shell:
  19030. @example
  19031. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  19032. @end example
  19033. This example is equivalent to the QRCode example of @ref{coreimage} without the
  19034. need for a nullsrc video source.
  19035. @end itemize
  19036. @section gradients
  19037. Generate several gradients.
  19038. @table @option
  19039. @item size, s
  19040. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  19041. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  19042. @item rate, r
  19043. Set frame rate, expressed as number of frames per second. Default
  19044. value is "25".
  19045. @item c0, c1, c2, c3, c4, c5, c6, c7
  19046. Set 8 colors. Default values for colors is to pick random one.
  19047. @item x0, y0, y0, y1
  19048. Set gradient line source and destination points. If negative or out of range, random ones
  19049. are picked.
  19050. @item nb_colors, n
  19051. Set number of colors to use at once. Allowed range is from 2 to 8. Default value is 2.
  19052. @item seed
  19053. Set seed for picking gradient line points.
  19054. @item duration, d
  19055. Set the duration of the sourced video. See
  19056. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  19057. for the accepted syntax.
  19058. If not specified, or the expressed duration is negative, the video is
  19059. supposed to be generated forever.
  19060. @item speed
  19061. Set speed of gradients rotation.
  19062. @end table
  19063. @section mandelbrot
  19064. Generate a Mandelbrot set fractal, and progressively zoom towards the
  19065. point specified with @var{start_x} and @var{start_y}.
  19066. This source accepts the following options:
  19067. @table @option
  19068. @item end_pts
  19069. Set the terminal pts value. Default value is 400.
  19070. @item end_scale
  19071. Set the terminal scale value.
  19072. Must be a floating point value. Default value is 0.3.
  19073. @item inner
  19074. Set the inner coloring mode, that is the algorithm used to draw the
  19075. Mandelbrot fractal internal region.
  19076. It shall assume one of the following values:
  19077. @table @option
  19078. @item black
  19079. Set black mode.
  19080. @item convergence
  19081. Show time until convergence.
  19082. @item mincol
  19083. Set color based on point closest to the origin of the iterations.
  19084. @item period
  19085. Set period mode.
  19086. @end table
  19087. Default value is @var{mincol}.
  19088. @item bailout
  19089. Set the bailout value. Default value is 10.0.
  19090. @item maxiter
  19091. Set the maximum of iterations performed by the rendering
  19092. algorithm. Default value is 7189.
  19093. @item outer
  19094. Set outer coloring mode.
  19095. It shall assume one of following values:
  19096. @table @option
  19097. @item iteration_count
  19098. Set iteration count mode.
  19099. @item normalized_iteration_count
  19100. set normalized iteration count mode.
  19101. @end table
  19102. Default value is @var{normalized_iteration_count}.
  19103. @item rate, r
  19104. Set frame rate, expressed as number of frames per second. Default
  19105. value is "25".
  19106. @item size, s
  19107. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  19108. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  19109. @item start_scale
  19110. Set the initial scale value. Default value is 3.0.
  19111. @item start_x
  19112. Set the initial x position. Must be a floating point value between
  19113. -100 and 100. Default value is -0.743643887037158704752191506114774.
  19114. @item start_y
  19115. Set the initial y position. Must be a floating point value between
  19116. -100 and 100. Default value is -0.131825904205311970493132056385139.
  19117. @end table
  19118. @section mptestsrc
  19119. Generate various test patterns, as generated by the MPlayer test filter.
  19120. The size of the generated video is fixed, and is 256x256.
  19121. This source is useful in particular for testing encoding features.
  19122. This source accepts the following options:
  19123. @table @option
  19124. @item rate, r
  19125. Specify the frame rate of the sourced video, as the number of frames
  19126. generated per second. It has to be a string in the format
  19127. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  19128. number or a valid video frame rate abbreviation. The default value is
  19129. "25".
  19130. @item duration, d
  19131. Set the duration of the sourced video. See
  19132. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  19133. for the accepted syntax.
  19134. If not specified, or the expressed duration is negative, the video is
  19135. supposed to be generated forever.
  19136. @item test, t
  19137. Set the number or the name of the test to perform. Supported tests are:
  19138. @table @option
  19139. @item dc_luma
  19140. @item dc_chroma
  19141. @item freq_luma
  19142. @item freq_chroma
  19143. @item amp_luma
  19144. @item amp_chroma
  19145. @item cbp
  19146. @item mv
  19147. @item ring1
  19148. @item ring2
  19149. @item all
  19150. @item max_frames, m
  19151. Set the maximum number of frames generated for each test, default value is 30.
  19152. @end table
  19153. Default value is "all", which will cycle through the list of all tests.
  19154. @end table
  19155. Some examples:
  19156. @example
  19157. mptestsrc=t=dc_luma
  19158. @end example
  19159. will generate a "dc_luma" test pattern.
  19160. @section frei0r_src
  19161. Provide a frei0r source.
  19162. To enable compilation of this filter you need to install the frei0r
  19163. header and configure FFmpeg with @code{--enable-frei0r}.
  19164. This source accepts the following parameters:
  19165. @table @option
  19166. @item size
  19167. The size of the video to generate. For the syntax of this option, check the
  19168. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19169. @item framerate
  19170. The framerate of the generated video. It may be a string of the form
  19171. @var{num}/@var{den} or a frame rate abbreviation.
  19172. @item filter_name
  19173. The name to the frei0r source to load. For more information regarding frei0r and
  19174. how to set the parameters, read the @ref{frei0r} section in the video filters
  19175. documentation.
  19176. @item filter_params
  19177. A '|'-separated list of parameters to pass to the frei0r source.
  19178. @end table
  19179. For example, to generate a frei0r partik0l source with size 200x200
  19180. and frame rate 10 which is overlaid on the overlay filter main input:
  19181. @example
  19182. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  19183. @end example
  19184. @section life
  19185. Generate a life pattern.
  19186. This source is based on a generalization of John Conway's life game.
  19187. The sourced input represents a life grid, each pixel represents a cell
  19188. which can be in one of two possible states, alive or dead. Every cell
  19189. interacts with its eight neighbours, which are the cells that are
  19190. horizontally, vertically, or diagonally adjacent.
  19191. At each interaction the grid evolves according to the adopted rule,
  19192. which specifies the number of neighbor alive cells which will make a
  19193. cell stay alive or born. The @option{rule} option allows one to specify
  19194. the rule to adopt.
  19195. This source accepts the following options:
  19196. @table @option
  19197. @item filename, f
  19198. Set the file from which to read the initial grid state. In the file,
  19199. each non-whitespace character is considered an alive cell, and newline
  19200. is used to delimit the end of each row.
  19201. If this option is not specified, the initial grid is generated
  19202. randomly.
  19203. @item rate, r
  19204. Set the video rate, that is the number of frames generated per second.
  19205. Default is 25.
  19206. @item random_fill_ratio, ratio
  19207. Set the random fill ratio for the initial random grid. It is a
  19208. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  19209. It is ignored when a file is specified.
  19210. @item random_seed, seed
  19211. Set the seed for filling the initial random grid, must be an integer
  19212. included between 0 and UINT32_MAX. If not specified, or if explicitly
  19213. set to -1, the filter will try to use a good random seed on a best
  19214. effort basis.
  19215. @item rule
  19216. Set the life rule.
  19217. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  19218. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  19219. @var{NS} specifies the number of alive neighbor cells which make a
  19220. live cell stay alive, and @var{NB} the number of alive neighbor cells
  19221. which make a dead cell to become alive (i.e. to "born").
  19222. "s" and "b" can be used in place of "S" and "B", respectively.
  19223. Alternatively a rule can be specified by an 18-bits integer. The 9
  19224. high order bits are used to encode the next cell state if it is alive
  19225. for each number of neighbor alive cells, the low order bits specify
  19226. the rule for "borning" new cells. Higher order bits encode for an
  19227. higher number of neighbor cells.
  19228. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  19229. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  19230. Default value is "S23/B3", which is the original Conway's game of life
  19231. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  19232. cells, and will born a new cell if there are three alive cells around
  19233. a dead cell.
  19234. @item size, s
  19235. Set the size of the output video. For the syntax of this option, check the
  19236. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19237. If @option{filename} is specified, the size is set by default to the
  19238. same size of the input file. If @option{size} is set, it must contain
  19239. the size specified in the input file, and the initial grid defined in
  19240. that file is centered in the larger resulting area.
  19241. If a filename is not specified, the size value defaults to "320x240"
  19242. (used for a randomly generated initial grid).
  19243. @item stitch
  19244. If set to 1, stitch the left and right grid edges together, and the
  19245. top and bottom edges also. Defaults to 1.
  19246. @item mold
  19247. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  19248. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  19249. value from 0 to 255.
  19250. @item life_color
  19251. Set the color of living (or new born) cells.
  19252. @item death_color
  19253. Set the color of dead cells. If @option{mold} is set, this is the first color
  19254. used to represent a dead cell.
  19255. @item mold_color
  19256. Set mold color, for definitely dead and moldy cells.
  19257. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  19258. ffmpeg-utils manual,ffmpeg-utils}.
  19259. @end table
  19260. @subsection Examples
  19261. @itemize
  19262. @item
  19263. Read a grid from @file{pattern}, and center it on a grid of size
  19264. 300x300 pixels:
  19265. @example
  19266. life=f=pattern:s=300x300
  19267. @end example
  19268. @item
  19269. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  19270. @example
  19271. life=ratio=2/3:s=200x200
  19272. @end example
  19273. @item
  19274. Specify a custom rule for evolving a randomly generated grid:
  19275. @example
  19276. life=rule=S14/B34
  19277. @end example
  19278. @item
  19279. Full example with slow death effect (mold) using @command{ffplay}:
  19280. @example
  19281. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  19282. @end example
  19283. @end itemize
  19284. @anchor{allrgb}
  19285. @anchor{allyuv}
  19286. @anchor{color}
  19287. @anchor{colorspectrum}
  19288. @anchor{haldclutsrc}
  19289. @anchor{nullsrc}
  19290. @anchor{pal75bars}
  19291. @anchor{pal100bars}
  19292. @anchor{rgbtestsrc}
  19293. @anchor{smptebars}
  19294. @anchor{smptehdbars}
  19295. @anchor{testsrc}
  19296. @anchor{testsrc2}
  19297. @anchor{yuvtestsrc}
  19298. @section allrgb, allyuv, color, colorspectrum, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  19299. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  19300. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  19301. The @code{color} source provides an uniformly colored input.
  19302. The @code{colorspectrum} source provides a color spectrum input.
  19303. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  19304. @ref{haldclut} filter.
  19305. The @code{nullsrc} source returns unprocessed video frames. It is
  19306. mainly useful to be employed in analysis / debugging tools, or as the
  19307. source for filters which ignore the input data.
  19308. The @code{pal75bars} source generates a color bars pattern, based on
  19309. EBU PAL recommendations with 75% color levels.
  19310. The @code{pal100bars} source generates a color bars pattern, based on
  19311. EBU PAL recommendations with 100% color levels.
  19312. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  19313. detecting RGB vs BGR issues. You should see a red, green and blue
  19314. stripe from top to bottom.
  19315. The @code{smptebars} source generates a color bars pattern, based on
  19316. the SMPTE Engineering Guideline EG 1-1990.
  19317. The @code{smptehdbars} source generates a color bars pattern, based on
  19318. the SMPTE RP 219-2002.
  19319. The @code{testsrc} source generates a test video pattern, showing a
  19320. color pattern, a scrolling gradient and a timestamp. This is mainly
  19321. intended for testing purposes.
  19322. The @code{testsrc2} source is similar to testsrc, but supports more
  19323. pixel formats instead of just @code{rgb24}. This allows using it as an
  19324. input for other tests without requiring a format conversion.
  19325. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  19326. see a y, cb and cr stripe from top to bottom.
  19327. The sources accept the following parameters:
  19328. @table @option
  19329. @item level
  19330. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  19331. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  19332. pixels to be used as identity matrix for 3D lookup tables. Each component is
  19333. coded on a @code{1/(N*N)} scale.
  19334. @item color, c
  19335. Specify the color of the source, only available in the @code{color}
  19336. source. For the syntax of this option, check the
  19337. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19338. @item size, s
  19339. Specify the size of the sourced video. For the syntax of this option, check the
  19340. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19341. The default value is @code{320x240}.
  19342. This option is not available with the @code{allrgb}, @code{allyuv}, and
  19343. @code{haldclutsrc} filters.
  19344. @item rate, r
  19345. Specify the frame rate of the sourced video, as the number of frames
  19346. generated per second. It has to be a string in the format
  19347. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  19348. number or a valid video frame rate abbreviation. The default value is
  19349. "25".
  19350. @item duration, d
  19351. Set the duration of the sourced video. See
  19352. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  19353. for the accepted syntax.
  19354. If not specified, or the expressed duration is negative, the video is
  19355. supposed to be generated forever.
  19356. Since the frame rate is used as time base, all frames including the last one
  19357. will have their full duration. If the specified duration is not a multiple
  19358. of the frame duration, it will be rounded up.
  19359. @item sar
  19360. Set the sample aspect ratio of the sourced video.
  19361. @item alpha
  19362. Specify the alpha (opacity) of the background, only available in the
  19363. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  19364. 255 (fully opaque, the default).
  19365. @item decimals, n
  19366. Set the number of decimals to show in the timestamp, only available in the
  19367. @code{testsrc} source.
  19368. The displayed timestamp value will correspond to the original
  19369. timestamp value multiplied by the power of 10 of the specified
  19370. value. Default value is 0.
  19371. @item type
  19372. Set the type of the color spectrum, only available in the
  19373. @code{colorspectrum} source. Can be one of the following:
  19374. @table @samp
  19375. @item black
  19376. @item white
  19377. @item all
  19378. @end table
  19379. @end table
  19380. @subsection Examples
  19381. @itemize
  19382. @item
  19383. Generate a video with a duration of 5.3 seconds, with size
  19384. 176x144 and a frame rate of 10 frames per second:
  19385. @example
  19386. testsrc=duration=5.3:size=qcif:rate=10
  19387. @end example
  19388. @item
  19389. The following graph description will generate a red source
  19390. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  19391. frames per second:
  19392. @example
  19393. color=c=red@@0.2:s=qcif:r=10
  19394. @end example
  19395. @item
  19396. If the input content is to be ignored, @code{nullsrc} can be used. The
  19397. following command generates noise in the luminance plane by employing
  19398. the @code{geq} filter:
  19399. @example
  19400. nullsrc=s=256x256, geq=random(1)*255:128:128
  19401. @end example
  19402. @end itemize
  19403. @subsection Commands
  19404. The @code{color} source supports the following commands:
  19405. @table @option
  19406. @item c, color
  19407. Set the color of the created image. Accepts the same syntax of the
  19408. corresponding @option{color} option.
  19409. @end table
  19410. @section openclsrc
  19411. Generate video using an OpenCL program.
  19412. @table @option
  19413. @item source
  19414. OpenCL program source file.
  19415. @item kernel
  19416. Kernel name in program.
  19417. @item size, s
  19418. Size of frames to generate. This must be set.
  19419. @item format
  19420. Pixel format to use for the generated frames. This must be set.
  19421. @item rate, r
  19422. Number of frames generated every second. Default value is '25'.
  19423. @end table
  19424. For details of how the program loading works, see the @ref{program_opencl}
  19425. filter.
  19426. Example programs:
  19427. @itemize
  19428. @item
  19429. Generate a colour ramp by setting pixel values from the position of the pixel
  19430. in the output image. (Note that this will work with all pixel formats, but
  19431. the generated output will not be the same.)
  19432. @verbatim
  19433. __kernel void ramp(__write_only image2d_t dst,
  19434. unsigned int index)
  19435. {
  19436. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  19437. float4 val;
  19438. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  19439. write_imagef(dst, loc, val);
  19440. }
  19441. @end verbatim
  19442. @item
  19443. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  19444. @verbatim
  19445. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  19446. unsigned int index)
  19447. {
  19448. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  19449. float4 value = 0.0f;
  19450. int x = loc.x + index;
  19451. int y = loc.y + index;
  19452. while (x > 0 || y > 0) {
  19453. if (x % 3 == 1 && y % 3 == 1) {
  19454. value = 1.0f;
  19455. break;
  19456. }
  19457. x /= 3;
  19458. y /= 3;
  19459. }
  19460. write_imagef(dst, loc, value);
  19461. }
  19462. @end verbatim
  19463. @end itemize
  19464. @section sierpinski
  19465. Generate a Sierpinski carpet/triangle fractal, and randomly pan around.
  19466. This source accepts the following options:
  19467. @table @option
  19468. @item size, s
  19469. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  19470. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  19471. @item rate, r
  19472. Set frame rate, expressed as number of frames per second. Default
  19473. value is "25".
  19474. @item seed
  19475. Set seed which is used for random panning.
  19476. @item jump
  19477. Set max jump for single pan destination. Allowed range is from 1 to 10000.
  19478. @item type
  19479. Set fractal type, can be default @code{carpet} or @code{triangle}.
  19480. @end table
  19481. @c man end VIDEO SOURCES
  19482. @chapter Video Sinks
  19483. @c man begin VIDEO SINKS
  19484. Below is a description of the currently available video sinks.
  19485. @section buffersink
  19486. Buffer video frames, and make them available to the end of the filter
  19487. graph.
  19488. This sink is mainly intended for programmatic use, in particular
  19489. through the interface defined in @file{libavfilter/buffersink.h}
  19490. or the options system.
  19491. It accepts a pointer to an AVBufferSinkContext structure, which
  19492. defines the incoming buffers' formats, to be passed as the opaque
  19493. parameter to @code{avfilter_init_filter} for initialization.
  19494. @section nullsink
  19495. Null video sink: do absolutely nothing with the input video. It is
  19496. mainly useful as a template and for use in analysis / debugging
  19497. tools.
  19498. @c man end VIDEO SINKS
  19499. @chapter Multimedia Filters
  19500. @c man begin MULTIMEDIA FILTERS
  19501. Below is a description of the currently available multimedia filters.
  19502. @section abitscope
  19503. Convert input audio to a video output, displaying the audio bit scope.
  19504. The filter accepts the following options:
  19505. @table @option
  19506. @item rate, r
  19507. Set frame rate, expressed as number of frames per second. Default
  19508. value is "25".
  19509. @item size, s
  19510. Specify the video size for the output. For the syntax of this option, check the
  19511. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19512. Default value is @code{1024x256}.
  19513. @item colors
  19514. Specify list of colors separated by space or by '|' which will be used to
  19515. draw channels. Unrecognized or missing colors will be replaced
  19516. by white color.
  19517. @end table
  19518. @section adrawgraph
  19519. Draw a graph using input audio metadata.
  19520. See @ref{drawgraph}
  19521. @section agraphmonitor
  19522. See @ref{graphmonitor}.
  19523. @section ahistogram
  19524. Convert input audio to a video output, displaying the volume histogram.
  19525. The filter accepts the following options:
  19526. @table @option
  19527. @item dmode
  19528. Specify how histogram is calculated.
  19529. It accepts the following values:
  19530. @table @samp
  19531. @item single
  19532. Use single histogram for all channels.
  19533. @item separate
  19534. Use separate histogram for each channel.
  19535. @end table
  19536. Default is @code{single}.
  19537. @item rate, r
  19538. Set frame rate, expressed as number of frames per second. Default
  19539. value is "25".
  19540. @item size, s
  19541. Specify the video size for the output. For the syntax of this option, check the
  19542. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19543. Default value is @code{hd720}.
  19544. @item scale
  19545. Set display scale.
  19546. It accepts the following values:
  19547. @table @samp
  19548. @item log
  19549. logarithmic
  19550. @item sqrt
  19551. square root
  19552. @item cbrt
  19553. cubic root
  19554. @item lin
  19555. linear
  19556. @item rlog
  19557. reverse logarithmic
  19558. @end table
  19559. Default is @code{log}.
  19560. @item ascale
  19561. Set amplitude scale.
  19562. It accepts the following values:
  19563. @table @samp
  19564. @item log
  19565. logarithmic
  19566. @item lin
  19567. linear
  19568. @end table
  19569. Default is @code{log}.
  19570. @item acount
  19571. Set how much frames to accumulate in histogram.
  19572. Default is 1. Setting this to -1 accumulates all frames.
  19573. @item rheight
  19574. Set histogram ratio of window height.
  19575. @item slide
  19576. Set sonogram sliding.
  19577. It accepts the following values:
  19578. @table @samp
  19579. @item replace
  19580. replace old rows with new ones.
  19581. @item scroll
  19582. scroll from top to bottom.
  19583. @end table
  19584. Default is @code{replace}.
  19585. @end table
  19586. @section aphasemeter
  19587. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  19588. representing mean phase of current audio frame. A video output can also be produced and is
  19589. enabled by default. The audio is passed through as first output.
  19590. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  19591. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  19592. and @code{1} means channels are in phase.
  19593. The filter accepts the following options, all related to its video output:
  19594. @table @option
  19595. @item rate, r
  19596. Set the output frame rate. Default value is @code{25}.
  19597. @item size, s
  19598. Set the video size for the output. For the syntax of this option, check the
  19599. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19600. Default value is @code{800x400}.
  19601. @item rc
  19602. @item gc
  19603. @item bc
  19604. Specify the red, green, blue contrast. Default values are @code{2},
  19605. @code{7} and @code{1}.
  19606. Allowed range is @code{[0, 255]}.
  19607. @item mpc
  19608. Set color which will be used for drawing median phase. If color is
  19609. @code{none} which is default, no median phase value will be drawn.
  19610. @item video
  19611. Enable video output. Default is enabled.
  19612. @end table
  19613. @subsection phasing detection
  19614. The filter also detects out of phase and mono sequences in stereo streams.
  19615. It logs the sequence start, end and duration when it lasts longer or as long as the minimum set.
  19616. The filter accepts the following options for this detection:
  19617. @table @option
  19618. @item phasing
  19619. Enable mono and out of phase detection. Default is disabled.
  19620. @item tolerance, t
  19621. Set phase tolerance for mono detection, in amplitude ratio. Default is @code{0}.
  19622. Allowed range is @code{[0, 1]}.
  19623. @item angle, a
  19624. Set angle threshold for out of phase detection, in degree. Default is @code{170}.
  19625. Allowed range is @code{[90, 180]}.
  19626. @item duration, d
  19627. Set mono or out of phase duration until notification, expressed in seconds. Default is @code{2}.
  19628. @end table
  19629. @subsection Examples
  19630. @itemize
  19631. @item
  19632. Complete example with @command{ffmpeg} to detect 1 second of mono with 0.001 phase tolerance:
  19633. @example
  19634. ffmpeg -i stereo.wav -af aphasemeter=video=0:phasing=1:duration=1:tolerance=0.001 -f null -
  19635. @end example
  19636. @end itemize
  19637. @section avectorscope
  19638. Convert input audio to a video output, representing the audio vector
  19639. scope.
  19640. The filter is used to measure the difference between channels of stereo
  19641. audio stream. A monaural signal, consisting of identical left and right
  19642. signal, results in straight vertical line. Any stereo separation is visible
  19643. as a deviation from this line, creating a Lissajous figure.
  19644. If the straight (or deviation from it) but horizontal line appears this
  19645. indicates that the left and right channels are out of phase.
  19646. The filter accepts the following options:
  19647. @table @option
  19648. @item mode, m
  19649. Set the vectorscope mode.
  19650. Available values are:
  19651. @table @samp
  19652. @item lissajous
  19653. Lissajous rotated by 45 degrees.
  19654. @item lissajous_xy
  19655. Same as above but not rotated.
  19656. @item polar
  19657. Shape resembling half of circle.
  19658. @end table
  19659. Default value is @samp{lissajous}.
  19660. @item size, s
  19661. Set the video size for the output. For the syntax of this option, check the
  19662. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19663. Default value is @code{400x400}.
  19664. @item rate, r
  19665. Set the output frame rate. Default value is @code{25}.
  19666. @item rc
  19667. @item gc
  19668. @item bc
  19669. @item ac
  19670. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  19671. @code{160}, @code{80} and @code{255}.
  19672. Allowed range is @code{[0, 255]}.
  19673. @item rf
  19674. @item gf
  19675. @item bf
  19676. @item af
  19677. Specify the red, green, blue and alpha fade. Default values are @code{15},
  19678. @code{10}, @code{5} and @code{5}.
  19679. Allowed range is @code{[0, 255]}.
  19680. @item zoom
  19681. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  19682. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  19683. @item draw
  19684. Set the vectorscope drawing mode.
  19685. Available values are:
  19686. @table @samp
  19687. @item dot
  19688. Draw dot for each sample.
  19689. @item line
  19690. Draw line between previous and current sample.
  19691. @end table
  19692. Default value is @samp{dot}.
  19693. @item scale
  19694. Specify amplitude scale of audio samples.
  19695. Available values are:
  19696. @table @samp
  19697. @item lin
  19698. Linear.
  19699. @item sqrt
  19700. Square root.
  19701. @item cbrt
  19702. Cubic root.
  19703. @item log
  19704. Logarithmic.
  19705. @end table
  19706. @item swap
  19707. Swap left channel axis with right channel axis.
  19708. @item mirror
  19709. Mirror axis.
  19710. @table @samp
  19711. @item none
  19712. No mirror.
  19713. @item x
  19714. Mirror only x axis.
  19715. @item y
  19716. Mirror only y axis.
  19717. @item xy
  19718. Mirror both axis.
  19719. @end table
  19720. @end table
  19721. @subsection Examples
  19722. @itemize
  19723. @item
  19724. Complete example using @command{ffplay}:
  19725. @example
  19726. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  19727. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  19728. @end example
  19729. @end itemize
  19730. @subsection Commands
  19731. This filter supports the all above options as commands except options @code{size} and @code{rate}.
  19732. @section bench, abench
  19733. Benchmark part of a filtergraph.
  19734. The filter accepts the following options:
  19735. @table @option
  19736. @item action
  19737. Start or stop a timer.
  19738. Available values are:
  19739. @table @samp
  19740. @item start
  19741. Get the current time, set it as frame metadata (using the key
  19742. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  19743. @item stop
  19744. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  19745. the input frame metadata to get the time difference. Time difference, average,
  19746. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  19747. @code{min}) are then printed. The timestamps are expressed in seconds.
  19748. @end table
  19749. @end table
  19750. @subsection Examples
  19751. @itemize
  19752. @item
  19753. Benchmark @ref{selectivecolor} filter:
  19754. @example
  19755. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  19756. @end example
  19757. @end itemize
  19758. @section concat
  19759. Concatenate audio and video streams, joining them together one after the
  19760. other.
  19761. The filter works on segments of synchronized video and audio streams. All
  19762. segments must have the same number of streams of each type, and that will
  19763. also be the number of streams at output.
  19764. The filter accepts the following options:
  19765. @table @option
  19766. @item n
  19767. Set the number of segments. Default is 2.
  19768. @item v
  19769. Set the number of output video streams, that is also the number of video
  19770. streams in each segment. Default is 1.
  19771. @item a
  19772. Set the number of output audio streams, that is also the number of audio
  19773. streams in each segment. Default is 0.
  19774. @item unsafe
  19775. Activate unsafe mode: do not fail if segments have a different format.
  19776. @end table
  19777. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  19778. @var{a} audio outputs.
  19779. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  19780. segment, in the same order as the outputs, then the inputs for the second
  19781. segment, etc.
  19782. Related streams do not always have exactly the same duration, for various
  19783. reasons including codec frame size or sloppy authoring. For that reason,
  19784. related synchronized streams (e.g. a video and its audio track) should be
  19785. concatenated at once. The concat filter will use the duration of the longest
  19786. stream in each segment (except the last one), and if necessary pad shorter
  19787. audio streams with silence.
  19788. For this filter to work correctly, all segments must start at timestamp 0.
  19789. All corresponding streams must have the same parameters in all segments; the
  19790. filtering system will automatically select a common pixel format for video
  19791. streams, and a common sample format, sample rate and channel layout for
  19792. audio streams, but other settings, such as resolution, must be converted
  19793. explicitly by the user.
  19794. Different frame rates are acceptable but will result in variable frame rate
  19795. at output; be sure to configure the output file to handle it.
  19796. @subsection Examples
  19797. @itemize
  19798. @item
  19799. Concatenate an opening, an episode and an ending, all in bilingual version
  19800. (video in stream 0, audio in streams 1 and 2):
  19801. @example
  19802. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  19803. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  19804. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  19805. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  19806. @end example
  19807. @item
  19808. Concatenate two parts, handling audio and video separately, using the
  19809. (a)movie sources, and adjusting the resolution:
  19810. @example
  19811. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  19812. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  19813. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  19814. @end example
  19815. Note that a desync will happen at the stitch if the audio and video streams
  19816. do not have exactly the same duration in the first file.
  19817. @end itemize
  19818. @subsection Commands
  19819. This filter supports the following commands:
  19820. @table @option
  19821. @item next
  19822. Close the current segment and step to the next one
  19823. @end table
  19824. @anchor{ebur128}
  19825. @section ebur128
  19826. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  19827. level. By default, it logs a message at a frequency of 10Hz with the
  19828. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  19829. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  19830. The filter can only analyze streams which have
  19831. sample format is double-precision floating point. The input stream will be converted to
  19832. this specification, if needed. Users may need to insert aformat and/or aresample filters
  19833. after this filter to obtain the original parameters.
  19834. The filter also has a video output (see the @var{video} option) with a real
  19835. time graph to observe the loudness evolution. The graphic contains the logged
  19836. message mentioned above, so it is not printed anymore when this option is set,
  19837. unless the verbose logging is set. The main graphing area contains the
  19838. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  19839. the momentary loudness (400 milliseconds), but can optionally be configured
  19840. to instead display short-term loudness (see @var{gauge}).
  19841. The green area marks a +/- 1LU target range around the target loudness
  19842. (-23LUFS by default, unless modified through @var{target}).
  19843. More information about the Loudness Recommendation EBU R128 on
  19844. @url{http://tech.ebu.ch/loudness}.
  19845. The filter accepts the following options:
  19846. @table @option
  19847. @item video
  19848. Activate the video output. The audio stream is passed unchanged whether this
  19849. option is set or no. The video stream will be the first output stream if
  19850. activated. Default is @code{0}.
  19851. @item size
  19852. Set the video size. This option is for video only. For the syntax of this
  19853. option, check the
  19854. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19855. Default and minimum resolution is @code{640x480}.
  19856. @item meter
  19857. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  19858. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  19859. other integer value between this range is allowed.
  19860. @item metadata
  19861. Set metadata injection. If set to @code{1}, the audio input will be segmented
  19862. into 100ms output frames, each of them containing various loudness information
  19863. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  19864. Default is @code{0}.
  19865. @item framelog
  19866. Force the frame logging level.
  19867. Available values are:
  19868. @table @samp
  19869. @item info
  19870. information logging level
  19871. @item verbose
  19872. verbose logging level
  19873. @end table
  19874. By default, the logging level is set to @var{info}. If the @option{video} or
  19875. the @option{metadata} options are set, it switches to @var{verbose}.
  19876. @item peak
  19877. Set peak mode(s).
  19878. Available modes can be cumulated (the option is a @code{flag} type). Possible
  19879. values are:
  19880. @table @samp
  19881. @item none
  19882. Disable any peak mode (default).
  19883. @item sample
  19884. Enable sample-peak mode.
  19885. Simple peak mode looking for the higher sample value. It logs a message
  19886. for sample-peak (identified by @code{SPK}).
  19887. @item true
  19888. Enable true-peak mode.
  19889. If enabled, the peak lookup is done on an over-sampled version of the input
  19890. stream for better peak accuracy. It logs a message for true-peak.
  19891. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  19892. This mode requires a build with @code{libswresample}.
  19893. @end table
  19894. @item dualmono
  19895. Treat mono input files as "dual mono". If a mono file is intended for playback
  19896. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  19897. If set to @code{true}, this option will compensate for this effect.
  19898. Multi-channel input files are not affected by this option.
  19899. @item panlaw
  19900. Set a specific pan law to be used for the measurement of dual mono files.
  19901. This parameter is optional, and has a default value of -3.01dB.
  19902. @item target
  19903. Set a specific target level (in LUFS) used as relative zero in the visualization.
  19904. This parameter is optional and has a default value of -23LUFS as specified
  19905. by EBU R128. However, material published online may prefer a level of -16LUFS
  19906. (e.g. for use with podcasts or video platforms).
  19907. @item gauge
  19908. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  19909. @code{shortterm}. By default the momentary value will be used, but in certain
  19910. scenarios it may be more useful to observe the short term value instead (e.g.
  19911. live mixing).
  19912. @item scale
  19913. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  19914. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  19915. video output, not the summary or continuous log output.
  19916. @end table
  19917. @subsection Examples
  19918. @itemize
  19919. @item
  19920. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  19921. @example
  19922. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  19923. @end example
  19924. @item
  19925. Run an analysis with @command{ffmpeg}:
  19926. @example
  19927. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  19928. @end example
  19929. @end itemize
  19930. @section interleave, ainterleave
  19931. Temporally interleave frames from several inputs.
  19932. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  19933. These filters read frames from several inputs and send the oldest
  19934. queued frame to the output.
  19935. Input streams must have well defined, monotonically increasing frame
  19936. timestamp values.
  19937. In order to submit one frame to output, these filters need to enqueue
  19938. at least one frame for each input, so they cannot work in case one
  19939. input is not yet terminated and will not receive incoming frames.
  19940. For example consider the case when one input is a @code{select} filter
  19941. which always drops input frames. The @code{interleave} filter will keep
  19942. reading from that input, but it will never be able to send new frames
  19943. to output until the input sends an end-of-stream signal.
  19944. Also, depending on inputs synchronization, the filters will drop
  19945. frames in case one input receives more frames than the other ones, and
  19946. the queue is already filled.
  19947. These filters accept the following options:
  19948. @table @option
  19949. @item nb_inputs, n
  19950. Set the number of different inputs, it is 2 by default.
  19951. @item duration
  19952. How to determine the end-of-stream.
  19953. @table @option
  19954. @item longest
  19955. The duration of the longest input. (default)
  19956. @item shortest
  19957. The duration of the shortest input.
  19958. @item first
  19959. The duration of the first input.
  19960. @end table
  19961. @end table
  19962. @subsection Examples
  19963. @itemize
  19964. @item
  19965. Interleave frames belonging to different streams using @command{ffmpeg}:
  19966. @example
  19967. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  19968. @end example
  19969. @item
  19970. Add flickering blur effect:
  19971. @example
  19972. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  19973. @end example
  19974. @end itemize
  19975. @section latency, alatency
  19976. Measure filtering latency.
  19977. Report previous filter filtering latency, delay in number of audio samples for audio filters
  19978. or number of video frames for video filters.
  19979. On end of input stream, filter will report min and max measured latency for previous running filter
  19980. in filtergraph.
  19981. @section metadata, ametadata
  19982. Manipulate frame metadata.
  19983. This filter accepts the following options:
  19984. @table @option
  19985. @item mode
  19986. Set mode of operation of the filter.
  19987. Can be one of the following:
  19988. @table @samp
  19989. @item select
  19990. If both @code{value} and @code{key} is set, select frames
  19991. which have such metadata. If only @code{key} is set, select
  19992. every frame that has such key in metadata.
  19993. @item add
  19994. Add new metadata @code{key} and @code{value}. If key is already available
  19995. do nothing.
  19996. @item modify
  19997. Modify value of already present key.
  19998. @item delete
  19999. If @code{value} is set, delete only keys that have such value.
  20000. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  20001. the frame.
  20002. @item print
  20003. Print key and its value if metadata was found. If @code{key} is not set print all
  20004. metadata values available in frame.
  20005. @end table
  20006. @item key
  20007. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  20008. @item value
  20009. Set metadata value which will be used. This option is mandatory for
  20010. @code{modify} and @code{add} mode.
  20011. @item function
  20012. Which function to use when comparing metadata value and @code{value}.
  20013. Can be one of following:
  20014. @table @samp
  20015. @item same_str
  20016. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  20017. @item starts_with
  20018. Values are interpreted as strings, returns true if metadata value starts with
  20019. the @code{value} option string.
  20020. @item less
  20021. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  20022. @item equal
  20023. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  20024. @item greater
  20025. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  20026. @item expr
  20027. Values are interpreted as floats, returns true if expression from option @code{expr}
  20028. evaluates to true.
  20029. @item ends_with
  20030. Values are interpreted as strings, returns true if metadata value ends with
  20031. the @code{value} option string.
  20032. @end table
  20033. @item expr
  20034. Set expression which is used when @code{function} is set to @code{expr}.
  20035. The expression is evaluated through the eval API and can contain the following
  20036. constants:
  20037. @table @option
  20038. @item VALUE1, FRAMEVAL
  20039. Float representation of @code{value} from metadata key.
  20040. @item VALUE2, USERVAL
  20041. Float representation of @code{value} as supplied by user in @code{value} option.
  20042. @end table
  20043. @item file
  20044. If specified in @code{print} mode, output is written to the named file. Instead of
  20045. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  20046. for standard output. If @code{file} option is not set, output is written to the log
  20047. with AV_LOG_INFO loglevel.
  20048. @item direct
  20049. Reduces buffering in print mode when output is written to a URL set using @var{file}.
  20050. @end table
  20051. @subsection Examples
  20052. @itemize
  20053. @item
  20054. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  20055. between 0 and 1.
  20056. @example
  20057. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  20058. @end example
  20059. @item
  20060. Print silencedetect output to file @file{metadata.txt}.
  20061. @example
  20062. silencedetect,ametadata=mode=print:file=metadata.txt
  20063. @end example
  20064. @item
  20065. Direct all metadata to a pipe with file descriptor 4.
  20066. @example
  20067. metadata=mode=print:file='pipe\:4'
  20068. @end example
  20069. @end itemize
  20070. @section perms, aperms
  20071. Set read/write permissions for the output frames.
  20072. These filters are mainly aimed at developers to test direct path in the
  20073. following filter in the filtergraph.
  20074. The filters accept the following options:
  20075. @table @option
  20076. @item mode
  20077. Select the permissions mode.
  20078. It accepts the following values:
  20079. @table @samp
  20080. @item none
  20081. Do nothing. This is the default.
  20082. @item ro
  20083. Set all the output frames read-only.
  20084. @item rw
  20085. Set all the output frames directly writable.
  20086. @item toggle
  20087. Make the frame read-only if writable, and writable if read-only.
  20088. @item random
  20089. Set each output frame read-only or writable randomly.
  20090. @end table
  20091. @item seed
  20092. Set the seed for the @var{random} mode, must be an integer included between
  20093. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  20094. @code{-1}, the filter will try to use a good random seed on a best effort
  20095. basis.
  20096. @end table
  20097. Note: in case of auto-inserted filter between the permission filter and the
  20098. following one, the permission might not be received as expected in that
  20099. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  20100. perms/aperms filter can avoid this problem.
  20101. @section realtime, arealtime
  20102. Slow down filtering to match real time approximately.
  20103. These filters will pause the filtering for a variable amount of time to
  20104. match the output rate with the input timestamps.
  20105. They are similar to the @option{re} option to @code{ffmpeg}.
  20106. They accept the following options:
  20107. @table @option
  20108. @item limit
  20109. Time limit for the pauses. Any pause longer than that will be considered
  20110. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  20111. @item speed
  20112. Speed factor for processing. The value must be a float larger than zero.
  20113. Values larger than 1.0 will result in faster than realtime processing,
  20114. smaller will slow processing down. The @var{limit} is automatically adapted
  20115. accordingly. Default is 1.0.
  20116. A processing speed faster than what is possible without these filters cannot
  20117. be achieved.
  20118. @end table
  20119. @section segment, asegment
  20120. Split single input stream into multiple streams.
  20121. This filter does opposite of concat filters.
  20122. @code{segment} works on video frames, @code{asegment} on audio samples.
  20123. This filter accepts the following options:
  20124. @table @option
  20125. @item timestamps
  20126. Timestamps of output segments separated by '|'. The first segment will run
  20127. from the beginning of the input stream. The last segment will run until
  20128. the end of the input stream
  20129. @item frames, samples
  20130. Exact frame/sample count to split the segments.
  20131. @end table
  20132. In all cases, prefixing an each segment with '+' will make it relative to the
  20133. previous segment.
  20134. @subsection Examples
  20135. @itemize
  20136. @item
  20137. Split input audio stream into three output audio streams, starting at start of input audio stream
  20138. and storing that in 1st output audio stream, then following at 60th second and storing than in 2nd
  20139. output audio stream, and last after 150th second of input audio stream store in 3rd output audio stream:
  20140. @example
  20141. asegment=timestamps="60|150"
  20142. @end example
  20143. @end itemize
  20144. @anchor{select}
  20145. @section select, aselect
  20146. Select frames to pass in output.
  20147. This filter accepts the following options:
  20148. @table @option
  20149. @item expr, e
  20150. Set expression, which is evaluated for each input frame.
  20151. If the expression is evaluated to zero, the frame is discarded.
  20152. If the evaluation result is negative or NaN, the frame is sent to the
  20153. first output; otherwise it is sent to the output with index
  20154. @code{ceil(val)-1}, assuming that the input index starts from 0.
  20155. For example a value of @code{1.2} corresponds to the output with index
  20156. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  20157. @item outputs, n
  20158. Set the number of outputs. The output to which to send the selected
  20159. frame is based on the result of the evaluation. Default value is 1.
  20160. @end table
  20161. The expression can contain the following constants:
  20162. @table @option
  20163. @item n
  20164. The (sequential) number of the filtered frame, starting from 0.
  20165. @item selected_n
  20166. The (sequential) number of the selected frame, starting from 0.
  20167. @item prev_selected_n
  20168. The sequential number of the last selected frame. It's NAN if undefined.
  20169. @item TB
  20170. The timebase of the input timestamps.
  20171. @item pts
  20172. The PTS (Presentation TimeStamp) of the filtered frame,
  20173. expressed in @var{TB} units. It's NAN if undefined.
  20174. @item t
  20175. The PTS of the filtered frame,
  20176. expressed in seconds. It's NAN if undefined.
  20177. @item prev_pts
  20178. The PTS of the previously filtered frame. It's NAN if undefined.
  20179. @item prev_selected_pts
  20180. The PTS of the last previously filtered frame. It's NAN if undefined.
  20181. @item prev_selected_t
  20182. The PTS of the last previously selected frame, expressed in seconds. It's NAN if undefined.
  20183. @item start_pts
  20184. The first PTS in the stream which is not NAN. It remains NAN if not found.
  20185. @item start_t
  20186. The first PTS, in seconds, in the stream which is not NAN. It remains NAN if not found.
  20187. @item pict_type @emph{(video only)}
  20188. The type of the filtered frame. It can assume one of the following
  20189. values:
  20190. @table @option
  20191. @item I
  20192. @item P
  20193. @item B
  20194. @item S
  20195. @item SI
  20196. @item SP
  20197. @item BI
  20198. @end table
  20199. @item interlace_type @emph{(video only)}
  20200. The frame interlace type. It can assume one of the following values:
  20201. @table @option
  20202. @item PROGRESSIVE
  20203. The frame is progressive (not interlaced).
  20204. @item TOPFIRST
  20205. The frame is top-field-first.
  20206. @item BOTTOMFIRST
  20207. The frame is bottom-field-first.
  20208. @end table
  20209. @item consumed_sample_n @emph{(audio only)}
  20210. the number of selected samples before the current frame
  20211. @item samples_n @emph{(audio only)}
  20212. the number of samples in the current frame
  20213. @item sample_rate @emph{(audio only)}
  20214. the input sample rate
  20215. @item key
  20216. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  20217. @item pos
  20218. the position in the file of the filtered frame, -1 if the information
  20219. is not available (e.g. for synthetic video)
  20220. @item scene @emph{(video only)}
  20221. value between 0 and 1 to indicate a new scene; a low value reflects a low
  20222. probability for the current frame to introduce a new scene, while a higher
  20223. value means the current frame is more likely to be one (see the example below)
  20224. @item concatdec_select
  20225. The concat demuxer can select only part of a concat input file by setting an
  20226. inpoint and an outpoint, but the output packets may not be entirely contained
  20227. in the selected interval. By using this variable, it is possible to skip frames
  20228. generated by the concat demuxer which are not exactly contained in the selected
  20229. interval.
  20230. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  20231. and the @var{lavf.concat.duration} packet metadata values which are also
  20232. present in the decoded frames.
  20233. The @var{concatdec_select} variable is -1 if the frame pts is at least
  20234. start_time and either the duration metadata is missing or the frame pts is less
  20235. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  20236. missing.
  20237. That basically means that an input frame is selected if its pts is within the
  20238. interval set by the concat demuxer.
  20239. @end table
  20240. The default value of the select expression is "1".
  20241. @subsection Examples
  20242. @itemize
  20243. @item
  20244. Select all frames in input:
  20245. @example
  20246. select
  20247. @end example
  20248. The example above is the same as:
  20249. @example
  20250. select=1
  20251. @end example
  20252. @item
  20253. Skip all frames:
  20254. @example
  20255. select=0
  20256. @end example
  20257. @item
  20258. Select only I-frames:
  20259. @example
  20260. select='eq(pict_type\,I)'
  20261. @end example
  20262. @item
  20263. Select one frame every 100:
  20264. @example
  20265. select='not(mod(n\,100))'
  20266. @end example
  20267. @item
  20268. Select only frames contained in the 10-20 time interval:
  20269. @example
  20270. select=between(t\,10\,20)
  20271. @end example
  20272. @item
  20273. Select only I-frames contained in the 10-20 time interval:
  20274. @example
  20275. select=between(t\,10\,20)*eq(pict_type\,I)
  20276. @end example
  20277. @item
  20278. Select frames with a minimum distance of 10 seconds:
  20279. @example
  20280. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  20281. @end example
  20282. @item
  20283. Use aselect to select only audio frames with samples number > 100:
  20284. @example
  20285. aselect='gt(samples_n\,100)'
  20286. @end example
  20287. @item
  20288. Create a mosaic of the first scenes:
  20289. @example
  20290. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  20291. @end example
  20292. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  20293. choice.
  20294. @item
  20295. Send even and odd frames to separate outputs, and compose them:
  20296. @example
  20297. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  20298. @end example
  20299. @item
  20300. Select useful frames from an ffconcat file which is using inpoints and
  20301. outpoints but where the source files are not intra frame only.
  20302. @example
  20303. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  20304. @end example
  20305. @end itemize
  20306. @section sendcmd, asendcmd
  20307. Send commands to filters in the filtergraph.
  20308. These filters read commands to be sent to other filters in the
  20309. filtergraph.
  20310. @code{sendcmd} must be inserted between two video filters,
  20311. @code{asendcmd} must be inserted between two audio filters, but apart
  20312. from that they act the same way.
  20313. The specification of commands can be provided in the filter arguments
  20314. with the @var{commands} option, or in a file specified by the
  20315. @var{filename} option.
  20316. These filters accept the following options:
  20317. @table @option
  20318. @item commands, c
  20319. Set the commands to be read and sent to the other filters.
  20320. @item filename, f
  20321. Set the filename of the commands to be read and sent to the other
  20322. filters.
  20323. @end table
  20324. @subsection Commands syntax
  20325. A commands description consists of a sequence of interval
  20326. specifications, comprising a list of commands to be executed when a
  20327. particular event related to that interval occurs. The occurring event
  20328. is typically the current frame time entering or leaving a given time
  20329. interval.
  20330. An interval is specified by the following syntax:
  20331. @example
  20332. @var{START}[-@var{END}] @var{COMMANDS};
  20333. @end example
  20334. The time interval is specified by the @var{START} and @var{END} times.
  20335. @var{END} is optional and defaults to the maximum time.
  20336. The current frame time is considered within the specified interval if
  20337. it is included in the interval [@var{START}, @var{END}), that is when
  20338. the time is greater or equal to @var{START} and is lesser than
  20339. @var{END}.
  20340. @var{COMMANDS} consists of a sequence of one or more command
  20341. specifications, separated by ",", relating to that interval. The
  20342. syntax of a command specification is given by:
  20343. @example
  20344. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  20345. @end example
  20346. @var{FLAGS} is optional and specifies the type of events relating to
  20347. the time interval which enable sending the specified command, and must
  20348. be a non-null sequence of identifier flags separated by "+" or "|" and
  20349. enclosed between "[" and "]".
  20350. The following flags are recognized:
  20351. @table @option
  20352. @item enter
  20353. The command is sent when the current frame timestamp enters the
  20354. specified interval. In other words, the command is sent when the
  20355. previous frame timestamp was not in the given interval, and the
  20356. current is.
  20357. @item leave
  20358. The command is sent when the current frame timestamp leaves the
  20359. specified interval. In other words, the command is sent when the
  20360. previous frame timestamp was in the given interval, and the
  20361. current is not.
  20362. @item expr
  20363. The command @var{ARG} is interpreted as expression and result of
  20364. expression is passed as @var{ARG}.
  20365. The expression is evaluated through the eval API and can contain the following
  20366. constants:
  20367. @table @option
  20368. @item POS
  20369. Original position in the file of the frame, or undefined if undefined
  20370. for the current frame.
  20371. @item PTS
  20372. The presentation timestamp in input.
  20373. @item N
  20374. The count of the input frame for video or audio, starting from 0.
  20375. @item T
  20376. The time in seconds of the current frame.
  20377. @item TS
  20378. The start time in seconds of the current command interval.
  20379. @item TE
  20380. The end time in seconds of the current command interval.
  20381. @item TI
  20382. The interpolated time of the current command interval, TI = (T - TS) / (TE - TS).
  20383. @end table
  20384. @end table
  20385. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  20386. assumed.
  20387. @var{TARGET} specifies the target of the command, usually the name of
  20388. the filter class or a specific filter instance name.
  20389. @var{COMMAND} specifies the name of the command for the target filter.
  20390. @var{ARG} is optional and specifies the optional list of argument for
  20391. the given @var{COMMAND}.
  20392. Between one interval specification and another, whitespaces, or
  20393. sequences of characters starting with @code{#} until the end of line,
  20394. are ignored and can be used to annotate comments.
  20395. A simplified BNF description of the commands specification syntax
  20396. follows:
  20397. @example
  20398. @var{COMMAND_FLAG} ::= "enter" | "leave"
  20399. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  20400. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  20401. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  20402. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  20403. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  20404. @end example
  20405. @subsection Examples
  20406. @itemize
  20407. @item
  20408. Specify audio tempo change at second 4:
  20409. @example
  20410. asendcmd=c='4.0 atempo tempo 1.5',atempo
  20411. @end example
  20412. @item
  20413. Target a specific filter instance:
  20414. @example
  20415. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  20416. @end example
  20417. @item
  20418. Specify a list of drawtext and hue commands in a file.
  20419. @example
  20420. # show text in the interval 5-10
  20421. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  20422. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  20423. # desaturate the image in the interval 15-20
  20424. 15.0-20.0 [enter] hue s 0,
  20425. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  20426. [leave] hue s 1,
  20427. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  20428. # apply an exponential saturation fade-out effect, starting from time 25
  20429. 25 [enter] hue s exp(25-t)
  20430. @end example
  20431. A filtergraph allowing to read and process the above command list
  20432. stored in a file @file{test.cmd}, can be specified with:
  20433. @example
  20434. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  20435. @end example
  20436. @end itemize
  20437. @anchor{setpts}
  20438. @section setpts, asetpts
  20439. Change the PTS (presentation timestamp) of the input frames.
  20440. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  20441. This filter accepts the following options:
  20442. @table @option
  20443. @item expr
  20444. The expression which is evaluated for each frame to construct its timestamp.
  20445. @end table
  20446. The expression is evaluated through the eval API and can contain the following
  20447. constants:
  20448. @table @option
  20449. @item FRAME_RATE, FR
  20450. frame rate, only defined for constant frame-rate video
  20451. @item PTS
  20452. The presentation timestamp in input
  20453. @item N
  20454. The count of the input frame for video or the number of consumed samples,
  20455. not including the current frame for audio, starting from 0.
  20456. @item NB_CONSUMED_SAMPLES
  20457. The number of consumed samples, not including the current frame (only
  20458. audio)
  20459. @item NB_SAMPLES, S
  20460. The number of samples in the current frame (only audio)
  20461. @item SAMPLE_RATE, SR
  20462. The audio sample rate.
  20463. @item STARTPTS
  20464. The PTS of the first frame.
  20465. @item STARTT
  20466. the time in seconds of the first frame
  20467. @item INTERLACED
  20468. State whether the current frame is interlaced.
  20469. @item T
  20470. the time in seconds of the current frame
  20471. @item POS
  20472. original position in the file of the frame, or undefined if undefined
  20473. for the current frame
  20474. @item PREV_INPTS
  20475. The previous input PTS.
  20476. @item PREV_INT
  20477. previous input time in seconds
  20478. @item PREV_OUTPTS
  20479. The previous output PTS.
  20480. @item PREV_OUTT
  20481. previous output time in seconds
  20482. @item RTCTIME
  20483. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  20484. instead.
  20485. @item RTCSTART
  20486. The wallclock (RTC) time at the start of the movie in microseconds.
  20487. @item TB
  20488. The timebase of the input timestamps.
  20489. @end table
  20490. @subsection Examples
  20491. @itemize
  20492. @item
  20493. Start counting PTS from zero
  20494. @example
  20495. setpts=PTS-STARTPTS
  20496. @end example
  20497. @item
  20498. Apply fast motion effect:
  20499. @example
  20500. setpts=0.5*PTS
  20501. @end example
  20502. @item
  20503. Apply slow motion effect:
  20504. @example
  20505. setpts=2.0*PTS
  20506. @end example
  20507. @item
  20508. Set fixed rate of 25 frames per second:
  20509. @example
  20510. setpts=N/(25*TB)
  20511. @end example
  20512. @item
  20513. Set fixed rate 25 fps with some jitter:
  20514. @example
  20515. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  20516. @end example
  20517. @item
  20518. Apply an offset of 10 seconds to the input PTS:
  20519. @example
  20520. setpts=PTS+10/TB
  20521. @end example
  20522. @item
  20523. Generate timestamps from a "live source" and rebase onto the current timebase:
  20524. @example
  20525. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  20526. @end example
  20527. @item
  20528. Generate timestamps by counting samples:
  20529. @example
  20530. asetpts=N/SR/TB
  20531. @end example
  20532. @end itemize
  20533. @section setrange
  20534. Force color range for the output video frame.
  20535. The @code{setrange} filter marks the color range property for the
  20536. output frames. It does not change the input frame, but only sets the
  20537. corresponding property, which affects how the frame is treated by
  20538. following filters.
  20539. The filter accepts the following options:
  20540. @table @option
  20541. @item range
  20542. Available values are:
  20543. @table @samp
  20544. @item auto
  20545. Keep the same color range property.
  20546. @item unspecified, unknown
  20547. Set the color range as unspecified.
  20548. @item limited, tv, mpeg
  20549. Set the color range as limited.
  20550. @item full, pc, jpeg
  20551. Set the color range as full.
  20552. @end table
  20553. @end table
  20554. @section settb, asettb
  20555. Set the timebase to use for the output frames timestamps.
  20556. It is mainly useful for testing timebase configuration.
  20557. It accepts the following parameters:
  20558. @table @option
  20559. @item expr, tb
  20560. The expression which is evaluated into the output timebase.
  20561. @end table
  20562. The value for @option{tb} is an arithmetic expression representing a
  20563. rational. The expression can contain the constants "AVTB" (the default
  20564. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  20565. audio only). Default value is "intb".
  20566. @subsection Examples
  20567. @itemize
  20568. @item
  20569. Set the timebase to 1/25:
  20570. @example
  20571. settb=expr=1/25
  20572. @end example
  20573. @item
  20574. Set the timebase to 1/10:
  20575. @example
  20576. settb=expr=0.1
  20577. @end example
  20578. @item
  20579. Set the timebase to 1001/1000:
  20580. @example
  20581. settb=1+0.001
  20582. @end example
  20583. @item
  20584. Set the timebase to 2*intb:
  20585. @example
  20586. settb=2*intb
  20587. @end example
  20588. @item
  20589. Set the default timebase value:
  20590. @example
  20591. settb=AVTB
  20592. @end example
  20593. @end itemize
  20594. @section showcqt
  20595. Convert input audio to a video output representing frequency spectrum
  20596. logarithmically using Brown-Puckette constant Q transform algorithm with
  20597. direct frequency domain coefficient calculation (but the transform itself
  20598. is not really constant Q, instead the Q factor is actually variable/clamped),
  20599. with musical tone scale, from E0 to D#10.
  20600. The filter accepts the following options:
  20601. @table @option
  20602. @item size, s
  20603. Specify the video size for the output. It must be even. For the syntax of this option,
  20604. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20605. Default value is @code{1920x1080}.
  20606. @item fps, rate, r
  20607. Set the output frame rate. Default value is @code{25}.
  20608. @item bar_h
  20609. Set the bargraph height. It must be even. Default value is @code{-1} which
  20610. computes the bargraph height automatically.
  20611. @item axis_h
  20612. Set the axis height. It must be even. Default value is @code{-1} which computes
  20613. the axis height automatically.
  20614. @item sono_h
  20615. Set the sonogram height. It must be even. Default value is @code{-1} which
  20616. computes the sonogram height automatically.
  20617. @item fullhd
  20618. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  20619. instead. Default value is @code{1}.
  20620. @item sono_v, volume
  20621. Specify the sonogram volume expression. It can contain variables:
  20622. @table @option
  20623. @item bar_v
  20624. the @var{bar_v} evaluated expression
  20625. @item frequency, freq, f
  20626. the frequency where it is evaluated
  20627. @item timeclamp, tc
  20628. the value of @var{timeclamp} option
  20629. @end table
  20630. and functions:
  20631. @table @option
  20632. @item a_weighting(f)
  20633. A-weighting of equal loudness
  20634. @item b_weighting(f)
  20635. B-weighting of equal loudness
  20636. @item c_weighting(f)
  20637. C-weighting of equal loudness.
  20638. @end table
  20639. Default value is @code{16}.
  20640. @item bar_v, volume2
  20641. Specify the bargraph volume expression. It can contain variables:
  20642. @table @option
  20643. @item sono_v
  20644. the @var{sono_v} evaluated expression
  20645. @item frequency, freq, f
  20646. the frequency where it is evaluated
  20647. @item timeclamp, tc
  20648. the value of @var{timeclamp} option
  20649. @end table
  20650. and functions:
  20651. @table @option
  20652. @item a_weighting(f)
  20653. A-weighting of equal loudness
  20654. @item b_weighting(f)
  20655. B-weighting of equal loudness
  20656. @item c_weighting(f)
  20657. C-weighting of equal loudness.
  20658. @end table
  20659. Default value is @code{sono_v}.
  20660. @item sono_g, gamma
  20661. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  20662. higher gamma makes the spectrum having more range. Default value is @code{3}.
  20663. Acceptable range is @code{[1, 7]}.
  20664. @item bar_g, gamma2
  20665. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  20666. @code{[1, 7]}.
  20667. @item bar_t
  20668. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  20669. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  20670. @item timeclamp, tc
  20671. Specify the transform timeclamp. At low frequency, there is trade-off between
  20672. accuracy in time domain and frequency domain. If timeclamp is lower,
  20673. event in time domain is represented more accurately (such as fast bass drum),
  20674. otherwise event in frequency domain is represented more accurately
  20675. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  20676. @item attack
  20677. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  20678. limits future samples by applying asymmetric windowing in time domain, useful
  20679. when low latency is required. Accepted range is @code{[0, 1]}.
  20680. @item basefreq
  20681. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  20682. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  20683. @item endfreq
  20684. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  20685. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  20686. @item coeffclamp
  20687. This option is deprecated and ignored.
  20688. @item tlength
  20689. Specify the transform length in time domain. Use this option to control accuracy
  20690. trade-off between time domain and frequency domain at every frequency sample.
  20691. It can contain variables:
  20692. @table @option
  20693. @item frequency, freq, f
  20694. the frequency where it is evaluated
  20695. @item timeclamp, tc
  20696. the value of @var{timeclamp} option.
  20697. @end table
  20698. Default value is @code{384*tc/(384+tc*f)}.
  20699. @item count
  20700. Specify the transform count for every video frame. Default value is @code{6}.
  20701. Acceptable range is @code{[1, 30]}.
  20702. @item fcount
  20703. Specify the transform count for every single pixel. Default value is @code{0},
  20704. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  20705. @item fontfile
  20706. Specify font file for use with freetype to draw the axis. If not specified,
  20707. use embedded font. Note that drawing with font file or embedded font is not
  20708. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  20709. option instead.
  20710. @item font
  20711. Specify fontconfig pattern. This has lower priority than @var{fontfile}. The
  20712. @code{:} in the pattern may be replaced by @code{|} to avoid unnecessary
  20713. escaping.
  20714. @item fontcolor
  20715. Specify font color expression. This is arithmetic expression that should return
  20716. integer value 0xRRGGBB. It can contain variables:
  20717. @table @option
  20718. @item frequency, freq, f
  20719. the frequency where it is evaluated
  20720. @item timeclamp, tc
  20721. the value of @var{timeclamp} option
  20722. @end table
  20723. and functions:
  20724. @table @option
  20725. @item midi(f)
  20726. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  20727. @item r(x), g(x), b(x)
  20728. red, green, and blue value of intensity x.
  20729. @end table
  20730. Default value is @code{st(0, (midi(f)-59.5)/12);
  20731. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  20732. r(1-ld(1)) + b(ld(1))}.
  20733. @item axisfile
  20734. Specify image file to draw the axis. This option override @var{fontfile} and
  20735. @var{fontcolor} option.
  20736. @item axis, text
  20737. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  20738. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  20739. Default value is @code{1}.
  20740. @item csp
  20741. Set colorspace. The accepted values are:
  20742. @table @samp
  20743. @item unspecified
  20744. Unspecified (default)
  20745. @item bt709
  20746. BT.709
  20747. @item fcc
  20748. FCC
  20749. @item bt470bg
  20750. BT.470BG or BT.601-6 625
  20751. @item smpte170m
  20752. SMPTE-170M or BT.601-6 525
  20753. @item smpte240m
  20754. SMPTE-240M
  20755. @item bt2020ncl
  20756. BT.2020 with non-constant luminance
  20757. @end table
  20758. @item cscheme
  20759. Set spectrogram color scheme. This is list of floating point values with format
  20760. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  20761. The default is @code{1|0.5|0|0|0.5|1}.
  20762. @end table
  20763. @subsection Examples
  20764. @itemize
  20765. @item
  20766. Playing audio while showing the spectrum:
  20767. @example
  20768. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  20769. @end example
  20770. @item
  20771. Same as above, but with frame rate 30 fps:
  20772. @example
  20773. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  20774. @end example
  20775. @item
  20776. Playing at 1280x720:
  20777. @example
  20778. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  20779. @end example
  20780. @item
  20781. Disable sonogram display:
  20782. @example
  20783. sono_h=0
  20784. @end example
  20785. @item
  20786. A1 and its harmonics: A1, A2, (near)E3, A3:
  20787. @example
  20788. 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),
  20789. asplit[a][out1]; [a] showcqt [out0]'
  20790. @end example
  20791. @item
  20792. Same as above, but with more accuracy in frequency domain:
  20793. @example
  20794. 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),
  20795. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  20796. @end example
  20797. @item
  20798. Custom volume:
  20799. @example
  20800. bar_v=10:sono_v=bar_v*a_weighting(f)
  20801. @end example
  20802. @item
  20803. Custom gamma, now spectrum is linear to the amplitude.
  20804. @example
  20805. bar_g=2:sono_g=2
  20806. @end example
  20807. @item
  20808. Custom tlength equation:
  20809. @example
  20810. 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)))'
  20811. @end example
  20812. @item
  20813. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  20814. @example
  20815. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  20816. @end example
  20817. @item
  20818. Custom font using fontconfig:
  20819. @example
  20820. font='Courier New,Monospace,mono|bold'
  20821. @end example
  20822. @item
  20823. Custom frequency range with custom axis using image file:
  20824. @example
  20825. axisfile=myaxis.png:basefreq=40:endfreq=10000
  20826. @end example
  20827. @end itemize
  20828. @section showfreqs
  20829. Convert input audio to video output representing the audio power spectrum.
  20830. Audio amplitude is on Y-axis while frequency is on X-axis.
  20831. The filter accepts the following options:
  20832. @table @option
  20833. @item size, s
  20834. Specify size of video. For the syntax of this option, check the
  20835. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20836. Default is @code{1024x512}.
  20837. @item mode
  20838. Set display mode.
  20839. This set how each frequency bin will be represented.
  20840. It accepts the following values:
  20841. @table @samp
  20842. @item line
  20843. @item bar
  20844. @item dot
  20845. @end table
  20846. Default is @code{bar}.
  20847. @item ascale
  20848. Set amplitude scale.
  20849. It accepts the following values:
  20850. @table @samp
  20851. @item lin
  20852. Linear scale.
  20853. @item sqrt
  20854. Square root scale.
  20855. @item cbrt
  20856. Cubic root scale.
  20857. @item log
  20858. Logarithmic scale.
  20859. @end table
  20860. Default is @code{log}.
  20861. @item fscale
  20862. Set frequency scale.
  20863. It accepts the following values:
  20864. @table @samp
  20865. @item lin
  20866. Linear scale.
  20867. @item log
  20868. Logarithmic scale.
  20869. @item rlog
  20870. Reverse logarithmic scale.
  20871. @end table
  20872. Default is @code{lin}.
  20873. @item win_size
  20874. Set window size. Allowed range is from 16 to 65536.
  20875. Default is @code{2048}
  20876. @item win_func
  20877. Set windowing function.
  20878. It accepts the following values:
  20879. @table @samp
  20880. @item rect
  20881. @item bartlett
  20882. @item hanning
  20883. @item hamming
  20884. @item blackman
  20885. @item welch
  20886. @item flattop
  20887. @item bharris
  20888. @item bnuttall
  20889. @item bhann
  20890. @item sine
  20891. @item nuttall
  20892. @item lanczos
  20893. @item gauss
  20894. @item tukey
  20895. @item dolph
  20896. @item cauchy
  20897. @item parzen
  20898. @item poisson
  20899. @item bohman
  20900. @end table
  20901. Default is @code{hanning}.
  20902. @item overlap
  20903. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  20904. which means optimal overlap for selected window function will be picked.
  20905. @item averaging
  20906. Set time averaging. Setting this to 0 will display current maximal peaks.
  20907. Default is @code{1}, which means time averaging is disabled.
  20908. @item colors
  20909. Specify list of colors separated by space or by '|' which will be used to
  20910. draw channel frequencies. Unrecognized or missing colors will be replaced
  20911. by white color.
  20912. @item cmode
  20913. Set channel display mode.
  20914. It accepts the following values:
  20915. @table @samp
  20916. @item combined
  20917. @item separate
  20918. @end table
  20919. Default is @code{combined}.
  20920. @item minamp
  20921. Set minimum amplitude used in @code{log} amplitude scaler.
  20922. @item data
  20923. Set data display mode.
  20924. It accepts the following values:
  20925. @table @samp
  20926. @item magnitude
  20927. @item phase
  20928. @item delay
  20929. @end table
  20930. Default is @code{magnitude}.
  20931. @end table
  20932. @section showspatial
  20933. Convert stereo input audio to a video output, representing the spatial relationship
  20934. between two channels.
  20935. The filter accepts the following options:
  20936. @table @option
  20937. @item size, s
  20938. Specify the video size for the output. For the syntax of this option, check the
  20939. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20940. Default value is @code{512x512}.
  20941. @item win_size
  20942. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  20943. @item win_func
  20944. Set window function.
  20945. It accepts the following values:
  20946. @table @samp
  20947. @item rect
  20948. @item bartlett
  20949. @item hann
  20950. @item hanning
  20951. @item hamming
  20952. @item blackman
  20953. @item welch
  20954. @item flattop
  20955. @item bharris
  20956. @item bnuttall
  20957. @item bhann
  20958. @item sine
  20959. @item nuttall
  20960. @item lanczos
  20961. @item gauss
  20962. @item tukey
  20963. @item dolph
  20964. @item cauchy
  20965. @item parzen
  20966. @item poisson
  20967. @item bohman
  20968. @end table
  20969. Default value is @code{hann}.
  20970. @item overlap
  20971. Set ratio of overlap window. Default value is @code{0.5}.
  20972. When value is @code{1} overlap is set to recommended size for specific
  20973. window function currently used.
  20974. @end table
  20975. @anchor{showspectrum}
  20976. @section showspectrum
  20977. Convert input audio to a video output, representing the audio frequency
  20978. spectrum.
  20979. The filter accepts the following options:
  20980. @table @option
  20981. @item size, s
  20982. Specify the video size for the output. For the syntax of this option, check the
  20983. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20984. Default value is @code{640x512}.
  20985. @item slide
  20986. Specify how the spectrum should slide along the window.
  20987. It accepts the following values:
  20988. @table @samp
  20989. @item replace
  20990. the samples start again on the left when they reach the right
  20991. @item scroll
  20992. the samples scroll from right to left
  20993. @item fullframe
  20994. frames are only produced when the samples reach the right
  20995. @item rscroll
  20996. the samples scroll from left to right
  20997. @item lreplace
  20998. the samples start again on the right when they reach the left
  20999. @end table
  21000. Default value is @code{replace}.
  21001. @item mode
  21002. Specify display mode.
  21003. It accepts the following values:
  21004. @table @samp
  21005. @item combined
  21006. all channels are displayed in the same row
  21007. @item separate
  21008. all channels are displayed in separate rows
  21009. @end table
  21010. Default value is @samp{combined}.
  21011. @item color
  21012. Specify display color mode.
  21013. It accepts the following values:
  21014. @table @samp
  21015. @item channel
  21016. each channel is displayed in a separate color
  21017. @item intensity
  21018. each channel is displayed using the same color scheme
  21019. @item rainbow
  21020. each channel is displayed using the rainbow color scheme
  21021. @item moreland
  21022. each channel is displayed using the moreland color scheme
  21023. @item nebulae
  21024. each channel is displayed using the nebulae color scheme
  21025. @item fire
  21026. each channel is displayed using the fire color scheme
  21027. @item fiery
  21028. each channel is displayed using the fiery color scheme
  21029. @item fruit
  21030. each channel is displayed using the fruit color scheme
  21031. @item cool
  21032. each channel is displayed using the cool color scheme
  21033. @item magma
  21034. each channel is displayed using the magma color scheme
  21035. @item green
  21036. each channel is displayed using the green color scheme
  21037. @item viridis
  21038. each channel is displayed using the viridis color scheme
  21039. @item plasma
  21040. each channel is displayed using the plasma color scheme
  21041. @item cividis
  21042. each channel is displayed using the cividis color scheme
  21043. @item terrain
  21044. each channel is displayed using the terrain color scheme
  21045. @end table
  21046. Default value is @samp{channel}.
  21047. @item scale
  21048. Specify scale used for calculating intensity color values.
  21049. It accepts the following values:
  21050. @table @samp
  21051. @item lin
  21052. linear
  21053. @item sqrt
  21054. square root, default
  21055. @item cbrt
  21056. cubic root
  21057. @item log
  21058. logarithmic
  21059. @item 4thrt
  21060. 4th root
  21061. @item 5thrt
  21062. 5th root
  21063. @end table
  21064. Default value is @samp{sqrt}.
  21065. @item fscale
  21066. Specify frequency scale.
  21067. It accepts the following values:
  21068. @table @samp
  21069. @item lin
  21070. linear
  21071. @item log
  21072. logarithmic
  21073. @end table
  21074. Default value is @samp{lin}.
  21075. @item saturation
  21076. Set saturation modifier for displayed colors. Negative values provide
  21077. alternative color scheme. @code{0} is no saturation at all.
  21078. Saturation must be in [-10.0, 10.0] range.
  21079. Default value is @code{1}.
  21080. @item win_func
  21081. Set window function.
  21082. It accepts the following values:
  21083. @table @samp
  21084. @item rect
  21085. @item bartlett
  21086. @item hann
  21087. @item hanning
  21088. @item hamming
  21089. @item blackman
  21090. @item welch
  21091. @item flattop
  21092. @item bharris
  21093. @item bnuttall
  21094. @item bhann
  21095. @item sine
  21096. @item nuttall
  21097. @item lanczos
  21098. @item gauss
  21099. @item tukey
  21100. @item dolph
  21101. @item cauchy
  21102. @item parzen
  21103. @item poisson
  21104. @item bohman
  21105. @end table
  21106. Default value is @code{hann}.
  21107. @item orientation
  21108. Set orientation of time vs frequency axis. Can be @code{vertical} or
  21109. @code{horizontal}. Default is @code{vertical}.
  21110. @item overlap
  21111. Set ratio of overlap window. Default value is @code{0}.
  21112. When value is @code{1} overlap is set to recommended size for specific
  21113. window function currently used.
  21114. @item gain
  21115. Set scale gain for calculating intensity color values.
  21116. Default value is @code{1}.
  21117. @item data
  21118. Set which data to display. Can be @code{magnitude}, default or @code{phase},
  21119. or unwrapped phase: @code{uphase}.
  21120. @item rotation
  21121. Set color rotation, must be in [-1.0, 1.0] range.
  21122. Default value is @code{0}.
  21123. @item start
  21124. Set start frequency from which to display spectrogram. Default is @code{0}.
  21125. @item stop
  21126. Set stop frequency to which to display spectrogram. Default is @code{0}.
  21127. @item fps
  21128. Set upper frame rate limit. Default is @code{auto}, unlimited.
  21129. @item legend
  21130. Draw time and frequency axes and legends. Default is disabled.
  21131. @item drange
  21132. Set dynamic range used to calculate intensity color values. Default is 120 dBFS.
  21133. Allowed range is from 10 to 200.
  21134. @item limit
  21135. Set upper limit of input audio samples volume in dBFS. Default is 0 dBFS.
  21136. Allowed range is from -100 to 100.
  21137. @end table
  21138. The usage is very similar to the showwaves filter; see the examples in that
  21139. section.
  21140. @subsection Examples
  21141. @itemize
  21142. @item
  21143. Large window with logarithmic color scaling:
  21144. @example
  21145. showspectrum=s=1280x480:scale=log
  21146. @end example
  21147. @item
  21148. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  21149. @example
  21150. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  21151. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  21152. @end example
  21153. @end itemize
  21154. @section showspectrumpic
  21155. Convert input audio to a single video frame, representing the audio frequency
  21156. spectrum.
  21157. The filter accepts the following options:
  21158. @table @option
  21159. @item size, s
  21160. Specify the video size for the output. For the syntax of this option, check the
  21161. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21162. Default value is @code{4096x2048}.
  21163. @item mode
  21164. Specify display mode.
  21165. It accepts the following values:
  21166. @table @samp
  21167. @item combined
  21168. all channels are displayed in the same row
  21169. @item separate
  21170. all channels are displayed in separate rows
  21171. @end table
  21172. Default value is @samp{combined}.
  21173. @item color
  21174. Specify display color mode.
  21175. It accepts the following values:
  21176. @table @samp
  21177. @item channel
  21178. each channel is displayed in a separate color
  21179. @item intensity
  21180. each channel is displayed using the same color scheme
  21181. @item rainbow
  21182. each channel is displayed using the rainbow color scheme
  21183. @item moreland
  21184. each channel is displayed using the moreland color scheme
  21185. @item nebulae
  21186. each channel is displayed using the nebulae color scheme
  21187. @item fire
  21188. each channel is displayed using the fire color scheme
  21189. @item fiery
  21190. each channel is displayed using the fiery color scheme
  21191. @item fruit
  21192. each channel is displayed using the fruit color scheme
  21193. @item cool
  21194. each channel is displayed using the cool color scheme
  21195. @item magma
  21196. each channel is displayed using the magma color scheme
  21197. @item green
  21198. each channel is displayed using the green color scheme
  21199. @item viridis
  21200. each channel is displayed using the viridis color scheme
  21201. @item plasma
  21202. each channel is displayed using the plasma color scheme
  21203. @item cividis
  21204. each channel is displayed using the cividis color scheme
  21205. @item terrain
  21206. each channel is displayed using the terrain color scheme
  21207. @end table
  21208. Default value is @samp{intensity}.
  21209. @item scale
  21210. Specify scale used for calculating intensity color values.
  21211. It accepts the following values:
  21212. @table @samp
  21213. @item lin
  21214. linear
  21215. @item sqrt
  21216. square root, default
  21217. @item cbrt
  21218. cubic root
  21219. @item log
  21220. logarithmic
  21221. @item 4thrt
  21222. 4th root
  21223. @item 5thrt
  21224. 5th root
  21225. @end table
  21226. Default value is @samp{log}.
  21227. @item fscale
  21228. Specify frequency scale.
  21229. It accepts the following values:
  21230. @table @samp
  21231. @item lin
  21232. linear
  21233. @item log
  21234. logarithmic
  21235. @end table
  21236. Default value is @samp{lin}.
  21237. @item saturation
  21238. Set saturation modifier for displayed colors. Negative values provide
  21239. alternative color scheme. @code{0} is no saturation at all.
  21240. Saturation must be in [-10.0, 10.0] range.
  21241. Default value is @code{1}.
  21242. @item win_func
  21243. Set window function.
  21244. It accepts the following values:
  21245. @table @samp
  21246. @item rect
  21247. @item bartlett
  21248. @item hann
  21249. @item hanning
  21250. @item hamming
  21251. @item blackman
  21252. @item welch
  21253. @item flattop
  21254. @item bharris
  21255. @item bnuttall
  21256. @item bhann
  21257. @item sine
  21258. @item nuttall
  21259. @item lanczos
  21260. @item gauss
  21261. @item tukey
  21262. @item dolph
  21263. @item cauchy
  21264. @item parzen
  21265. @item poisson
  21266. @item bohman
  21267. @end table
  21268. Default value is @code{hann}.
  21269. @item orientation
  21270. Set orientation of time vs frequency axis. Can be @code{vertical} or
  21271. @code{horizontal}. Default is @code{vertical}.
  21272. @item gain
  21273. Set scale gain for calculating intensity color values.
  21274. Default value is @code{1}.
  21275. @item legend
  21276. Draw time and frequency axes and legends. Default is enabled.
  21277. @item rotation
  21278. Set color rotation, must be in [-1.0, 1.0] range.
  21279. Default value is @code{0}.
  21280. @item start
  21281. Set start frequency from which to display spectrogram. Default is @code{0}.
  21282. @item stop
  21283. Set stop frequency to which to display spectrogram. Default is @code{0}.
  21284. @item drange
  21285. Set dynamic range used to calculate intensity color values. Default is 120 dBFS.
  21286. Allowed range is from 10 to 200.
  21287. @item limit
  21288. Set upper limit of input audio samples volume in dBFS. Default is 0 dBFS.
  21289. Allowed range is from -100 to 100.
  21290. @end table
  21291. @subsection Examples
  21292. @itemize
  21293. @item
  21294. Extract an audio spectrogram of a whole audio track
  21295. in a 1024x1024 picture using @command{ffmpeg}:
  21296. @example
  21297. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  21298. @end example
  21299. @end itemize
  21300. @section showvolume
  21301. Convert input audio volume to a video output.
  21302. The filter accepts the following options:
  21303. @table @option
  21304. @item rate, r
  21305. Set video rate.
  21306. @item b
  21307. Set border width, allowed range is [0, 5]. Default is 1.
  21308. @item w
  21309. Set channel width, allowed range is [80, 8192]. Default is 400.
  21310. @item h
  21311. Set channel height, allowed range is [1, 900]. Default is 20.
  21312. @item f
  21313. Set fade, allowed range is [0, 1]. Default is 0.95.
  21314. @item c
  21315. Set volume color expression.
  21316. The expression can use the following variables:
  21317. @table @option
  21318. @item VOLUME
  21319. Current max volume of channel in dB.
  21320. @item PEAK
  21321. Current peak.
  21322. @item CHANNEL
  21323. Current channel number, starting from 0.
  21324. @end table
  21325. @item t
  21326. If set, displays channel names. Default is enabled.
  21327. @item v
  21328. If set, displays volume values. Default is enabled.
  21329. @item o
  21330. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  21331. default is @code{h}.
  21332. @item s
  21333. Set step size, allowed range is [0, 5]. Default is 0, which means
  21334. step is disabled.
  21335. @item p
  21336. Set background opacity, allowed range is [0, 1]. Default is 0.
  21337. @item m
  21338. Set metering mode, can be peak: @code{p} or rms: @code{r},
  21339. default is @code{p}.
  21340. @item ds
  21341. Set display scale, can be linear: @code{lin} or log: @code{log},
  21342. default is @code{lin}.
  21343. @item dm
  21344. In second.
  21345. If set to > 0., display a line for the max level
  21346. in the previous seconds.
  21347. default is disabled: @code{0.}
  21348. @item dmc
  21349. The color of the max line. Use when @code{dm} option is set to > 0.
  21350. default is: @code{orange}
  21351. @end table
  21352. @section showwaves
  21353. Convert input audio to a video output, representing the samples waves.
  21354. The filter accepts the following options:
  21355. @table @option
  21356. @item size, s
  21357. Specify the video size for the output. For the syntax of this option, check the
  21358. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21359. Default value is @code{600x240}.
  21360. @item mode
  21361. Set display mode.
  21362. Available values are:
  21363. @table @samp
  21364. @item point
  21365. Draw a point for each sample.
  21366. @item line
  21367. Draw a vertical line for each sample.
  21368. @item p2p
  21369. Draw a point for each sample and a line between them.
  21370. @item cline
  21371. Draw a centered vertical line for each sample.
  21372. @end table
  21373. Default value is @code{point}.
  21374. @item n
  21375. Set the number of samples which are printed on the same column. A
  21376. larger value will decrease the frame rate. Must be a positive
  21377. integer. This option can be set only if the value for @var{rate}
  21378. is not explicitly specified.
  21379. @item rate, r
  21380. Set the (approximate) output frame rate. This is done by setting the
  21381. option @var{n}. Default value is "25".
  21382. @item split_channels
  21383. Set if channels should be drawn separately or overlap. Default value is 0.
  21384. @item colors
  21385. Set colors separated by '|' which are going to be used for drawing of each channel.
  21386. @item scale
  21387. Set amplitude scale.
  21388. Available values are:
  21389. @table @samp
  21390. @item lin
  21391. Linear.
  21392. @item log
  21393. Logarithmic.
  21394. @item sqrt
  21395. Square root.
  21396. @item cbrt
  21397. Cubic root.
  21398. @end table
  21399. Default is linear.
  21400. @item draw
  21401. Set the draw mode. This is mostly useful to set for high @var{n}.
  21402. Available values are:
  21403. @table @samp
  21404. @item scale
  21405. Scale pixel values for each drawn sample.
  21406. @item full
  21407. Draw every sample directly.
  21408. @end table
  21409. Default value is @code{scale}.
  21410. @end table
  21411. @subsection Examples
  21412. @itemize
  21413. @item
  21414. Output the input file audio and the corresponding video representation
  21415. at the same time:
  21416. @example
  21417. amovie=a.mp3,asplit[out0],showwaves[out1]
  21418. @end example
  21419. @item
  21420. Create a synthetic signal and show it with showwaves, forcing a
  21421. frame rate of 30 frames per second:
  21422. @example
  21423. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  21424. @end example
  21425. @end itemize
  21426. @section showwavespic
  21427. Convert input audio to a single video frame, representing the samples waves.
  21428. The filter accepts the following options:
  21429. @table @option
  21430. @item size, s
  21431. Specify the video size for the output. For the syntax of this option, check the
  21432. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21433. Default value is @code{600x240}.
  21434. @item split_channels
  21435. Set if channels should be drawn separately or overlap. Default value is 0.
  21436. @item colors
  21437. Set colors separated by '|' which are going to be used for drawing of each channel.
  21438. @item scale
  21439. Set amplitude scale.
  21440. Available values are:
  21441. @table @samp
  21442. @item lin
  21443. Linear.
  21444. @item log
  21445. Logarithmic.
  21446. @item sqrt
  21447. Square root.
  21448. @item cbrt
  21449. Cubic root.
  21450. @end table
  21451. Default is linear.
  21452. @item draw
  21453. Set the draw mode.
  21454. Available values are:
  21455. @table @samp
  21456. @item scale
  21457. Scale pixel values for each drawn sample.
  21458. @item full
  21459. Draw every sample directly.
  21460. @end table
  21461. Default value is @code{scale}.
  21462. @item filter
  21463. Set the filter mode.
  21464. Available values are:
  21465. @table @samp
  21466. @item average
  21467. Use average samples values for each drawn sample.
  21468. @item peak
  21469. Use peak samples values for each drawn sample.
  21470. @end table
  21471. Default value is @code{average}.
  21472. @end table
  21473. @subsection Examples
  21474. @itemize
  21475. @item
  21476. Extract a channel split representation of the wave form of a whole audio track
  21477. in a 1024x800 picture using @command{ffmpeg}:
  21478. @example
  21479. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  21480. @end example
  21481. @end itemize
  21482. @section sidedata, asidedata
  21483. Delete frame side data, or select frames based on it.
  21484. This filter accepts the following options:
  21485. @table @option
  21486. @item mode
  21487. Set mode of operation of the filter.
  21488. Can be one of the following:
  21489. @table @samp
  21490. @item select
  21491. Select every frame with side data of @code{type}.
  21492. @item delete
  21493. Delete side data of @code{type}. If @code{type} is not set, delete all side
  21494. data in the frame.
  21495. @end table
  21496. @item type
  21497. Set side data type used with all modes. Must be set for @code{select} mode. For
  21498. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  21499. in @file{libavutil/frame.h}. For example, to choose
  21500. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  21501. @end table
  21502. @section spectrumsynth
  21503. Synthesize audio from 2 input video spectrums, first input stream represents
  21504. magnitude across time and second represents phase across time.
  21505. The filter will transform from frequency domain as displayed in videos back
  21506. to time domain as presented in audio output.
  21507. This filter is primarily created for reversing processed @ref{showspectrum}
  21508. filter outputs, but can synthesize sound from other spectrograms too.
  21509. But in such case results are going to be poor if the phase data is not
  21510. available, because in such cases phase data need to be recreated, usually
  21511. it's just recreated from random noise.
  21512. For best results use gray only output (@code{channel} color mode in
  21513. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  21514. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  21515. @code{data} option. Inputs videos should generally use @code{fullframe}
  21516. slide mode as that saves resources needed for decoding video.
  21517. The filter accepts the following options:
  21518. @table @option
  21519. @item sample_rate
  21520. Specify sample rate of output audio, the sample rate of audio from which
  21521. spectrum was generated may differ.
  21522. @item channels
  21523. Set number of channels represented in input video spectrums.
  21524. @item scale
  21525. Set scale which was used when generating magnitude input spectrum.
  21526. Can be @code{lin} or @code{log}. Default is @code{log}.
  21527. @item slide
  21528. Set slide which was used when generating inputs spectrums.
  21529. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  21530. Default is @code{fullframe}.
  21531. @item win_func
  21532. Set window function used for resynthesis.
  21533. @item overlap
  21534. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  21535. which means optimal overlap for selected window function will be picked.
  21536. @item orientation
  21537. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  21538. Default is @code{vertical}.
  21539. @end table
  21540. @subsection Examples
  21541. @itemize
  21542. @item
  21543. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  21544. then resynthesize videos back to audio with spectrumsynth:
  21545. @example
  21546. 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
  21547. 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
  21548. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  21549. @end example
  21550. @end itemize
  21551. @section split, asplit
  21552. Split input into several identical outputs.
  21553. @code{asplit} works with audio input, @code{split} with video.
  21554. The filter accepts a single parameter which specifies the number of outputs. If
  21555. unspecified, it defaults to 2.
  21556. @subsection Examples
  21557. @itemize
  21558. @item
  21559. Create two separate outputs from the same input:
  21560. @example
  21561. [in] split [out0][out1]
  21562. @end example
  21563. @item
  21564. To create 3 or more outputs, you need to specify the number of
  21565. outputs, like in:
  21566. @example
  21567. [in] asplit=3 [out0][out1][out2]
  21568. @end example
  21569. @item
  21570. Create two separate outputs from the same input, one cropped and
  21571. one padded:
  21572. @example
  21573. [in] split [splitout1][splitout2];
  21574. [splitout1] crop=100:100:0:0 [cropout];
  21575. [splitout2] pad=200:200:100:100 [padout];
  21576. @end example
  21577. @item
  21578. Create 5 copies of the input audio with @command{ffmpeg}:
  21579. @example
  21580. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  21581. @end example
  21582. @end itemize
  21583. @section zmq, azmq
  21584. Receive commands sent through a libzmq client, and forward them to
  21585. filters in the filtergraph.
  21586. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  21587. must be inserted between two video filters, @code{azmq} between two
  21588. audio filters. Both are capable to send messages to any filter type.
  21589. To enable these filters you need to install the libzmq library and
  21590. headers and configure FFmpeg with @code{--enable-libzmq}.
  21591. For more information about libzmq see:
  21592. @url{http://www.zeromq.org/}
  21593. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  21594. receives messages sent through a network interface defined by the
  21595. @option{bind_address} (or the abbreviation "@option{b}") option.
  21596. Default value of this option is @file{tcp://localhost:5555}. You may
  21597. want to alter this value to your needs, but do not forget to escape any
  21598. ':' signs (see @ref{filtergraph escaping}).
  21599. The received message must be in the form:
  21600. @example
  21601. @var{TARGET} @var{COMMAND} [@var{ARG}]
  21602. @end example
  21603. @var{TARGET} specifies the target of the command, usually the name of
  21604. the filter class or a specific filter instance name. The default
  21605. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  21606. but you can override this by using the @samp{filter_name@@id} syntax
  21607. (see @ref{Filtergraph syntax}).
  21608. @var{COMMAND} specifies the name of the command for the target filter.
  21609. @var{ARG} is optional and specifies the optional argument list for the
  21610. given @var{COMMAND}.
  21611. Upon reception, the message is processed and the corresponding command
  21612. is injected into the filtergraph. Depending on the result, the filter
  21613. will send a reply to the client, adopting the format:
  21614. @example
  21615. @var{ERROR_CODE} @var{ERROR_REASON}
  21616. @var{MESSAGE}
  21617. @end example
  21618. @var{MESSAGE} is optional.
  21619. @subsection Examples
  21620. Look at @file{tools/zmqsend} for an example of a zmq client which can
  21621. be used to send commands processed by these filters.
  21622. Consider the following filtergraph generated by @command{ffplay}.
  21623. In this example the last overlay filter has an instance name. All other
  21624. filters will have default instance names.
  21625. @example
  21626. ffplay -dumpgraph 1 -f lavfi "
  21627. color=s=100x100:c=red [l];
  21628. color=s=100x100:c=blue [r];
  21629. nullsrc=s=200x100, zmq [bg];
  21630. [bg][l] overlay [bg+l];
  21631. [bg+l][r] overlay@@my=x=100 "
  21632. @end example
  21633. To change the color of the left side of the video, the following
  21634. command can be used:
  21635. @example
  21636. echo Parsed_color_0 c yellow | tools/zmqsend
  21637. @end example
  21638. To change the right side:
  21639. @example
  21640. echo Parsed_color_1 c pink | tools/zmqsend
  21641. @end example
  21642. To change the position of the right side:
  21643. @example
  21644. echo overlay@@my x 150 | tools/zmqsend
  21645. @end example
  21646. @c man end MULTIMEDIA FILTERS
  21647. @chapter Multimedia Sources
  21648. @c man begin MULTIMEDIA SOURCES
  21649. Below is a description of the currently available multimedia sources.
  21650. @section amovie
  21651. This is the same as @ref{movie} source, except it selects an audio
  21652. stream by default.
  21653. @anchor{movie}
  21654. @section movie
  21655. Read audio and/or video stream(s) from a movie container.
  21656. It accepts the following parameters:
  21657. @table @option
  21658. @item filename
  21659. The name of the resource to read (not necessarily a file; it can also be a
  21660. device or a stream accessed through some protocol).
  21661. @item format_name, f
  21662. Specifies the format assumed for the movie to read, and can be either
  21663. the name of a container or an input device. If not specified, the
  21664. format is guessed from @var{movie_name} or by probing.
  21665. @item seek_point, sp
  21666. Specifies the seek point in seconds. The frames will be output
  21667. starting from this seek point. The parameter is evaluated with
  21668. @code{av_strtod}, so the numerical value may be suffixed by an IS
  21669. postfix. The default value is "0".
  21670. @item streams, s
  21671. Specifies the streams to read. Several streams can be specified,
  21672. separated by "+". The source will then have as many outputs, in the
  21673. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  21674. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  21675. respectively the default (best suited) video and audio stream. Default
  21676. is "dv", or "da" if the filter is called as "amovie".
  21677. @item stream_index, si
  21678. Specifies the index of the video stream to read. If the value is -1,
  21679. the most suitable video stream will be automatically selected. The default
  21680. value is "-1". Deprecated. If the filter is called "amovie", it will select
  21681. audio instead of video.
  21682. @item loop
  21683. Specifies how many times to read the stream in sequence.
  21684. If the value is 0, the stream will be looped infinitely.
  21685. Default value is "1".
  21686. Note that when the movie is looped the source timestamps are not
  21687. changed, so it will generate non monotonically increasing timestamps.
  21688. @item discontinuity
  21689. Specifies the time difference between frames above which the point is
  21690. considered a timestamp discontinuity which is removed by adjusting the later
  21691. timestamps.
  21692. @item dec_threads
  21693. Specifies the number of threads for decoding
  21694. @item format_opts
  21695. Specify format options for the opened file. Format options can be specified
  21696. as a list of @var{key}=@var{value} pairs separated by ':'. The following example
  21697. shows how to add protocol_whitelist and protocol_blacklist options:
  21698. @example
  21699. ffplay -f lavfi
  21700. "movie=filename='1.sdp':format_opts='protocol_whitelist=file,rtp,udp\:protocol_blacklist=http'"
  21701. @end example
  21702. @end table
  21703. It allows overlaying a second video on top of the main input of
  21704. a filtergraph, as shown in this graph:
  21705. @example
  21706. input -----------> deltapts0 --> overlay --> output
  21707. ^
  21708. |
  21709. movie --> scale--> deltapts1 -------+
  21710. @end example
  21711. @subsection Examples
  21712. @itemize
  21713. @item
  21714. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  21715. on top of the input labelled "in":
  21716. @example
  21717. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  21718. [in] setpts=PTS-STARTPTS [main];
  21719. [main][over] overlay=16:16 [out]
  21720. @end example
  21721. @item
  21722. Read from a video4linux2 device, and overlay it on top of the input
  21723. labelled "in":
  21724. @example
  21725. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  21726. [in] setpts=PTS-STARTPTS [main];
  21727. [main][over] overlay=16:16 [out]
  21728. @end example
  21729. @item
  21730. Read the first video stream and the audio stream with id 0x81 from
  21731. dvd.vob; the video is connected to the pad named "video" and the audio is
  21732. connected to the pad named "audio":
  21733. @example
  21734. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  21735. @end example
  21736. @end itemize
  21737. @subsection Commands
  21738. Both movie and amovie support the following commands:
  21739. @table @option
  21740. @item seek
  21741. Perform seek using "av_seek_frame".
  21742. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  21743. @itemize
  21744. @item
  21745. @var{stream_index}: If stream_index is -1, a default
  21746. stream is selected, and @var{timestamp} is automatically converted
  21747. from AV_TIME_BASE units to the stream specific time_base.
  21748. @item
  21749. @var{timestamp}: Timestamp in AVStream.time_base units
  21750. or, if no stream is specified, in AV_TIME_BASE units.
  21751. @item
  21752. @var{flags}: Flags which select direction and seeking mode.
  21753. @end itemize
  21754. @item get_duration
  21755. Get movie duration in AV_TIME_BASE units.
  21756. @end table
  21757. @c man end MULTIMEDIA SOURCES