filters.texi 612 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953
  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}@@@var{id}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program optionally followed by "@@@var{id}".
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{FILTER_NAME} ::= @var{NAME}["@@"@var{NAME}]
  173. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  174. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  175. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  176. @var{FILTER} ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  177. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  178. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  179. @end example
  180. @anchor{filtergraph escaping}
  181. @section Notes on filtergraph escaping
  182. Filtergraph description composition entails several levels of
  183. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  184. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  185. information about the employed escaping procedure.
  186. A first level escaping affects the content of each filter option
  187. value, which may contain the special character @code{:} used to
  188. separate values, or one of the escaping characters @code{\'}.
  189. A second level escaping affects the whole filter description, which
  190. may contain the escaping characters @code{\'} or the special
  191. characters @code{[],;} used by the filtergraph description.
  192. Finally, when you specify a filtergraph on a shell commandline, you
  193. need to perform a third level escaping for the shell special
  194. characters contained within it.
  195. For example, consider the following string to be embedded in
  196. the @ref{drawtext} filter description @option{text} value:
  197. @example
  198. this is a 'string': may contain one, or more, special characters
  199. @end example
  200. This string contains the @code{'} special escaping character, and the
  201. @code{:} special character, so it needs to be escaped in this way:
  202. @example
  203. text=this is a \'string\'\: may contain one, or more, special characters
  204. @end example
  205. A second level of escaping is required when embedding the filter
  206. description in a filtergraph description, in order to escape all the
  207. filtergraph special characters. Thus the example above becomes:
  208. @example
  209. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  210. @end example
  211. (note that in addition to the @code{\'} escaping special characters,
  212. also @code{,} needs to be escaped).
  213. Finally an additional level of escaping is needed when writing the
  214. filtergraph description in a shell command, which depends on the
  215. escaping rules of the adopted shell. For example, assuming that
  216. @code{\} is special and needs to be escaped with another @code{\}, the
  217. previous string will finally result in:
  218. @example
  219. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  220. @end example
  221. @chapter Timeline editing
  222. Some filters support a generic @option{enable} option. For the filters
  223. supporting timeline editing, this option can be set to an expression which is
  224. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  225. the filter will be enabled, otherwise the frame will be sent unchanged to the
  226. next filter in the filtergraph.
  227. The expression accepts the following values:
  228. @table @samp
  229. @item t
  230. timestamp expressed in seconds, NAN if the input timestamp is unknown
  231. @item n
  232. sequential number of the input frame, starting from 0
  233. @item pos
  234. the position in the file of the input frame, NAN if unknown
  235. @item w
  236. @item h
  237. width and height of the input frame if video
  238. @end table
  239. Additionally, these filters support an @option{enable} command that can be used
  240. to re-define the expression.
  241. Like any other filtering option, the @option{enable} option follows the same
  242. rules.
  243. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  244. minutes, and a @ref{curves} filter starting at 3 seconds:
  245. @example
  246. smartblur = enable='between(t,10,3*60)',
  247. curves = enable='gte(t,3)' : preset=cross_process
  248. @end example
  249. See @code{ffmpeg -filters} to view which filters have timeline support.
  250. @c man end FILTERGRAPH DESCRIPTION
  251. @anchor{framesync}
  252. @chapter Options for filters with several inputs (framesync)
  253. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  254. Some filters with several inputs support a common set of options.
  255. These options can only be set by name, not with the short notation.
  256. @table @option
  257. @item eof_action
  258. The action to take when EOF is encountered on the secondary input; it accepts
  259. one of the following values:
  260. @table @option
  261. @item repeat
  262. Repeat the last frame (the default).
  263. @item endall
  264. End both streams.
  265. @item pass
  266. Pass the main input through.
  267. @end table
  268. @item shortest
  269. If set to 1, force the output to terminate when the shortest input
  270. terminates. Default value is 0.
  271. @item repeatlast
  272. If set to 1, force the filter to extend the last frame of secondary streams
  273. until the end of the primary stream. A value of 0 disables this behavior.
  274. Default value is 1.
  275. @end table
  276. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  277. @chapter Audio Filters
  278. @c man begin AUDIO FILTERS
  279. When you configure your FFmpeg build, you can disable any of the
  280. existing filters using @code{--disable-filters}.
  281. The configure output will show the audio filters included in your
  282. build.
  283. Below is a description of the currently available audio filters.
  284. @section acompressor
  285. A compressor is mainly used to reduce the dynamic range of a signal.
  286. Especially modern music is mostly compressed at a high ratio to
  287. improve the overall loudness. It's done to get the highest attention
  288. of a listener, "fatten" the sound and bring more "power" to the track.
  289. If a signal is compressed too much it may sound dull or "dead"
  290. afterwards or it may start to "pump" (which could be a powerful effect
  291. but can also destroy a track completely).
  292. The right compression is the key to reach a professional sound and is
  293. the high art of mixing and mastering. Because of its complex settings
  294. it may take a long time to get the right feeling for this kind of effect.
  295. Compression is done by detecting the volume above a chosen level
  296. @code{threshold} and dividing it by the factor set with @code{ratio}.
  297. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  298. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  299. the signal would cause distortion of the waveform the reduction can be
  300. levelled over the time. This is done by setting "Attack" and "Release".
  301. @code{attack} determines how long the signal has to rise above the threshold
  302. before any reduction will occur and @code{release} sets the time the signal
  303. has to fall below the threshold to reduce the reduction again. Shorter signals
  304. than the chosen attack time will be left untouched.
  305. The overall reduction of the signal can be made up afterwards with the
  306. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  307. raising the makeup to this level results in a signal twice as loud than the
  308. source. To gain a softer entry in the compression the @code{knee} flattens the
  309. hard edge at the threshold in the range of the chosen decibels.
  310. The filter accepts the following options:
  311. @table @option
  312. @item level_in
  313. Set input gain. Default is 1. Range is between 0.015625 and 64.
  314. @item mode
  315. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  316. Default is @code{downward}.
  317. @item threshold
  318. If a signal of stream rises above this level it will affect the gain
  319. reduction.
  320. By default it is 0.125. Range is between 0.00097563 and 1.
  321. @item ratio
  322. Set a ratio by which the signal is reduced. 1:2 means that if the level
  323. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  324. Default is 2. Range is between 1 and 20.
  325. @item attack
  326. Amount of milliseconds the signal has to rise above the threshold before gain
  327. reduction starts. Default is 20. Range is between 0.01 and 2000.
  328. @item release
  329. Amount of milliseconds the signal has to fall below the threshold before
  330. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  331. @item makeup
  332. Set the amount by how much signal will be amplified after processing.
  333. Default is 1. Range is from 1 to 64.
  334. @item knee
  335. Curve the sharp knee around the threshold to enter gain reduction more softly.
  336. Default is 2.82843. Range is between 1 and 8.
  337. @item link
  338. Choose if the @code{average} level between all channels of input stream
  339. or the louder(@code{maximum}) channel of input stream affects the
  340. reduction. Default is @code{average}.
  341. @item detection
  342. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  343. of @code{rms}. Default is @code{rms} which is mostly smoother.
  344. @item mix
  345. How much to use compressed signal in output. Default is 1.
  346. Range is between 0 and 1.
  347. @end table
  348. @section acontrast
  349. Simple audio dynamic range compression/expansion filter.
  350. The filter accepts the following options:
  351. @table @option
  352. @item contrast
  353. Set contrast. Default is 33. Allowed range is between 0 and 100.
  354. @end table
  355. @section acopy
  356. Copy the input audio source unchanged to the output. This is mainly useful for
  357. testing purposes.
  358. @section acrossfade
  359. Apply cross fade from one input audio stream to another input audio stream.
  360. The cross fade is applied for specified duration near the end of first stream.
  361. The filter accepts the following options:
  362. @table @option
  363. @item nb_samples, ns
  364. Specify the number of samples for which the cross fade effect has to last.
  365. At the end of the cross fade effect the first input audio will be completely
  366. silent. Default is 44100.
  367. @item duration, d
  368. Specify the duration of the cross fade effect. See
  369. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  370. for the accepted syntax.
  371. By default the duration is determined by @var{nb_samples}.
  372. If set this option is used instead of @var{nb_samples}.
  373. @item overlap, o
  374. Should first stream end overlap with second stream start. Default is enabled.
  375. @item curve1
  376. Set curve for cross fade transition for first stream.
  377. @item curve2
  378. Set curve for cross fade transition for second stream.
  379. For description of available curve types see @ref{afade} filter description.
  380. @end table
  381. @subsection Examples
  382. @itemize
  383. @item
  384. Cross fade from one input to another:
  385. @example
  386. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  387. @end example
  388. @item
  389. Cross fade from one input to another but without overlapping:
  390. @example
  391. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  392. @end example
  393. @end itemize
  394. @section acrossover
  395. Split audio stream into several bands.
  396. This filter splits audio stream into two or more frequency ranges.
  397. Summing all streams back will give flat output.
  398. The filter accepts the following options:
  399. @table @option
  400. @item split
  401. Set split frequencies. Those must be positive and increasing.
  402. @item order
  403. Set filter order, can be @var{2nd}, @var{4th} or @var{8th}.
  404. Default is @var{4th}.
  405. @end table
  406. @section acrusher
  407. Reduce audio bit resolution.
  408. This filter is bit crusher with enhanced functionality. A bit crusher
  409. is used to audibly reduce number of bits an audio signal is sampled
  410. with. This doesn't change the bit depth at all, it just produces the
  411. effect. Material reduced in bit depth sounds more harsh and "digital".
  412. This filter is able to even round to continuous values instead of discrete
  413. bit depths.
  414. Additionally it has a D/C offset which results in different crushing of
  415. the lower and the upper half of the signal.
  416. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  417. Another feature of this filter is the logarithmic mode.
  418. This setting switches from linear distances between bits to logarithmic ones.
  419. The result is a much more "natural" sounding crusher which doesn't gate low
  420. signals for example. The human ear has a logarithmic perception,
  421. so this kind of crushing is much more pleasant.
  422. Logarithmic crushing is also able to get anti-aliased.
  423. The filter accepts the following options:
  424. @table @option
  425. @item level_in
  426. Set level in.
  427. @item level_out
  428. Set level out.
  429. @item bits
  430. Set bit reduction.
  431. @item mix
  432. Set mixing amount.
  433. @item mode
  434. Can be linear: @code{lin} or logarithmic: @code{log}.
  435. @item dc
  436. Set DC.
  437. @item aa
  438. Set anti-aliasing.
  439. @item samples
  440. Set sample reduction.
  441. @item lfo
  442. Enable LFO. By default disabled.
  443. @item lforange
  444. Set LFO range.
  445. @item lforate
  446. Set LFO rate.
  447. @end table
  448. @section acue
  449. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  450. filter.
  451. @section adeclick
  452. Remove impulsive noise from input audio.
  453. Samples detected as impulsive noise are replaced by interpolated samples using
  454. autoregressive modelling.
  455. @table @option
  456. @item w
  457. Set window size, in milliseconds. Allowed range is from @code{10} to
  458. @code{100}. Default value is @code{55} milliseconds.
  459. This sets size of window which will be processed at once.
  460. @item o
  461. Set window overlap, in percentage of window size. Allowed range is from
  462. @code{50} to @code{95}. Default value is @code{75} percent.
  463. Setting this to a very high value increases impulsive noise removal but makes
  464. whole process much slower.
  465. @item a
  466. Set autoregression order, in percentage of window size. Allowed range is from
  467. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  468. controls quality of interpolated samples using neighbour good samples.
  469. @item t
  470. Set threshold value. Allowed range is from @code{1} to @code{100}.
  471. Default value is @code{2}.
  472. This controls the strength of impulsive noise which is going to be removed.
  473. The lower value, the more samples will be detected as impulsive noise.
  474. @item b
  475. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  476. @code{10}. Default value is @code{2}.
  477. If any two samples detected as noise are spaced less than this value then any
  478. sample between those two samples will be also detected as noise.
  479. @item m
  480. Set overlap method.
  481. It accepts the following values:
  482. @table @option
  483. @item a
  484. Select overlap-add method. Even not interpolated samples are slightly
  485. changed with this method.
  486. @item s
  487. Select overlap-save method. Not interpolated samples remain unchanged.
  488. @end table
  489. Default value is @code{a}.
  490. @end table
  491. @section adeclip
  492. Remove clipped samples from input audio.
  493. Samples detected as clipped are replaced by interpolated samples using
  494. autoregressive modelling.
  495. @table @option
  496. @item w
  497. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  498. Default value is @code{55} milliseconds.
  499. This sets size of window which will be processed at once.
  500. @item o
  501. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  502. to @code{95}. Default value is @code{75} percent.
  503. @item a
  504. Set autoregression order, in percentage of window size. Allowed range is from
  505. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  506. quality of interpolated samples using neighbour good samples.
  507. @item t
  508. Set threshold value. Allowed range is from @code{1} to @code{100}.
  509. Default value is @code{10}. Higher values make clip detection less aggressive.
  510. @item n
  511. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  512. Default value is @code{1000}. Higher values make clip detection less aggressive.
  513. @item m
  514. Set overlap method.
  515. It accepts the following values:
  516. @table @option
  517. @item a
  518. Select overlap-add method. Even not interpolated samples are slightly changed
  519. with this method.
  520. @item s
  521. Select overlap-save method. Not interpolated samples remain unchanged.
  522. @end table
  523. Default value is @code{a}.
  524. @end table
  525. @section adelay
  526. Delay one or more audio channels.
  527. Samples in delayed channel are filled with silence.
  528. The filter accepts the following option:
  529. @table @option
  530. @item delays
  531. Set list of delays in milliseconds for each channel separated by '|'.
  532. Unused delays will be silently ignored. If number of given delays is
  533. smaller than number of channels all remaining channels will not be delayed.
  534. If you want to delay exact number of samples, append 'S' to number.
  535. If you want instead to delay in seconds, append 's' to number.
  536. @end table
  537. @subsection Examples
  538. @itemize
  539. @item
  540. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  541. the second channel (and any other channels that may be present) unchanged.
  542. @example
  543. adelay=1500|0|500
  544. @end example
  545. @item
  546. Delay second channel by 500 samples, the third channel by 700 samples and leave
  547. the first channel (and any other channels that may be present) unchanged.
  548. @example
  549. adelay=0|500S|700S
  550. @end example
  551. @end itemize
  552. @section aderivative, aintegral
  553. Compute derivative/integral of audio stream.
  554. Applying both filters one after another produces original audio.
  555. @section aecho
  556. Apply echoing to the input audio.
  557. Echoes are reflected sound and can occur naturally amongst mountains
  558. (and sometimes large buildings) when talking or shouting; digital echo
  559. effects emulate this behaviour and are often used to help fill out the
  560. sound of a single instrument or vocal. The time difference between the
  561. original signal and the reflection is the @code{delay}, and the
  562. loudness of the reflected signal is the @code{decay}.
  563. Multiple echoes can have different delays and decays.
  564. A description of the accepted parameters follows.
  565. @table @option
  566. @item in_gain
  567. Set input gain of reflected signal. Default is @code{0.6}.
  568. @item out_gain
  569. Set output gain of reflected signal. Default is @code{0.3}.
  570. @item delays
  571. Set list of time intervals in milliseconds between original signal and reflections
  572. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  573. Default is @code{1000}.
  574. @item decays
  575. Set list of loudness of reflected signals separated by '|'.
  576. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  577. Default is @code{0.5}.
  578. @end table
  579. @subsection Examples
  580. @itemize
  581. @item
  582. Make it sound as if there are twice as many instruments as are actually playing:
  583. @example
  584. aecho=0.8:0.88:60:0.4
  585. @end example
  586. @item
  587. If delay is very short, then it sound like a (metallic) robot playing music:
  588. @example
  589. aecho=0.8:0.88:6:0.4
  590. @end example
  591. @item
  592. A longer delay will sound like an open air concert in the mountains:
  593. @example
  594. aecho=0.8:0.9:1000:0.3
  595. @end example
  596. @item
  597. Same as above but with one more mountain:
  598. @example
  599. aecho=0.8:0.9:1000|1800:0.3|0.25
  600. @end example
  601. @end itemize
  602. @section aemphasis
  603. Audio emphasis filter creates or restores material directly taken from LPs or
  604. emphased CDs with different filter curves. E.g. to store music on vinyl the
  605. signal has to be altered by a filter first to even out the disadvantages of
  606. this recording medium.
  607. Once the material is played back the inverse filter has to be applied to
  608. restore the distortion of the frequency response.
  609. The filter accepts the following options:
  610. @table @option
  611. @item level_in
  612. Set input gain.
  613. @item level_out
  614. Set output gain.
  615. @item mode
  616. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  617. use @code{production} mode. Default is @code{reproduction} mode.
  618. @item type
  619. Set filter type. Selects medium. Can be one of the following:
  620. @table @option
  621. @item col
  622. select Columbia.
  623. @item emi
  624. select EMI.
  625. @item bsi
  626. select BSI (78RPM).
  627. @item riaa
  628. select RIAA.
  629. @item cd
  630. select Compact Disc (CD).
  631. @item 50fm
  632. select 50µs (FM).
  633. @item 75fm
  634. select 75µs (FM).
  635. @item 50kf
  636. select 50µs (FM-KF).
  637. @item 75kf
  638. select 75µs (FM-KF).
  639. @end table
  640. @end table
  641. @section aeval
  642. Modify an audio signal according to the specified expressions.
  643. This filter accepts one or more expressions (one for each channel),
  644. which are evaluated and used to modify a corresponding audio signal.
  645. It accepts the following parameters:
  646. @table @option
  647. @item exprs
  648. Set the '|'-separated expressions list for each separate channel. If
  649. the number of input channels is greater than the number of
  650. expressions, the last specified expression is used for the remaining
  651. output channels.
  652. @item channel_layout, c
  653. Set output channel layout. If not specified, the channel layout is
  654. specified by the number of expressions. If set to @samp{same}, it will
  655. use by default the same input channel layout.
  656. @end table
  657. Each expression in @var{exprs} can contain the following constants and functions:
  658. @table @option
  659. @item ch
  660. channel number of the current expression
  661. @item n
  662. number of the evaluated sample, starting from 0
  663. @item s
  664. sample rate
  665. @item t
  666. time of the evaluated sample expressed in seconds
  667. @item nb_in_channels
  668. @item nb_out_channels
  669. input and output number of channels
  670. @item val(CH)
  671. the value of input channel with number @var{CH}
  672. @end table
  673. Note: this filter is slow. For faster processing you should use a
  674. dedicated filter.
  675. @subsection Examples
  676. @itemize
  677. @item
  678. Half volume:
  679. @example
  680. aeval=val(ch)/2:c=same
  681. @end example
  682. @item
  683. Invert phase of the second channel:
  684. @example
  685. aeval=val(0)|-val(1)
  686. @end example
  687. @end itemize
  688. @anchor{afade}
  689. @section afade
  690. Apply fade-in/out effect to input audio.
  691. A description of the accepted parameters follows.
  692. @table @option
  693. @item type, t
  694. Specify the effect type, can be either @code{in} for fade-in, or
  695. @code{out} for a fade-out effect. Default is @code{in}.
  696. @item start_sample, ss
  697. Specify the number of the start sample for starting to apply the fade
  698. effect. Default is 0.
  699. @item nb_samples, ns
  700. Specify the number of samples for which the fade effect has to last. At
  701. the end of the fade-in effect the output audio will have the same
  702. volume as the input audio, at the end of the fade-out transition
  703. the output audio will be silence. Default is 44100.
  704. @item start_time, st
  705. Specify the start time of the fade effect. Default is 0.
  706. The value must be specified as a time duration; see
  707. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  708. for the accepted syntax.
  709. If set this option is used instead of @var{start_sample}.
  710. @item duration, d
  711. Specify the duration of the fade effect. See
  712. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  713. for the accepted syntax.
  714. At the end of the fade-in effect the output audio will have the same
  715. volume as the input audio, at the end of the fade-out transition
  716. the output audio will be silence.
  717. By default the duration is determined by @var{nb_samples}.
  718. If set this option is used instead of @var{nb_samples}.
  719. @item curve
  720. Set curve for fade transition.
  721. It accepts the following values:
  722. @table @option
  723. @item tri
  724. select triangular, linear slope (default)
  725. @item qsin
  726. select quarter of sine wave
  727. @item hsin
  728. select half of sine wave
  729. @item esin
  730. select exponential sine wave
  731. @item log
  732. select logarithmic
  733. @item ipar
  734. select inverted parabola
  735. @item qua
  736. select quadratic
  737. @item cub
  738. select cubic
  739. @item squ
  740. select square root
  741. @item cbr
  742. select cubic root
  743. @item par
  744. select parabola
  745. @item exp
  746. select exponential
  747. @item iqsin
  748. select inverted quarter of sine wave
  749. @item ihsin
  750. select inverted half of sine wave
  751. @item dese
  752. select double-exponential seat
  753. @item desi
  754. select double-exponential sigmoid
  755. @item losi
  756. select logistic sigmoid
  757. @item nofade
  758. no fade applied
  759. @end table
  760. @end table
  761. @subsection Examples
  762. @itemize
  763. @item
  764. Fade in first 15 seconds of audio:
  765. @example
  766. afade=t=in:ss=0:d=15
  767. @end example
  768. @item
  769. Fade out last 25 seconds of a 900 seconds audio:
  770. @example
  771. afade=t=out:st=875:d=25
  772. @end example
  773. @end itemize
  774. @section afftdn
  775. Denoise audio samples with FFT.
  776. A description of the accepted parameters follows.
  777. @table @option
  778. @item nr
  779. Set the noise reduction in dB, allowed range is 0.01 to 97.
  780. Default value is 12 dB.
  781. @item nf
  782. Set the noise floor in dB, allowed range is -80 to -20.
  783. Default value is -50 dB.
  784. @item nt
  785. Set the noise type.
  786. It accepts the following values:
  787. @table @option
  788. @item w
  789. Select white noise.
  790. @item v
  791. Select vinyl noise.
  792. @item s
  793. Select shellac noise.
  794. @item c
  795. Select custom noise, defined in @code{bn} option.
  796. Default value is white noise.
  797. @end table
  798. @item bn
  799. Set custom band noise for every one of 15 bands.
  800. Bands are separated by ' ' or '|'.
  801. @item rf
  802. Set the residual floor in dB, allowed range is -80 to -20.
  803. Default value is -38 dB.
  804. @item tn
  805. Enable noise tracking. By default is disabled.
  806. With this enabled, noise floor is automatically adjusted.
  807. @item tr
  808. Enable residual tracking. By default is disabled.
  809. @item om
  810. Set the output mode.
  811. It accepts the following values:
  812. @table @option
  813. @item i
  814. Pass input unchanged.
  815. @item o
  816. Pass noise filtered out.
  817. @item n
  818. Pass only noise.
  819. Default value is @var{o}.
  820. @end table
  821. @end table
  822. @subsection Commands
  823. This filter supports the following commands:
  824. @table @option
  825. @item sample_noise, sn
  826. Start or stop measuring noise profile.
  827. Syntax for the command is : "start" or "stop" string.
  828. After measuring noise profile is stopped it will be
  829. automatically applied in filtering.
  830. @item noise_reduction, nr
  831. Change noise reduction. Argument is single float number.
  832. Syntax for the command is : "@var{noise_reduction}"
  833. @item noise_floor, nf
  834. Change noise floor. Argument is single float number.
  835. Syntax for the command is : "@var{noise_floor}"
  836. @item output_mode, om
  837. Change output mode operation.
  838. Syntax for the command is : "i", "o" or "n" string.
  839. @end table
  840. @section afftfilt
  841. Apply arbitrary expressions to samples in frequency domain.
  842. @table @option
  843. @item real
  844. Set frequency domain real expression for each separate channel separated
  845. by '|'. Default is "re".
  846. If the number of input channels is greater than the number of
  847. expressions, the last specified expression is used for the remaining
  848. output channels.
  849. @item imag
  850. Set frequency domain imaginary expression for each separate channel
  851. separated by '|'. Default is "im".
  852. Each expression in @var{real} and @var{imag} can contain the following
  853. constants and functions:
  854. @table @option
  855. @item sr
  856. sample rate
  857. @item b
  858. current frequency bin number
  859. @item nb
  860. number of available bins
  861. @item ch
  862. channel number of the current expression
  863. @item chs
  864. number of channels
  865. @item pts
  866. current frame pts
  867. @item re
  868. current real part of frequency bin of current channel
  869. @item im
  870. current imaginary part of frequency bin of current channel
  871. @item real(b, ch)
  872. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  873. @item imag(b, ch)
  874. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  875. @end table
  876. @item win_size
  877. Set window size.
  878. It accepts the following values:
  879. @table @samp
  880. @item w16
  881. @item w32
  882. @item w64
  883. @item w128
  884. @item w256
  885. @item w512
  886. @item w1024
  887. @item w2048
  888. @item w4096
  889. @item w8192
  890. @item w16384
  891. @item w32768
  892. @item w65536
  893. @end table
  894. Default is @code{w4096}
  895. @item win_func
  896. Set window function. Default is @code{hann}.
  897. @item overlap
  898. Set window overlap. If set to 1, the recommended overlap for selected
  899. window function will be picked. Default is @code{0.75}.
  900. @end table
  901. @subsection Examples
  902. @itemize
  903. @item
  904. Leave almost only low frequencies in audio:
  905. @example
  906. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  907. @end example
  908. @end itemize
  909. @anchor{afir}
  910. @section afir
  911. Apply an arbitrary Frequency Impulse Response filter.
  912. This filter is designed for applying long FIR filters,
  913. up to 60 seconds long.
  914. It can be used as component for digital crossover filters,
  915. room equalization, cross talk cancellation, wavefield synthesis,
  916. auralization, ambiophonics, ambisonics and spatialization.
  917. This filter uses second stream as FIR coefficients.
  918. If second stream holds single channel, it will be used
  919. for all input channels in first stream, otherwise
  920. number of channels in second stream must be same as
  921. number of channels in first stream.
  922. It accepts the following parameters:
  923. @table @option
  924. @item dry
  925. Set dry gain. This sets input gain.
  926. @item wet
  927. Set wet gain. This sets final output gain.
  928. @item length
  929. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  930. @item gtype
  931. Enable applying gain measured from power of IR.
  932. Set which approach to use for auto gain measurement.
  933. @table @option
  934. @item none
  935. Do not apply any gain.
  936. @item peak
  937. select peak gain, very conservative approach. This is default value.
  938. @item dc
  939. select DC gain, limited application.
  940. @item gn
  941. select gain to noise approach, this is most popular one.
  942. @end table
  943. @item irgain
  944. Set gain to be applied to IR coefficients before filtering.
  945. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  946. @item irfmt
  947. Set format of IR stream. Can be @code{mono} or @code{input}.
  948. Default is @code{input}.
  949. @item maxir
  950. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  951. Allowed range is 0.1 to 60 seconds.
  952. @item response
  953. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  954. By default it is disabled.
  955. @item channel
  956. Set for which IR channel to display frequency response. By default is first channel
  957. displayed. This option is used only when @var{response} is enabled.
  958. @item size
  959. Set video stream size. This option is used only when @var{response} is enabled.
  960. @item rate
  961. Set video stream frame rate. This option is used only when @var{response} is enabled.
  962. @item minp
  963. Set minimal partition size used for convolution. Default is @var{8192}.
  964. Allowed range is from @var{8} to @var{32768}.
  965. Lower values decreases latency at cost of higher CPU usage.
  966. @item maxp
  967. Set maximal partition size used for convolution. Default is @var{8192}.
  968. Allowed range is from @var{8} to @var{32768}.
  969. Lower values may increase CPU usage.
  970. @end table
  971. @subsection Examples
  972. @itemize
  973. @item
  974. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  975. @example
  976. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  977. @end example
  978. @end itemize
  979. @anchor{aformat}
  980. @section aformat
  981. Set output format constraints for the input audio. The framework will
  982. negotiate the most appropriate format to minimize conversions.
  983. It accepts the following parameters:
  984. @table @option
  985. @item sample_fmts
  986. A '|'-separated list of requested sample formats.
  987. @item sample_rates
  988. A '|'-separated list of requested sample rates.
  989. @item channel_layouts
  990. A '|'-separated list of requested channel layouts.
  991. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  992. for the required syntax.
  993. @end table
  994. If a parameter is omitted, all values are allowed.
  995. Force the output to either unsigned 8-bit or signed 16-bit stereo
  996. @example
  997. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  998. @end example
  999. @section agate
  1000. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  1001. processing reduces disturbing noise between useful signals.
  1002. Gating is done by detecting the volume below a chosen level @var{threshold}
  1003. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  1004. floor is set via @var{range}. Because an exact manipulation of the signal
  1005. would cause distortion of the waveform the reduction can be levelled over
  1006. time. This is done by setting @var{attack} and @var{release}.
  1007. @var{attack} determines how long the signal has to fall below the threshold
  1008. before any reduction will occur and @var{release} sets the time the signal
  1009. has to rise above the threshold to reduce the reduction again.
  1010. Shorter signals than the chosen attack time will be left untouched.
  1011. @table @option
  1012. @item level_in
  1013. Set input level before filtering.
  1014. Default is 1. Allowed range is from 0.015625 to 64.
  1015. @item mode
  1016. Set the mode of operation. Can be @code{upward} or @code{downward}.
  1017. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  1018. will be amplified, expanding dynamic range in upward direction.
  1019. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  1020. @item range
  1021. Set the level of gain reduction when the signal is below the threshold.
  1022. Default is 0.06125. Allowed range is from 0 to 1.
  1023. Setting this to 0 disables reduction and then filter behaves like expander.
  1024. @item threshold
  1025. If a signal rises above this level the gain reduction is released.
  1026. Default is 0.125. Allowed range is from 0 to 1.
  1027. @item ratio
  1028. Set a ratio by which the signal is reduced.
  1029. Default is 2. Allowed range is from 1 to 9000.
  1030. @item attack
  1031. Amount of milliseconds the signal has to rise above the threshold before gain
  1032. reduction stops.
  1033. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1034. @item release
  1035. Amount of milliseconds the signal has to fall below the threshold before the
  1036. reduction is increased again. Default is 250 milliseconds.
  1037. Allowed range is from 0.01 to 9000.
  1038. @item makeup
  1039. Set amount of amplification of signal after processing.
  1040. Default is 1. Allowed range is from 1 to 64.
  1041. @item knee
  1042. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1043. Default is 2.828427125. Allowed range is from 1 to 8.
  1044. @item detection
  1045. Choose if exact signal should be taken for detection or an RMS like one.
  1046. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1047. @item link
  1048. Choose if the average level between all channels or the louder channel affects
  1049. the reduction.
  1050. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1051. @end table
  1052. @section aiir
  1053. Apply an arbitrary Infinite Impulse Response filter.
  1054. It accepts the following parameters:
  1055. @table @option
  1056. @item z
  1057. Set numerator/zeros coefficients.
  1058. @item p
  1059. Set denominator/poles coefficients.
  1060. @item k
  1061. Set channels gains.
  1062. @item dry_gain
  1063. Set input gain.
  1064. @item wet_gain
  1065. Set output gain.
  1066. @item f
  1067. Set coefficients format.
  1068. @table @samp
  1069. @item tf
  1070. transfer function
  1071. @item zp
  1072. Z-plane zeros/poles, cartesian (default)
  1073. @item pr
  1074. Z-plane zeros/poles, polar radians
  1075. @item pd
  1076. Z-plane zeros/poles, polar degrees
  1077. @end table
  1078. @item r
  1079. Set kind of processing.
  1080. Can be @code{d} - direct or @code{s} - serial cascading. Default is @code{s}.
  1081. @item e
  1082. Set filtering precision.
  1083. @table @samp
  1084. @item dbl
  1085. double-precision floating-point (default)
  1086. @item flt
  1087. single-precision floating-point
  1088. @item i32
  1089. 32-bit integers
  1090. @item i16
  1091. 16-bit integers
  1092. @end table
  1093. @item response
  1094. Show IR frequency response, magnitude and phase in additional video stream.
  1095. By default it is disabled.
  1096. @item channel
  1097. Set for which IR channel to display frequency response. By default is first channel
  1098. displayed. This option is used only when @var{response} is enabled.
  1099. @item size
  1100. Set video stream size. This option is used only when @var{response} is enabled.
  1101. @end table
  1102. Coefficients in @code{tf} format are separated by spaces and are in ascending
  1103. order.
  1104. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1105. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1106. imaginary unit.
  1107. Different coefficients and gains can be provided for every channel, in such case
  1108. use '|' to separate coefficients or gains. Last provided coefficients will be
  1109. used for all remaining channels.
  1110. @subsection Examples
  1111. @itemize
  1112. @item
  1113. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1114. @example
  1115. 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
  1116. @end example
  1117. @item
  1118. Same as above but in @code{zp} format:
  1119. @example
  1120. 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
  1121. @end example
  1122. @end itemize
  1123. @section alimiter
  1124. The limiter prevents an input signal from rising over a desired threshold.
  1125. This limiter uses lookahead technology to prevent your signal from distorting.
  1126. It means that there is a small delay after the signal is processed. Keep in mind
  1127. that the delay it produces is the attack time you set.
  1128. The filter accepts the following options:
  1129. @table @option
  1130. @item level_in
  1131. Set input gain. Default is 1.
  1132. @item level_out
  1133. Set output gain. Default is 1.
  1134. @item limit
  1135. Don't let signals above this level pass the limiter. Default is 1.
  1136. @item attack
  1137. The limiter will reach its attenuation level in this amount of time in
  1138. milliseconds. Default is 5 milliseconds.
  1139. @item release
  1140. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1141. Default is 50 milliseconds.
  1142. @item asc
  1143. When gain reduction is always needed ASC takes care of releasing to an
  1144. average reduction level rather than reaching a reduction of 0 in the release
  1145. time.
  1146. @item asc_level
  1147. Select how much the release time is affected by ASC, 0 means nearly no changes
  1148. in release time while 1 produces higher release times.
  1149. @item level
  1150. Auto level output signal. Default is enabled.
  1151. This normalizes audio back to 0dB if enabled.
  1152. @end table
  1153. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1154. with @ref{aresample} before applying this filter.
  1155. @section allpass
  1156. Apply a two-pole all-pass filter with central frequency (in Hz)
  1157. @var{frequency}, and filter-width @var{width}.
  1158. An all-pass filter changes the audio's frequency to phase relationship
  1159. without changing its frequency to amplitude relationship.
  1160. The filter accepts the following options:
  1161. @table @option
  1162. @item frequency, f
  1163. Set frequency in Hz.
  1164. @item width_type, t
  1165. Set method to specify band-width of filter.
  1166. @table @option
  1167. @item h
  1168. Hz
  1169. @item q
  1170. Q-Factor
  1171. @item o
  1172. octave
  1173. @item s
  1174. slope
  1175. @item k
  1176. kHz
  1177. @end table
  1178. @item width, w
  1179. Specify the band-width of a filter in width_type units.
  1180. @item channels, c
  1181. Specify which channels to filter, by default all available are filtered.
  1182. @end table
  1183. @subsection Commands
  1184. This filter supports the following commands:
  1185. @table @option
  1186. @item frequency, f
  1187. Change allpass frequency.
  1188. Syntax for the command is : "@var{frequency}"
  1189. @item width_type, t
  1190. Change allpass width_type.
  1191. Syntax for the command is : "@var{width_type}"
  1192. @item width, w
  1193. Change allpass width.
  1194. Syntax for the command is : "@var{width}"
  1195. @end table
  1196. @section aloop
  1197. Loop audio samples.
  1198. The filter accepts the following options:
  1199. @table @option
  1200. @item loop
  1201. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1202. Default is 0.
  1203. @item size
  1204. Set maximal number of samples. Default is 0.
  1205. @item start
  1206. Set first sample of loop. Default is 0.
  1207. @end table
  1208. @anchor{amerge}
  1209. @section amerge
  1210. Merge two or more audio streams into a single multi-channel stream.
  1211. The filter accepts the following options:
  1212. @table @option
  1213. @item inputs
  1214. Set the number of inputs. Default is 2.
  1215. @end table
  1216. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1217. the channel layout of the output will be set accordingly and the channels
  1218. will be reordered as necessary. If the channel layouts of the inputs are not
  1219. disjoint, the output will have all the channels of the first input then all
  1220. the channels of the second input, in that order, and the channel layout of
  1221. the output will be the default value corresponding to the total number of
  1222. channels.
  1223. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1224. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1225. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1226. first input, b1 is the first channel of the second input).
  1227. On the other hand, if both input are in stereo, the output channels will be
  1228. in the default order: a1, a2, b1, b2, and the channel layout will be
  1229. arbitrarily set to 4.0, which may or may not be the expected value.
  1230. All inputs must have the same sample rate, and format.
  1231. If inputs do not have the same duration, the output will stop with the
  1232. shortest.
  1233. @subsection Examples
  1234. @itemize
  1235. @item
  1236. Merge two mono files into a stereo stream:
  1237. @example
  1238. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1239. @end example
  1240. @item
  1241. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1242. @example
  1243. 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
  1244. @end example
  1245. @end itemize
  1246. @section amix
  1247. Mixes multiple audio inputs into a single output.
  1248. Note that this filter only supports float samples (the @var{amerge}
  1249. and @var{pan} audio filters support many formats). If the @var{amix}
  1250. input has integer samples then @ref{aresample} will be automatically
  1251. inserted to perform the conversion to float samples.
  1252. For example
  1253. @example
  1254. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1255. @end example
  1256. will mix 3 input audio streams to a single output with the same duration as the
  1257. first input and a dropout transition time of 3 seconds.
  1258. It accepts the following parameters:
  1259. @table @option
  1260. @item inputs
  1261. The number of inputs. If unspecified, it defaults to 2.
  1262. @item duration
  1263. How to determine the end-of-stream.
  1264. @table @option
  1265. @item longest
  1266. The duration of the longest input. (default)
  1267. @item shortest
  1268. The duration of the shortest input.
  1269. @item first
  1270. The duration of the first input.
  1271. @end table
  1272. @item dropout_transition
  1273. The transition time, in seconds, for volume renormalization when an input
  1274. stream ends. The default value is 2 seconds.
  1275. @item weights
  1276. Specify weight of each input audio stream as sequence.
  1277. Each weight is separated by space. By default all inputs have same weight.
  1278. @end table
  1279. @section amultiply
  1280. Multiply first audio stream with second audio stream and store result
  1281. in output audio stream. Multiplication is done by multiplying each
  1282. sample from first stream with sample at same position from second stream.
  1283. With this element-wise multiplication one can create amplitude fades and
  1284. amplitude modulations.
  1285. @section anequalizer
  1286. High-order parametric multiband equalizer for each channel.
  1287. It accepts the following parameters:
  1288. @table @option
  1289. @item params
  1290. This option string is in format:
  1291. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1292. Each equalizer band is separated by '|'.
  1293. @table @option
  1294. @item chn
  1295. Set channel number to which equalization will be applied.
  1296. If input doesn't have that channel the entry is ignored.
  1297. @item f
  1298. Set central frequency for band.
  1299. If input doesn't have that frequency the entry is ignored.
  1300. @item w
  1301. Set band width in hertz.
  1302. @item g
  1303. Set band gain in dB.
  1304. @item t
  1305. Set filter type for band, optional, can be:
  1306. @table @samp
  1307. @item 0
  1308. Butterworth, this is default.
  1309. @item 1
  1310. Chebyshev type 1.
  1311. @item 2
  1312. Chebyshev type 2.
  1313. @end table
  1314. @end table
  1315. @item curves
  1316. With this option activated frequency response of anequalizer is displayed
  1317. in video stream.
  1318. @item size
  1319. Set video stream size. Only useful if curves option is activated.
  1320. @item mgain
  1321. Set max gain that will be displayed. Only useful if curves option is activated.
  1322. Setting this to a reasonable value makes it possible to display gain which is derived from
  1323. neighbour bands which are too close to each other and thus produce higher gain
  1324. when both are activated.
  1325. @item fscale
  1326. Set frequency scale used to draw frequency response in video output.
  1327. Can be linear or logarithmic. Default is logarithmic.
  1328. @item colors
  1329. Set color for each channel curve which is going to be displayed in video stream.
  1330. This is list of color names separated by space or by '|'.
  1331. Unrecognised or missing colors will be replaced by white color.
  1332. @end table
  1333. @subsection Examples
  1334. @itemize
  1335. @item
  1336. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1337. for first 2 channels using Chebyshev type 1 filter:
  1338. @example
  1339. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1340. @end example
  1341. @end itemize
  1342. @subsection Commands
  1343. This filter supports the following commands:
  1344. @table @option
  1345. @item change
  1346. Alter existing filter parameters.
  1347. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1348. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1349. error is returned.
  1350. @var{freq} set new frequency parameter.
  1351. @var{width} set new width parameter in herz.
  1352. @var{gain} set new gain parameter in dB.
  1353. Full filter invocation with asendcmd may look like this:
  1354. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1355. @end table
  1356. @section anlmdn
  1357. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  1358. Each sample is adjusted by looking for other samples with similar contexts. This
  1359. context similarity is defined by comparing their surrounding patches of size
  1360. @option{p}. Patches are searched in an area of @option{r} around the sample.
  1361. The filter accepts the following options.
  1362. @table @option
  1363. @item s
  1364. Set denoising strength. Allowed range is from 0.00001 to 10. Default value is 0.00001.
  1365. @item p
  1366. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  1367. Default value is 2 milliseconds.
  1368. @item r
  1369. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  1370. Default value is 6 milliseconds.
  1371. @item o
  1372. Set the output mode.
  1373. It accepts the following values:
  1374. @table @option
  1375. @item i
  1376. Pass input unchanged.
  1377. @item o
  1378. Pass noise filtered out.
  1379. @item n
  1380. Pass only noise.
  1381. Default value is @var{o}.
  1382. @end table
  1383. @end table
  1384. @section anull
  1385. Pass the audio source unchanged to the output.
  1386. @section apad
  1387. Pad the end of an audio stream with silence.
  1388. This can be used together with @command{ffmpeg} @option{-shortest} to
  1389. extend audio streams to the same length as the video stream.
  1390. A description of the accepted options follows.
  1391. @table @option
  1392. @item packet_size
  1393. Set silence packet size. Default value is 4096.
  1394. @item pad_len
  1395. Set the number of samples of silence to add to the end. After the
  1396. value is reached, the stream is terminated. This option is mutually
  1397. exclusive with @option{whole_len}.
  1398. @item whole_len
  1399. Set the minimum total number of samples in the output audio stream. If
  1400. the value is longer than the input audio length, silence is added to
  1401. the end, until the value is reached. This option is mutually exclusive
  1402. with @option{pad_len}.
  1403. @item pad_dur
  1404. Specify the duration of samples of silence to add. See
  1405. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1406. for the accepted syntax. Used only if set to non-zero value.
  1407. @item whole_dur
  1408. Specify the minimum total duration in the output audio stream. See
  1409. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1410. for the accepted syntax. Used only if set to non-zero value. If the value is longer than
  1411. the input audio length, silence is added to the end, until the value is reached.
  1412. This option is mutually exclusive with @option{pad_dur}
  1413. @end table
  1414. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  1415. nor @option{whole_dur} option is set, the filter will add silence to the end of
  1416. the input stream indefinitely.
  1417. @subsection Examples
  1418. @itemize
  1419. @item
  1420. Add 1024 samples of silence to the end of the input:
  1421. @example
  1422. apad=pad_len=1024
  1423. @end example
  1424. @item
  1425. Make sure the audio output will contain at least 10000 samples, pad
  1426. the input with silence if required:
  1427. @example
  1428. apad=whole_len=10000
  1429. @end example
  1430. @item
  1431. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1432. video stream will always result the shortest and will be converted
  1433. until the end in the output file when using the @option{shortest}
  1434. option:
  1435. @example
  1436. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1437. @end example
  1438. @end itemize
  1439. @section aphaser
  1440. Add a phasing effect to the input audio.
  1441. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1442. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1443. A description of the accepted parameters follows.
  1444. @table @option
  1445. @item in_gain
  1446. Set input gain. Default is 0.4.
  1447. @item out_gain
  1448. Set output gain. Default is 0.74
  1449. @item delay
  1450. Set delay in milliseconds. Default is 3.0.
  1451. @item decay
  1452. Set decay. Default is 0.4.
  1453. @item speed
  1454. Set modulation speed in Hz. Default is 0.5.
  1455. @item type
  1456. Set modulation type. Default is triangular.
  1457. It accepts the following values:
  1458. @table @samp
  1459. @item triangular, t
  1460. @item sinusoidal, s
  1461. @end table
  1462. @end table
  1463. @section apulsator
  1464. Audio pulsator is something between an autopanner and a tremolo.
  1465. But it can produce funny stereo effects as well. Pulsator changes the volume
  1466. of the left and right channel based on a LFO (low frequency oscillator) with
  1467. different waveforms and shifted phases.
  1468. This filter have the ability to define an offset between left and right
  1469. channel. An offset of 0 means that both LFO shapes match each other.
  1470. The left and right channel are altered equally - a conventional tremolo.
  1471. An offset of 50% means that the shape of the right channel is exactly shifted
  1472. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1473. an autopanner. At 1 both curves match again. Every setting in between moves the
  1474. phase shift gapless between all stages and produces some "bypassing" sounds with
  1475. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1476. the 0.5) the faster the signal passes from the left to the right speaker.
  1477. The filter accepts the following options:
  1478. @table @option
  1479. @item level_in
  1480. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1481. @item level_out
  1482. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1483. @item mode
  1484. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1485. sawup or sawdown. Default is sine.
  1486. @item amount
  1487. Set modulation. Define how much of original signal is affected by the LFO.
  1488. @item offset_l
  1489. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1490. @item offset_r
  1491. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1492. @item width
  1493. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1494. @item timing
  1495. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1496. @item bpm
  1497. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1498. is set to bpm.
  1499. @item ms
  1500. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1501. is set to ms.
  1502. @item hz
  1503. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1504. if timing is set to hz.
  1505. @end table
  1506. @anchor{aresample}
  1507. @section aresample
  1508. Resample the input audio to the specified parameters, using the
  1509. libswresample library. If none are specified then the filter will
  1510. automatically convert between its input and output.
  1511. This filter is also able to stretch/squeeze the audio data to make it match
  1512. the timestamps or to inject silence / cut out audio to make it match the
  1513. timestamps, do a combination of both or do neither.
  1514. The filter accepts the syntax
  1515. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1516. expresses a sample rate and @var{resampler_options} is a list of
  1517. @var{key}=@var{value} pairs, separated by ":". See the
  1518. @ref{Resampler Options,,"Resampler Options" section in the
  1519. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1520. for the complete list of supported options.
  1521. @subsection Examples
  1522. @itemize
  1523. @item
  1524. Resample the input audio to 44100Hz:
  1525. @example
  1526. aresample=44100
  1527. @end example
  1528. @item
  1529. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1530. samples per second compensation:
  1531. @example
  1532. aresample=async=1000
  1533. @end example
  1534. @end itemize
  1535. @section areverse
  1536. Reverse an audio clip.
  1537. Warning: This filter requires memory to buffer the entire clip, so trimming
  1538. is suggested.
  1539. @subsection Examples
  1540. @itemize
  1541. @item
  1542. Take the first 5 seconds of a clip, and reverse it.
  1543. @example
  1544. atrim=end=5,areverse
  1545. @end example
  1546. @end itemize
  1547. @section asetnsamples
  1548. Set the number of samples per each output audio frame.
  1549. The last output packet may contain a different number of samples, as
  1550. the filter will flush all the remaining samples when the input audio
  1551. signals its end.
  1552. The filter accepts the following options:
  1553. @table @option
  1554. @item nb_out_samples, n
  1555. Set the number of frames per each output audio frame. The number is
  1556. intended as the number of samples @emph{per each channel}.
  1557. Default value is 1024.
  1558. @item pad, p
  1559. If set to 1, the filter will pad the last audio frame with zeroes, so
  1560. that the last frame will contain the same number of samples as the
  1561. previous ones. Default value is 1.
  1562. @end table
  1563. For example, to set the number of per-frame samples to 1234 and
  1564. disable padding for the last frame, use:
  1565. @example
  1566. asetnsamples=n=1234:p=0
  1567. @end example
  1568. @section asetrate
  1569. Set the sample rate without altering the PCM data.
  1570. This will result in a change of speed and pitch.
  1571. The filter accepts the following options:
  1572. @table @option
  1573. @item sample_rate, r
  1574. Set the output sample rate. Default is 44100 Hz.
  1575. @end table
  1576. @section ashowinfo
  1577. Show a line containing various information for each input audio frame.
  1578. The input audio is not modified.
  1579. The shown line contains a sequence of key/value pairs of the form
  1580. @var{key}:@var{value}.
  1581. The following values are shown in the output:
  1582. @table @option
  1583. @item n
  1584. The (sequential) number of the input frame, starting from 0.
  1585. @item pts
  1586. The presentation timestamp of the input frame, in time base units; the time base
  1587. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1588. @item pts_time
  1589. The presentation timestamp of the input frame in seconds.
  1590. @item pos
  1591. position of the frame in the input stream, -1 if this information in
  1592. unavailable and/or meaningless (for example in case of synthetic audio)
  1593. @item fmt
  1594. The sample format.
  1595. @item chlayout
  1596. The channel layout.
  1597. @item rate
  1598. The sample rate for the audio frame.
  1599. @item nb_samples
  1600. The number of samples (per channel) in the frame.
  1601. @item checksum
  1602. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1603. audio, the data is treated as if all the planes were concatenated.
  1604. @item plane_checksums
  1605. A list of Adler-32 checksums for each data plane.
  1606. @end table
  1607. @anchor{astats}
  1608. @section astats
  1609. Display time domain statistical information about the audio channels.
  1610. Statistics are calculated and displayed for each audio channel and,
  1611. where applicable, an overall figure is also given.
  1612. It accepts the following option:
  1613. @table @option
  1614. @item length
  1615. Short window length in seconds, used for peak and trough RMS measurement.
  1616. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1617. @item metadata
  1618. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1619. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1620. disabled.
  1621. Available keys for each channel are:
  1622. DC_offset
  1623. Min_level
  1624. Max_level
  1625. Min_difference
  1626. Max_difference
  1627. Mean_difference
  1628. RMS_difference
  1629. Peak_level
  1630. RMS_peak
  1631. RMS_trough
  1632. Crest_factor
  1633. Flat_factor
  1634. Peak_count
  1635. Bit_depth
  1636. Dynamic_range
  1637. Zero_crossings
  1638. Zero_crossings_rate
  1639. and for Overall:
  1640. DC_offset
  1641. Min_level
  1642. Max_level
  1643. Min_difference
  1644. Max_difference
  1645. Mean_difference
  1646. RMS_difference
  1647. Peak_level
  1648. RMS_level
  1649. RMS_peak
  1650. RMS_trough
  1651. Flat_factor
  1652. Peak_count
  1653. Bit_depth
  1654. Number_of_samples
  1655. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1656. this @code{lavfi.astats.Overall.Peak_count}.
  1657. For description what each key means read below.
  1658. @item reset
  1659. Set number of frame after which stats are going to be recalculated.
  1660. Default is disabled.
  1661. @item measure_perchannel
  1662. Select the entries which need to be measured per channel. The metadata keys can
  1663. be used as flags, default is @option{all} which measures everything.
  1664. @option{none} disables all per channel measurement.
  1665. @item measure_overall
  1666. Select the entries which need to be measured overall. The metadata keys can
  1667. be used as flags, default is @option{all} which measures everything.
  1668. @option{none} disables all overall measurement.
  1669. @end table
  1670. A description of each shown parameter follows:
  1671. @table @option
  1672. @item DC offset
  1673. Mean amplitude displacement from zero.
  1674. @item Min level
  1675. Minimal sample level.
  1676. @item Max level
  1677. Maximal sample level.
  1678. @item Min difference
  1679. Minimal difference between two consecutive samples.
  1680. @item Max difference
  1681. Maximal difference between two consecutive samples.
  1682. @item Mean difference
  1683. Mean difference between two consecutive samples.
  1684. The average of each difference between two consecutive samples.
  1685. @item RMS difference
  1686. Root Mean Square difference between two consecutive samples.
  1687. @item Peak level dB
  1688. @item RMS level dB
  1689. Standard peak and RMS level measured in dBFS.
  1690. @item RMS peak dB
  1691. @item RMS trough dB
  1692. Peak and trough values for RMS level measured over a short window.
  1693. @item Crest factor
  1694. Standard ratio of peak to RMS level (note: not in dB).
  1695. @item Flat factor
  1696. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1697. (i.e. either @var{Min level} or @var{Max level}).
  1698. @item Peak count
  1699. Number of occasions (not the number of samples) that the signal attained either
  1700. @var{Min level} or @var{Max level}.
  1701. @item Bit depth
  1702. Overall bit depth of audio. Number of bits used for each sample.
  1703. @item Dynamic range
  1704. Measured dynamic range of audio in dB.
  1705. @item Zero crossings
  1706. Number of points where the waveform crosses the zero level axis.
  1707. @item Zero crossings rate
  1708. Rate of Zero crossings and number of audio samples.
  1709. @end table
  1710. @section atempo
  1711. Adjust audio tempo.
  1712. The filter accepts exactly one parameter, the audio tempo. If not
  1713. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1714. be in the [0.5, 100.0] range.
  1715. Note that tempo greater than 2 will skip some samples rather than
  1716. blend them in. If for any reason this is a concern it is always
  1717. possible to daisy-chain several instances of atempo to achieve the
  1718. desired product tempo.
  1719. @subsection Examples
  1720. @itemize
  1721. @item
  1722. Slow down audio to 80% tempo:
  1723. @example
  1724. atempo=0.8
  1725. @end example
  1726. @item
  1727. To speed up audio to 300% tempo:
  1728. @example
  1729. atempo=3
  1730. @end example
  1731. @item
  1732. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  1733. @example
  1734. atempo=sqrt(3),atempo=sqrt(3)
  1735. @end example
  1736. @end itemize
  1737. @section atrim
  1738. Trim the input so that the output contains one continuous subpart of the input.
  1739. It accepts the following parameters:
  1740. @table @option
  1741. @item start
  1742. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1743. sample with the timestamp @var{start} will be the first sample in the output.
  1744. @item end
  1745. Specify time of the first audio sample that will be dropped, i.e. the
  1746. audio sample immediately preceding the one with the timestamp @var{end} will be
  1747. the last sample in the output.
  1748. @item start_pts
  1749. Same as @var{start}, except this option sets the start timestamp in samples
  1750. instead of seconds.
  1751. @item end_pts
  1752. Same as @var{end}, except this option sets the end timestamp in samples instead
  1753. of seconds.
  1754. @item duration
  1755. The maximum duration of the output in seconds.
  1756. @item start_sample
  1757. The number of the first sample that should be output.
  1758. @item end_sample
  1759. The number of the first sample that should be dropped.
  1760. @end table
  1761. @option{start}, @option{end}, and @option{duration} are expressed as time
  1762. duration specifications; see
  1763. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1764. Note that the first two sets of the start/end options and the @option{duration}
  1765. option look at the frame timestamp, while the _sample options simply count the
  1766. samples that pass through the filter. So start/end_pts and start/end_sample will
  1767. give different results when the timestamps are wrong, inexact or do not start at
  1768. zero. Also note that this filter does not modify the timestamps. If you wish
  1769. to have the output timestamps start at zero, insert the asetpts filter after the
  1770. atrim filter.
  1771. If multiple start or end options are set, this filter tries to be greedy and
  1772. keep all samples that match at least one of the specified constraints. To keep
  1773. only the part that matches all the constraints at once, chain multiple atrim
  1774. filters.
  1775. The defaults are such that all the input is kept. So it is possible to set e.g.
  1776. just the end values to keep everything before the specified time.
  1777. Examples:
  1778. @itemize
  1779. @item
  1780. Drop everything except the second minute of input:
  1781. @example
  1782. ffmpeg -i INPUT -af atrim=60:120
  1783. @end example
  1784. @item
  1785. Keep only the first 1000 samples:
  1786. @example
  1787. ffmpeg -i INPUT -af atrim=end_sample=1000
  1788. @end example
  1789. @end itemize
  1790. @section bandpass
  1791. Apply a two-pole Butterworth band-pass filter with central
  1792. frequency @var{frequency}, and (3dB-point) band-width width.
  1793. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1794. instead of the default: constant 0dB peak gain.
  1795. The filter roll off at 6dB per octave (20dB per decade).
  1796. The filter accepts the following options:
  1797. @table @option
  1798. @item frequency, f
  1799. Set the filter's central frequency. Default is @code{3000}.
  1800. @item csg
  1801. Constant skirt gain if set to 1. Defaults to 0.
  1802. @item width_type, t
  1803. Set method to specify band-width of filter.
  1804. @table @option
  1805. @item h
  1806. Hz
  1807. @item q
  1808. Q-Factor
  1809. @item o
  1810. octave
  1811. @item s
  1812. slope
  1813. @item k
  1814. kHz
  1815. @end table
  1816. @item width, w
  1817. Specify the band-width of a filter in width_type units.
  1818. @item channels, c
  1819. Specify which channels to filter, by default all available are filtered.
  1820. @end table
  1821. @subsection Commands
  1822. This filter supports the following commands:
  1823. @table @option
  1824. @item frequency, f
  1825. Change bandpass frequency.
  1826. Syntax for the command is : "@var{frequency}"
  1827. @item width_type, t
  1828. Change bandpass width_type.
  1829. Syntax for the command is : "@var{width_type}"
  1830. @item width, w
  1831. Change bandpass width.
  1832. Syntax for the command is : "@var{width}"
  1833. @end table
  1834. @section bandreject
  1835. Apply a two-pole Butterworth band-reject filter with central
  1836. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1837. The filter roll off at 6dB per octave (20dB per decade).
  1838. The filter accepts the following options:
  1839. @table @option
  1840. @item frequency, f
  1841. Set the filter's central frequency. Default is @code{3000}.
  1842. @item width_type, t
  1843. Set method to specify band-width of filter.
  1844. @table @option
  1845. @item h
  1846. Hz
  1847. @item q
  1848. Q-Factor
  1849. @item o
  1850. octave
  1851. @item s
  1852. slope
  1853. @item k
  1854. kHz
  1855. @end table
  1856. @item width, w
  1857. Specify the band-width of a filter in width_type units.
  1858. @item channels, c
  1859. Specify which channels to filter, by default all available are filtered.
  1860. @end table
  1861. @subsection Commands
  1862. This filter supports the following commands:
  1863. @table @option
  1864. @item frequency, f
  1865. Change bandreject frequency.
  1866. Syntax for the command is : "@var{frequency}"
  1867. @item width_type, t
  1868. Change bandreject width_type.
  1869. Syntax for the command is : "@var{width_type}"
  1870. @item width, w
  1871. Change bandreject width.
  1872. Syntax for the command is : "@var{width}"
  1873. @end table
  1874. @section bass, lowshelf
  1875. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1876. shelving filter with a response similar to that of a standard
  1877. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1878. The filter accepts the following options:
  1879. @table @option
  1880. @item gain, g
  1881. Give the gain at 0 Hz. Its useful range is about -20
  1882. (for a large cut) to +20 (for a large boost).
  1883. Beware of clipping when using a positive gain.
  1884. @item frequency, f
  1885. Set the filter's central frequency and so can be used
  1886. to extend or reduce the frequency range to be boosted or cut.
  1887. The default value is @code{100} Hz.
  1888. @item width_type, t
  1889. Set method to specify band-width of filter.
  1890. @table @option
  1891. @item h
  1892. Hz
  1893. @item q
  1894. Q-Factor
  1895. @item o
  1896. octave
  1897. @item s
  1898. slope
  1899. @item k
  1900. kHz
  1901. @end table
  1902. @item width, w
  1903. Determine how steep is the filter's shelf transition.
  1904. @item channels, c
  1905. Specify which channels to filter, by default all available are filtered.
  1906. @end table
  1907. @subsection Commands
  1908. This filter supports the following commands:
  1909. @table @option
  1910. @item frequency, f
  1911. Change bass frequency.
  1912. Syntax for the command is : "@var{frequency}"
  1913. @item width_type, t
  1914. Change bass width_type.
  1915. Syntax for the command is : "@var{width_type}"
  1916. @item width, w
  1917. Change bass width.
  1918. Syntax for the command is : "@var{width}"
  1919. @item gain, g
  1920. Change bass gain.
  1921. Syntax for the command is : "@var{gain}"
  1922. @end table
  1923. @section biquad
  1924. Apply a biquad IIR filter with the given coefficients.
  1925. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1926. are the numerator and denominator coefficients respectively.
  1927. and @var{channels}, @var{c} specify which channels to filter, by default all
  1928. available are filtered.
  1929. @subsection Commands
  1930. This filter supports the following commands:
  1931. @table @option
  1932. @item a0
  1933. @item a1
  1934. @item a2
  1935. @item b0
  1936. @item b1
  1937. @item b2
  1938. Change biquad parameter.
  1939. Syntax for the command is : "@var{value}"
  1940. @end table
  1941. @section bs2b
  1942. Bauer stereo to binaural transformation, which improves headphone listening of
  1943. stereo audio records.
  1944. To enable compilation of this filter you need to configure FFmpeg with
  1945. @code{--enable-libbs2b}.
  1946. It accepts the following parameters:
  1947. @table @option
  1948. @item profile
  1949. Pre-defined crossfeed level.
  1950. @table @option
  1951. @item default
  1952. Default level (fcut=700, feed=50).
  1953. @item cmoy
  1954. Chu Moy circuit (fcut=700, feed=60).
  1955. @item jmeier
  1956. Jan Meier circuit (fcut=650, feed=95).
  1957. @end table
  1958. @item fcut
  1959. Cut frequency (in Hz).
  1960. @item feed
  1961. Feed level (in Hz).
  1962. @end table
  1963. @section channelmap
  1964. Remap input channels to new locations.
  1965. It accepts the following parameters:
  1966. @table @option
  1967. @item map
  1968. Map channels from input to output. The argument is a '|'-separated list of
  1969. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1970. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1971. channel (e.g. FL for front left) or its index in the input channel layout.
  1972. @var{out_channel} is the name of the output channel or its index in the output
  1973. channel layout. If @var{out_channel} is not given then it is implicitly an
  1974. index, starting with zero and increasing by one for each mapping.
  1975. @item channel_layout
  1976. The channel layout of the output stream.
  1977. @end table
  1978. If no mapping is present, the filter will implicitly map input channels to
  1979. output channels, preserving indices.
  1980. @subsection Examples
  1981. @itemize
  1982. @item
  1983. For example, assuming a 5.1+downmix input MOV file,
  1984. @example
  1985. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1986. @end example
  1987. will create an output WAV file tagged as stereo from the downmix channels of
  1988. the input.
  1989. @item
  1990. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1991. @example
  1992. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1993. @end example
  1994. @end itemize
  1995. @section channelsplit
  1996. Split each channel from an input audio stream into a separate output stream.
  1997. It accepts the following parameters:
  1998. @table @option
  1999. @item channel_layout
  2000. The channel layout of the input stream. The default is "stereo".
  2001. @item channels
  2002. A channel layout describing the channels to be extracted as separate output streams
  2003. or "all" to extract each input channel as a separate stream. The default is "all".
  2004. Choosing channels not present in channel layout in the input will result in an error.
  2005. @end table
  2006. @subsection Examples
  2007. @itemize
  2008. @item
  2009. For example, assuming a stereo input MP3 file,
  2010. @example
  2011. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  2012. @end example
  2013. will create an output Matroska file with two audio streams, one containing only
  2014. the left channel and the other the right channel.
  2015. @item
  2016. Split a 5.1 WAV file into per-channel files:
  2017. @example
  2018. ffmpeg -i in.wav -filter_complex
  2019. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  2020. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  2021. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  2022. side_right.wav
  2023. @end example
  2024. @item
  2025. Extract only LFE from a 5.1 WAV file:
  2026. @example
  2027. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  2028. -map '[LFE]' lfe.wav
  2029. @end example
  2030. @end itemize
  2031. @section chorus
  2032. Add a chorus effect to the audio.
  2033. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  2034. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  2035. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  2036. The modulation depth defines the range the modulated delay is played before or after
  2037. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  2038. sound tuned around the original one, like in a chorus where some vocals are slightly
  2039. off key.
  2040. It accepts the following parameters:
  2041. @table @option
  2042. @item in_gain
  2043. Set input gain. Default is 0.4.
  2044. @item out_gain
  2045. Set output gain. Default is 0.4.
  2046. @item delays
  2047. Set delays. A typical delay is around 40ms to 60ms.
  2048. @item decays
  2049. Set decays.
  2050. @item speeds
  2051. Set speeds.
  2052. @item depths
  2053. Set depths.
  2054. @end table
  2055. @subsection Examples
  2056. @itemize
  2057. @item
  2058. A single delay:
  2059. @example
  2060. chorus=0.7:0.9:55:0.4:0.25:2
  2061. @end example
  2062. @item
  2063. Two delays:
  2064. @example
  2065. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  2066. @end example
  2067. @item
  2068. Fuller sounding chorus with three delays:
  2069. @example
  2070. 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
  2071. @end example
  2072. @end itemize
  2073. @section compand
  2074. Compress or expand the audio's dynamic range.
  2075. It accepts the following parameters:
  2076. @table @option
  2077. @item attacks
  2078. @item decays
  2079. A list of times in seconds for each channel over which the instantaneous level
  2080. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2081. increase of volume and @var{decays} refers to decrease of volume. For most
  2082. situations, the attack time (response to the audio getting louder) should be
  2083. shorter than the decay time, because the human ear is more sensitive to sudden
  2084. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2085. a typical value for decay is 0.8 seconds.
  2086. If specified number of attacks & decays is lower than number of channels, the last
  2087. set attack/decay will be used for all remaining channels.
  2088. @item points
  2089. A list of points for the transfer function, specified in dB relative to the
  2090. maximum possible signal amplitude. Each key points list must be defined using
  2091. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2092. @code{x0/y0 x1/y1 x2/y2 ....}
  2093. The input values must be in strictly increasing order but the transfer function
  2094. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2095. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2096. function are @code{-70/-70|-60/-20|1/0}.
  2097. @item soft-knee
  2098. Set the curve radius in dB for all joints. It defaults to 0.01.
  2099. @item gain
  2100. Set the additional gain in dB to be applied at all points on the transfer
  2101. function. This allows for easy adjustment of the overall gain.
  2102. It defaults to 0.
  2103. @item volume
  2104. Set an initial volume, in dB, to be assumed for each channel when filtering
  2105. starts. This permits the user to supply a nominal level initially, so that, for
  2106. example, a very large gain is not applied to initial signal levels before the
  2107. companding has begun to operate. A typical value for audio which is initially
  2108. quiet is -90 dB. It defaults to 0.
  2109. @item delay
  2110. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2111. delayed before being fed to the volume adjuster. Specifying a delay
  2112. approximately equal to the attack/decay times allows the filter to effectively
  2113. operate in predictive rather than reactive mode. It defaults to 0.
  2114. @end table
  2115. @subsection Examples
  2116. @itemize
  2117. @item
  2118. Make music with both quiet and loud passages suitable for listening to in a
  2119. noisy environment:
  2120. @example
  2121. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2122. @end example
  2123. Another example for audio with whisper and explosion parts:
  2124. @example
  2125. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2126. @end example
  2127. @item
  2128. A noise gate for when the noise is at a lower level than the signal:
  2129. @example
  2130. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2131. @end example
  2132. @item
  2133. Here is another noise gate, this time for when the noise is at a higher level
  2134. than the signal (making it, in some ways, similar to squelch):
  2135. @example
  2136. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2137. @end example
  2138. @item
  2139. 2:1 compression starting at -6dB:
  2140. @example
  2141. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2142. @end example
  2143. @item
  2144. 2:1 compression starting at -9dB:
  2145. @example
  2146. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2147. @end example
  2148. @item
  2149. 2:1 compression starting at -12dB:
  2150. @example
  2151. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2152. @end example
  2153. @item
  2154. 2:1 compression starting at -18dB:
  2155. @example
  2156. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2157. @end example
  2158. @item
  2159. 3:1 compression starting at -15dB:
  2160. @example
  2161. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2162. @end example
  2163. @item
  2164. Compressor/Gate:
  2165. @example
  2166. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2167. @end example
  2168. @item
  2169. Expander:
  2170. @example
  2171. 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
  2172. @end example
  2173. @item
  2174. Hard limiter at -6dB:
  2175. @example
  2176. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2177. @end example
  2178. @item
  2179. Hard limiter at -12dB:
  2180. @example
  2181. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2182. @end example
  2183. @item
  2184. Hard noise gate at -35 dB:
  2185. @example
  2186. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2187. @end example
  2188. @item
  2189. Soft limiter:
  2190. @example
  2191. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2192. @end example
  2193. @end itemize
  2194. @section compensationdelay
  2195. Compensation Delay Line is a metric based delay to compensate differing
  2196. positions of microphones or speakers.
  2197. For example, you have recorded guitar with two microphones placed in
  2198. different location. Because the front of sound wave has fixed speed in
  2199. normal conditions, the phasing of microphones can vary and depends on
  2200. their location and interposition. The best sound mix can be achieved when
  2201. these microphones are in phase (synchronized). Note that distance of
  2202. ~30 cm between microphones makes one microphone to capture signal in
  2203. antiphase to another microphone. That makes the final mix sounding moody.
  2204. This filter helps to solve phasing problems by adding different delays
  2205. to each microphone track and make them synchronized.
  2206. The best result can be reached when you take one track as base and
  2207. synchronize other tracks one by one with it.
  2208. Remember that synchronization/delay tolerance depends on sample rate, too.
  2209. Higher sample rates will give more tolerance.
  2210. It accepts the following parameters:
  2211. @table @option
  2212. @item mm
  2213. Set millimeters distance. This is compensation distance for fine tuning.
  2214. Default is 0.
  2215. @item cm
  2216. Set cm distance. This is compensation distance for tightening distance setup.
  2217. Default is 0.
  2218. @item m
  2219. Set meters distance. This is compensation distance for hard distance setup.
  2220. Default is 0.
  2221. @item dry
  2222. Set dry amount. Amount of unprocessed (dry) signal.
  2223. Default is 0.
  2224. @item wet
  2225. Set wet amount. Amount of processed (wet) signal.
  2226. Default is 1.
  2227. @item temp
  2228. Set temperature degree in Celsius. This is the temperature of the environment.
  2229. Default is 20.
  2230. @end table
  2231. @section crossfeed
  2232. Apply headphone crossfeed filter.
  2233. Crossfeed is the process of blending the left and right channels of stereo
  2234. audio recording.
  2235. It is mainly used to reduce extreme stereo separation of low frequencies.
  2236. The intent is to produce more speaker like sound to the listener.
  2237. The filter accepts the following options:
  2238. @table @option
  2239. @item strength
  2240. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2241. This sets gain of low shelf filter for side part of stereo image.
  2242. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2243. @item range
  2244. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2245. This sets cut off frequency of low shelf filter. Default is cut off near
  2246. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2247. @item level_in
  2248. Set input gain. Default is 0.9.
  2249. @item level_out
  2250. Set output gain. Default is 1.
  2251. @end table
  2252. @section crystalizer
  2253. Simple algorithm to expand audio dynamic range.
  2254. The filter accepts the following options:
  2255. @table @option
  2256. @item i
  2257. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2258. (unchanged sound) to 10.0 (maximum effect).
  2259. @item c
  2260. Enable clipping. By default is enabled.
  2261. @end table
  2262. @section dcshift
  2263. Apply a DC shift to the audio.
  2264. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2265. in the recording chain) from the audio. The effect of a DC offset is reduced
  2266. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2267. a signal has a DC offset.
  2268. @table @option
  2269. @item shift
  2270. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2271. the audio.
  2272. @item limitergain
  2273. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2274. used to prevent clipping.
  2275. @end table
  2276. @section drmeter
  2277. Measure audio dynamic range.
  2278. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2279. is found in transition material. And anything less that 8 have very poor dynamics
  2280. and is very compressed.
  2281. The filter accepts the following options:
  2282. @table @option
  2283. @item length
  2284. Set window length in seconds used to split audio into segments of equal length.
  2285. Default is 3 seconds.
  2286. @end table
  2287. @section dynaudnorm
  2288. Dynamic Audio Normalizer.
  2289. This filter applies a certain amount of gain to the input audio in order
  2290. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2291. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2292. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2293. This allows for applying extra gain to the "quiet" sections of the audio
  2294. while avoiding distortions or clipping the "loud" sections. In other words:
  2295. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2296. sections, in the sense that the volume of each section is brought to the
  2297. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2298. this goal *without* applying "dynamic range compressing". It will retain 100%
  2299. of the dynamic range *within* each section of the audio file.
  2300. @table @option
  2301. @item f
  2302. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2303. Default is 500 milliseconds.
  2304. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2305. referred to as frames. This is required, because a peak magnitude has no
  2306. meaning for just a single sample value. Instead, we need to determine the
  2307. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2308. normalizer would simply use the peak magnitude of the complete file, the
  2309. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2310. frame. The length of a frame is specified in milliseconds. By default, the
  2311. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2312. been found to give good results with most files.
  2313. Note that the exact frame length, in number of samples, will be determined
  2314. automatically, based on the sampling rate of the individual input audio file.
  2315. @item g
  2316. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2317. number. Default is 31.
  2318. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2319. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2320. is specified in frames, centered around the current frame. For the sake of
  2321. simplicity, this must be an odd number. Consequently, the default value of 31
  2322. takes into account the current frame, as well as the 15 preceding frames and
  2323. the 15 subsequent frames. Using a larger window results in a stronger
  2324. smoothing effect and thus in less gain variation, i.e. slower gain
  2325. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2326. effect and thus in more gain variation, i.e. faster gain adaptation.
  2327. In other words, the more you increase this value, the more the Dynamic Audio
  2328. Normalizer will behave like a "traditional" normalization filter. On the
  2329. contrary, the more you decrease this value, the more the Dynamic Audio
  2330. Normalizer will behave like a dynamic range compressor.
  2331. @item p
  2332. Set the target peak value. This specifies the highest permissible magnitude
  2333. level for the normalized audio input. This filter will try to approach the
  2334. target peak magnitude as closely as possible, but at the same time it also
  2335. makes sure that the normalized signal will never exceed the peak magnitude.
  2336. A frame's maximum local gain factor is imposed directly by the target peak
  2337. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2338. It is not recommended to go above this value.
  2339. @item m
  2340. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2341. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2342. factor for each input frame, i.e. the maximum gain factor that does not
  2343. result in clipping or distortion. The maximum gain factor is determined by
  2344. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2345. additionally bounds the frame's maximum gain factor by a predetermined
  2346. (global) maximum gain factor. This is done in order to avoid excessive gain
  2347. factors in "silent" or almost silent frames. By default, the maximum gain
  2348. factor is 10.0, For most inputs the default value should be sufficient and
  2349. it usually is not recommended to increase this value. Though, for input
  2350. with an extremely low overall volume level, it may be necessary to allow even
  2351. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2352. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2353. Instead, a "sigmoid" threshold function will be applied. This way, the
  2354. gain factors will smoothly approach the threshold value, but never exceed that
  2355. value.
  2356. @item r
  2357. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2358. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2359. This means that the maximum local gain factor for each frame is defined
  2360. (only) by the frame's highest magnitude sample. This way, the samples can
  2361. be amplified as much as possible without exceeding the maximum signal
  2362. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2363. Normalizer can also take into account the frame's root mean square,
  2364. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2365. determine the power of a time-varying signal. It is therefore considered
  2366. that the RMS is a better approximation of the "perceived loudness" than
  2367. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2368. frames to a constant RMS value, a uniform "perceived loudness" can be
  2369. established. If a target RMS value has been specified, a frame's local gain
  2370. factor is defined as the factor that would result in exactly that RMS value.
  2371. Note, however, that the maximum local gain factor is still restricted by the
  2372. frame's highest magnitude sample, in order to prevent clipping.
  2373. @item n
  2374. Enable channels coupling. By default is enabled.
  2375. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2376. amount. This means the same gain factor will be applied to all channels, i.e.
  2377. the maximum possible gain factor is determined by the "loudest" channel.
  2378. However, in some recordings, it may happen that the volume of the different
  2379. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2380. In this case, this option can be used to disable the channel coupling. This way,
  2381. the gain factor will be determined independently for each channel, depending
  2382. only on the individual channel's highest magnitude sample. This allows for
  2383. harmonizing the volume of the different channels.
  2384. @item c
  2385. Enable DC bias correction. By default is disabled.
  2386. An audio signal (in the time domain) is a sequence of sample values.
  2387. In the Dynamic Audio Normalizer these sample values are represented in the
  2388. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2389. audio signal, or "waveform", should be centered around the zero point.
  2390. That means if we calculate the mean value of all samples in a file, or in a
  2391. single frame, then the result should be 0.0 or at least very close to that
  2392. value. If, however, there is a significant deviation of the mean value from
  2393. 0.0, in either positive or negative direction, this is referred to as a
  2394. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2395. Audio Normalizer provides optional DC bias correction.
  2396. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2397. the mean value, or "DC correction" offset, of each input frame and subtract
  2398. that value from all of the frame's sample values which ensures those samples
  2399. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2400. boundaries, the DC correction offset values will be interpolated smoothly
  2401. between neighbouring frames.
  2402. @item b
  2403. Enable alternative boundary mode. By default is disabled.
  2404. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2405. around each frame. This includes the preceding frames as well as the
  2406. subsequent frames. However, for the "boundary" frames, located at the very
  2407. beginning and at the very end of the audio file, not all neighbouring
  2408. frames are available. In particular, for the first few frames in the audio
  2409. file, the preceding frames are not known. And, similarly, for the last few
  2410. frames in the audio file, the subsequent frames are not known. Thus, the
  2411. question arises which gain factors should be assumed for the missing frames
  2412. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2413. to deal with this situation. The default boundary mode assumes a gain factor
  2414. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2415. "fade out" at the beginning and at the end of the input, respectively.
  2416. @item s
  2417. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2418. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2419. compression. This means that signal peaks will not be pruned and thus the
  2420. full dynamic range will be retained within each local neighbourhood. However,
  2421. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2422. normalization algorithm with a more "traditional" compression.
  2423. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2424. (thresholding) function. If (and only if) the compression feature is enabled,
  2425. all input frames will be processed by a soft knee thresholding function prior
  2426. to the actual normalization process. Put simply, the thresholding function is
  2427. going to prune all samples whose magnitude exceeds a certain threshold value.
  2428. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2429. value. Instead, the threshold value will be adjusted for each individual
  2430. frame.
  2431. In general, smaller parameters result in stronger compression, and vice versa.
  2432. Values below 3.0 are not recommended, because audible distortion may appear.
  2433. @end table
  2434. @section earwax
  2435. Make audio easier to listen to on headphones.
  2436. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2437. so that when listened to on headphones the stereo image is moved from
  2438. inside your head (standard for headphones) to outside and in front of
  2439. the listener (standard for speakers).
  2440. Ported from SoX.
  2441. @section equalizer
  2442. Apply a two-pole peaking equalisation (EQ) filter. With this
  2443. filter, the signal-level at and around a selected frequency can
  2444. be increased or decreased, whilst (unlike bandpass and bandreject
  2445. filters) that at all other frequencies is unchanged.
  2446. In order to produce complex equalisation curves, this filter can
  2447. be given several times, each with a different central frequency.
  2448. The filter accepts the following options:
  2449. @table @option
  2450. @item frequency, f
  2451. Set the filter's central frequency in Hz.
  2452. @item width_type, t
  2453. Set method to specify band-width of filter.
  2454. @table @option
  2455. @item h
  2456. Hz
  2457. @item q
  2458. Q-Factor
  2459. @item o
  2460. octave
  2461. @item s
  2462. slope
  2463. @item k
  2464. kHz
  2465. @end table
  2466. @item width, w
  2467. Specify the band-width of a filter in width_type units.
  2468. @item gain, g
  2469. Set the required gain or attenuation in dB.
  2470. Beware of clipping when using a positive gain.
  2471. @item channels, c
  2472. Specify which channels to filter, by default all available are filtered.
  2473. @end table
  2474. @subsection Examples
  2475. @itemize
  2476. @item
  2477. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2478. @example
  2479. equalizer=f=1000:t=h:width=200:g=-10
  2480. @end example
  2481. @item
  2482. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2483. @example
  2484. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2485. @end example
  2486. @end itemize
  2487. @subsection Commands
  2488. This filter supports the following commands:
  2489. @table @option
  2490. @item frequency, f
  2491. Change equalizer frequency.
  2492. Syntax for the command is : "@var{frequency}"
  2493. @item width_type, t
  2494. Change equalizer width_type.
  2495. Syntax for the command is : "@var{width_type}"
  2496. @item width, w
  2497. Change equalizer width.
  2498. Syntax for the command is : "@var{width}"
  2499. @item gain, g
  2500. Change equalizer gain.
  2501. Syntax for the command is : "@var{gain}"
  2502. @end table
  2503. @section extrastereo
  2504. Linearly increases the difference between left and right channels which
  2505. adds some sort of "live" effect to playback.
  2506. The filter accepts the following options:
  2507. @table @option
  2508. @item m
  2509. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2510. (average of both channels), with 1.0 sound will be unchanged, with
  2511. -1.0 left and right channels will be swapped.
  2512. @item c
  2513. Enable clipping. By default is enabled.
  2514. @end table
  2515. @section firequalizer
  2516. Apply FIR Equalization using arbitrary frequency response.
  2517. The filter accepts the following option:
  2518. @table @option
  2519. @item gain
  2520. Set gain curve equation (in dB). The expression can contain variables:
  2521. @table @option
  2522. @item f
  2523. the evaluated frequency
  2524. @item sr
  2525. sample rate
  2526. @item ch
  2527. channel number, set to 0 when multichannels evaluation is disabled
  2528. @item chid
  2529. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2530. multichannels evaluation is disabled
  2531. @item chs
  2532. number of channels
  2533. @item chlayout
  2534. channel_layout, see libavutil/channel_layout.h
  2535. @end table
  2536. and functions:
  2537. @table @option
  2538. @item gain_interpolate(f)
  2539. interpolate gain on frequency f based on gain_entry
  2540. @item cubic_interpolate(f)
  2541. same as gain_interpolate, but smoother
  2542. @end table
  2543. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2544. @item gain_entry
  2545. Set gain entry for gain_interpolate function. The expression can
  2546. contain functions:
  2547. @table @option
  2548. @item entry(f, g)
  2549. store gain entry at frequency f with value g
  2550. @end table
  2551. This option is also available as command.
  2552. @item delay
  2553. Set filter delay in seconds. Higher value means more accurate.
  2554. Default is @code{0.01}.
  2555. @item accuracy
  2556. Set filter accuracy in Hz. Lower value means more accurate.
  2557. Default is @code{5}.
  2558. @item wfunc
  2559. Set window function. Acceptable values are:
  2560. @table @option
  2561. @item rectangular
  2562. rectangular window, useful when gain curve is already smooth
  2563. @item hann
  2564. hann window (default)
  2565. @item hamming
  2566. hamming window
  2567. @item blackman
  2568. blackman window
  2569. @item nuttall3
  2570. 3-terms continuous 1st derivative nuttall window
  2571. @item mnuttall3
  2572. minimum 3-terms discontinuous nuttall window
  2573. @item nuttall
  2574. 4-terms continuous 1st derivative nuttall window
  2575. @item bnuttall
  2576. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2577. @item bharris
  2578. blackman-harris window
  2579. @item tukey
  2580. tukey window
  2581. @end table
  2582. @item fixed
  2583. If enabled, use fixed number of audio samples. This improves speed when
  2584. filtering with large delay. Default is disabled.
  2585. @item multi
  2586. Enable multichannels evaluation on gain. Default is disabled.
  2587. @item zero_phase
  2588. Enable zero phase mode by subtracting timestamp to compensate delay.
  2589. Default is disabled.
  2590. @item scale
  2591. Set scale used by gain. Acceptable values are:
  2592. @table @option
  2593. @item linlin
  2594. linear frequency, linear gain
  2595. @item linlog
  2596. linear frequency, logarithmic (in dB) gain (default)
  2597. @item loglin
  2598. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2599. @item loglog
  2600. logarithmic frequency, logarithmic gain
  2601. @end table
  2602. @item dumpfile
  2603. Set file for dumping, suitable for gnuplot.
  2604. @item dumpscale
  2605. Set scale for dumpfile. Acceptable values are same with scale option.
  2606. Default is linlog.
  2607. @item fft2
  2608. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2609. Default is disabled.
  2610. @item min_phase
  2611. Enable minimum phase impulse response. Default is disabled.
  2612. @end table
  2613. @subsection Examples
  2614. @itemize
  2615. @item
  2616. lowpass at 1000 Hz:
  2617. @example
  2618. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2619. @end example
  2620. @item
  2621. lowpass at 1000 Hz with gain_entry:
  2622. @example
  2623. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2624. @end example
  2625. @item
  2626. custom equalization:
  2627. @example
  2628. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2629. @end example
  2630. @item
  2631. higher delay with zero phase to compensate delay:
  2632. @example
  2633. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2634. @end example
  2635. @item
  2636. lowpass on left channel, highpass on right channel:
  2637. @example
  2638. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2639. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2640. @end example
  2641. @end itemize
  2642. @section flanger
  2643. Apply a flanging effect to the audio.
  2644. The filter accepts the following options:
  2645. @table @option
  2646. @item delay
  2647. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2648. @item depth
  2649. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2650. @item regen
  2651. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2652. Default value is 0.
  2653. @item width
  2654. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2655. Default value is 71.
  2656. @item speed
  2657. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2658. @item shape
  2659. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2660. Default value is @var{sinusoidal}.
  2661. @item phase
  2662. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2663. Default value is 25.
  2664. @item interp
  2665. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2666. Default is @var{linear}.
  2667. @end table
  2668. @section haas
  2669. Apply Haas effect to audio.
  2670. Note that this makes most sense to apply on mono signals.
  2671. With this filter applied to mono signals it give some directionality and
  2672. stretches its stereo image.
  2673. The filter accepts the following options:
  2674. @table @option
  2675. @item level_in
  2676. Set input level. By default is @var{1}, or 0dB
  2677. @item level_out
  2678. Set output level. By default is @var{1}, or 0dB.
  2679. @item side_gain
  2680. Set gain applied to side part of signal. By default is @var{1}.
  2681. @item middle_source
  2682. Set kind of middle source. Can be one of the following:
  2683. @table @samp
  2684. @item left
  2685. Pick left channel.
  2686. @item right
  2687. Pick right channel.
  2688. @item mid
  2689. Pick middle part signal of stereo image.
  2690. @item side
  2691. Pick side part signal of stereo image.
  2692. @end table
  2693. @item middle_phase
  2694. Change middle phase. By default is disabled.
  2695. @item left_delay
  2696. Set left channel delay. By default is @var{2.05} milliseconds.
  2697. @item left_balance
  2698. Set left channel balance. By default is @var{-1}.
  2699. @item left_gain
  2700. Set left channel gain. By default is @var{1}.
  2701. @item left_phase
  2702. Change left phase. By default is disabled.
  2703. @item right_delay
  2704. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2705. @item right_balance
  2706. Set right channel balance. By default is @var{1}.
  2707. @item right_gain
  2708. Set right channel gain. By default is @var{1}.
  2709. @item right_phase
  2710. Change right phase. By default is enabled.
  2711. @end table
  2712. @section hdcd
  2713. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2714. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2715. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2716. of HDCD, and detects the Transient Filter flag.
  2717. @example
  2718. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2719. @end example
  2720. When using the filter with wav, note the default encoding for wav is 16-bit,
  2721. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2722. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2723. @example
  2724. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2725. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2726. @end example
  2727. The filter accepts the following options:
  2728. @table @option
  2729. @item disable_autoconvert
  2730. Disable any automatic format conversion or resampling in the filter graph.
  2731. @item process_stereo
  2732. Process the stereo channels together. If target_gain does not match between
  2733. channels, consider it invalid and use the last valid target_gain.
  2734. @item cdt_ms
  2735. Set the code detect timer period in ms.
  2736. @item force_pe
  2737. Always extend peaks above -3dBFS even if PE isn't signaled.
  2738. @item analyze_mode
  2739. Replace audio with a solid tone and adjust the amplitude to signal some
  2740. specific aspect of the decoding process. The output file can be loaded in
  2741. an audio editor alongside the original to aid analysis.
  2742. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2743. Modes are:
  2744. @table @samp
  2745. @item 0, off
  2746. Disabled
  2747. @item 1, lle
  2748. Gain adjustment level at each sample
  2749. @item 2, pe
  2750. Samples where peak extend occurs
  2751. @item 3, cdt
  2752. Samples where the code detect timer is active
  2753. @item 4, tgm
  2754. Samples where the target gain does not match between channels
  2755. @end table
  2756. @end table
  2757. @section headphone
  2758. Apply head-related transfer functions (HRTFs) to create virtual
  2759. loudspeakers around the user for binaural listening via headphones.
  2760. The HRIRs are provided via additional streams, for each channel
  2761. one stereo input stream is needed.
  2762. The filter accepts the following options:
  2763. @table @option
  2764. @item map
  2765. Set mapping of input streams for convolution.
  2766. The argument is a '|'-separated list of channel names in order as they
  2767. are given as additional stream inputs for filter.
  2768. This also specify number of input streams. Number of input streams
  2769. must be not less than number of channels in first stream plus one.
  2770. @item gain
  2771. Set gain applied to audio. Value is in dB. Default is 0.
  2772. @item type
  2773. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2774. processing audio in time domain which is slow.
  2775. @var{freq} is processing audio in frequency domain which is fast.
  2776. Default is @var{freq}.
  2777. @item lfe
  2778. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2779. @item size
  2780. Set size of frame in number of samples which will be processed at once.
  2781. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  2782. @item hrir
  2783. Set format of hrir stream.
  2784. Default value is @var{stereo}. Alternative value is @var{multich}.
  2785. If value is set to @var{stereo}, number of additional streams should
  2786. be greater or equal to number of input channels in first input stream.
  2787. Also each additional stream should have stereo number of channels.
  2788. If value is set to @var{multich}, number of additional streams should
  2789. be exactly one. Also number of input channels of additional stream
  2790. should be equal or greater than twice number of channels of first input
  2791. stream.
  2792. @end table
  2793. @subsection Examples
  2794. @itemize
  2795. @item
  2796. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2797. each amovie filter use stereo file with IR coefficients as input.
  2798. The files give coefficients for each position of virtual loudspeaker:
  2799. @example
  2800. ffmpeg -i input.wav
  2801. -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"
  2802. output.wav
  2803. @end example
  2804. @item
  2805. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2806. but now in @var{multich} @var{hrir} format.
  2807. @example
  2808. 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"
  2809. output.wav
  2810. @end example
  2811. @end itemize
  2812. @section highpass
  2813. Apply a high-pass filter with 3dB point frequency.
  2814. The filter can be either single-pole, or double-pole (the default).
  2815. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2816. The filter accepts the following options:
  2817. @table @option
  2818. @item frequency, f
  2819. Set frequency in Hz. Default is 3000.
  2820. @item poles, p
  2821. Set number of poles. Default is 2.
  2822. @item width_type, t
  2823. Set method to specify band-width of filter.
  2824. @table @option
  2825. @item h
  2826. Hz
  2827. @item q
  2828. Q-Factor
  2829. @item o
  2830. octave
  2831. @item s
  2832. slope
  2833. @item k
  2834. kHz
  2835. @end table
  2836. @item width, w
  2837. Specify the band-width of a filter in width_type units.
  2838. Applies only to double-pole filter.
  2839. The default is 0.707q and gives a Butterworth response.
  2840. @item channels, c
  2841. Specify which channels to filter, by default all available are filtered.
  2842. @end table
  2843. @subsection Commands
  2844. This filter supports the following commands:
  2845. @table @option
  2846. @item frequency, f
  2847. Change highpass frequency.
  2848. Syntax for the command is : "@var{frequency}"
  2849. @item width_type, t
  2850. Change highpass width_type.
  2851. Syntax for the command is : "@var{width_type}"
  2852. @item width, w
  2853. Change highpass width.
  2854. Syntax for the command is : "@var{width}"
  2855. @end table
  2856. @section join
  2857. Join multiple input streams into one multi-channel stream.
  2858. It accepts the following parameters:
  2859. @table @option
  2860. @item inputs
  2861. The number of input streams. It defaults to 2.
  2862. @item channel_layout
  2863. The desired output channel layout. It defaults to stereo.
  2864. @item map
  2865. Map channels from inputs to output. The argument is a '|'-separated list of
  2866. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2867. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2868. can be either the name of the input channel (e.g. FL for front left) or its
  2869. index in the specified input stream. @var{out_channel} is the name of the output
  2870. channel.
  2871. @end table
  2872. The filter will attempt to guess the mappings when they are not specified
  2873. explicitly. It does so by first trying to find an unused matching input channel
  2874. and if that fails it picks the first unused input channel.
  2875. Join 3 inputs (with properly set channel layouts):
  2876. @example
  2877. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2878. @end example
  2879. Build a 5.1 output from 6 single-channel streams:
  2880. @example
  2881. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2882. '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'
  2883. out
  2884. @end example
  2885. @section ladspa
  2886. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2887. To enable compilation of this filter you need to configure FFmpeg with
  2888. @code{--enable-ladspa}.
  2889. @table @option
  2890. @item file, f
  2891. Specifies the name of LADSPA plugin library to load. If the environment
  2892. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2893. each one of the directories specified by the colon separated list in
  2894. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2895. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2896. @file{/usr/lib/ladspa/}.
  2897. @item plugin, p
  2898. Specifies the plugin within the library. Some libraries contain only
  2899. one plugin, but others contain many of them. If this is not set filter
  2900. will list all available plugins within the specified library.
  2901. @item controls, c
  2902. Set the '|' separated list of controls which are zero or more floating point
  2903. values that determine the behavior of the loaded plugin (for example delay,
  2904. threshold or gain).
  2905. Controls need to be defined using the following syntax:
  2906. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2907. @var{valuei} is the value set on the @var{i}-th control.
  2908. Alternatively they can be also defined using the following syntax:
  2909. @var{value0}|@var{value1}|@var{value2}|..., where
  2910. @var{valuei} is the value set on the @var{i}-th control.
  2911. If @option{controls} is set to @code{help}, all available controls and
  2912. their valid ranges are printed.
  2913. @item sample_rate, s
  2914. Specify the sample rate, default to 44100. Only used if plugin have
  2915. zero inputs.
  2916. @item nb_samples, n
  2917. Set the number of samples per channel per each output frame, default
  2918. is 1024. Only used if plugin have zero inputs.
  2919. @item duration, d
  2920. Set the minimum duration of the sourced audio. See
  2921. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2922. for the accepted syntax.
  2923. Note that the resulting duration may be greater than the specified duration,
  2924. as the generated audio is always cut at the end of a complete frame.
  2925. If not specified, or the expressed duration is negative, the audio is
  2926. supposed to be generated forever.
  2927. Only used if plugin have zero inputs.
  2928. @end table
  2929. @subsection Examples
  2930. @itemize
  2931. @item
  2932. List all available plugins within amp (LADSPA example plugin) library:
  2933. @example
  2934. ladspa=file=amp
  2935. @end example
  2936. @item
  2937. List all available controls and their valid ranges for @code{vcf_notch}
  2938. plugin from @code{VCF} library:
  2939. @example
  2940. ladspa=f=vcf:p=vcf_notch:c=help
  2941. @end example
  2942. @item
  2943. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2944. plugin library:
  2945. @example
  2946. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2947. @end example
  2948. @item
  2949. Add reverberation to the audio using TAP-plugins
  2950. (Tom's Audio Processing plugins):
  2951. @example
  2952. ladspa=file=tap_reverb:tap_reverb
  2953. @end example
  2954. @item
  2955. Generate white noise, with 0.2 amplitude:
  2956. @example
  2957. ladspa=file=cmt:noise_source_white:c=c0=.2
  2958. @end example
  2959. @item
  2960. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2961. @code{C* Audio Plugin Suite} (CAPS) library:
  2962. @example
  2963. ladspa=file=caps:Click:c=c1=20'
  2964. @end example
  2965. @item
  2966. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2967. @example
  2968. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2969. @end example
  2970. @item
  2971. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2972. @code{SWH Plugins} collection:
  2973. @example
  2974. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2975. @end example
  2976. @item
  2977. Attenuate low frequencies using Multiband EQ from Steve Harris
  2978. @code{SWH Plugins} collection:
  2979. @example
  2980. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2981. @end example
  2982. @item
  2983. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  2984. (CAPS) library:
  2985. @example
  2986. ladspa=caps:Narrower
  2987. @end example
  2988. @item
  2989. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  2990. @example
  2991. ladspa=caps:White:.2
  2992. @end example
  2993. @item
  2994. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  2995. @example
  2996. ladspa=caps:Fractal:c=c1=1
  2997. @end example
  2998. @item
  2999. Dynamic volume normalization using @code{VLevel} plugin:
  3000. @example
  3001. ladspa=vlevel-ladspa:vlevel_mono
  3002. @end example
  3003. @end itemize
  3004. @subsection Commands
  3005. This filter supports the following commands:
  3006. @table @option
  3007. @item cN
  3008. Modify the @var{N}-th control value.
  3009. If the specified value is not valid, it is ignored and prior one is kept.
  3010. @end table
  3011. @section loudnorm
  3012. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  3013. Support for both single pass (livestreams, files) and double pass (files) modes.
  3014. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  3015. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  3016. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  3017. The filter accepts the following options:
  3018. @table @option
  3019. @item I, i
  3020. Set integrated loudness target.
  3021. Range is -70.0 - -5.0. Default value is -24.0.
  3022. @item LRA, lra
  3023. Set loudness range target.
  3024. Range is 1.0 - 20.0. Default value is 7.0.
  3025. @item TP, tp
  3026. Set maximum true peak.
  3027. Range is -9.0 - +0.0. Default value is -2.0.
  3028. @item measured_I, measured_i
  3029. Measured IL of input file.
  3030. Range is -99.0 - +0.0.
  3031. @item measured_LRA, measured_lra
  3032. Measured LRA of input file.
  3033. Range is 0.0 - 99.0.
  3034. @item measured_TP, measured_tp
  3035. Measured true peak of input file.
  3036. Range is -99.0 - +99.0.
  3037. @item measured_thresh
  3038. Measured threshold of input file.
  3039. Range is -99.0 - +0.0.
  3040. @item offset
  3041. Set offset gain. Gain is applied before the true-peak limiter.
  3042. Range is -99.0 - +99.0. Default is +0.0.
  3043. @item linear
  3044. Normalize linearly if possible.
  3045. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  3046. to be specified in order to use this mode.
  3047. Options are true or false. Default is true.
  3048. @item dual_mono
  3049. Treat mono input files as "dual-mono". If a mono file is intended for playback
  3050. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  3051. If set to @code{true}, this option will compensate for this effect.
  3052. Multi-channel input files are not affected by this option.
  3053. Options are true or false. Default is false.
  3054. @item print_format
  3055. Set print format for stats. Options are summary, json, or none.
  3056. Default value is none.
  3057. @end table
  3058. @section lowpass
  3059. Apply a low-pass filter with 3dB point frequency.
  3060. The filter can be either single-pole or double-pole (the default).
  3061. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  3062. The filter accepts the following options:
  3063. @table @option
  3064. @item frequency, f
  3065. Set frequency in Hz. Default is 500.
  3066. @item poles, p
  3067. Set number of poles. Default is 2.
  3068. @item width_type, t
  3069. Set method to specify band-width of filter.
  3070. @table @option
  3071. @item h
  3072. Hz
  3073. @item q
  3074. Q-Factor
  3075. @item o
  3076. octave
  3077. @item s
  3078. slope
  3079. @item k
  3080. kHz
  3081. @end table
  3082. @item width, w
  3083. Specify the band-width of a filter in width_type units.
  3084. Applies only to double-pole filter.
  3085. The default is 0.707q and gives a Butterworth response.
  3086. @item channels, c
  3087. Specify which channels to filter, by default all available are filtered.
  3088. @end table
  3089. @subsection Examples
  3090. @itemize
  3091. @item
  3092. Lowpass only LFE channel, it LFE is not present it does nothing:
  3093. @example
  3094. lowpass=c=LFE
  3095. @end example
  3096. @end itemize
  3097. @subsection Commands
  3098. This filter supports the following commands:
  3099. @table @option
  3100. @item frequency, f
  3101. Change lowpass frequency.
  3102. Syntax for the command is : "@var{frequency}"
  3103. @item width_type, t
  3104. Change lowpass width_type.
  3105. Syntax for the command is : "@var{width_type}"
  3106. @item width, w
  3107. Change lowpass width.
  3108. Syntax for the command is : "@var{width}"
  3109. @end table
  3110. @section lv2
  3111. Load a LV2 (LADSPA Version 2) plugin.
  3112. To enable compilation of this filter you need to configure FFmpeg with
  3113. @code{--enable-lv2}.
  3114. @table @option
  3115. @item plugin, p
  3116. Specifies the plugin URI. You may need to escape ':'.
  3117. @item controls, c
  3118. Set the '|' separated list of controls which are zero or more floating point
  3119. values that determine the behavior of the loaded plugin (for example delay,
  3120. threshold or gain).
  3121. If @option{controls} is set to @code{help}, all available controls and
  3122. their valid ranges are printed.
  3123. @item sample_rate, s
  3124. Specify the sample rate, default to 44100. Only used if plugin have
  3125. zero inputs.
  3126. @item nb_samples, n
  3127. Set the number of samples per channel per each output frame, default
  3128. is 1024. Only used if plugin have zero inputs.
  3129. @item duration, d
  3130. Set the minimum duration of the sourced audio. See
  3131. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3132. for the accepted syntax.
  3133. Note that the resulting duration may be greater than the specified duration,
  3134. as the generated audio is always cut at the end of a complete frame.
  3135. If not specified, or the expressed duration is negative, the audio is
  3136. supposed to be generated forever.
  3137. Only used if plugin have zero inputs.
  3138. @end table
  3139. @subsection Examples
  3140. @itemize
  3141. @item
  3142. Apply bass enhancer plugin from Calf:
  3143. @example
  3144. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3145. @end example
  3146. @item
  3147. Apply vinyl plugin from Calf:
  3148. @example
  3149. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3150. @end example
  3151. @item
  3152. Apply bit crusher plugin from ArtyFX:
  3153. @example
  3154. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3155. @end example
  3156. @end itemize
  3157. @section mcompand
  3158. Multiband Compress or expand the audio's dynamic range.
  3159. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3160. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3161. response when absent compander action.
  3162. It accepts the following parameters:
  3163. @table @option
  3164. @item args
  3165. This option syntax is:
  3166. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3167. For explanation of each item refer to compand filter documentation.
  3168. @end table
  3169. @anchor{pan}
  3170. @section pan
  3171. Mix channels with specific gain levels. The filter accepts the output
  3172. channel layout followed by a set of channels definitions.
  3173. This filter is also designed to efficiently remap the channels of an audio
  3174. stream.
  3175. The filter accepts parameters of the form:
  3176. "@var{l}|@var{outdef}|@var{outdef}|..."
  3177. @table @option
  3178. @item l
  3179. output channel layout or number of channels
  3180. @item outdef
  3181. output channel specification, of the form:
  3182. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3183. @item out_name
  3184. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3185. number (c0, c1, etc.)
  3186. @item gain
  3187. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3188. @item in_name
  3189. input channel to use, see out_name for details; it is not possible to mix
  3190. named and numbered input channels
  3191. @end table
  3192. If the `=' in a channel specification is replaced by `<', then the gains for
  3193. that specification will be renormalized so that the total is 1, thus
  3194. avoiding clipping noise.
  3195. @subsection Mixing examples
  3196. For example, if you want to down-mix from stereo to mono, but with a bigger
  3197. factor for the left channel:
  3198. @example
  3199. pan=1c|c0=0.9*c0+0.1*c1
  3200. @end example
  3201. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3202. 7-channels surround:
  3203. @example
  3204. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3205. @end example
  3206. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3207. that should be preferred (see "-ac" option) unless you have very specific
  3208. needs.
  3209. @subsection Remapping examples
  3210. The channel remapping will be effective if, and only if:
  3211. @itemize
  3212. @item gain coefficients are zeroes or ones,
  3213. @item only one input per channel output,
  3214. @end itemize
  3215. If all these conditions are satisfied, the filter will notify the user ("Pure
  3216. channel mapping detected"), and use an optimized and lossless method to do the
  3217. remapping.
  3218. For example, if you have a 5.1 source and want a stereo audio stream by
  3219. dropping the extra channels:
  3220. @example
  3221. pan="stereo| c0=FL | c1=FR"
  3222. @end example
  3223. Given the same source, you can also switch front left and front right channels
  3224. and keep the input channel layout:
  3225. @example
  3226. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3227. @end example
  3228. If the input is a stereo audio stream, you can mute the front left channel (and
  3229. still keep the stereo channel layout) with:
  3230. @example
  3231. pan="stereo|c1=c1"
  3232. @end example
  3233. Still with a stereo audio stream input, you can copy the right channel in both
  3234. front left and right:
  3235. @example
  3236. pan="stereo| c0=FR | c1=FR"
  3237. @end example
  3238. @section replaygain
  3239. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3240. outputs it unchanged.
  3241. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3242. @section resample
  3243. Convert the audio sample format, sample rate and channel layout. It is
  3244. not meant to be used directly.
  3245. @section rubberband
  3246. Apply time-stretching and pitch-shifting with librubberband.
  3247. To enable compilation of this filter, you need to configure FFmpeg with
  3248. @code{--enable-librubberband}.
  3249. The filter accepts the following options:
  3250. @table @option
  3251. @item tempo
  3252. Set tempo scale factor.
  3253. @item pitch
  3254. Set pitch scale factor.
  3255. @item transients
  3256. Set transients detector.
  3257. Possible values are:
  3258. @table @var
  3259. @item crisp
  3260. @item mixed
  3261. @item smooth
  3262. @end table
  3263. @item detector
  3264. Set detector.
  3265. Possible values are:
  3266. @table @var
  3267. @item compound
  3268. @item percussive
  3269. @item soft
  3270. @end table
  3271. @item phase
  3272. Set phase.
  3273. Possible values are:
  3274. @table @var
  3275. @item laminar
  3276. @item independent
  3277. @end table
  3278. @item window
  3279. Set processing window size.
  3280. Possible values are:
  3281. @table @var
  3282. @item standard
  3283. @item short
  3284. @item long
  3285. @end table
  3286. @item smoothing
  3287. Set smoothing.
  3288. Possible values are:
  3289. @table @var
  3290. @item off
  3291. @item on
  3292. @end table
  3293. @item formant
  3294. Enable formant preservation when shift pitching.
  3295. Possible values are:
  3296. @table @var
  3297. @item shifted
  3298. @item preserved
  3299. @end table
  3300. @item pitchq
  3301. Set pitch quality.
  3302. Possible values are:
  3303. @table @var
  3304. @item quality
  3305. @item speed
  3306. @item consistency
  3307. @end table
  3308. @item channels
  3309. Set channels.
  3310. Possible values are:
  3311. @table @var
  3312. @item apart
  3313. @item together
  3314. @end table
  3315. @end table
  3316. @section sidechaincompress
  3317. This filter acts like normal compressor but has the ability to compress
  3318. detected signal using second input signal.
  3319. It needs two input streams and returns one output stream.
  3320. First input stream will be processed depending on second stream signal.
  3321. The filtered signal then can be filtered with other filters in later stages of
  3322. processing. See @ref{pan} and @ref{amerge} filter.
  3323. The filter accepts the following options:
  3324. @table @option
  3325. @item level_in
  3326. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3327. @item mode
  3328. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  3329. Default is @code{downward}.
  3330. @item threshold
  3331. If a signal of second stream raises above this level it will affect the gain
  3332. reduction of first stream.
  3333. By default is 0.125. Range is between 0.00097563 and 1.
  3334. @item ratio
  3335. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3336. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3337. Default is 2. Range is between 1 and 20.
  3338. @item attack
  3339. Amount of milliseconds the signal has to rise above the threshold before gain
  3340. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3341. @item release
  3342. Amount of milliseconds the signal has to fall below the threshold before
  3343. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3344. @item makeup
  3345. Set the amount by how much signal will be amplified after processing.
  3346. Default is 1. Range is from 1 to 64.
  3347. @item knee
  3348. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3349. Default is 2.82843. Range is between 1 and 8.
  3350. @item link
  3351. Choose if the @code{average} level between all channels of side-chain stream
  3352. or the louder(@code{maximum}) channel of side-chain stream affects the
  3353. reduction. Default is @code{average}.
  3354. @item detection
  3355. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3356. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3357. @item level_sc
  3358. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3359. @item mix
  3360. How much to use compressed signal in output. Default is 1.
  3361. Range is between 0 and 1.
  3362. @end table
  3363. @subsection Examples
  3364. @itemize
  3365. @item
  3366. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3367. depending on the signal of 2nd input and later compressed signal to be
  3368. merged with 2nd input:
  3369. @example
  3370. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3371. @end example
  3372. @end itemize
  3373. @section sidechaingate
  3374. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3375. filter the detected signal before sending it to the gain reduction stage.
  3376. Normally a gate uses the full range signal to detect a level above the
  3377. threshold.
  3378. For example: If you cut all lower frequencies from your sidechain signal
  3379. the gate will decrease the volume of your track only if not enough highs
  3380. appear. With this technique you are able to reduce the resonation of a
  3381. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3382. guitar.
  3383. It needs two input streams and returns one output stream.
  3384. First input stream will be processed depending on second stream signal.
  3385. The filter accepts the following options:
  3386. @table @option
  3387. @item level_in
  3388. Set input level before filtering.
  3389. Default is 1. Allowed range is from 0.015625 to 64.
  3390. @item mode
  3391. Set the mode of operation. Can be @code{upward} or @code{downward}.
  3392. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  3393. will be amplified, expanding dynamic range in upward direction.
  3394. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  3395. @item range
  3396. Set the level of gain reduction when the signal is below the threshold.
  3397. Default is 0.06125. Allowed range is from 0 to 1.
  3398. Setting this to 0 disables reduction and then filter behaves like expander.
  3399. @item threshold
  3400. If a signal rises above this level the gain reduction is released.
  3401. Default is 0.125. Allowed range is from 0 to 1.
  3402. @item ratio
  3403. Set a ratio about which the signal is reduced.
  3404. Default is 2. Allowed range is from 1 to 9000.
  3405. @item attack
  3406. Amount of milliseconds the signal has to rise above the threshold before gain
  3407. reduction stops.
  3408. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3409. @item release
  3410. Amount of milliseconds the signal has to fall below the threshold before the
  3411. reduction is increased again. Default is 250 milliseconds.
  3412. Allowed range is from 0.01 to 9000.
  3413. @item makeup
  3414. Set amount of amplification of signal after processing.
  3415. Default is 1. Allowed range is from 1 to 64.
  3416. @item knee
  3417. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3418. Default is 2.828427125. Allowed range is from 1 to 8.
  3419. @item detection
  3420. Choose if exact signal should be taken for detection or an RMS like one.
  3421. Default is rms. Can be peak or rms.
  3422. @item link
  3423. Choose if the average level between all channels or the louder channel affects
  3424. the reduction.
  3425. Default is average. Can be average or maximum.
  3426. @item level_sc
  3427. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3428. @end table
  3429. @section silencedetect
  3430. Detect silence in an audio stream.
  3431. This filter logs a message when it detects that the input audio volume is less
  3432. or equal to a noise tolerance value for a duration greater or equal to the
  3433. minimum detected noise duration.
  3434. The printed times and duration are expressed in seconds.
  3435. The filter accepts the following options:
  3436. @table @option
  3437. @item noise, n
  3438. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3439. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3440. @item duration, d
  3441. Set silence duration until notification (default is 2 seconds).
  3442. @item mono, m
  3443. Process each channel separately, instead of combined. By default is disabled.
  3444. @end table
  3445. @subsection Examples
  3446. @itemize
  3447. @item
  3448. Detect 5 seconds of silence with -50dB noise tolerance:
  3449. @example
  3450. silencedetect=n=-50dB:d=5
  3451. @end example
  3452. @item
  3453. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3454. tolerance in @file{silence.mp3}:
  3455. @example
  3456. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3457. @end example
  3458. @end itemize
  3459. @section silenceremove
  3460. Remove silence from the beginning, middle or end of the audio.
  3461. The filter accepts the following options:
  3462. @table @option
  3463. @item start_periods
  3464. This value is used to indicate if audio should be trimmed at beginning of
  3465. the audio. A value of zero indicates no silence should be trimmed from the
  3466. beginning. When specifying a non-zero value, it trims audio up until it
  3467. finds non-silence. Normally, when trimming silence from beginning of audio
  3468. the @var{start_periods} will be @code{1} but it can be increased to higher
  3469. values to trim all audio up to specific count of non-silence periods.
  3470. Default value is @code{0}.
  3471. @item start_duration
  3472. Specify the amount of time that non-silence must be detected before it stops
  3473. trimming audio. By increasing the duration, bursts of noises can be treated
  3474. as silence and trimmed off. Default value is @code{0}.
  3475. @item start_threshold
  3476. This indicates what sample value should be treated as silence. For digital
  3477. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3478. you may wish to increase the value to account for background noise.
  3479. Can be specified in dB (in case "dB" is appended to the specified value)
  3480. or amplitude ratio. Default value is @code{0}.
  3481. @item start_silence
  3482. Specify max duration of silence at beginning that will be kept after
  3483. trimming. Default is 0, which is equal to trimming all samples detected
  3484. as silence.
  3485. @item start_mode
  3486. Specify mode of detection of silence end in start of multi-channel audio.
  3487. Can be @var{any} or @var{all}. Default is @var{any}.
  3488. With @var{any}, any sample that is detected as non-silence will cause
  3489. stopped trimming of silence.
  3490. With @var{all}, only if all channels are detected as non-silence will cause
  3491. stopped trimming of silence.
  3492. @item stop_periods
  3493. Set the count for trimming silence from the end of audio.
  3494. To remove silence from the middle of a file, specify a @var{stop_periods}
  3495. that is negative. This value is then treated as a positive value and is
  3496. used to indicate the effect should restart processing as specified by
  3497. @var{start_periods}, making it suitable for removing periods of silence
  3498. in the middle of the audio.
  3499. Default value is @code{0}.
  3500. @item stop_duration
  3501. Specify a duration of silence that must exist before audio is not copied any
  3502. more. By specifying a higher duration, silence that is wanted can be left in
  3503. the audio.
  3504. Default value is @code{0}.
  3505. @item stop_threshold
  3506. This is the same as @option{start_threshold} but for trimming silence from
  3507. the end of audio.
  3508. Can be specified in dB (in case "dB" is appended to the specified value)
  3509. or amplitude ratio. Default value is @code{0}.
  3510. @item stop_silence
  3511. Specify max duration of silence at end that will be kept after
  3512. trimming. Default is 0, which is equal to trimming all samples detected
  3513. as silence.
  3514. @item stop_mode
  3515. Specify mode of detection of silence start in end of multi-channel audio.
  3516. Can be @var{any} or @var{all}. Default is @var{any}.
  3517. With @var{any}, any sample that is detected as non-silence will cause
  3518. stopped trimming of silence.
  3519. With @var{all}, only if all channels are detected as non-silence will cause
  3520. stopped trimming of silence.
  3521. @item detection
  3522. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3523. and works better with digital silence which is exactly 0.
  3524. Default value is @code{rms}.
  3525. @item window
  3526. Set duration in number of seconds used to calculate size of window in number
  3527. of samples for detecting silence.
  3528. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3529. @end table
  3530. @subsection Examples
  3531. @itemize
  3532. @item
  3533. The following example shows how this filter can be used to start a recording
  3534. that does not contain the delay at the start which usually occurs between
  3535. pressing the record button and the start of the performance:
  3536. @example
  3537. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  3538. @end example
  3539. @item
  3540. Trim all silence encountered from beginning to end where there is more than 1
  3541. second of silence in audio:
  3542. @example
  3543. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  3544. @end example
  3545. @end itemize
  3546. @section sofalizer
  3547. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3548. loudspeakers around the user for binaural listening via headphones (audio
  3549. formats up to 9 channels supported).
  3550. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3551. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3552. Austrian Academy of Sciences.
  3553. To enable compilation of this filter you need to configure FFmpeg with
  3554. @code{--enable-libmysofa}.
  3555. The filter accepts the following options:
  3556. @table @option
  3557. @item sofa
  3558. Set the SOFA file used for rendering.
  3559. @item gain
  3560. Set gain applied to audio. Value is in dB. Default is 0.
  3561. @item rotation
  3562. Set rotation of virtual loudspeakers in deg. Default is 0.
  3563. @item elevation
  3564. Set elevation of virtual speakers in deg. Default is 0.
  3565. @item radius
  3566. Set distance in meters between loudspeakers and the listener with near-field
  3567. HRTFs. Default is 1.
  3568. @item type
  3569. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3570. processing audio in time domain which is slow.
  3571. @var{freq} is processing audio in frequency domain which is fast.
  3572. Default is @var{freq}.
  3573. @item speakers
  3574. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3575. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3576. Each virtual loudspeaker is described with short channel name following with
  3577. azimuth and elevation in degrees.
  3578. Each virtual loudspeaker description is separated by '|'.
  3579. For example to override front left and front right channel positions use:
  3580. 'speakers=FL 45 15|FR 345 15'.
  3581. Descriptions with unrecognised channel names are ignored.
  3582. @item lfegain
  3583. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3584. @item framesize
  3585. Set custom frame size in number of samples. Default is 1024.
  3586. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  3587. is set to @var{freq}.
  3588. @item normalize
  3589. Should all IRs be normalized upon importing SOFA file.
  3590. By default is enabled.
  3591. @item interpolate
  3592. Should nearest IRs be interpolated with neighbor IRs if exact position
  3593. does not match. By default is disabled.
  3594. @item minphase
  3595. Minphase all IRs upon loading of SOFA file. By default is disabled.
  3596. @item anglestep
  3597. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  3598. @item radstep
  3599. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  3600. @end table
  3601. @subsection Examples
  3602. @itemize
  3603. @item
  3604. Using ClubFritz6 sofa file:
  3605. @example
  3606. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3607. @end example
  3608. @item
  3609. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3610. @example
  3611. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3612. @end example
  3613. @item
  3614. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3615. and also with custom gain:
  3616. @example
  3617. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3618. @end example
  3619. @end itemize
  3620. @section stereotools
  3621. This filter has some handy utilities to manage stereo signals, for converting
  3622. M/S stereo recordings to L/R signal while having control over the parameters
  3623. or spreading the stereo image of master track.
  3624. The filter accepts the following options:
  3625. @table @option
  3626. @item level_in
  3627. Set input level before filtering for both channels. Defaults is 1.
  3628. Allowed range is from 0.015625 to 64.
  3629. @item level_out
  3630. Set output level after filtering for both channels. Defaults is 1.
  3631. Allowed range is from 0.015625 to 64.
  3632. @item balance_in
  3633. Set input balance between both channels. Default is 0.
  3634. Allowed range is from -1 to 1.
  3635. @item balance_out
  3636. Set output balance between both channels. Default is 0.
  3637. Allowed range is from -1 to 1.
  3638. @item softclip
  3639. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3640. clipping. Disabled by default.
  3641. @item mutel
  3642. Mute the left channel. Disabled by default.
  3643. @item muter
  3644. Mute the right channel. Disabled by default.
  3645. @item phasel
  3646. Change the phase of the left channel. Disabled by default.
  3647. @item phaser
  3648. Change the phase of the right channel. Disabled by default.
  3649. @item mode
  3650. Set stereo mode. Available values are:
  3651. @table @samp
  3652. @item lr>lr
  3653. Left/Right to Left/Right, this is default.
  3654. @item lr>ms
  3655. Left/Right to Mid/Side.
  3656. @item ms>lr
  3657. Mid/Side to Left/Right.
  3658. @item lr>ll
  3659. Left/Right to Left/Left.
  3660. @item lr>rr
  3661. Left/Right to Right/Right.
  3662. @item lr>l+r
  3663. Left/Right to Left + Right.
  3664. @item lr>rl
  3665. Left/Right to Right/Left.
  3666. @item ms>ll
  3667. Mid/Side to Left/Left.
  3668. @item ms>rr
  3669. Mid/Side to Right/Right.
  3670. @end table
  3671. @item slev
  3672. Set level of side signal. Default is 1.
  3673. Allowed range is from 0.015625 to 64.
  3674. @item sbal
  3675. Set balance of side signal. Default is 0.
  3676. Allowed range is from -1 to 1.
  3677. @item mlev
  3678. Set level of the middle signal. Default is 1.
  3679. Allowed range is from 0.015625 to 64.
  3680. @item mpan
  3681. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3682. @item base
  3683. Set stereo base between mono and inversed channels. Default is 0.
  3684. Allowed range is from -1 to 1.
  3685. @item delay
  3686. Set delay in milliseconds how much to delay left from right channel and
  3687. vice versa. Default is 0. Allowed range is from -20 to 20.
  3688. @item sclevel
  3689. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3690. @item phase
  3691. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3692. @item bmode_in, bmode_out
  3693. Set balance mode for balance_in/balance_out option.
  3694. Can be one of the following:
  3695. @table @samp
  3696. @item balance
  3697. Classic balance mode. Attenuate one channel at time.
  3698. Gain is raised up to 1.
  3699. @item amplitude
  3700. Similar as classic mode above but gain is raised up to 2.
  3701. @item power
  3702. Equal power distribution, from -6dB to +6dB range.
  3703. @end table
  3704. @end table
  3705. @subsection Examples
  3706. @itemize
  3707. @item
  3708. Apply karaoke like effect:
  3709. @example
  3710. stereotools=mlev=0.015625
  3711. @end example
  3712. @item
  3713. Convert M/S signal to L/R:
  3714. @example
  3715. "stereotools=mode=ms>lr"
  3716. @end example
  3717. @end itemize
  3718. @section stereowiden
  3719. This filter enhance the stereo effect by suppressing signal common to both
  3720. channels and by delaying the signal of left into right and vice versa,
  3721. thereby widening the stereo effect.
  3722. The filter accepts the following options:
  3723. @table @option
  3724. @item delay
  3725. Time in milliseconds of the delay of left signal into right and vice versa.
  3726. Default is 20 milliseconds.
  3727. @item feedback
  3728. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3729. effect of left signal in right output and vice versa which gives widening
  3730. effect. Default is 0.3.
  3731. @item crossfeed
  3732. Cross feed of left into right with inverted phase. This helps in suppressing
  3733. the mono. If the value is 1 it will cancel all the signal common to both
  3734. channels. Default is 0.3.
  3735. @item drymix
  3736. Set level of input signal of original channel. Default is 0.8.
  3737. @end table
  3738. @section superequalizer
  3739. Apply 18 band equalizer.
  3740. The filter accepts the following options:
  3741. @table @option
  3742. @item 1b
  3743. Set 65Hz band gain.
  3744. @item 2b
  3745. Set 92Hz band gain.
  3746. @item 3b
  3747. Set 131Hz band gain.
  3748. @item 4b
  3749. Set 185Hz band gain.
  3750. @item 5b
  3751. Set 262Hz band gain.
  3752. @item 6b
  3753. Set 370Hz band gain.
  3754. @item 7b
  3755. Set 523Hz band gain.
  3756. @item 8b
  3757. Set 740Hz band gain.
  3758. @item 9b
  3759. Set 1047Hz band gain.
  3760. @item 10b
  3761. Set 1480Hz band gain.
  3762. @item 11b
  3763. Set 2093Hz band gain.
  3764. @item 12b
  3765. Set 2960Hz band gain.
  3766. @item 13b
  3767. Set 4186Hz band gain.
  3768. @item 14b
  3769. Set 5920Hz band gain.
  3770. @item 15b
  3771. Set 8372Hz band gain.
  3772. @item 16b
  3773. Set 11840Hz band gain.
  3774. @item 17b
  3775. Set 16744Hz band gain.
  3776. @item 18b
  3777. Set 20000Hz band gain.
  3778. @end table
  3779. @section surround
  3780. Apply audio surround upmix filter.
  3781. This filter allows to produce multichannel output from audio stream.
  3782. The filter accepts the following options:
  3783. @table @option
  3784. @item chl_out
  3785. Set output channel layout. By default, this is @var{5.1}.
  3786. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3787. for the required syntax.
  3788. @item chl_in
  3789. Set input channel layout. By default, this is @var{stereo}.
  3790. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3791. for the required syntax.
  3792. @item level_in
  3793. Set input volume level. By default, this is @var{1}.
  3794. @item level_out
  3795. Set output volume level. By default, this is @var{1}.
  3796. @item lfe
  3797. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3798. @item lfe_low
  3799. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3800. @item lfe_high
  3801. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3802. @item lfe_mode
  3803. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  3804. In @var{add} mode, LFE channel is created from input audio and added to output.
  3805. In @var{sub} mode, LFE channel is created from input audio and added to output but
  3806. also all non-LFE output channels are subtracted with output LFE channel.
  3807. @item fc_in
  3808. Set front center input volume. By default, this is @var{1}.
  3809. @item fc_out
  3810. Set front center output volume. By default, this is @var{1}.
  3811. @item lfe_in
  3812. Set LFE input volume. By default, this is @var{1}.
  3813. @item lfe_out
  3814. Set LFE output volume. By default, this is @var{1}.
  3815. @item allx
  3816. Set spread usage of stereo image across X axis for all channels.
  3817. @item ally
  3818. Set spread usage of stereo image across Y axis for all channels.
  3819. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  3820. Set spread usage of stereo image across X axis for each channel.
  3821. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  3822. Set spread usage of stereo image across Y axis for each channel.
  3823. @item win_func
  3824. Set window function.
  3825. It accepts the following values:
  3826. @table @samp
  3827. @item rect
  3828. @item bartlett
  3829. @item hann, hanning
  3830. @item hamming
  3831. @item blackman
  3832. @item welch
  3833. @item flattop
  3834. @item bharris
  3835. @item bnuttall
  3836. @item bhann
  3837. @item sine
  3838. @item nuttall
  3839. @item lanczos
  3840. @item gauss
  3841. @item tukey
  3842. @item dolph
  3843. @item cauchy
  3844. @item parzen
  3845. @item poisson
  3846. @item bohman
  3847. @end table
  3848. Default is @code{hann}.
  3849. @item overlap
  3850. Set window overlap. If set to 1, the recommended overlap for selected
  3851. window function will be picked. Default is @code{0.5}.
  3852. @end table
  3853. @section treble, highshelf
  3854. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3855. shelving filter with a response similar to that of a standard
  3856. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3857. The filter accepts the following options:
  3858. @table @option
  3859. @item gain, g
  3860. Give the gain at whichever is the lower of ~22 kHz and the
  3861. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3862. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3863. @item frequency, f
  3864. Set the filter's central frequency and so can be used
  3865. to extend or reduce the frequency range to be boosted or cut.
  3866. The default value is @code{3000} Hz.
  3867. @item width_type, t
  3868. Set method to specify band-width of filter.
  3869. @table @option
  3870. @item h
  3871. Hz
  3872. @item q
  3873. Q-Factor
  3874. @item o
  3875. octave
  3876. @item s
  3877. slope
  3878. @item k
  3879. kHz
  3880. @end table
  3881. @item width, w
  3882. Determine how steep is the filter's shelf transition.
  3883. @item channels, c
  3884. Specify which channels to filter, by default all available are filtered.
  3885. @end table
  3886. @subsection Commands
  3887. This filter supports the following commands:
  3888. @table @option
  3889. @item frequency, f
  3890. Change treble frequency.
  3891. Syntax for the command is : "@var{frequency}"
  3892. @item width_type, t
  3893. Change treble width_type.
  3894. Syntax for the command is : "@var{width_type}"
  3895. @item width, w
  3896. Change treble width.
  3897. Syntax for the command is : "@var{width}"
  3898. @item gain, g
  3899. Change treble gain.
  3900. Syntax for the command is : "@var{gain}"
  3901. @end table
  3902. @section tremolo
  3903. Sinusoidal amplitude modulation.
  3904. The filter accepts the following options:
  3905. @table @option
  3906. @item f
  3907. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3908. (20 Hz or lower) will result in a tremolo effect.
  3909. This filter may also be used as a ring modulator by specifying
  3910. a modulation frequency higher than 20 Hz.
  3911. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3912. @item d
  3913. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3914. Default value is 0.5.
  3915. @end table
  3916. @section vibrato
  3917. Sinusoidal phase modulation.
  3918. The filter accepts the following options:
  3919. @table @option
  3920. @item f
  3921. Modulation frequency in Hertz.
  3922. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3923. @item d
  3924. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3925. Default value is 0.5.
  3926. @end table
  3927. @section volume
  3928. Adjust the input audio volume.
  3929. It accepts the following parameters:
  3930. @table @option
  3931. @item volume
  3932. Set audio volume expression.
  3933. Output values are clipped to the maximum value.
  3934. The output audio volume is given by the relation:
  3935. @example
  3936. @var{output_volume} = @var{volume} * @var{input_volume}
  3937. @end example
  3938. The default value for @var{volume} is "1.0".
  3939. @item precision
  3940. This parameter represents the mathematical precision.
  3941. It determines which input sample formats will be allowed, which affects the
  3942. precision of the volume scaling.
  3943. @table @option
  3944. @item fixed
  3945. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  3946. @item float
  3947. 32-bit floating-point; this limits input sample format to FLT. (default)
  3948. @item double
  3949. 64-bit floating-point; this limits input sample format to DBL.
  3950. @end table
  3951. @item replaygain
  3952. Choose the behaviour on encountering ReplayGain side data in input frames.
  3953. @table @option
  3954. @item drop
  3955. Remove ReplayGain side data, ignoring its contents (the default).
  3956. @item ignore
  3957. Ignore ReplayGain side data, but leave it in the frame.
  3958. @item track
  3959. Prefer the track gain, if present.
  3960. @item album
  3961. Prefer the album gain, if present.
  3962. @end table
  3963. @item replaygain_preamp
  3964. Pre-amplification gain in dB to apply to the selected replaygain gain.
  3965. Default value for @var{replaygain_preamp} is 0.0.
  3966. @item eval
  3967. Set when the volume expression is evaluated.
  3968. It accepts the following values:
  3969. @table @samp
  3970. @item once
  3971. only evaluate expression once during the filter initialization, or
  3972. when the @samp{volume} command is sent
  3973. @item frame
  3974. evaluate expression for each incoming frame
  3975. @end table
  3976. Default value is @samp{once}.
  3977. @end table
  3978. The volume expression can contain the following parameters.
  3979. @table @option
  3980. @item n
  3981. frame number (starting at zero)
  3982. @item nb_channels
  3983. number of channels
  3984. @item nb_consumed_samples
  3985. number of samples consumed by the filter
  3986. @item nb_samples
  3987. number of samples in the current frame
  3988. @item pos
  3989. original frame position in the file
  3990. @item pts
  3991. frame PTS
  3992. @item sample_rate
  3993. sample rate
  3994. @item startpts
  3995. PTS at start of stream
  3996. @item startt
  3997. time at start of stream
  3998. @item t
  3999. frame time
  4000. @item tb
  4001. timestamp timebase
  4002. @item volume
  4003. last set volume value
  4004. @end table
  4005. Note that when @option{eval} is set to @samp{once} only the
  4006. @var{sample_rate} and @var{tb} variables are available, all other
  4007. variables will evaluate to NAN.
  4008. @subsection Commands
  4009. This filter supports the following commands:
  4010. @table @option
  4011. @item volume
  4012. Modify the volume expression.
  4013. The command accepts the same syntax of the corresponding option.
  4014. If the specified expression is not valid, it is kept at its current
  4015. value.
  4016. @item replaygain_noclip
  4017. Prevent clipping by limiting the gain applied.
  4018. Default value for @var{replaygain_noclip} is 1.
  4019. @end table
  4020. @subsection Examples
  4021. @itemize
  4022. @item
  4023. Halve the input audio volume:
  4024. @example
  4025. volume=volume=0.5
  4026. volume=volume=1/2
  4027. volume=volume=-6.0206dB
  4028. @end example
  4029. In all the above example the named key for @option{volume} can be
  4030. omitted, for example like in:
  4031. @example
  4032. volume=0.5
  4033. @end example
  4034. @item
  4035. Increase input audio power by 6 decibels using fixed-point precision:
  4036. @example
  4037. volume=volume=6dB:precision=fixed
  4038. @end example
  4039. @item
  4040. Fade volume after time 10 with an annihilation period of 5 seconds:
  4041. @example
  4042. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  4043. @end example
  4044. @end itemize
  4045. @section volumedetect
  4046. Detect the volume of the input video.
  4047. The filter has no parameters. The input is not modified. Statistics about
  4048. the volume will be printed in the log when the input stream end is reached.
  4049. In particular it will show the mean volume (root mean square), maximum
  4050. volume (on a per-sample basis), and the beginning of a histogram of the
  4051. registered volume values (from the maximum value to a cumulated 1/1000 of
  4052. the samples).
  4053. All volumes are in decibels relative to the maximum PCM value.
  4054. @subsection Examples
  4055. Here is an excerpt of the output:
  4056. @example
  4057. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  4058. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  4059. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  4060. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  4061. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  4062. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  4063. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  4064. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  4065. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  4066. @end example
  4067. It means that:
  4068. @itemize
  4069. @item
  4070. The mean square energy is approximately -27 dB, or 10^-2.7.
  4071. @item
  4072. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  4073. @item
  4074. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  4075. @end itemize
  4076. In other words, raising the volume by +4 dB does not cause any clipping,
  4077. raising it by +5 dB causes clipping for 6 samples, etc.
  4078. @c man end AUDIO FILTERS
  4079. @chapter Audio Sources
  4080. @c man begin AUDIO SOURCES
  4081. Below is a description of the currently available audio sources.
  4082. @section abuffer
  4083. Buffer audio frames, and make them available to the filter chain.
  4084. This source is mainly intended for a programmatic use, in particular
  4085. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  4086. It accepts the following parameters:
  4087. @table @option
  4088. @item time_base
  4089. The timebase which will be used for timestamps of submitted frames. It must be
  4090. either a floating-point number or in @var{numerator}/@var{denominator} form.
  4091. @item sample_rate
  4092. The sample rate of the incoming audio buffers.
  4093. @item sample_fmt
  4094. The sample format of the incoming audio buffers.
  4095. Either a sample format name or its corresponding integer representation from
  4096. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  4097. @item channel_layout
  4098. The channel layout of the incoming audio buffers.
  4099. Either a channel layout name from channel_layout_map in
  4100. @file{libavutil/channel_layout.c} or its corresponding integer representation
  4101. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  4102. @item channels
  4103. The number of channels of the incoming audio buffers.
  4104. If both @var{channels} and @var{channel_layout} are specified, then they
  4105. must be consistent.
  4106. @end table
  4107. @subsection Examples
  4108. @example
  4109. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  4110. @end example
  4111. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  4112. Since the sample format with name "s16p" corresponds to the number
  4113. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  4114. equivalent to:
  4115. @example
  4116. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  4117. @end example
  4118. @section aevalsrc
  4119. Generate an audio signal specified by an expression.
  4120. This source accepts in input one or more expressions (one for each
  4121. channel), which are evaluated and used to generate a corresponding
  4122. audio signal.
  4123. This source accepts the following options:
  4124. @table @option
  4125. @item exprs
  4126. Set the '|'-separated expressions list for each separate channel. In case the
  4127. @option{channel_layout} option is not specified, the selected channel layout
  4128. depends on the number of provided expressions. Otherwise the last
  4129. specified expression is applied to the remaining output channels.
  4130. @item channel_layout, c
  4131. Set the channel layout. The number of channels in the specified layout
  4132. must be equal to the number of specified expressions.
  4133. @item duration, d
  4134. Set the minimum duration of the sourced audio. See
  4135. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4136. for the accepted syntax.
  4137. Note that the resulting duration may be greater than the specified
  4138. duration, as the generated audio is always cut at the end of a
  4139. complete frame.
  4140. If not specified, or the expressed duration is negative, the audio is
  4141. supposed to be generated forever.
  4142. @item nb_samples, n
  4143. Set the number of samples per channel per each output frame,
  4144. default to 1024.
  4145. @item sample_rate, s
  4146. Specify the sample rate, default to 44100.
  4147. @end table
  4148. Each expression in @var{exprs} can contain the following constants:
  4149. @table @option
  4150. @item n
  4151. number of the evaluated sample, starting from 0
  4152. @item t
  4153. time of the evaluated sample expressed in seconds, starting from 0
  4154. @item s
  4155. sample rate
  4156. @end table
  4157. @subsection Examples
  4158. @itemize
  4159. @item
  4160. Generate silence:
  4161. @example
  4162. aevalsrc=0
  4163. @end example
  4164. @item
  4165. Generate a sin signal with frequency of 440 Hz, set sample rate to
  4166. 8000 Hz:
  4167. @example
  4168. aevalsrc="sin(440*2*PI*t):s=8000"
  4169. @end example
  4170. @item
  4171. Generate a two channels signal, specify the channel layout (Front
  4172. Center + Back Center) explicitly:
  4173. @example
  4174. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  4175. @end example
  4176. @item
  4177. Generate white noise:
  4178. @example
  4179. aevalsrc="-2+random(0)"
  4180. @end example
  4181. @item
  4182. Generate an amplitude modulated signal:
  4183. @example
  4184. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  4185. @end example
  4186. @item
  4187. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  4188. @example
  4189. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  4190. @end example
  4191. @end itemize
  4192. @section anullsrc
  4193. The null audio source, return unprocessed audio frames. It is mainly useful
  4194. as a template and to be employed in analysis / debugging tools, or as
  4195. the source for filters which ignore the input data (for example the sox
  4196. synth filter).
  4197. This source accepts the following options:
  4198. @table @option
  4199. @item channel_layout, cl
  4200. Specifies the channel layout, and can be either an integer or a string
  4201. representing a channel layout. The default value of @var{channel_layout}
  4202. is "stereo".
  4203. Check the channel_layout_map definition in
  4204. @file{libavutil/channel_layout.c} for the mapping between strings and
  4205. channel layout values.
  4206. @item sample_rate, r
  4207. Specifies the sample rate, and defaults to 44100.
  4208. @item nb_samples, n
  4209. Set the number of samples per requested frames.
  4210. @end table
  4211. @subsection Examples
  4212. @itemize
  4213. @item
  4214. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  4215. @example
  4216. anullsrc=r=48000:cl=4
  4217. @end example
  4218. @item
  4219. Do the same operation with a more obvious syntax:
  4220. @example
  4221. anullsrc=r=48000:cl=mono
  4222. @end example
  4223. @end itemize
  4224. All the parameters need to be explicitly defined.
  4225. @section flite
  4226. Synthesize a voice utterance using the libflite library.
  4227. To enable compilation of this filter you need to configure FFmpeg with
  4228. @code{--enable-libflite}.
  4229. Note that versions of the flite library prior to 2.0 are not thread-safe.
  4230. The filter accepts the following options:
  4231. @table @option
  4232. @item list_voices
  4233. If set to 1, list the names of the available voices and exit
  4234. immediately. Default value is 0.
  4235. @item nb_samples, n
  4236. Set the maximum number of samples per frame. Default value is 512.
  4237. @item textfile
  4238. Set the filename containing the text to speak.
  4239. @item text
  4240. Set the text to speak.
  4241. @item voice, v
  4242. Set the voice to use for the speech synthesis. Default value is
  4243. @code{kal}. See also the @var{list_voices} option.
  4244. @end table
  4245. @subsection Examples
  4246. @itemize
  4247. @item
  4248. Read from file @file{speech.txt}, and synthesize the text using the
  4249. standard flite voice:
  4250. @example
  4251. flite=textfile=speech.txt
  4252. @end example
  4253. @item
  4254. Read the specified text selecting the @code{slt} voice:
  4255. @example
  4256. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4257. @end example
  4258. @item
  4259. Input text to ffmpeg:
  4260. @example
  4261. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4262. @end example
  4263. @item
  4264. Make @file{ffplay} speak the specified text, using @code{flite} and
  4265. the @code{lavfi} device:
  4266. @example
  4267. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  4268. @end example
  4269. @end itemize
  4270. For more information about libflite, check:
  4271. @url{http://www.festvox.org/flite/}
  4272. @section anoisesrc
  4273. Generate a noise audio signal.
  4274. The filter accepts the following options:
  4275. @table @option
  4276. @item sample_rate, r
  4277. Specify the sample rate. Default value is 48000 Hz.
  4278. @item amplitude, a
  4279. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4280. is 1.0.
  4281. @item duration, d
  4282. Specify the duration of the generated audio stream. Not specifying this option
  4283. results in noise with an infinite length.
  4284. @item color, colour, c
  4285. Specify the color of noise. Available noise colors are white, pink, brown,
  4286. blue and violet. Default color is white.
  4287. @item seed, s
  4288. Specify a value used to seed the PRNG.
  4289. @item nb_samples, n
  4290. Set the number of samples per each output frame, default is 1024.
  4291. @end table
  4292. @subsection Examples
  4293. @itemize
  4294. @item
  4295. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4296. @example
  4297. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4298. @end example
  4299. @end itemize
  4300. @section hilbert
  4301. Generate odd-tap Hilbert transform FIR coefficients.
  4302. The resulting stream can be used with @ref{afir} filter for phase-shifting
  4303. the signal by 90 degrees.
  4304. This is used in many matrix coding schemes and for analytic signal generation.
  4305. The process is often written as a multiplication by i (or j), the imaginary unit.
  4306. The filter accepts the following options:
  4307. @table @option
  4308. @item sample_rate, s
  4309. Set sample rate, default is 44100.
  4310. @item taps, t
  4311. Set length of FIR filter, default is 22051.
  4312. @item nb_samples, n
  4313. Set number of samples per each frame.
  4314. @item win_func, w
  4315. Set window function to be used when generating FIR coefficients.
  4316. @end table
  4317. @section sinc
  4318. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  4319. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4320. The filter accepts the following options:
  4321. @table @option
  4322. @item sample_rate, r
  4323. Set sample rate, default is 44100.
  4324. @item nb_samples, n
  4325. Set number of samples per each frame. Default is 1024.
  4326. @item hp
  4327. Set high-pass frequency. Default is 0.
  4328. @item lp
  4329. Set low-pass frequency. Default is 0.
  4330. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  4331. is higher than 0 then filter will create band-pass filter coefficients,
  4332. otherwise band-reject filter coefficients.
  4333. @item phase
  4334. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  4335. @item beta
  4336. Set Kaiser window beta.
  4337. @item att
  4338. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  4339. @item round
  4340. Enable rounding, by default is disabled.
  4341. @item hptaps
  4342. Set number of taps for high-pass filter.
  4343. @item lptaps
  4344. Set number of taps for low-pass filter.
  4345. @end table
  4346. @section sine
  4347. Generate an audio signal made of a sine wave with amplitude 1/8.
  4348. The audio signal is bit-exact.
  4349. The filter accepts the following options:
  4350. @table @option
  4351. @item frequency, f
  4352. Set the carrier frequency. Default is 440 Hz.
  4353. @item beep_factor, b
  4354. Enable a periodic beep every second with frequency @var{beep_factor} times
  4355. the carrier frequency. Default is 0, meaning the beep is disabled.
  4356. @item sample_rate, r
  4357. Specify the sample rate, default is 44100.
  4358. @item duration, d
  4359. Specify the duration of the generated audio stream.
  4360. @item samples_per_frame
  4361. Set the number of samples per output frame.
  4362. The expression can contain the following constants:
  4363. @table @option
  4364. @item n
  4365. The (sequential) number of the output audio frame, starting from 0.
  4366. @item pts
  4367. The PTS (Presentation TimeStamp) of the output audio frame,
  4368. expressed in @var{TB} units.
  4369. @item t
  4370. The PTS of the output audio frame, expressed in seconds.
  4371. @item TB
  4372. The timebase of the output audio frames.
  4373. @end table
  4374. Default is @code{1024}.
  4375. @end table
  4376. @subsection Examples
  4377. @itemize
  4378. @item
  4379. Generate a simple 440 Hz sine wave:
  4380. @example
  4381. sine
  4382. @end example
  4383. @item
  4384. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  4385. @example
  4386. sine=220:4:d=5
  4387. sine=f=220:b=4:d=5
  4388. sine=frequency=220:beep_factor=4:duration=5
  4389. @end example
  4390. @item
  4391. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  4392. pattern:
  4393. @example
  4394. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  4395. @end example
  4396. @end itemize
  4397. @c man end AUDIO SOURCES
  4398. @chapter Audio Sinks
  4399. @c man begin AUDIO SINKS
  4400. Below is a description of the currently available audio sinks.
  4401. @section abuffersink
  4402. Buffer audio frames, and make them available to the end of filter chain.
  4403. This sink is mainly intended for programmatic use, in particular
  4404. through the interface defined in @file{libavfilter/buffersink.h}
  4405. or the options system.
  4406. It accepts a pointer to an AVABufferSinkContext structure, which
  4407. defines the incoming buffers' formats, to be passed as the opaque
  4408. parameter to @code{avfilter_init_filter} for initialization.
  4409. @section anullsink
  4410. Null audio sink; do absolutely nothing with the input audio. It is
  4411. mainly useful as a template and for use in analysis / debugging
  4412. tools.
  4413. @c man end AUDIO SINKS
  4414. @chapter Video Filters
  4415. @c man begin VIDEO FILTERS
  4416. When you configure your FFmpeg build, you can disable any of the
  4417. existing filters using @code{--disable-filters}.
  4418. The configure output will show the video filters included in your
  4419. build.
  4420. Below is a description of the currently available video filters.
  4421. @section alphaextract
  4422. Extract the alpha component from the input as a grayscale video. This
  4423. is especially useful with the @var{alphamerge} filter.
  4424. @section alphamerge
  4425. Add or replace the alpha component of the primary input with the
  4426. grayscale value of a second input. This is intended for use with
  4427. @var{alphaextract} to allow the transmission or storage of frame
  4428. sequences that have alpha in a format that doesn't support an alpha
  4429. channel.
  4430. For example, to reconstruct full frames from a normal YUV-encoded video
  4431. and a separate video created with @var{alphaextract}, you might use:
  4432. @example
  4433. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4434. @end example
  4435. Since this filter is designed for reconstruction, it operates on frame
  4436. sequences without considering timestamps, and terminates when either
  4437. input reaches end of stream. This will cause problems if your encoding
  4438. pipeline drops frames. If you're trying to apply an image as an
  4439. overlay to a video stream, consider the @var{overlay} filter instead.
  4440. @section amplify
  4441. Amplify differences between current pixel and pixels of adjacent frames in
  4442. same pixel location.
  4443. This filter accepts the following options:
  4444. @table @option
  4445. @item radius
  4446. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  4447. For example radius of 3 will instruct filter to calculate average of 7 frames.
  4448. @item factor
  4449. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  4450. @item threshold
  4451. Set threshold for difference amplification. Any difference greater or equal to
  4452. this value will not alter source pixel. Default is 10.
  4453. Allowed range is from 0 to 65535.
  4454. @item tolerance
  4455. Set tolerance for difference amplification. Any difference lower to
  4456. this value will not alter source pixel. Default is 0.
  4457. Allowed range is from 0 to 65535.
  4458. @item low
  4459. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4460. This option controls maximum possible value that will decrease source pixel value.
  4461. @item high
  4462. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4463. This option controls maximum possible value that will increase source pixel value.
  4464. @item planes
  4465. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  4466. @end table
  4467. @section ass
  4468. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4469. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4470. Substation Alpha) subtitles files.
  4471. This filter accepts the following option in addition to the common options from
  4472. the @ref{subtitles} filter:
  4473. @table @option
  4474. @item shaping
  4475. Set the shaping engine
  4476. Available values are:
  4477. @table @samp
  4478. @item auto
  4479. The default libass shaping engine, which is the best available.
  4480. @item simple
  4481. Fast, font-agnostic shaper that can do only substitutions
  4482. @item complex
  4483. Slower shaper using OpenType for substitutions and positioning
  4484. @end table
  4485. The default is @code{auto}.
  4486. @end table
  4487. @section atadenoise
  4488. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4489. The filter accepts the following options:
  4490. @table @option
  4491. @item 0a
  4492. Set threshold A for 1st plane. Default is 0.02.
  4493. Valid range is 0 to 0.3.
  4494. @item 0b
  4495. Set threshold B for 1st plane. Default is 0.04.
  4496. Valid range is 0 to 5.
  4497. @item 1a
  4498. Set threshold A for 2nd plane. Default is 0.02.
  4499. Valid range is 0 to 0.3.
  4500. @item 1b
  4501. Set threshold B for 2nd plane. Default is 0.04.
  4502. Valid range is 0 to 5.
  4503. @item 2a
  4504. Set threshold A for 3rd plane. Default is 0.02.
  4505. Valid range is 0 to 0.3.
  4506. @item 2b
  4507. Set threshold B for 3rd plane. Default is 0.04.
  4508. Valid range is 0 to 5.
  4509. Threshold A is designed to react on abrupt changes in the input signal and
  4510. threshold B is designed to react on continuous changes in the input signal.
  4511. @item s
  4512. Set number of frames filter will use for averaging. Default is 9. Must be odd
  4513. number in range [5, 129].
  4514. @item p
  4515. Set what planes of frame filter will use for averaging. Default is all.
  4516. @end table
  4517. @section avgblur
  4518. Apply average blur filter.
  4519. The filter accepts the following options:
  4520. @table @option
  4521. @item sizeX
  4522. Set horizontal radius size.
  4523. @item planes
  4524. Set which planes to filter. By default all planes are filtered.
  4525. @item sizeY
  4526. Set vertical radius size, if zero it will be same as @code{sizeX}.
  4527. Default is @code{0}.
  4528. @end table
  4529. @section bbox
  4530. Compute the bounding box for the non-black pixels in the input frame
  4531. luminance plane.
  4532. This filter computes the bounding box containing all the pixels with a
  4533. luminance value greater than the minimum allowed value.
  4534. The parameters describing the bounding box are printed on the filter
  4535. log.
  4536. The filter accepts the following option:
  4537. @table @option
  4538. @item min_val
  4539. Set the minimal luminance value. Default is @code{16}.
  4540. @end table
  4541. @section bitplanenoise
  4542. Show and measure bit plane noise.
  4543. The filter accepts the following options:
  4544. @table @option
  4545. @item bitplane
  4546. Set which plane to analyze. Default is @code{1}.
  4547. @item filter
  4548. Filter out noisy pixels from @code{bitplane} set above.
  4549. Default is disabled.
  4550. @end table
  4551. @section blackdetect
  4552. Detect video intervals that are (almost) completely black. Can be
  4553. useful to detect chapter transitions, commercials, or invalid
  4554. recordings. Output lines contains the time for the start, end and
  4555. duration of the detected black interval expressed in seconds.
  4556. In order to display the output lines, you need to set the loglevel at
  4557. least to the AV_LOG_INFO value.
  4558. The filter accepts the following options:
  4559. @table @option
  4560. @item black_min_duration, d
  4561. Set the minimum detected black duration expressed in seconds. It must
  4562. be a non-negative floating point number.
  4563. Default value is 2.0.
  4564. @item picture_black_ratio_th, pic_th
  4565. Set the threshold for considering a picture "black".
  4566. Express the minimum value for the ratio:
  4567. @example
  4568. @var{nb_black_pixels} / @var{nb_pixels}
  4569. @end example
  4570. for which a picture is considered black.
  4571. Default value is 0.98.
  4572. @item pixel_black_th, pix_th
  4573. Set the threshold for considering a pixel "black".
  4574. The threshold expresses the maximum pixel luminance value for which a
  4575. pixel is considered "black". The provided value is scaled according to
  4576. the following equation:
  4577. @example
  4578. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  4579. @end example
  4580. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  4581. the input video format, the range is [0-255] for YUV full-range
  4582. formats and [16-235] for YUV non full-range formats.
  4583. Default value is 0.10.
  4584. @end table
  4585. The following example sets the maximum pixel threshold to the minimum
  4586. value, and detects only black intervals of 2 or more seconds:
  4587. @example
  4588. blackdetect=d=2:pix_th=0.00
  4589. @end example
  4590. @section blackframe
  4591. Detect frames that are (almost) completely black. Can be useful to
  4592. detect chapter transitions or commercials. Output lines consist of
  4593. the frame number of the detected frame, the percentage of blackness,
  4594. the position in the file if known or -1 and the timestamp in seconds.
  4595. In order to display the output lines, you need to set the loglevel at
  4596. least to the AV_LOG_INFO value.
  4597. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  4598. The value represents the percentage of pixels in the picture that
  4599. are below the threshold value.
  4600. It accepts the following parameters:
  4601. @table @option
  4602. @item amount
  4603. The percentage of the pixels that have to be below the threshold; it defaults to
  4604. @code{98}.
  4605. @item threshold, thresh
  4606. The threshold below which a pixel value is considered black; it defaults to
  4607. @code{32}.
  4608. @end table
  4609. @section blend, tblend
  4610. Blend two video frames into each other.
  4611. The @code{blend} filter takes two input streams and outputs one
  4612. stream, the first input is the "top" layer and second input is
  4613. "bottom" layer. By default, the output terminates when the longest input terminates.
  4614. The @code{tblend} (time blend) filter takes two consecutive frames
  4615. from one single stream, and outputs the result obtained by blending
  4616. the new frame on top of the old frame.
  4617. A description of the accepted options follows.
  4618. @table @option
  4619. @item c0_mode
  4620. @item c1_mode
  4621. @item c2_mode
  4622. @item c3_mode
  4623. @item all_mode
  4624. Set blend mode for specific pixel component or all pixel components in case
  4625. of @var{all_mode}. Default value is @code{normal}.
  4626. Available values for component modes are:
  4627. @table @samp
  4628. @item addition
  4629. @item grainmerge
  4630. @item and
  4631. @item average
  4632. @item burn
  4633. @item darken
  4634. @item difference
  4635. @item grainextract
  4636. @item divide
  4637. @item dodge
  4638. @item freeze
  4639. @item exclusion
  4640. @item extremity
  4641. @item glow
  4642. @item hardlight
  4643. @item hardmix
  4644. @item heat
  4645. @item lighten
  4646. @item linearlight
  4647. @item multiply
  4648. @item multiply128
  4649. @item negation
  4650. @item normal
  4651. @item or
  4652. @item overlay
  4653. @item phoenix
  4654. @item pinlight
  4655. @item reflect
  4656. @item screen
  4657. @item softlight
  4658. @item subtract
  4659. @item vividlight
  4660. @item xor
  4661. @end table
  4662. @item c0_opacity
  4663. @item c1_opacity
  4664. @item c2_opacity
  4665. @item c3_opacity
  4666. @item all_opacity
  4667. Set blend opacity for specific pixel component or all pixel components in case
  4668. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  4669. @item c0_expr
  4670. @item c1_expr
  4671. @item c2_expr
  4672. @item c3_expr
  4673. @item all_expr
  4674. Set blend expression for specific pixel component or all pixel components in case
  4675. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  4676. The expressions can use the following variables:
  4677. @table @option
  4678. @item N
  4679. The sequential number of the filtered frame, starting from @code{0}.
  4680. @item X
  4681. @item Y
  4682. the coordinates of the current sample
  4683. @item W
  4684. @item H
  4685. the width and height of currently filtered plane
  4686. @item SW
  4687. @item SH
  4688. Width and height scale for the plane being filtered. It is the
  4689. ratio between the dimensions of the current plane to the luma plane,
  4690. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  4691. the luma plane and @code{0.5,0.5} for the chroma planes.
  4692. @item T
  4693. Time of the current frame, expressed in seconds.
  4694. @item TOP, A
  4695. Value of pixel component at current location for first video frame (top layer).
  4696. @item BOTTOM, B
  4697. Value of pixel component at current location for second video frame (bottom layer).
  4698. @end table
  4699. @end table
  4700. The @code{blend} filter also supports the @ref{framesync} options.
  4701. @subsection Examples
  4702. @itemize
  4703. @item
  4704. Apply transition from bottom layer to top layer in first 10 seconds:
  4705. @example
  4706. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  4707. @end example
  4708. @item
  4709. Apply linear horizontal transition from top layer to bottom layer:
  4710. @example
  4711. blend=all_expr='A*(X/W)+B*(1-X/W)'
  4712. @end example
  4713. @item
  4714. Apply 1x1 checkerboard effect:
  4715. @example
  4716. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  4717. @end example
  4718. @item
  4719. Apply uncover left effect:
  4720. @example
  4721. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  4722. @end example
  4723. @item
  4724. Apply uncover down effect:
  4725. @example
  4726. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  4727. @end example
  4728. @item
  4729. Apply uncover up-left effect:
  4730. @example
  4731. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  4732. @end example
  4733. @item
  4734. Split diagonally video and shows top and bottom layer on each side:
  4735. @example
  4736. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  4737. @end example
  4738. @item
  4739. Display differences between the current and the previous frame:
  4740. @example
  4741. tblend=all_mode=grainextract
  4742. @end example
  4743. @end itemize
  4744. @section bm3d
  4745. Denoise frames using Block-Matching 3D algorithm.
  4746. The filter accepts the following options.
  4747. @table @option
  4748. @item sigma
  4749. Set denoising strength. Default value is 1.
  4750. Allowed range is from 0 to 999.9.
  4751. The denoising algorithm is very sensitive to sigma, so adjust it
  4752. according to the source.
  4753. @item block
  4754. Set local patch size. This sets dimensions in 2D.
  4755. @item bstep
  4756. Set sliding step for processing blocks. Default value is 4.
  4757. Allowed range is from 1 to 64.
  4758. Smaller values allows processing more reference blocks and is slower.
  4759. @item group
  4760. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  4761. When set to 1, no block matching is done. Larger values allows more blocks
  4762. in single group.
  4763. Allowed range is from 1 to 256.
  4764. @item range
  4765. Set radius for search block matching. Default is 9.
  4766. Allowed range is from 1 to INT32_MAX.
  4767. @item mstep
  4768. Set step between two search locations for block matching. Default is 1.
  4769. Allowed range is from 1 to 64. Smaller is slower.
  4770. @item thmse
  4771. Set threshold of mean square error for block matching. Valid range is 0 to
  4772. INT32_MAX.
  4773. @item hdthr
  4774. Set thresholding parameter for hard thresholding in 3D transformed domain.
  4775. Larger values results in stronger hard-thresholding filtering in frequency
  4776. domain.
  4777. @item estim
  4778. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  4779. Default is @code{basic}.
  4780. @item ref
  4781. If enabled, filter will use 2nd stream for block matching.
  4782. Default is disabled for @code{basic} value of @var{estim} option,
  4783. and always enabled if value of @var{estim} is @code{final}.
  4784. @item planes
  4785. Set planes to filter. Default is all available except alpha.
  4786. @end table
  4787. @subsection Examples
  4788. @itemize
  4789. @item
  4790. Basic filtering with bm3d:
  4791. @example
  4792. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  4793. @end example
  4794. @item
  4795. Same as above, but filtering only luma:
  4796. @example
  4797. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  4798. @end example
  4799. @item
  4800. Same as above, but with both estimation modes:
  4801. @example
  4802. 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
  4803. @end example
  4804. @item
  4805. Same as above, but prefilter with @ref{nlmeans} filter instead:
  4806. @example
  4807. 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
  4808. @end example
  4809. @end itemize
  4810. @section boxblur
  4811. Apply a boxblur algorithm to the input video.
  4812. It accepts the following parameters:
  4813. @table @option
  4814. @item luma_radius, lr
  4815. @item luma_power, lp
  4816. @item chroma_radius, cr
  4817. @item chroma_power, cp
  4818. @item alpha_radius, ar
  4819. @item alpha_power, ap
  4820. @end table
  4821. A description of the accepted options follows.
  4822. @table @option
  4823. @item luma_radius, lr
  4824. @item chroma_radius, cr
  4825. @item alpha_radius, ar
  4826. Set an expression for the box radius in pixels used for blurring the
  4827. corresponding input plane.
  4828. The radius value must be a non-negative number, and must not be
  4829. greater than the value of the expression @code{min(w,h)/2} for the
  4830. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  4831. planes.
  4832. Default value for @option{luma_radius} is "2". If not specified,
  4833. @option{chroma_radius} and @option{alpha_radius} default to the
  4834. corresponding value set for @option{luma_radius}.
  4835. The expressions can contain the following constants:
  4836. @table @option
  4837. @item w
  4838. @item h
  4839. The input width and height in pixels.
  4840. @item cw
  4841. @item ch
  4842. The input chroma image width and height in pixels.
  4843. @item hsub
  4844. @item vsub
  4845. The horizontal and vertical chroma subsample values. For example, for the
  4846. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  4847. @end table
  4848. @item luma_power, lp
  4849. @item chroma_power, cp
  4850. @item alpha_power, ap
  4851. Specify how many times the boxblur filter is applied to the
  4852. corresponding plane.
  4853. Default value for @option{luma_power} is 2. If not specified,
  4854. @option{chroma_power} and @option{alpha_power} default to the
  4855. corresponding value set for @option{luma_power}.
  4856. A value of 0 will disable the effect.
  4857. @end table
  4858. @subsection Examples
  4859. @itemize
  4860. @item
  4861. Apply a boxblur filter with the luma, chroma, and alpha radii
  4862. set to 2:
  4863. @example
  4864. boxblur=luma_radius=2:luma_power=1
  4865. boxblur=2:1
  4866. @end example
  4867. @item
  4868. Set the luma radius to 2, and alpha and chroma radius to 0:
  4869. @example
  4870. boxblur=2:1:cr=0:ar=0
  4871. @end example
  4872. @item
  4873. Set the luma and chroma radii to a fraction of the video dimension:
  4874. @example
  4875. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  4876. @end example
  4877. @end itemize
  4878. @section bwdif
  4879. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  4880. Deinterlacing Filter").
  4881. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  4882. interpolation algorithms.
  4883. It accepts the following parameters:
  4884. @table @option
  4885. @item mode
  4886. The interlacing mode to adopt. It accepts one of the following values:
  4887. @table @option
  4888. @item 0, send_frame
  4889. Output one frame for each frame.
  4890. @item 1, send_field
  4891. Output one frame for each field.
  4892. @end table
  4893. The default value is @code{send_field}.
  4894. @item parity
  4895. The picture field parity assumed for the input interlaced video. It accepts one
  4896. of the following values:
  4897. @table @option
  4898. @item 0, tff
  4899. Assume the top field is first.
  4900. @item 1, bff
  4901. Assume the bottom field is first.
  4902. @item -1, auto
  4903. Enable automatic detection of field parity.
  4904. @end table
  4905. The default value is @code{auto}.
  4906. If the interlacing is unknown or the decoder does not export this information,
  4907. top field first will be assumed.
  4908. @item deint
  4909. Specify which frames to deinterlace. Accept one of the following
  4910. values:
  4911. @table @option
  4912. @item 0, all
  4913. Deinterlace all frames.
  4914. @item 1, interlaced
  4915. Only deinterlace frames marked as interlaced.
  4916. @end table
  4917. The default value is @code{all}.
  4918. @end table
  4919. @section chromahold
  4920. Remove all color information for all colors except for certain one.
  4921. The filter accepts the following options:
  4922. @table @option
  4923. @item color
  4924. The color which will not be replaced with neutral chroma.
  4925. @item similarity
  4926. Similarity percentage with the above color.
  4927. 0.01 matches only the exact key color, while 1.0 matches everything.
  4928. @item yuv
  4929. Signals that the color passed is already in YUV instead of RGB.
  4930. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  4931. This can be used to pass exact YUV values as hexadecimal numbers.
  4932. @end table
  4933. @section chromakey
  4934. YUV colorspace color/chroma keying.
  4935. The filter accepts the following options:
  4936. @table @option
  4937. @item color
  4938. The color which will be replaced with transparency.
  4939. @item similarity
  4940. Similarity percentage with the key color.
  4941. 0.01 matches only the exact key color, while 1.0 matches everything.
  4942. @item blend
  4943. Blend percentage.
  4944. 0.0 makes pixels either fully transparent, or not transparent at all.
  4945. Higher values result in semi-transparent pixels, with a higher transparency
  4946. the more similar the pixels color is to the key color.
  4947. @item yuv
  4948. Signals that the color passed is already in YUV instead of RGB.
  4949. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  4950. This can be used to pass exact YUV values as hexadecimal numbers.
  4951. @end table
  4952. @subsection Examples
  4953. @itemize
  4954. @item
  4955. Make every green pixel in the input image transparent:
  4956. @example
  4957. ffmpeg -i input.png -vf chromakey=green out.png
  4958. @end example
  4959. @item
  4960. Overlay a greenscreen-video on top of a static black background.
  4961. @example
  4962. 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
  4963. @end example
  4964. @end itemize
  4965. @section chromashift
  4966. Shift chroma pixels horizontally and/or vertically.
  4967. The filter accepts the following options:
  4968. @table @option
  4969. @item cbh
  4970. Set amount to shift chroma-blue horizontally.
  4971. @item cbv
  4972. Set amount to shift chroma-blue vertically.
  4973. @item crh
  4974. Set amount to shift chroma-red horizontally.
  4975. @item crv
  4976. Set amount to shift chroma-red vertically.
  4977. @item edge
  4978. Set edge mode, can be @var{smear}, default, or @var{warp}.
  4979. @end table
  4980. @section ciescope
  4981. Display CIE color diagram with pixels overlaid onto it.
  4982. The filter accepts the following options:
  4983. @table @option
  4984. @item system
  4985. Set color system.
  4986. @table @samp
  4987. @item ntsc, 470m
  4988. @item ebu, 470bg
  4989. @item smpte
  4990. @item 240m
  4991. @item apple
  4992. @item widergb
  4993. @item cie1931
  4994. @item rec709, hdtv
  4995. @item uhdtv, rec2020
  4996. @end table
  4997. @item cie
  4998. Set CIE system.
  4999. @table @samp
  5000. @item xyy
  5001. @item ucs
  5002. @item luv
  5003. @end table
  5004. @item gamuts
  5005. Set what gamuts to draw.
  5006. See @code{system} option for available values.
  5007. @item size, s
  5008. Set ciescope size, by default set to 512.
  5009. @item intensity, i
  5010. Set intensity used to map input pixel values to CIE diagram.
  5011. @item contrast
  5012. Set contrast used to draw tongue colors that are out of active color system gamut.
  5013. @item corrgamma
  5014. Correct gamma displayed on scope, by default enabled.
  5015. @item showwhite
  5016. Show white point on CIE diagram, by default disabled.
  5017. @item gamma
  5018. Set input gamma. Used only with XYZ input color space.
  5019. @end table
  5020. @section codecview
  5021. Visualize information exported by some codecs.
  5022. Some codecs can export information through frames using side-data or other
  5023. means. For example, some MPEG based codecs export motion vectors through the
  5024. @var{export_mvs} flag in the codec @option{flags2} option.
  5025. The filter accepts the following option:
  5026. @table @option
  5027. @item mv
  5028. Set motion vectors to visualize.
  5029. Available flags for @var{mv} are:
  5030. @table @samp
  5031. @item pf
  5032. forward predicted MVs of P-frames
  5033. @item bf
  5034. forward predicted MVs of B-frames
  5035. @item bb
  5036. backward predicted MVs of B-frames
  5037. @end table
  5038. @item qp
  5039. Display quantization parameters using the chroma planes.
  5040. @item mv_type, mvt
  5041. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  5042. Available flags for @var{mv_type} are:
  5043. @table @samp
  5044. @item fp
  5045. forward predicted MVs
  5046. @item bp
  5047. backward predicted MVs
  5048. @end table
  5049. @item frame_type, ft
  5050. Set frame type to visualize motion vectors of.
  5051. Available flags for @var{frame_type} are:
  5052. @table @samp
  5053. @item if
  5054. intra-coded frames (I-frames)
  5055. @item pf
  5056. predicted frames (P-frames)
  5057. @item bf
  5058. bi-directionally predicted frames (B-frames)
  5059. @end table
  5060. @end table
  5061. @subsection Examples
  5062. @itemize
  5063. @item
  5064. Visualize forward predicted MVs of all frames using @command{ffplay}:
  5065. @example
  5066. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  5067. @end example
  5068. @item
  5069. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  5070. @example
  5071. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  5072. @end example
  5073. @end itemize
  5074. @section colorbalance
  5075. Modify intensity of primary colors (red, green and blue) of input frames.
  5076. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  5077. regions for the red-cyan, green-magenta or blue-yellow balance.
  5078. A positive adjustment value shifts the balance towards the primary color, a negative
  5079. value towards the complementary color.
  5080. The filter accepts the following options:
  5081. @table @option
  5082. @item rs
  5083. @item gs
  5084. @item bs
  5085. Adjust red, green and blue shadows (darkest pixels).
  5086. @item rm
  5087. @item gm
  5088. @item bm
  5089. Adjust red, green and blue midtones (medium pixels).
  5090. @item rh
  5091. @item gh
  5092. @item bh
  5093. Adjust red, green and blue highlights (brightest pixels).
  5094. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5095. @end table
  5096. @subsection Examples
  5097. @itemize
  5098. @item
  5099. Add red color cast to shadows:
  5100. @example
  5101. colorbalance=rs=.3
  5102. @end example
  5103. @end itemize
  5104. @section colorkey
  5105. RGB colorspace color keying.
  5106. The filter accepts the following options:
  5107. @table @option
  5108. @item color
  5109. The color which will be replaced with transparency.
  5110. @item similarity
  5111. Similarity percentage with the key color.
  5112. 0.01 matches only the exact key color, while 1.0 matches everything.
  5113. @item blend
  5114. Blend percentage.
  5115. 0.0 makes pixels either fully transparent, or not transparent at all.
  5116. Higher values result in semi-transparent pixels, with a higher transparency
  5117. the more similar the pixels color is to the key color.
  5118. @end table
  5119. @subsection Examples
  5120. @itemize
  5121. @item
  5122. Make every green pixel in the input image transparent:
  5123. @example
  5124. ffmpeg -i input.png -vf colorkey=green out.png
  5125. @end example
  5126. @item
  5127. Overlay a greenscreen-video on top of a static background image.
  5128. @example
  5129. 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
  5130. @end example
  5131. @end itemize
  5132. @section colorlevels
  5133. Adjust video input frames using levels.
  5134. The filter accepts the following options:
  5135. @table @option
  5136. @item rimin
  5137. @item gimin
  5138. @item bimin
  5139. @item aimin
  5140. Adjust red, green, blue and alpha input black point.
  5141. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  5142. @item rimax
  5143. @item gimax
  5144. @item bimax
  5145. @item aimax
  5146. Adjust red, green, blue and alpha input white point.
  5147. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  5148. Input levels are used to lighten highlights (bright tones), darken shadows
  5149. (dark tones), change the balance of bright and dark tones.
  5150. @item romin
  5151. @item gomin
  5152. @item bomin
  5153. @item aomin
  5154. Adjust red, green, blue and alpha output black point.
  5155. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  5156. @item romax
  5157. @item gomax
  5158. @item bomax
  5159. @item aomax
  5160. Adjust red, green, blue and alpha output white point.
  5161. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  5162. Output levels allows manual selection of a constrained output level range.
  5163. @end table
  5164. @subsection Examples
  5165. @itemize
  5166. @item
  5167. Make video output darker:
  5168. @example
  5169. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  5170. @end example
  5171. @item
  5172. Increase contrast:
  5173. @example
  5174. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  5175. @end example
  5176. @item
  5177. Make video output lighter:
  5178. @example
  5179. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  5180. @end example
  5181. @item
  5182. Increase brightness:
  5183. @example
  5184. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  5185. @end example
  5186. @end itemize
  5187. @section colorchannelmixer
  5188. Adjust video input frames by re-mixing color channels.
  5189. This filter modifies a color channel by adding the values associated to
  5190. the other channels of the same pixels. For example if the value to
  5191. modify is red, the output value will be:
  5192. @example
  5193. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  5194. @end example
  5195. The filter accepts the following options:
  5196. @table @option
  5197. @item rr
  5198. @item rg
  5199. @item rb
  5200. @item ra
  5201. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  5202. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  5203. @item gr
  5204. @item gg
  5205. @item gb
  5206. @item ga
  5207. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  5208. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  5209. @item br
  5210. @item bg
  5211. @item bb
  5212. @item ba
  5213. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  5214. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  5215. @item ar
  5216. @item ag
  5217. @item ab
  5218. @item aa
  5219. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  5220. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  5221. Allowed ranges for options are @code{[-2.0, 2.0]}.
  5222. @end table
  5223. @subsection Examples
  5224. @itemize
  5225. @item
  5226. Convert source to grayscale:
  5227. @example
  5228. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  5229. @end example
  5230. @item
  5231. Simulate sepia tones:
  5232. @example
  5233. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  5234. @end example
  5235. @end itemize
  5236. @section colormatrix
  5237. Convert color matrix.
  5238. The filter accepts the following options:
  5239. @table @option
  5240. @item src
  5241. @item dst
  5242. Specify the source and destination color matrix. Both values must be
  5243. specified.
  5244. The accepted values are:
  5245. @table @samp
  5246. @item bt709
  5247. BT.709
  5248. @item fcc
  5249. FCC
  5250. @item bt601
  5251. BT.601
  5252. @item bt470
  5253. BT.470
  5254. @item bt470bg
  5255. BT.470BG
  5256. @item smpte170m
  5257. SMPTE-170M
  5258. @item smpte240m
  5259. SMPTE-240M
  5260. @item bt2020
  5261. BT.2020
  5262. @end table
  5263. @end table
  5264. For example to convert from BT.601 to SMPTE-240M, use the command:
  5265. @example
  5266. colormatrix=bt601:smpte240m
  5267. @end example
  5268. @section colorspace
  5269. Convert colorspace, transfer characteristics or color primaries.
  5270. Input video needs to have an even size.
  5271. The filter accepts the following options:
  5272. @table @option
  5273. @anchor{all}
  5274. @item all
  5275. Specify all color properties at once.
  5276. The accepted values are:
  5277. @table @samp
  5278. @item bt470m
  5279. BT.470M
  5280. @item bt470bg
  5281. BT.470BG
  5282. @item bt601-6-525
  5283. BT.601-6 525
  5284. @item bt601-6-625
  5285. BT.601-6 625
  5286. @item bt709
  5287. BT.709
  5288. @item smpte170m
  5289. SMPTE-170M
  5290. @item smpte240m
  5291. SMPTE-240M
  5292. @item bt2020
  5293. BT.2020
  5294. @end table
  5295. @anchor{space}
  5296. @item space
  5297. Specify output colorspace.
  5298. The accepted values are:
  5299. @table @samp
  5300. @item bt709
  5301. BT.709
  5302. @item fcc
  5303. FCC
  5304. @item bt470bg
  5305. BT.470BG or BT.601-6 625
  5306. @item smpte170m
  5307. SMPTE-170M or BT.601-6 525
  5308. @item smpte240m
  5309. SMPTE-240M
  5310. @item ycgco
  5311. YCgCo
  5312. @item bt2020ncl
  5313. BT.2020 with non-constant luminance
  5314. @end table
  5315. @anchor{trc}
  5316. @item trc
  5317. Specify output transfer characteristics.
  5318. The accepted values are:
  5319. @table @samp
  5320. @item bt709
  5321. BT.709
  5322. @item bt470m
  5323. BT.470M
  5324. @item bt470bg
  5325. BT.470BG
  5326. @item gamma22
  5327. Constant gamma of 2.2
  5328. @item gamma28
  5329. Constant gamma of 2.8
  5330. @item smpte170m
  5331. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  5332. @item smpte240m
  5333. SMPTE-240M
  5334. @item srgb
  5335. SRGB
  5336. @item iec61966-2-1
  5337. iec61966-2-1
  5338. @item iec61966-2-4
  5339. iec61966-2-4
  5340. @item xvycc
  5341. xvycc
  5342. @item bt2020-10
  5343. BT.2020 for 10-bits content
  5344. @item bt2020-12
  5345. BT.2020 for 12-bits content
  5346. @end table
  5347. @anchor{primaries}
  5348. @item primaries
  5349. Specify output color primaries.
  5350. The accepted values are:
  5351. @table @samp
  5352. @item bt709
  5353. BT.709
  5354. @item bt470m
  5355. BT.470M
  5356. @item bt470bg
  5357. BT.470BG or BT.601-6 625
  5358. @item smpte170m
  5359. SMPTE-170M or BT.601-6 525
  5360. @item smpte240m
  5361. SMPTE-240M
  5362. @item film
  5363. film
  5364. @item smpte431
  5365. SMPTE-431
  5366. @item smpte432
  5367. SMPTE-432
  5368. @item bt2020
  5369. BT.2020
  5370. @item jedec-p22
  5371. JEDEC P22 phosphors
  5372. @end table
  5373. @anchor{range}
  5374. @item range
  5375. Specify output color range.
  5376. The accepted values are:
  5377. @table @samp
  5378. @item tv
  5379. TV (restricted) range
  5380. @item mpeg
  5381. MPEG (restricted) range
  5382. @item pc
  5383. PC (full) range
  5384. @item jpeg
  5385. JPEG (full) range
  5386. @end table
  5387. @item format
  5388. Specify output color format.
  5389. The accepted values are:
  5390. @table @samp
  5391. @item yuv420p
  5392. YUV 4:2:0 planar 8-bits
  5393. @item yuv420p10
  5394. YUV 4:2:0 planar 10-bits
  5395. @item yuv420p12
  5396. YUV 4:2:0 planar 12-bits
  5397. @item yuv422p
  5398. YUV 4:2:2 planar 8-bits
  5399. @item yuv422p10
  5400. YUV 4:2:2 planar 10-bits
  5401. @item yuv422p12
  5402. YUV 4:2:2 planar 12-bits
  5403. @item yuv444p
  5404. YUV 4:4:4 planar 8-bits
  5405. @item yuv444p10
  5406. YUV 4:4:4 planar 10-bits
  5407. @item yuv444p12
  5408. YUV 4:4:4 planar 12-bits
  5409. @end table
  5410. @item fast
  5411. Do a fast conversion, which skips gamma/primary correction. This will take
  5412. significantly less CPU, but will be mathematically incorrect. To get output
  5413. compatible with that produced by the colormatrix filter, use fast=1.
  5414. @item dither
  5415. Specify dithering mode.
  5416. The accepted values are:
  5417. @table @samp
  5418. @item none
  5419. No dithering
  5420. @item fsb
  5421. Floyd-Steinberg dithering
  5422. @end table
  5423. @item wpadapt
  5424. Whitepoint adaptation mode.
  5425. The accepted values are:
  5426. @table @samp
  5427. @item bradford
  5428. Bradford whitepoint adaptation
  5429. @item vonkries
  5430. von Kries whitepoint adaptation
  5431. @item identity
  5432. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  5433. @end table
  5434. @item iall
  5435. Override all input properties at once. Same accepted values as @ref{all}.
  5436. @item ispace
  5437. Override input colorspace. Same accepted values as @ref{space}.
  5438. @item iprimaries
  5439. Override input color primaries. Same accepted values as @ref{primaries}.
  5440. @item itrc
  5441. Override input transfer characteristics. Same accepted values as @ref{trc}.
  5442. @item irange
  5443. Override input color range. Same accepted values as @ref{range}.
  5444. @end table
  5445. The filter converts the transfer characteristics, color space and color
  5446. primaries to the specified user values. The output value, if not specified,
  5447. is set to a default value based on the "all" property. If that property is
  5448. also not specified, the filter will log an error. The output color range and
  5449. format default to the same value as the input color range and format. The
  5450. input transfer characteristics, color space, color primaries and color range
  5451. should be set on the input data. If any of these are missing, the filter will
  5452. log an error and no conversion will take place.
  5453. For example to convert the input to SMPTE-240M, use the command:
  5454. @example
  5455. colorspace=smpte240m
  5456. @end example
  5457. @section convolution
  5458. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  5459. The filter accepts the following options:
  5460. @table @option
  5461. @item 0m
  5462. @item 1m
  5463. @item 2m
  5464. @item 3m
  5465. Set matrix for each plane.
  5466. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  5467. and from 1 to 49 odd number of signed integers in @var{row} mode.
  5468. @item 0rdiv
  5469. @item 1rdiv
  5470. @item 2rdiv
  5471. @item 3rdiv
  5472. Set multiplier for calculated value for each plane.
  5473. If unset or 0, it will be sum of all matrix elements.
  5474. @item 0bias
  5475. @item 1bias
  5476. @item 2bias
  5477. @item 3bias
  5478. Set bias for each plane. This value is added to the result of the multiplication.
  5479. Useful for making the overall image brighter or darker. Default is 0.0.
  5480. @item 0mode
  5481. @item 1mode
  5482. @item 2mode
  5483. @item 3mode
  5484. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  5485. Default is @var{square}.
  5486. @end table
  5487. @subsection Examples
  5488. @itemize
  5489. @item
  5490. Apply sharpen:
  5491. @example
  5492. 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"
  5493. @end example
  5494. @item
  5495. Apply blur:
  5496. @example
  5497. 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"
  5498. @end example
  5499. @item
  5500. Apply edge enhance:
  5501. @example
  5502. 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"
  5503. @end example
  5504. @item
  5505. Apply edge detect:
  5506. @example
  5507. 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"
  5508. @end example
  5509. @item
  5510. Apply laplacian edge detector which includes diagonals:
  5511. @example
  5512. 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"
  5513. @end example
  5514. @item
  5515. Apply emboss:
  5516. @example
  5517. 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"
  5518. @end example
  5519. @end itemize
  5520. @section convolve
  5521. Apply 2D convolution of video stream in frequency domain using second stream
  5522. as impulse.
  5523. The filter accepts the following options:
  5524. @table @option
  5525. @item planes
  5526. Set which planes to process.
  5527. @item impulse
  5528. Set which impulse video frames will be processed, can be @var{first}
  5529. or @var{all}. Default is @var{all}.
  5530. @end table
  5531. The @code{convolve} filter also supports the @ref{framesync} options.
  5532. @section copy
  5533. Copy the input video source unchanged to the output. This is mainly useful for
  5534. testing purposes.
  5535. @anchor{coreimage}
  5536. @section coreimage
  5537. Video filtering on GPU using Apple's CoreImage API on OSX.
  5538. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  5539. processed by video hardware. However, software-based OpenGL implementations
  5540. exist which means there is no guarantee for hardware processing. It depends on
  5541. the respective OSX.
  5542. There are many filters and image generators provided by Apple that come with a
  5543. large variety of options. The filter has to be referenced by its name along
  5544. with its options.
  5545. The coreimage filter accepts the following options:
  5546. @table @option
  5547. @item list_filters
  5548. List all available filters and generators along with all their respective
  5549. options as well as possible minimum and maximum values along with the default
  5550. values.
  5551. @example
  5552. list_filters=true
  5553. @end example
  5554. @item filter
  5555. Specify all filters by their respective name and options.
  5556. Use @var{list_filters} to determine all valid filter names and options.
  5557. Numerical options are specified by a float value and are automatically clamped
  5558. to their respective value range. Vector and color options have to be specified
  5559. by a list of space separated float values. Character escaping has to be done.
  5560. A special option name @code{default} is available to use default options for a
  5561. filter.
  5562. It is required to specify either @code{default} or at least one of the filter options.
  5563. All omitted options are used with their default values.
  5564. The syntax of the filter string is as follows:
  5565. @example
  5566. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  5567. @end example
  5568. @item output_rect
  5569. Specify a rectangle where the output of the filter chain is copied into the
  5570. input image. It is given by a list of space separated float values:
  5571. @example
  5572. output_rect=x\ y\ width\ height
  5573. @end example
  5574. If not given, the output rectangle equals the dimensions of the input image.
  5575. The output rectangle is automatically cropped at the borders of the input
  5576. image. Negative values are valid for each component.
  5577. @example
  5578. output_rect=25\ 25\ 100\ 100
  5579. @end example
  5580. @end table
  5581. Several filters can be chained for successive processing without GPU-HOST
  5582. transfers allowing for fast processing of complex filter chains.
  5583. Currently, only filters with zero (generators) or exactly one (filters) input
  5584. image and one output image are supported. Also, transition filters are not yet
  5585. usable as intended.
  5586. Some filters generate output images with additional padding depending on the
  5587. respective filter kernel. The padding is automatically removed to ensure the
  5588. filter output has the same size as the input image.
  5589. For image generators, the size of the output image is determined by the
  5590. previous output image of the filter chain or the input image of the whole
  5591. filterchain, respectively. The generators do not use the pixel information of
  5592. this image to generate their output. However, the generated output is
  5593. blended onto this image, resulting in partial or complete coverage of the
  5594. output image.
  5595. The @ref{coreimagesrc} video source can be used for generating input images
  5596. which are directly fed into the filter chain. By using it, providing input
  5597. images by another video source or an input video is not required.
  5598. @subsection Examples
  5599. @itemize
  5600. @item
  5601. List all filters available:
  5602. @example
  5603. coreimage=list_filters=true
  5604. @end example
  5605. @item
  5606. Use the CIBoxBlur filter with default options to blur an image:
  5607. @example
  5608. coreimage=filter=CIBoxBlur@@default
  5609. @end example
  5610. @item
  5611. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  5612. its center at 100x100 and a radius of 50 pixels:
  5613. @example
  5614. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  5615. @end example
  5616. @item
  5617. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  5618. given as complete and escaped command-line for Apple's standard bash shell:
  5619. @example
  5620. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  5621. @end example
  5622. @end itemize
  5623. @section crop
  5624. Crop the input video to given dimensions.
  5625. It accepts the following parameters:
  5626. @table @option
  5627. @item w, out_w
  5628. The width of the output video. It defaults to @code{iw}.
  5629. This expression is evaluated only once during the filter
  5630. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  5631. @item h, out_h
  5632. The height of the output video. It defaults to @code{ih}.
  5633. This expression is evaluated only once during the filter
  5634. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  5635. @item x
  5636. The horizontal position, in the input video, of the left edge of the output
  5637. video. It defaults to @code{(in_w-out_w)/2}.
  5638. This expression is evaluated per-frame.
  5639. @item y
  5640. The vertical position, in the input video, of the top edge of the output video.
  5641. It defaults to @code{(in_h-out_h)/2}.
  5642. This expression is evaluated per-frame.
  5643. @item keep_aspect
  5644. If set to 1 will force the output display aspect ratio
  5645. to be the same of the input, by changing the output sample aspect
  5646. ratio. It defaults to 0.
  5647. @item exact
  5648. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  5649. width/height/x/y as specified and will not be rounded to nearest smaller value.
  5650. It defaults to 0.
  5651. @end table
  5652. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  5653. expressions containing the following constants:
  5654. @table @option
  5655. @item x
  5656. @item y
  5657. The computed values for @var{x} and @var{y}. They are evaluated for
  5658. each new frame.
  5659. @item in_w
  5660. @item in_h
  5661. The input width and height.
  5662. @item iw
  5663. @item ih
  5664. These are the same as @var{in_w} and @var{in_h}.
  5665. @item out_w
  5666. @item out_h
  5667. The output (cropped) width and height.
  5668. @item ow
  5669. @item oh
  5670. These are the same as @var{out_w} and @var{out_h}.
  5671. @item a
  5672. same as @var{iw} / @var{ih}
  5673. @item sar
  5674. input sample aspect ratio
  5675. @item dar
  5676. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  5677. @item hsub
  5678. @item vsub
  5679. horizontal and vertical chroma subsample values. For example for the
  5680. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5681. @item n
  5682. The number of the input frame, starting from 0.
  5683. @item pos
  5684. the position in the file of the input frame, NAN if unknown
  5685. @item t
  5686. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  5687. @end table
  5688. The expression for @var{out_w} may depend on the value of @var{out_h},
  5689. and the expression for @var{out_h} may depend on @var{out_w}, but they
  5690. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  5691. evaluated after @var{out_w} and @var{out_h}.
  5692. The @var{x} and @var{y} parameters specify the expressions for the
  5693. position of the top-left corner of the output (non-cropped) area. They
  5694. are evaluated for each frame. If the evaluated value is not valid, it
  5695. is approximated to the nearest valid value.
  5696. The expression for @var{x} may depend on @var{y}, and the expression
  5697. for @var{y} may depend on @var{x}.
  5698. @subsection Examples
  5699. @itemize
  5700. @item
  5701. Crop area with size 100x100 at position (12,34).
  5702. @example
  5703. crop=100:100:12:34
  5704. @end example
  5705. Using named options, the example above becomes:
  5706. @example
  5707. crop=w=100:h=100:x=12:y=34
  5708. @end example
  5709. @item
  5710. Crop the central input area with size 100x100:
  5711. @example
  5712. crop=100:100
  5713. @end example
  5714. @item
  5715. Crop the central input area with size 2/3 of the input video:
  5716. @example
  5717. crop=2/3*in_w:2/3*in_h
  5718. @end example
  5719. @item
  5720. Crop the input video central square:
  5721. @example
  5722. crop=out_w=in_h
  5723. crop=in_h
  5724. @end example
  5725. @item
  5726. Delimit the rectangle with the top-left corner placed at position
  5727. 100:100 and the right-bottom corner corresponding to the right-bottom
  5728. corner of the input image.
  5729. @example
  5730. crop=in_w-100:in_h-100:100:100
  5731. @end example
  5732. @item
  5733. Crop 10 pixels from the left and right borders, and 20 pixels from
  5734. the top and bottom borders
  5735. @example
  5736. crop=in_w-2*10:in_h-2*20
  5737. @end example
  5738. @item
  5739. Keep only the bottom right quarter of the input image:
  5740. @example
  5741. crop=in_w/2:in_h/2:in_w/2:in_h/2
  5742. @end example
  5743. @item
  5744. Crop height for getting Greek harmony:
  5745. @example
  5746. crop=in_w:1/PHI*in_w
  5747. @end example
  5748. @item
  5749. Apply trembling effect:
  5750. @example
  5751. 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)
  5752. @end example
  5753. @item
  5754. Apply erratic camera effect depending on timestamp:
  5755. @example
  5756. 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)"
  5757. @end example
  5758. @item
  5759. Set x depending on the value of y:
  5760. @example
  5761. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  5762. @end example
  5763. @end itemize
  5764. @subsection Commands
  5765. This filter supports the following commands:
  5766. @table @option
  5767. @item w, out_w
  5768. @item h, out_h
  5769. @item x
  5770. @item y
  5771. Set width/height of the output video and the horizontal/vertical position
  5772. in the input video.
  5773. The command accepts the same syntax of the corresponding option.
  5774. If the specified expression is not valid, it is kept at its current
  5775. value.
  5776. @end table
  5777. @section cropdetect
  5778. Auto-detect the crop size.
  5779. It calculates the necessary cropping parameters and prints the
  5780. recommended parameters via the logging system. The detected dimensions
  5781. correspond to the non-black area of the input video.
  5782. It accepts the following parameters:
  5783. @table @option
  5784. @item limit
  5785. Set higher black value threshold, which can be optionally specified
  5786. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  5787. value greater to the set value is considered non-black. It defaults to 24.
  5788. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  5789. on the bitdepth of the pixel format.
  5790. @item round
  5791. The value which the width/height should be divisible by. It defaults to
  5792. 16. The offset is automatically adjusted to center the video. Use 2 to
  5793. get only even dimensions (needed for 4:2:2 video). 16 is best when
  5794. encoding to most video codecs.
  5795. @item reset_count, reset
  5796. Set the counter that determines after how many frames cropdetect will
  5797. reset the previously detected largest video area and start over to
  5798. detect the current optimal crop area. Default value is 0.
  5799. This can be useful when channel logos distort the video area. 0
  5800. indicates 'never reset', and returns the largest area encountered during
  5801. playback.
  5802. @end table
  5803. @anchor{cue}
  5804. @section cue
  5805. Delay video filtering until a given wallclock timestamp. The filter first
  5806. passes on @option{preroll} amount of frames, then it buffers at most
  5807. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  5808. it forwards the buffered frames and also any subsequent frames coming in its
  5809. input.
  5810. The filter can be used synchronize the output of multiple ffmpeg processes for
  5811. realtime output devices like decklink. By putting the delay in the filtering
  5812. chain and pre-buffering frames the process can pass on data to output almost
  5813. immediately after the target wallclock timestamp is reached.
  5814. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  5815. some use cases.
  5816. @table @option
  5817. @item cue
  5818. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  5819. @item preroll
  5820. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  5821. @item buffer
  5822. The maximum duration of content to buffer before waiting for the cue expressed
  5823. in seconds. Default is 0.
  5824. @end table
  5825. @anchor{curves}
  5826. @section curves
  5827. Apply color adjustments using curves.
  5828. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  5829. component (red, green and blue) has its values defined by @var{N} key points
  5830. tied from each other using a smooth curve. The x-axis represents the pixel
  5831. values from the input frame, and the y-axis the new pixel values to be set for
  5832. the output frame.
  5833. By default, a component curve is defined by the two points @var{(0;0)} and
  5834. @var{(1;1)}. This creates a straight line where each original pixel value is
  5835. "adjusted" to its own value, which means no change to the image.
  5836. The filter allows you to redefine these two points and add some more. A new
  5837. curve (using a natural cubic spline interpolation) will be define to pass
  5838. smoothly through all these new coordinates. The new defined points needs to be
  5839. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  5840. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  5841. the vector spaces, the values will be clipped accordingly.
  5842. The filter accepts the following options:
  5843. @table @option
  5844. @item preset
  5845. Select one of the available color presets. This option can be used in addition
  5846. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  5847. options takes priority on the preset values.
  5848. Available presets are:
  5849. @table @samp
  5850. @item none
  5851. @item color_negative
  5852. @item cross_process
  5853. @item darker
  5854. @item increase_contrast
  5855. @item lighter
  5856. @item linear_contrast
  5857. @item medium_contrast
  5858. @item negative
  5859. @item strong_contrast
  5860. @item vintage
  5861. @end table
  5862. Default is @code{none}.
  5863. @item master, m
  5864. Set the master key points. These points will define a second pass mapping. It
  5865. is sometimes called a "luminance" or "value" mapping. It can be used with
  5866. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  5867. post-processing LUT.
  5868. @item red, r
  5869. Set the key points for the red component.
  5870. @item green, g
  5871. Set the key points for the green component.
  5872. @item blue, b
  5873. Set the key points for the blue component.
  5874. @item all
  5875. Set the key points for all components (not including master).
  5876. Can be used in addition to the other key points component
  5877. options. In this case, the unset component(s) will fallback on this
  5878. @option{all} setting.
  5879. @item psfile
  5880. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  5881. @item plot
  5882. Save Gnuplot script of the curves in specified file.
  5883. @end table
  5884. To avoid some filtergraph syntax conflicts, each key points list need to be
  5885. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  5886. @subsection Examples
  5887. @itemize
  5888. @item
  5889. Increase slightly the middle level of blue:
  5890. @example
  5891. curves=blue='0/0 0.5/0.58 1/1'
  5892. @end example
  5893. @item
  5894. Vintage effect:
  5895. @example
  5896. 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'
  5897. @end example
  5898. Here we obtain the following coordinates for each components:
  5899. @table @var
  5900. @item red
  5901. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  5902. @item green
  5903. @code{(0;0) (0.50;0.48) (1;1)}
  5904. @item blue
  5905. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  5906. @end table
  5907. @item
  5908. The previous example can also be achieved with the associated built-in preset:
  5909. @example
  5910. curves=preset=vintage
  5911. @end example
  5912. @item
  5913. Or simply:
  5914. @example
  5915. curves=vintage
  5916. @end example
  5917. @item
  5918. Use a Photoshop preset and redefine the points of the green component:
  5919. @example
  5920. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  5921. @end example
  5922. @item
  5923. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  5924. and @command{gnuplot}:
  5925. @example
  5926. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  5927. gnuplot -p /tmp/curves.plt
  5928. @end example
  5929. @end itemize
  5930. @section datascope
  5931. Video data analysis filter.
  5932. This filter shows hexadecimal pixel values of part of video.
  5933. The filter accepts the following options:
  5934. @table @option
  5935. @item size, s
  5936. Set output video size.
  5937. @item x
  5938. Set x offset from where to pick pixels.
  5939. @item y
  5940. Set y offset from where to pick pixels.
  5941. @item mode
  5942. Set scope mode, can be one of the following:
  5943. @table @samp
  5944. @item mono
  5945. Draw hexadecimal pixel values with white color on black background.
  5946. @item color
  5947. Draw hexadecimal pixel values with input video pixel color on black
  5948. background.
  5949. @item color2
  5950. Draw hexadecimal pixel values on color background picked from input video,
  5951. the text color is picked in such way so its always visible.
  5952. @end table
  5953. @item axis
  5954. Draw rows and columns numbers on left and top of video.
  5955. @item opacity
  5956. Set background opacity.
  5957. @end table
  5958. @section dctdnoiz
  5959. Denoise frames using 2D DCT (frequency domain filtering).
  5960. This filter is not designed for real time.
  5961. The filter accepts the following options:
  5962. @table @option
  5963. @item sigma, s
  5964. Set the noise sigma constant.
  5965. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  5966. coefficient (absolute value) below this threshold with be dropped.
  5967. If you need a more advanced filtering, see @option{expr}.
  5968. Default is @code{0}.
  5969. @item overlap
  5970. Set number overlapping pixels for each block. Since the filter can be slow, you
  5971. may want to reduce this value, at the cost of a less effective filter and the
  5972. risk of various artefacts.
  5973. If the overlapping value doesn't permit processing the whole input width or
  5974. height, a warning will be displayed and according borders won't be denoised.
  5975. Default value is @var{blocksize}-1, which is the best possible setting.
  5976. @item expr, e
  5977. Set the coefficient factor expression.
  5978. For each coefficient of a DCT block, this expression will be evaluated as a
  5979. multiplier value for the coefficient.
  5980. If this is option is set, the @option{sigma} option will be ignored.
  5981. The absolute value of the coefficient can be accessed through the @var{c}
  5982. variable.
  5983. @item n
  5984. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  5985. @var{blocksize}, which is the width and height of the processed blocks.
  5986. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  5987. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  5988. on the speed processing. Also, a larger block size does not necessarily means a
  5989. better de-noising.
  5990. @end table
  5991. @subsection Examples
  5992. Apply a denoise with a @option{sigma} of @code{4.5}:
  5993. @example
  5994. dctdnoiz=4.5
  5995. @end example
  5996. The same operation can be achieved using the expression system:
  5997. @example
  5998. dctdnoiz=e='gte(c, 4.5*3)'
  5999. @end example
  6000. Violent denoise using a block size of @code{16x16}:
  6001. @example
  6002. dctdnoiz=15:n=4
  6003. @end example
  6004. @section deband
  6005. Remove banding artifacts from input video.
  6006. It works by replacing banded pixels with average value of referenced pixels.
  6007. The filter accepts the following options:
  6008. @table @option
  6009. @item 1thr
  6010. @item 2thr
  6011. @item 3thr
  6012. @item 4thr
  6013. Set banding detection threshold for each plane. Default is 0.02.
  6014. Valid range is 0.00003 to 0.5.
  6015. If difference between current pixel and reference pixel is less than threshold,
  6016. it will be considered as banded.
  6017. @item range, r
  6018. Banding detection range in pixels. Default is 16. If positive, random number
  6019. in range 0 to set value will be used. If negative, exact absolute value
  6020. will be used.
  6021. The range defines square of four pixels around current pixel.
  6022. @item direction, d
  6023. Set direction in radians from which four pixel will be compared. If positive,
  6024. random direction from 0 to set direction will be picked. If negative, exact of
  6025. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  6026. will pick only pixels on same row and -PI/2 will pick only pixels on same
  6027. column.
  6028. @item blur, b
  6029. If enabled, current pixel is compared with average value of all four
  6030. surrounding pixels. The default is enabled. If disabled current pixel is
  6031. compared with all four surrounding pixels. The pixel is considered banded
  6032. if only all four differences with surrounding pixels are less than threshold.
  6033. @item coupling, c
  6034. If enabled, current pixel is changed if and only if all pixel components are banded,
  6035. e.g. banding detection threshold is triggered for all color components.
  6036. The default is disabled.
  6037. @end table
  6038. @section deblock
  6039. Remove blocking artifacts from input video.
  6040. The filter accepts the following options:
  6041. @table @option
  6042. @item filter
  6043. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  6044. This controls what kind of deblocking is applied.
  6045. @item block
  6046. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  6047. @item alpha
  6048. @item beta
  6049. @item gamma
  6050. @item delta
  6051. Set blocking detection thresholds. Allowed range is 0 to 1.
  6052. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  6053. Using higher threshold gives more deblocking strength.
  6054. Setting @var{alpha} controls threshold detection at exact edge of block.
  6055. Remaining options controls threshold detection near the edge. Each one for
  6056. below/above or left/right. Setting any of those to @var{0} disables
  6057. deblocking.
  6058. @item planes
  6059. Set planes to filter. Default is to filter all available planes.
  6060. @end table
  6061. @subsection Examples
  6062. @itemize
  6063. @item
  6064. Deblock using weak filter and block size of 4 pixels.
  6065. @example
  6066. deblock=filter=weak:block=4
  6067. @end example
  6068. @item
  6069. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  6070. deblocking more edges.
  6071. @example
  6072. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  6073. @end example
  6074. @item
  6075. Similar as above, but filter only first plane.
  6076. @example
  6077. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  6078. @end example
  6079. @item
  6080. Similar as above, but filter only second and third plane.
  6081. @example
  6082. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  6083. @end example
  6084. @end itemize
  6085. @anchor{decimate}
  6086. @section decimate
  6087. Drop duplicated frames at regular intervals.
  6088. The filter accepts the following options:
  6089. @table @option
  6090. @item cycle
  6091. Set the number of frames from which one will be dropped. Setting this to
  6092. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  6093. Default is @code{5}.
  6094. @item dupthresh
  6095. Set the threshold for duplicate detection. If the difference metric for a frame
  6096. is less than or equal to this value, then it is declared as duplicate. Default
  6097. is @code{1.1}
  6098. @item scthresh
  6099. Set scene change threshold. Default is @code{15}.
  6100. @item blockx
  6101. @item blocky
  6102. Set the size of the x and y-axis blocks used during metric calculations.
  6103. Larger blocks give better noise suppression, but also give worse detection of
  6104. small movements. Must be a power of two. Default is @code{32}.
  6105. @item ppsrc
  6106. Mark main input as a pre-processed input and activate clean source input
  6107. stream. This allows the input to be pre-processed with various filters to help
  6108. the metrics calculation while keeping the frame selection lossless. When set to
  6109. @code{1}, the first stream is for the pre-processed input, and the second
  6110. stream is the clean source from where the kept frames are chosen. Default is
  6111. @code{0}.
  6112. @item chroma
  6113. Set whether or not chroma is considered in the metric calculations. Default is
  6114. @code{1}.
  6115. @end table
  6116. @section deconvolve
  6117. Apply 2D deconvolution of video stream in frequency domain using second stream
  6118. as impulse.
  6119. The filter accepts the following options:
  6120. @table @option
  6121. @item planes
  6122. Set which planes to process.
  6123. @item impulse
  6124. Set which impulse video frames will be processed, can be @var{first}
  6125. or @var{all}. Default is @var{all}.
  6126. @item noise
  6127. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  6128. and height are not same and not power of 2 or if stream prior to convolving
  6129. had noise.
  6130. @end table
  6131. The @code{deconvolve} filter also supports the @ref{framesync} options.
  6132. @section dedot
  6133. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  6134. It accepts the following options:
  6135. @table @option
  6136. @item m
  6137. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  6138. @var{rainbows} for cross-color reduction.
  6139. @item lt
  6140. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  6141. @item tl
  6142. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  6143. @item tc
  6144. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  6145. @item ct
  6146. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  6147. @end table
  6148. @section deflate
  6149. Apply deflate effect to the video.
  6150. This filter replaces the pixel by the local(3x3) average by taking into account
  6151. only values lower than the pixel.
  6152. It accepts the following options:
  6153. @table @option
  6154. @item threshold0
  6155. @item threshold1
  6156. @item threshold2
  6157. @item threshold3
  6158. Limit the maximum change for each plane, default is 65535.
  6159. If 0, plane will remain unchanged.
  6160. @end table
  6161. @section deflicker
  6162. Remove temporal frame luminance variations.
  6163. It accepts the following options:
  6164. @table @option
  6165. @item size, s
  6166. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  6167. @item mode, m
  6168. Set averaging mode to smooth temporal luminance variations.
  6169. Available values are:
  6170. @table @samp
  6171. @item am
  6172. Arithmetic mean
  6173. @item gm
  6174. Geometric mean
  6175. @item hm
  6176. Harmonic mean
  6177. @item qm
  6178. Quadratic mean
  6179. @item cm
  6180. Cubic mean
  6181. @item pm
  6182. Power mean
  6183. @item median
  6184. Median
  6185. @end table
  6186. @item bypass
  6187. Do not actually modify frame. Useful when one only wants metadata.
  6188. @end table
  6189. @section dejudder
  6190. Remove judder produced by partially interlaced telecined content.
  6191. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  6192. source was partially telecined content then the output of @code{pullup,dejudder}
  6193. will have a variable frame rate. May change the recorded frame rate of the
  6194. container. Aside from that change, this filter will not affect constant frame
  6195. rate video.
  6196. The option available in this filter is:
  6197. @table @option
  6198. @item cycle
  6199. Specify the length of the window over which the judder repeats.
  6200. Accepts any integer greater than 1. Useful values are:
  6201. @table @samp
  6202. @item 4
  6203. If the original was telecined from 24 to 30 fps (Film to NTSC).
  6204. @item 5
  6205. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  6206. @item 20
  6207. If a mixture of the two.
  6208. @end table
  6209. The default is @samp{4}.
  6210. @end table
  6211. @section delogo
  6212. Suppress a TV station logo by a simple interpolation of the surrounding
  6213. pixels. Just set a rectangle covering the logo and watch it disappear
  6214. (and sometimes something even uglier appear - your mileage may vary).
  6215. It accepts the following parameters:
  6216. @table @option
  6217. @item x
  6218. @item y
  6219. Specify the top left corner coordinates of the logo. They must be
  6220. specified.
  6221. @item w
  6222. @item h
  6223. Specify the width and height of the logo to clear. They must be
  6224. specified.
  6225. @item band, t
  6226. Specify the thickness of the fuzzy edge of the rectangle (added to
  6227. @var{w} and @var{h}). The default value is 1. This option is
  6228. deprecated, setting higher values should no longer be necessary and
  6229. is not recommended.
  6230. @item show
  6231. When set to 1, a green rectangle is drawn on the screen to simplify
  6232. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  6233. The default value is 0.
  6234. The rectangle is drawn on the outermost pixels which will be (partly)
  6235. replaced with interpolated values. The values of the next pixels
  6236. immediately outside this rectangle in each direction will be used to
  6237. compute the interpolated pixel values inside the rectangle.
  6238. @end table
  6239. @subsection Examples
  6240. @itemize
  6241. @item
  6242. Set a rectangle covering the area with top left corner coordinates 0,0
  6243. and size 100x77, and a band of size 10:
  6244. @example
  6245. delogo=x=0:y=0:w=100:h=77:band=10
  6246. @end example
  6247. @end itemize
  6248. @section deshake
  6249. Attempt to fix small changes in horizontal and/or vertical shift. This
  6250. filter helps remove camera shake from hand-holding a camera, bumping a
  6251. tripod, moving on a vehicle, etc.
  6252. The filter accepts the following options:
  6253. @table @option
  6254. @item x
  6255. @item y
  6256. @item w
  6257. @item h
  6258. Specify a rectangular area where to limit the search for motion
  6259. vectors.
  6260. If desired the search for motion vectors can be limited to a
  6261. rectangular area of the frame defined by its top left corner, width
  6262. and height. These parameters have the same meaning as the drawbox
  6263. filter which can be used to visualise the position of the bounding
  6264. box.
  6265. This is useful when simultaneous movement of subjects within the frame
  6266. might be confused for camera motion by the motion vector search.
  6267. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  6268. then the full frame is used. This allows later options to be set
  6269. without specifying the bounding box for the motion vector search.
  6270. Default - search the whole frame.
  6271. @item rx
  6272. @item ry
  6273. Specify the maximum extent of movement in x and y directions in the
  6274. range 0-64 pixels. Default 16.
  6275. @item edge
  6276. Specify how to generate pixels to fill blanks at the edge of the
  6277. frame. Available values are:
  6278. @table @samp
  6279. @item blank, 0
  6280. Fill zeroes at blank locations
  6281. @item original, 1
  6282. Original image at blank locations
  6283. @item clamp, 2
  6284. Extruded edge value at blank locations
  6285. @item mirror, 3
  6286. Mirrored edge at blank locations
  6287. @end table
  6288. Default value is @samp{mirror}.
  6289. @item blocksize
  6290. Specify the blocksize to use for motion search. Range 4-128 pixels,
  6291. default 8.
  6292. @item contrast
  6293. Specify the contrast threshold for blocks. Only blocks with more than
  6294. the specified contrast (difference between darkest and lightest
  6295. pixels) will be considered. Range 1-255, default 125.
  6296. @item search
  6297. Specify the search strategy. Available values are:
  6298. @table @samp
  6299. @item exhaustive, 0
  6300. Set exhaustive search
  6301. @item less, 1
  6302. Set less exhaustive search.
  6303. @end table
  6304. Default value is @samp{exhaustive}.
  6305. @item filename
  6306. If set then a detailed log of the motion search is written to the
  6307. specified file.
  6308. @end table
  6309. @section despill
  6310. Remove unwanted contamination of foreground colors, caused by reflected color of
  6311. greenscreen or bluescreen.
  6312. This filter accepts the following options:
  6313. @table @option
  6314. @item type
  6315. Set what type of despill to use.
  6316. @item mix
  6317. Set how spillmap will be generated.
  6318. @item expand
  6319. Set how much to get rid of still remaining spill.
  6320. @item red
  6321. Controls amount of red in spill area.
  6322. @item green
  6323. Controls amount of green in spill area.
  6324. Should be -1 for greenscreen.
  6325. @item blue
  6326. Controls amount of blue in spill area.
  6327. Should be -1 for bluescreen.
  6328. @item brightness
  6329. Controls brightness of spill area, preserving colors.
  6330. @item alpha
  6331. Modify alpha from generated spillmap.
  6332. @end table
  6333. @section detelecine
  6334. Apply an exact inverse of the telecine operation. It requires a predefined
  6335. pattern specified using the pattern option which must be the same as that passed
  6336. to the telecine filter.
  6337. This filter accepts the following options:
  6338. @table @option
  6339. @item first_field
  6340. @table @samp
  6341. @item top, t
  6342. top field first
  6343. @item bottom, b
  6344. bottom field first
  6345. The default value is @code{top}.
  6346. @end table
  6347. @item pattern
  6348. A string of numbers representing the pulldown pattern you wish to apply.
  6349. The default value is @code{23}.
  6350. @item start_frame
  6351. A number representing position of the first frame with respect to the telecine
  6352. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  6353. @end table
  6354. @section dilation
  6355. Apply dilation effect to the video.
  6356. This filter replaces the pixel by the local(3x3) maximum.
  6357. It accepts the following options:
  6358. @table @option
  6359. @item threshold0
  6360. @item threshold1
  6361. @item threshold2
  6362. @item threshold3
  6363. Limit the maximum change for each plane, default is 65535.
  6364. If 0, plane will remain unchanged.
  6365. @item coordinates
  6366. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6367. pixels are used.
  6368. Flags to local 3x3 coordinates maps like this:
  6369. 1 2 3
  6370. 4 5
  6371. 6 7 8
  6372. @end table
  6373. @section displace
  6374. Displace pixels as indicated by second and third input stream.
  6375. It takes three input streams and outputs one stream, the first input is the
  6376. source, and second and third input are displacement maps.
  6377. The second input specifies how much to displace pixels along the
  6378. x-axis, while the third input specifies how much to displace pixels
  6379. along the y-axis.
  6380. If one of displacement map streams terminates, last frame from that
  6381. displacement map will be used.
  6382. Note that once generated, displacements maps can be reused over and over again.
  6383. A description of the accepted options follows.
  6384. @table @option
  6385. @item edge
  6386. Set displace behavior for pixels that are out of range.
  6387. Available values are:
  6388. @table @samp
  6389. @item blank
  6390. Missing pixels are replaced by black pixels.
  6391. @item smear
  6392. Adjacent pixels will spread out to replace missing pixels.
  6393. @item wrap
  6394. Out of range pixels are wrapped so they point to pixels of other side.
  6395. @item mirror
  6396. Out of range pixels will be replaced with mirrored pixels.
  6397. @end table
  6398. Default is @samp{smear}.
  6399. @end table
  6400. @subsection Examples
  6401. @itemize
  6402. @item
  6403. Add ripple effect to rgb input of video size hd720:
  6404. @example
  6405. 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
  6406. @end example
  6407. @item
  6408. Add wave effect to rgb input of video size hd720:
  6409. @example
  6410. 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
  6411. @end example
  6412. @end itemize
  6413. @section drawbox
  6414. Draw a colored box on the input image.
  6415. It accepts the following parameters:
  6416. @table @option
  6417. @item x
  6418. @item y
  6419. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  6420. @item width, w
  6421. @item height, h
  6422. The expressions which specify the width and height of the box; if 0 they are interpreted as
  6423. the input width and height. It defaults to 0.
  6424. @item color, c
  6425. Specify the color of the box to write. For the general syntax of this option,
  6426. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6427. value @code{invert} is used, the box edge color is the same as the
  6428. video with inverted luma.
  6429. @item thickness, t
  6430. The expression which sets the thickness of the box edge.
  6431. A value of @code{fill} will create a filled box. Default value is @code{3}.
  6432. See below for the list of accepted constants.
  6433. @item replace
  6434. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  6435. will overwrite the video's color and alpha pixels.
  6436. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  6437. @end table
  6438. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6439. following constants:
  6440. @table @option
  6441. @item dar
  6442. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6443. @item hsub
  6444. @item vsub
  6445. horizontal and vertical chroma subsample values. For example for the
  6446. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6447. @item in_h, ih
  6448. @item in_w, iw
  6449. The input width and height.
  6450. @item sar
  6451. The input sample aspect ratio.
  6452. @item x
  6453. @item y
  6454. The x and y offset coordinates where the box is drawn.
  6455. @item w
  6456. @item h
  6457. The width and height of the drawn box.
  6458. @item t
  6459. The thickness of the drawn box.
  6460. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6461. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6462. @end table
  6463. @subsection Examples
  6464. @itemize
  6465. @item
  6466. Draw a black box around the edge of the input image:
  6467. @example
  6468. drawbox
  6469. @end example
  6470. @item
  6471. Draw a box with color red and an opacity of 50%:
  6472. @example
  6473. drawbox=10:20:200:60:red@@0.5
  6474. @end example
  6475. The previous example can be specified as:
  6476. @example
  6477. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  6478. @end example
  6479. @item
  6480. Fill the box with pink color:
  6481. @example
  6482. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  6483. @end example
  6484. @item
  6485. Draw a 2-pixel red 2.40:1 mask:
  6486. @example
  6487. 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
  6488. @end example
  6489. @end itemize
  6490. @section drawgrid
  6491. Draw a grid on the input image.
  6492. It accepts the following parameters:
  6493. @table @option
  6494. @item x
  6495. @item y
  6496. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  6497. @item width, w
  6498. @item height, h
  6499. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  6500. input width and height, respectively, minus @code{thickness}, so image gets
  6501. framed. Default to 0.
  6502. @item color, c
  6503. Specify the color of the grid. For the general syntax of this option,
  6504. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6505. value @code{invert} is used, the grid color is the same as the
  6506. video with inverted luma.
  6507. @item thickness, t
  6508. The expression which sets the thickness of the grid line. Default value is @code{1}.
  6509. See below for the list of accepted constants.
  6510. @item replace
  6511. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  6512. will overwrite the video's color and alpha pixels.
  6513. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  6514. @end table
  6515. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6516. following constants:
  6517. @table @option
  6518. @item dar
  6519. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6520. @item hsub
  6521. @item vsub
  6522. horizontal and vertical chroma subsample values. For example for the
  6523. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6524. @item in_h, ih
  6525. @item in_w, iw
  6526. The input grid cell width and height.
  6527. @item sar
  6528. The input sample aspect ratio.
  6529. @item x
  6530. @item y
  6531. The x and y coordinates of some point of grid intersection (meant to configure offset).
  6532. @item w
  6533. @item h
  6534. The width and height of the drawn cell.
  6535. @item t
  6536. The thickness of the drawn cell.
  6537. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6538. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6539. @end table
  6540. @subsection Examples
  6541. @itemize
  6542. @item
  6543. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  6544. @example
  6545. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  6546. @end example
  6547. @item
  6548. Draw a white 3x3 grid with an opacity of 50%:
  6549. @example
  6550. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  6551. @end example
  6552. @end itemize
  6553. @anchor{drawtext}
  6554. @section drawtext
  6555. Draw a text string or text from a specified file on top of a video, using the
  6556. libfreetype library.
  6557. To enable compilation of this filter, you need to configure FFmpeg with
  6558. @code{--enable-libfreetype}.
  6559. To enable default font fallback and the @var{font} option you need to
  6560. configure FFmpeg with @code{--enable-libfontconfig}.
  6561. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  6562. @code{--enable-libfribidi}.
  6563. @subsection Syntax
  6564. It accepts the following parameters:
  6565. @table @option
  6566. @item box
  6567. Used to draw a box around text using the background color.
  6568. The value must be either 1 (enable) or 0 (disable).
  6569. The default value of @var{box} is 0.
  6570. @item boxborderw
  6571. Set the width of the border to be drawn around the box using @var{boxcolor}.
  6572. The default value of @var{boxborderw} is 0.
  6573. @item boxcolor
  6574. The color to be used for drawing box around text. For the syntax of this
  6575. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6576. The default value of @var{boxcolor} is "white".
  6577. @item line_spacing
  6578. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  6579. The default value of @var{line_spacing} is 0.
  6580. @item borderw
  6581. Set the width of the border to be drawn around the text using @var{bordercolor}.
  6582. The default value of @var{borderw} is 0.
  6583. @item bordercolor
  6584. Set the color to be used for drawing border around text. For the syntax of this
  6585. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6586. The default value of @var{bordercolor} is "black".
  6587. @item expansion
  6588. Select how the @var{text} is expanded. Can be either @code{none},
  6589. @code{strftime} (deprecated) or
  6590. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  6591. below for details.
  6592. @item basetime
  6593. Set a start time for the count. Value is in microseconds. Only applied
  6594. in the deprecated strftime expansion mode. To emulate in normal expansion
  6595. mode use the @code{pts} function, supplying the start time (in seconds)
  6596. as the second argument.
  6597. @item fix_bounds
  6598. If true, check and fix text coords to avoid clipping.
  6599. @item fontcolor
  6600. The color to be used for drawing fonts. For the syntax of this option, check
  6601. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6602. The default value of @var{fontcolor} is "black".
  6603. @item fontcolor_expr
  6604. String which is expanded the same way as @var{text} to obtain dynamic
  6605. @var{fontcolor} value. By default this option has empty value and is not
  6606. processed. When this option is set, it overrides @var{fontcolor} option.
  6607. @item font
  6608. The font family to be used for drawing text. By default Sans.
  6609. @item fontfile
  6610. The font file to be used for drawing text. The path must be included.
  6611. This parameter is mandatory if the fontconfig support is disabled.
  6612. @item alpha
  6613. Draw the text applying alpha blending. The value can
  6614. be a number between 0.0 and 1.0.
  6615. The expression accepts the same variables @var{x, y} as well.
  6616. The default value is 1.
  6617. Please see @var{fontcolor_expr}.
  6618. @item fontsize
  6619. The font size to be used for drawing text.
  6620. The default value of @var{fontsize} is 16.
  6621. @item text_shaping
  6622. If set to 1, attempt to shape the text (for example, reverse the order of
  6623. right-to-left text and join Arabic characters) before drawing it.
  6624. Otherwise, just draw the text exactly as given.
  6625. By default 1 (if supported).
  6626. @item ft_load_flags
  6627. The flags to be used for loading the fonts.
  6628. The flags map the corresponding flags supported by libfreetype, and are
  6629. a combination of the following values:
  6630. @table @var
  6631. @item default
  6632. @item no_scale
  6633. @item no_hinting
  6634. @item render
  6635. @item no_bitmap
  6636. @item vertical_layout
  6637. @item force_autohint
  6638. @item crop_bitmap
  6639. @item pedantic
  6640. @item ignore_global_advance_width
  6641. @item no_recurse
  6642. @item ignore_transform
  6643. @item monochrome
  6644. @item linear_design
  6645. @item no_autohint
  6646. @end table
  6647. Default value is "default".
  6648. For more information consult the documentation for the FT_LOAD_*
  6649. libfreetype flags.
  6650. @item shadowcolor
  6651. The color to be used for drawing a shadow behind the drawn text. For the
  6652. syntax of this option, check the @ref{color syntax,,"Color" section in the
  6653. ffmpeg-utils manual,ffmpeg-utils}.
  6654. The default value of @var{shadowcolor} is "black".
  6655. @item shadowx
  6656. @item shadowy
  6657. The x and y offsets for the text shadow position with respect to the
  6658. position of the text. They can be either positive or negative
  6659. values. The default value for both is "0".
  6660. @item start_number
  6661. The starting frame number for the n/frame_num variable. The default value
  6662. is "0".
  6663. @item tabsize
  6664. The size in number of spaces to use for rendering the tab.
  6665. Default value is 4.
  6666. @item timecode
  6667. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  6668. format. It can be used with or without text parameter. @var{timecode_rate}
  6669. option must be specified.
  6670. @item timecode_rate, rate, r
  6671. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  6672. integer. Minimum value is "1".
  6673. Drop-frame timecode is supported for frame rates 30 & 60.
  6674. @item tc24hmax
  6675. If set to 1, the output of the timecode option will wrap around at 24 hours.
  6676. Default is 0 (disabled).
  6677. @item text
  6678. The text string to be drawn. The text must be a sequence of UTF-8
  6679. encoded characters.
  6680. This parameter is mandatory if no file is specified with the parameter
  6681. @var{textfile}.
  6682. @item textfile
  6683. A text file containing text to be drawn. The text must be a sequence
  6684. of UTF-8 encoded characters.
  6685. This parameter is mandatory if no text string is specified with the
  6686. parameter @var{text}.
  6687. If both @var{text} and @var{textfile} are specified, an error is thrown.
  6688. @item reload
  6689. If set to 1, the @var{textfile} will be reloaded before each frame.
  6690. Be sure to update it atomically, or it may be read partially, or even fail.
  6691. @item x
  6692. @item y
  6693. The expressions which specify the offsets where text will be drawn
  6694. within the video frame. They are relative to the top/left border of the
  6695. output image.
  6696. The default value of @var{x} and @var{y} is "0".
  6697. See below for the list of accepted constants and functions.
  6698. @end table
  6699. The parameters for @var{x} and @var{y} are expressions containing the
  6700. following constants and functions:
  6701. @table @option
  6702. @item dar
  6703. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  6704. @item hsub
  6705. @item vsub
  6706. horizontal and vertical chroma subsample values. For example for the
  6707. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6708. @item line_h, lh
  6709. the height of each text line
  6710. @item main_h, h, H
  6711. the input height
  6712. @item main_w, w, W
  6713. the input width
  6714. @item max_glyph_a, ascent
  6715. the maximum distance from the baseline to the highest/upper grid
  6716. coordinate used to place a glyph outline point, for all the rendered
  6717. glyphs.
  6718. It is a positive value, due to the grid's orientation with the Y axis
  6719. upwards.
  6720. @item max_glyph_d, descent
  6721. the maximum distance from the baseline to the lowest grid coordinate
  6722. used to place a glyph outline point, for all the rendered glyphs.
  6723. This is a negative value, due to the grid's orientation, with the Y axis
  6724. upwards.
  6725. @item max_glyph_h
  6726. maximum glyph height, that is the maximum height for all the glyphs
  6727. contained in the rendered text, it is equivalent to @var{ascent} -
  6728. @var{descent}.
  6729. @item max_glyph_w
  6730. maximum glyph width, that is the maximum width for all the glyphs
  6731. contained in the rendered text
  6732. @item n
  6733. the number of input frame, starting from 0
  6734. @item rand(min, max)
  6735. return a random number included between @var{min} and @var{max}
  6736. @item sar
  6737. The input sample aspect ratio.
  6738. @item t
  6739. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6740. @item text_h, th
  6741. the height of the rendered text
  6742. @item text_w, tw
  6743. the width of the rendered text
  6744. @item x
  6745. @item y
  6746. the x and y offset coordinates where the text is drawn.
  6747. These parameters allow the @var{x} and @var{y} expressions to refer
  6748. each other, so you can for example specify @code{y=x/dar}.
  6749. @end table
  6750. @anchor{drawtext_expansion}
  6751. @subsection Text expansion
  6752. If @option{expansion} is set to @code{strftime},
  6753. the filter recognizes strftime() sequences in the provided text and
  6754. expands them accordingly. Check the documentation of strftime(). This
  6755. feature is deprecated.
  6756. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  6757. If @option{expansion} is set to @code{normal} (which is the default),
  6758. the following expansion mechanism is used.
  6759. The backslash character @samp{\}, followed by any character, always expands to
  6760. the second character.
  6761. Sequences of the form @code{%@{...@}} are expanded. The text between the
  6762. braces is a function name, possibly followed by arguments separated by ':'.
  6763. If the arguments contain special characters or delimiters (':' or '@}'),
  6764. they should be escaped.
  6765. Note that they probably must also be escaped as the value for the
  6766. @option{text} option in the filter argument string and as the filter
  6767. argument in the filtergraph description, and possibly also for the shell,
  6768. that makes up to four levels of escaping; using a text file avoids these
  6769. problems.
  6770. The following functions are available:
  6771. @table @command
  6772. @item expr, e
  6773. The expression evaluation result.
  6774. It must take one argument specifying the expression to be evaluated,
  6775. which accepts the same constants and functions as the @var{x} and
  6776. @var{y} values. Note that not all constants should be used, for
  6777. example the text size is not known when evaluating the expression, so
  6778. the constants @var{text_w} and @var{text_h} will have an undefined
  6779. value.
  6780. @item expr_int_format, eif
  6781. Evaluate the expression's value and output as formatted integer.
  6782. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  6783. The second argument specifies the output format. Allowed values are @samp{x},
  6784. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  6785. @code{printf} function.
  6786. The third parameter is optional and sets the number of positions taken by the output.
  6787. It can be used to add padding with zeros from the left.
  6788. @item gmtime
  6789. The time at which the filter is running, expressed in UTC.
  6790. It can accept an argument: a strftime() format string.
  6791. @item localtime
  6792. The time at which the filter is running, expressed in the local time zone.
  6793. It can accept an argument: a strftime() format string.
  6794. @item metadata
  6795. Frame metadata. Takes one or two arguments.
  6796. The first argument is mandatory and specifies the metadata key.
  6797. The second argument is optional and specifies a default value, used when the
  6798. metadata key is not found or empty.
  6799. @item n, frame_num
  6800. The frame number, starting from 0.
  6801. @item pict_type
  6802. A 1 character description of the current picture type.
  6803. @item pts
  6804. The timestamp of the current frame.
  6805. It can take up to three arguments.
  6806. The first argument is the format of the timestamp; it defaults to @code{flt}
  6807. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  6808. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  6809. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  6810. @code{localtime} stands for the timestamp of the frame formatted as
  6811. local time zone time.
  6812. The second argument is an offset added to the timestamp.
  6813. If the format is set to @code{hms}, a third argument @code{24HH} may be
  6814. supplied to present the hour part of the formatted timestamp in 24h format
  6815. (00-23).
  6816. If the format is set to @code{localtime} or @code{gmtime},
  6817. a third argument may be supplied: a strftime() format string.
  6818. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  6819. @end table
  6820. @subsection Examples
  6821. @itemize
  6822. @item
  6823. Draw "Test Text" with font FreeSerif, using the default values for the
  6824. optional parameters.
  6825. @example
  6826. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  6827. @end example
  6828. @item
  6829. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  6830. and y=50 (counting from the top-left corner of the screen), text is
  6831. yellow with a red box around it. Both the text and the box have an
  6832. opacity of 20%.
  6833. @example
  6834. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  6835. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  6836. @end example
  6837. Note that the double quotes are not necessary if spaces are not used
  6838. within the parameter list.
  6839. @item
  6840. Show the text at the center of the video frame:
  6841. @example
  6842. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  6843. @end example
  6844. @item
  6845. Show the text at a random position, switching to a new position every 30 seconds:
  6846. @example
  6847. 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)"
  6848. @end example
  6849. @item
  6850. Show a text line sliding from right to left in the last row of the video
  6851. frame. The file @file{LONG_LINE} is assumed to contain a single line
  6852. with no newlines.
  6853. @example
  6854. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  6855. @end example
  6856. @item
  6857. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  6858. @example
  6859. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  6860. @end example
  6861. @item
  6862. Draw a single green letter "g", at the center of the input video.
  6863. The glyph baseline is placed at half screen height.
  6864. @example
  6865. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  6866. @end example
  6867. @item
  6868. Show text for 1 second every 3 seconds:
  6869. @example
  6870. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  6871. @end example
  6872. @item
  6873. Use fontconfig to set the font. Note that the colons need to be escaped.
  6874. @example
  6875. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  6876. @end example
  6877. @item
  6878. Print the date of a real-time encoding (see strftime(3)):
  6879. @example
  6880. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  6881. @end example
  6882. @item
  6883. Show text fading in and out (appearing/disappearing):
  6884. @example
  6885. #!/bin/sh
  6886. DS=1.0 # display start
  6887. DE=10.0 # display end
  6888. FID=1.5 # fade in duration
  6889. FOD=5 # fade out duration
  6890. 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 @}"
  6891. @end example
  6892. @item
  6893. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  6894. and the @option{fontsize} value are included in the @option{y} offset.
  6895. @example
  6896. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  6897. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  6898. @end example
  6899. @end itemize
  6900. For more information about libfreetype, check:
  6901. @url{http://www.freetype.org/}.
  6902. For more information about fontconfig, check:
  6903. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  6904. For more information about libfribidi, check:
  6905. @url{http://fribidi.org/}.
  6906. @section edgedetect
  6907. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  6908. The filter accepts the following options:
  6909. @table @option
  6910. @item low
  6911. @item high
  6912. Set low and high threshold values used by the Canny thresholding
  6913. algorithm.
  6914. The high threshold selects the "strong" edge pixels, which are then
  6915. connected through 8-connectivity with the "weak" edge pixels selected
  6916. by the low threshold.
  6917. @var{low} and @var{high} threshold values must be chosen in the range
  6918. [0,1], and @var{low} should be lesser or equal to @var{high}.
  6919. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  6920. is @code{50/255}.
  6921. @item mode
  6922. Define the drawing mode.
  6923. @table @samp
  6924. @item wires
  6925. Draw white/gray wires on black background.
  6926. @item colormix
  6927. Mix the colors to create a paint/cartoon effect.
  6928. @item canny
  6929. Apply Canny edge detector on all selected planes.
  6930. @end table
  6931. Default value is @var{wires}.
  6932. @item planes
  6933. Select planes for filtering. By default all available planes are filtered.
  6934. @end table
  6935. @subsection Examples
  6936. @itemize
  6937. @item
  6938. Standard edge detection with custom values for the hysteresis thresholding:
  6939. @example
  6940. edgedetect=low=0.1:high=0.4
  6941. @end example
  6942. @item
  6943. Painting effect without thresholding:
  6944. @example
  6945. edgedetect=mode=colormix:high=0
  6946. @end example
  6947. @end itemize
  6948. @section eq
  6949. Set brightness, contrast, saturation and approximate gamma adjustment.
  6950. The filter accepts the following options:
  6951. @table @option
  6952. @item contrast
  6953. Set the contrast expression. The value must be a float value in range
  6954. @code{-2.0} to @code{2.0}. The default value is "1".
  6955. @item brightness
  6956. Set the brightness expression. The value must be a float value in
  6957. range @code{-1.0} to @code{1.0}. The default value is "0".
  6958. @item saturation
  6959. Set the saturation expression. The value must be a float in
  6960. range @code{0.0} to @code{3.0}. The default value is "1".
  6961. @item gamma
  6962. Set the gamma expression. The value must be a float in range
  6963. @code{0.1} to @code{10.0}. The default value is "1".
  6964. @item gamma_r
  6965. Set the gamma expression for red. The value must be a float in
  6966. range @code{0.1} to @code{10.0}. The default value is "1".
  6967. @item gamma_g
  6968. Set the gamma expression for green. The value must be a float in range
  6969. @code{0.1} to @code{10.0}. The default value is "1".
  6970. @item gamma_b
  6971. Set the gamma expression for blue. The value must be a float in range
  6972. @code{0.1} to @code{10.0}. The default value is "1".
  6973. @item gamma_weight
  6974. Set the gamma weight expression. It can be used to reduce the effect
  6975. of a high gamma value on bright image areas, e.g. keep them from
  6976. getting overamplified and just plain white. The value must be a float
  6977. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  6978. gamma correction all the way down while @code{1.0} leaves it at its
  6979. full strength. Default is "1".
  6980. @item eval
  6981. Set when the expressions for brightness, contrast, saturation and
  6982. gamma expressions are evaluated.
  6983. It accepts the following values:
  6984. @table @samp
  6985. @item init
  6986. only evaluate expressions once during the filter initialization or
  6987. when a command is processed
  6988. @item frame
  6989. evaluate expressions for each incoming frame
  6990. @end table
  6991. Default value is @samp{init}.
  6992. @end table
  6993. The expressions accept the following parameters:
  6994. @table @option
  6995. @item n
  6996. frame count of the input frame starting from 0
  6997. @item pos
  6998. byte position of the corresponding packet in the input file, NAN if
  6999. unspecified
  7000. @item r
  7001. frame rate of the input video, NAN if the input frame rate is unknown
  7002. @item t
  7003. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7004. @end table
  7005. @subsection Commands
  7006. The filter supports the following commands:
  7007. @table @option
  7008. @item contrast
  7009. Set the contrast expression.
  7010. @item brightness
  7011. Set the brightness expression.
  7012. @item saturation
  7013. Set the saturation expression.
  7014. @item gamma
  7015. Set the gamma expression.
  7016. @item gamma_r
  7017. Set the gamma_r expression.
  7018. @item gamma_g
  7019. Set gamma_g expression.
  7020. @item gamma_b
  7021. Set gamma_b expression.
  7022. @item gamma_weight
  7023. Set gamma_weight expression.
  7024. The command accepts the same syntax of the corresponding option.
  7025. If the specified expression is not valid, it is kept at its current
  7026. value.
  7027. @end table
  7028. @section erosion
  7029. Apply erosion effect to the video.
  7030. This filter replaces the pixel by the local(3x3) minimum.
  7031. It accepts the following options:
  7032. @table @option
  7033. @item threshold0
  7034. @item threshold1
  7035. @item threshold2
  7036. @item threshold3
  7037. Limit the maximum change for each plane, default is 65535.
  7038. If 0, plane will remain unchanged.
  7039. @item coordinates
  7040. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  7041. pixels are used.
  7042. Flags to local 3x3 coordinates maps like this:
  7043. 1 2 3
  7044. 4 5
  7045. 6 7 8
  7046. @end table
  7047. @section extractplanes
  7048. Extract color channel components from input video stream into
  7049. separate grayscale video streams.
  7050. The filter accepts the following option:
  7051. @table @option
  7052. @item planes
  7053. Set plane(s) to extract.
  7054. Available values for planes are:
  7055. @table @samp
  7056. @item y
  7057. @item u
  7058. @item v
  7059. @item a
  7060. @item r
  7061. @item g
  7062. @item b
  7063. @end table
  7064. Choosing planes not available in the input will result in an error.
  7065. That means you cannot select @code{r}, @code{g}, @code{b} planes
  7066. with @code{y}, @code{u}, @code{v} planes at same time.
  7067. @end table
  7068. @subsection Examples
  7069. @itemize
  7070. @item
  7071. Extract luma, u and v color channel component from input video frame
  7072. into 3 grayscale outputs:
  7073. @example
  7074. 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
  7075. @end example
  7076. @end itemize
  7077. @section elbg
  7078. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  7079. For each input image, the filter will compute the optimal mapping from
  7080. the input to the output given the codebook length, that is the number
  7081. of distinct output colors.
  7082. This filter accepts the following options.
  7083. @table @option
  7084. @item codebook_length, l
  7085. Set codebook length. The value must be a positive integer, and
  7086. represents the number of distinct output colors. Default value is 256.
  7087. @item nb_steps, n
  7088. Set the maximum number of iterations to apply for computing the optimal
  7089. mapping. The higher the value the better the result and the higher the
  7090. computation time. Default value is 1.
  7091. @item seed, s
  7092. Set a random seed, must be an integer included between 0 and
  7093. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  7094. will try to use a good random seed on a best effort basis.
  7095. @item pal8
  7096. Set pal8 output pixel format. This option does not work with codebook
  7097. length greater than 256.
  7098. @end table
  7099. @section entropy
  7100. Measure graylevel entropy in histogram of color channels of video frames.
  7101. It accepts the following parameters:
  7102. @table @option
  7103. @item mode
  7104. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  7105. @var{diff} mode measures entropy of histogram delta values, absolute differences
  7106. between neighbour histogram values.
  7107. @end table
  7108. @section fade
  7109. Apply a fade-in/out effect to the input video.
  7110. It accepts the following parameters:
  7111. @table @option
  7112. @item type, t
  7113. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  7114. effect.
  7115. Default is @code{in}.
  7116. @item start_frame, s
  7117. Specify the number of the frame to start applying the fade
  7118. effect at. Default is 0.
  7119. @item nb_frames, n
  7120. The number of frames that the fade effect lasts. At the end of the
  7121. fade-in effect, the output video will have the same intensity as the input video.
  7122. At the end of the fade-out transition, the output video will be filled with the
  7123. selected @option{color}.
  7124. Default is 25.
  7125. @item alpha
  7126. If set to 1, fade only alpha channel, if one exists on the input.
  7127. Default value is 0.
  7128. @item start_time, st
  7129. Specify the timestamp (in seconds) of the frame to start to apply the fade
  7130. effect. If both start_frame and start_time are specified, the fade will start at
  7131. whichever comes last. Default is 0.
  7132. @item duration, d
  7133. The number of seconds for which the fade effect has to last. At the end of the
  7134. fade-in effect the output video will have the same intensity as the input video,
  7135. at the end of the fade-out transition the output video will be filled with the
  7136. selected @option{color}.
  7137. If both duration and nb_frames are specified, duration is used. Default is 0
  7138. (nb_frames is used by default).
  7139. @item color, c
  7140. Specify the color of the fade. Default is "black".
  7141. @end table
  7142. @subsection Examples
  7143. @itemize
  7144. @item
  7145. Fade in the first 30 frames of video:
  7146. @example
  7147. fade=in:0:30
  7148. @end example
  7149. The command above is equivalent to:
  7150. @example
  7151. fade=t=in:s=0:n=30
  7152. @end example
  7153. @item
  7154. Fade out the last 45 frames of a 200-frame video:
  7155. @example
  7156. fade=out:155:45
  7157. fade=type=out:start_frame=155:nb_frames=45
  7158. @end example
  7159. @item
  7160. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  7161. @example
  7162. fade=in:0:25, fade=out:975:25
  7163. @end example
  7164. @item
  7165. Make the first 5 frames yellow, then fade in from frame 5-24:
  7166. @example
  7167. fade=in:5:20:color=yellow
  7168. @end example
  7169. @item
  7170. Fade in alpha over first 25 frames of video:
  7171. @example
  7172. fade=in:0:25:alpha=1
  7173. @end example
  7174. @item
  7175. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  7176. @example
  7177. fade=t=in:st=5.5:d=0.5
  7178. @end example
  7179. @end itemize
  7180. @section fftfilt
  7181. Apply arbitrary expressions to samples in frequency domain
  7182. @table @option
  7183. @item dc_Y
  7184. Adjust the dc value (gain) of the luma plane of the image. The filter
  7185. accepts an integer value in range @code{0} to @code{1000}. The default
  7186. value is set to @code{0}.
  7187. @item dc_U
  7188. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  7189. filter accepts an integer value in range @code{0} to @code{1000}. The
  7190. default value is set to @code{0}.
  7191. @item dc_V
  7192. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  7193. filter accepts an integer value in range @code{0} to @code{1000}. The
  7194. default value is set to @code{0}.
  7195. @item weight_Y
  7196. Set the frequency domain weight expression for the luma plane.
  7197. @item weight_U
  7198. Set the frequency domain weight expression for the 1st chroma plane.
  7199. @item weight_V
  7200. Set the frequency domain weight expression for the 2nd chroma plane.
  7201. @item eval
  7202. Set when the expressions are evaluated.
  7203. It accepts the following values:
  7204. @table @samp
  7205. @item init
  7206. Only evaluate expressions once during the filter initialization.
  7207. @item frame
  7208. Evaluate expressions for each incoming frame.
  7209. @end table
  7210. Default value is @samp{init}.
  7211. The filter accepts the following variables:
  7212. @item X
  7213. @item Y
  7214. The coordinates of the current sample.
  7215. @item W
  7216. @item H
  7217. The width and height of the image.
  7218. @item N
  7219. The number of input frame, starting from 0.
  7220. @end table
  7221. @subsection Examples
  7222. @itemize
  7223. @item
  7224. High-pass:
  7225. @example
  7226. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  7227. @end example
  7228. @item
  7229. Low-pass:
  7230. @example
  7231. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  7232. @end example
  7233. @item
  7234. Sharpen:
  7235. @example
  7236. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  7237. @end example
  7238. @item
  7239. Blur:
  7240. @example
  7241. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  7242. @end example
  7243. @end itemize
  7244. @section fftdnoiz
  7245. Denoise frames using 3D FFT (frequency domain filtering).
  7246. The filter accepts the following options:
  7247. @table @option
  7248. @item sigma
  7249. Set the noise sigma constant. This sets denoising strength.
  7250. Default value is 1. Allowed range is from 0 to 30.
  7251. Using very high sigma with low overlap may give blocking artifacts.
  7252. @item amount
  7253. Set amount of denoising. By default all detected noise is reduced.
  7254. Default value is 1. Allowed range is from 0 to 1.
  7255. @item block
  7256. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  7257. Actual size of block in pixels is 2 to power of @var{block}, so by default
  7258. block size in pixels is 2^4 which is 16.
  7259. @item overlap
  7260. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  7261. @item prev
  7262. Set number of previous frames to use for denoising. By default is set to 0.
  7263. @item next
  7264. Set number of next frames to to use for denoising. By default is set to 0.
  7265. @item planes
  7266. Set planes which will be filtered, by default are all available filtered
  7267. except alpha.
  7268. @end table
  7269. @section field
  7270. Extract a single field from an interlaced image using stride
  7271. arithmetic to avoid wasting CPU time. The output frames are marked as
  7272. non-interlaced.
  7273. The filter accepts the following options:
  7274. @table @option
  7275. @item type
  7276. Specify whether to extract the top (if the value is @code{0} or
  7277. @code{top}) or the bottom field (if the value is @code{1} or
  7278. @code{bottom}).
  7279. @end table
  7280. @section fieldhint
  7281. Create new frames by copying the top and bottom fields from surrounding frames
  7282. supplied as numbers by the hint file.
  7283. @table @option
  7284. @item hint
  7285. Set file containing hints: absolute/relative frame numbers.
  7286. There must be one line for each frame in a clip. Each line must contain two
  7287. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  7288. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  7289. is current frame number for @code{absolute} mode or out of [-1, 1] range
  7290. for @code{relative} mode. First number tells from which frame to pick up top
  7291. field and second number tells from which frame to pick up bottom field.
  7292. If optionally followed by @code{+} output frame will be marked as interlaced,
  7293. else if followed by @code{-} output frame will be marked as progressive, else
  7294. it will be marked same as input frame.
  7295. If line starts with @code{#} or @code{;} that line is skipped.
  7296. @item mode
  7297. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  7298. @end table
  7299. Example of first several lines of @code{hint} file for @code{relative} mode:
  7300. @example
  7301. 0,0 - # first frame
  7302. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  7303. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  7304. 1,0 -
  7305. 0,0 -
  7306. 0,0 -
  7307. 1,0 -
  7308. 1,0 -
  7309. 1,0 -
  7310. 0,0 -
  7311. 0,0 -
  7312. 1,0 -
  7313. 1,0 -
  7314. 1,0 -
  7315. 0,0 -
  7316. @end example
  7317. @section fieldmatch
  7318. Field matching filter for inverse telecine. It is meant to reconstruct the
  7319. progressive frames from a telecined stream. The filter does not drop duplicated
  7320. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  7321. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  7322. The separation of the field matching and the decimation is notably motivated by
  7323. the possibility of inserting a de-interlacing filter fallback between the two.
  7324. If the source has mixed telecined and real interlaced content,
  7325. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  7326. But these remaining combed frames will be marked as interlaced, and thus can be
  7327. de-interlaced by a later filter such as @ref{yadif} before decimation.
  7328. In addition to the various configuration options, @code{fieldmatch} can take an
  7329. optional second stream, activated through the @option{ppsrc} option. If
  7330. enabled, the frames reconstruction will be based on the fields and frames from
  7331. this second stream. This allows the first input to be pre-processed in order to
  7332. help the various algorithms of the filter, while keeping the output lossless
  7333. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  7334. or brightness/contrast adjustments can help.
  7335. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  7336. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  7337. which @code{fieldmatch} is based on. While the semantic and usage are very
  7338. close, some behaviour and options names can differ.
  7339. The @ref{decimate} filter currently only works for constant frame rate input.
  7340. If your input has mixed telecined (30fps) and progressive content with a lower
  7341. framerate like 24fps use the following filterchain to produce the necessary cfr
  7342. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  7343. The filter accepts the following options:
  7344. @table @option
  7345. @item order
  7346. Specify the assumed field order of the input stream. Available values are:
  7347. @table @samp
  7348. @item auto
  7349. Auto detect parity (use FFmpeg's internal parity value).
  7350. @item bff
  7351. Assume bottom field first.
  7352. @item tff
  7353. Assume top field first.
  7354. @end table
  7355. Note that it is sometimes recommended not to trust the parity announced by the
  7356. stream.
  7357. Default value is @var{auto}.
  7358. @item mode
  7359. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  7360. sense that it won't risk creating jerkiness due to duplicate frames when
  7361. possible, but if there are bad edits or blended fields it will end up
  7362. outputting combed frames when a good match might actually exist. On the other
  7363. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  7364. but will almost always find a good frame if there is one. The other values are
  7365. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  7366. jerkiness and creating duplicate frames versus finding good matches in sections
  7367. with bad edits, orphaned fields, blended fields, etc.
  7368. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  7369. Available values are:
  7370. @table @samp
  7371. @item pc
  7372. 2-way matching (p/c)
  7373. @item pc_n
  7374. 2-way matching, and trying 3rd match if still combed (p/c + n)
  7375. @item pc_u
  7376. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  7377. @item pc_n_ub
  7378. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  7379. still combed (p/c + n + u/b)
  7380. @item pcn
  7381. 3-way matching (p/c/n)
  7382. @item pcn_ub
  7383. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  7384. detected as combed (p/c/n + u/b)
  7385. @end table
  7386. The parenthesis at the end indicate the matches that would be used for that
  7387. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  7388. @var{top}).
  7389. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  7390. the slowest.
  7391. Default value is @var{pc_n}.
  7392. @item ppsrc
  7393. Mark the main input stream as a pre-processed input, and enable the secondary
  7394. input stream as the clean source to pick the fields from. See the filter
  7395. introduction for more details. It is similar to the @option{clip2} feature from
  7396. VFM/TFM.
  7397. Default value is @code{0} (disabled).
  7398. @item field
  7399. Set the field to match from. It is recommended to set this to the same value as
  7400. @option{order} unless you experience matching failures with that setting. In
  7401. certain circumstances changing the field that is used to match from can have a
  7402. large impact on matching performance. Available values are:
  7403. @table @samp
  7404. @item auto
  7405. Automatic (same value as @option{order}).
  7406. @item bottom
  7407. Match from the bottom field.
  7408. @item top
  7409. Match from the top field.
  7410. @end table
  7411. Default value is @var{auto}.
  7412. @item mchroma
  7413. Set whether or not chroma is included during the match comparisons. In most
  7414. cases it is recommended to leave this enabled. You should set this to @code{0}
  7415. only if your clip has bad chroma problems such as heavy rainbowing or other
  7416. artifacts. Setting this to @code{0} could also be used to speed things up at
  7417. the cost of some accuracy.
  7418. Default value is @code{1}.
  7419. @item y0
  7420. @item y1
  7421. These define an exclusion band which excludes the lines between @option{y0} and
  7422. @option{y1} from being included in the field matching decision. An exclusion
  7423. band can be used to ignore subtitles, a logo, or other things that may
  7424. interfere with the matching. @option{y0} sets the starting scan line and
  7425. @option{y1} sets the ending line; all lines in between @option{y0} and
  7426. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  7427. @option{y0} and @option{y1} to the same value will disable the feature.
  7428. @option{y0} and @option{y1} defaults to @code{0}.
  7429. @item scthresh
  7430. Set the scene change detection threshold as a percentage of maximum change on
  7431. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  7432. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  7433. @option{scthresh} is @code{[0.0, 100.0]}.
  7434. Default value is @code{12.0}.
  7435. @item combmatch
  7436. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  7437. account the combed scores of matches when deciding what match to use as the
  7438. final match. Available values are:
  7439. @table @samp
  7440. @item none
  7441. No final matching based on combed scores.
  7442. @item sc
  7443. Combed scores are only used when a scene change is detected.
  7444. @item full
  7445. Use combed scores all the time.
  7446. @end table
  7447. Default is @var{sc}.
  7448. @item combdbg
  7449. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  7450. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  7451. Available values are:
  7452. @table @samp
  7453. @item none
  7454. No forced calculation.
  7455. @item pcn
  7456. Force p/c/n calculations.
  7457. @item pcnub
  7458. Force p/c/n/u/b calculations.
  7459. @end table
  7460. Default value is @var{none}.
  7461. @item cthresh
  7462. This is the area combing threshold used for combed frame detection. This
  7463. essentially controls how "strong" or "visible" combing must be to be detected.
  7464. Larger values mean combing must be more visible and smaller values mean combing
  7465. can be less visible or strong and still be detected. Valid settings are from
  7466. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  7467. be detected as combed). This is basically a pixel difference value. A good
  7468. range is @code{[8, 12]}.
  7469. Default value is @code{9}.
  7470. @item chroma
  7471. Sets whether or not chroma is considered in the combed frame decision. Only
  7472. disable this if your source has chroma problems (rainbowing, etc.) that are
  7473. causing problems for the combed frame detection with chroma enabled. Actually,
  7474. using @option{chroma}=@var{0} is usually more reliable, except for the case
  7475. where there is chroma only combing in the source.
  7476. Default value is @code{0}.
  7477. @item blockx
  7478. @item blocky
  7479. Respectively set the x-axis and y-axis size of the window used during combed
  7480. frame detection. This has to do with the size of the area in which
  7481. @option{combpel} pixels are required to be detected as combed for a frame to be
  7482. declared combed. See the @option{combpel} parameter description for more info.
  7483. Possible values are any number that is a power of 2 starting at 4 and going up
  7484. to 512.
  7485. Default value is @code{16}.
  7486. @item combpel
  7487. The number of combed pixels inside any of the @option{blocky} by
  7488. @option{blockx} size blocks on the frame for the frame to be detected as
  7489. combed. While @option{cthresh} controls how "visible" the combing must be, this
  7490. setting controls "how much" combing there must be in any localized area (a
  7491. window defined by the @option{blockx} and @option{blocky} settings) on the
  7492. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  7493. which point no frames will ever be detected as combed). This setting is known
  7494. as @option{MI} in TFM/VFM vocabulary.
  7495. Default value is @code{80}.
  7496. @end table
  7497. @anchor{p/c/n/u/b meaning}
  7498. @subsection p/c/n/u/b meaning
  7499. @subsubsection p/c/n
  7500. We assume the following telecined stream:
  7501. @example
  7502. Top fields: 1 2 2 3 4
  7503. Bottom fields: 1 2 3 4 4
  7504. @end example
  7505. The numbers correspond to the progressive frame the fields relate to. Here, the
  7506. first two frames are progressive, the 3rd and 4th are combed, and so on.
  7507. When @code{fieldmatch} is configured to run a matching from bottom
  7508. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  7509. @example
  7510. Input stream:
  7511. T 1 2 2 3 4
  7512. B 1 2 3 4 4 <-- matching reference
  7513. Matches: c c n n c
  7514. Output stream:
  7515. T 1 2 3 4 4
  7516. B 1 2 3 4 4
  7517. @end example
  7518. As a result of the field matching, we can see that some frames get duplicated.
  7519. To perform a complete inverse telecine, you need to rely on a decimation filter
  7520. after this operation. See for instance the @ref{decimate} filter.
  7521. The same operation now matching from top fields (@option{field}=@var{top})
  7522. looks like this:
  7523. @example
  7524. Input stream:
  7525. T 1 2 2 3 4 <-- matching reference
  7526. B 1 2 3 4 4
  7527. Matches: c c p p c
  7528. Output stream:
  7529. T 1 2 2 3 4
  7530. B 1 2 2 3 4
  7531. @end example
  7532. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  7533. basically, they refer to the frame and field of the opposite parity:
  7534. @itemize
  7535. @item @var{p} matches the field of the opposite parity in the previous frame
  7536. @item @var{c} matches the field of the opposite parity in the current frame
  7537. @item @var{n} matches the field of the opposite parity in the next frame
  7538. @end itemize
  7539. @subsubsection u/b
  7540. The @var{u} and @var{b} matching are a bit special in the sense that they match
  7541. from the opposite parity flag. In the following examples, we assume that we are
  7542. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  7543. 'x' is placed above and below each matched fields.
  7544. With bottom matching (@option{field}=@var{bottom}):
  7545. @example
  7546. Match: c p n b u
  7547. x x x x x
  7548. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7549. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7550. x x x x x
  7551. Output frames:
  7552. 2 1 2 2 2
  7553. 2 2 2 1 3
  7554. @end example
  7555. With top matching (@option{field}=@var{top}):
  7556. @example
  7557. Match: c p n b u
  7558. x x x x x
  7559. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7560. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7561. x x x x x
  7562. Output frames:
  7563. 2 2 2 1 2
  7564. 2 1 3 2 2
  7565. @end example
  7566. @subsection Examples
  7567. Simple IVTC of a top field first telecined stream:
  7568. @example
  7569. fieldmatch=order=tff:combmatch=none, decimate
  7570. @end example
  7571. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  7572. @example
  7573. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  7574. @end example
  7575. @section fieldorder
  7576. Transform the field order of the input video.
  7577. It accepts the following parameters:
  7578. @table @option
  7579. @item order
  7580. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  7581. for bottom field first.
  7582. @end table
  7583. The default value is @samp{tff}.
  7584. The transformation is done by shifting the picture content up or down
  7585. by one line, and filling the remaining line with appropriate picture content.
  7586. This method is consistent with most broadcast field order converters.
  7587. If the input video is not flagged as being interlaced, or it is already
  7588. flagged as being of the required output field order, then this filter does
  7589. not alter the incoming video.
  7590. It is very useful when converting to or from PAL DV material,
  7591. which is bottom field first.
  7592. For example:
  7593. @example
  7594. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  7595. @end example
  7596. @section fifo, afifo
  7597. Buffer input images and send them when they are requested.
  7598. It is mainly useful when auto-inserted by the libavfilter
  7599. framework.
  7600. It does not take parameters.
  7601. @section fillborders
  7602. Fill borders of the input video, without changing video stream dimensions.
  7603. Sometimes video can have garbage at the four edges and you may not want to
  7604. crop video input to keep size multiple of some number.
  7605. This filter accepts the following options:
  7606. @table @option
  7607. @item left
  7608. Number of pixels to fill from left border.
  7609. @item right
  7610. Number of pixels to fill from right border.
  7611. @item top
  7612. Number of pixels to fill from top border.
  7613. @item bottom
  7614. Number of pixels to fill from bottom border.
  7615. @item mode
  7616. Set fill mode.
  7617. It accepts the following values:
  7618. @table @samp
  7619. @item smear
  7620. fill pixels using outermost pixels
  7621. @item mirror
  7622. fill pixels using mirroring
  7623. @item fixed
  7624. fill pixels with constant value
  7625. @end table
  7626. Default is @var{smear}.
  7627. @item color
  7628. Set color for pixels in fixed mode. Default is @var{black}.
  7629. @end table
  7630. @section find_rect
  7631. Find a rectangular object
  7632. It accepts the following options:
  7633. @table @option
  7634. @item object
  7635. Filepath of the object image, needs to be in gray8.
  7636. @item threshold
  7637. Detection threshold, default is 0.5.
  7638. @item mipmaps
  7639. Number of mipmaps, default is 3.
  7640. @item xmin, ymin, xmax, ymax
  7641. Specifies the rectangle in which to search.
  7642. @end table
  7643. @subsection Examples
  7644. @itemize
  7645. @item
  7646. Generate a representative palette of a given video using @command{ffmpeg}:
  7647. @example
  7648. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7649. @end example
  7650. @end itemize
  7651. @section cover_rect
  7652. Cover a rectangular object
  7653. It accepts the following options:
  7654. @table @option
  7655. @item cover
  7656. Filepath of the optional cover image, needs to be in yuv420.
  7657. @item mode
  7658. Set covering mode.
  7659. It accepts the following values:
  7660. @table @samp
  7661. @item cover
  7662. cover it by the supplied image
  7663. @item blur
  7664. cover it by interpolating the surrounding pixels
  7665. @end table
  7666. Default value is @var{blur}.
  7667. @end table
  7668. @subsection Examples
  7669. @itemize
  7670. @item
  7671. Generate a representative palette of a given video using @command{ffmpeg}:
  7672. @example
  7673. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7674. @end example
  7675. @end itemize
  7676. @section floodfill
  7677. Flood area with values of same pixel components with another values.
  7678. It accepts the following options:
  7679. @table @option
  7680. @item x
  7681. Set pixel x coordinate.
  7682. @item y
  7683. Set pixel y coordinate.
  7684. @item s0
  7685. Set source #0 component value.
  7686. @item s1
  7687. Set source #1 component value.
  7688. @item s2
  7689. Set source #2 component value.
  7690. @item s3
  7691. Set source #3 component value.
  7692. @item d0
  7693. Set destination #0 component value.
  7694. @item d1
  7695. Set destination #1 component value.
  7696. @item d2
  7697. Set destination #2 component value.
  7698. @item d3
  7699. Set destination #3 component value.
  7700. @end table
  7701. @anchor{format}
  7702. @section format
  7703. Convert the input video to one of the specified pixel formats.
  7704. Libavfilter will try to pick one that is suitable as input to
  7705. the next filter.
  7706. It accepts the following parameters:
  7707. @table @option
  7708. @item pix_fmts
  7709. A '|'-separated list of pixel format names, such as
  7710. "pix_fmts=yuv420p|monow|rgb24".
  7711. @end table
  7712. @subsection Examples
  7713. @itemize
  7714. @item
  7715. Convert the input video to the @var{yuv420p} format
  7716. @example
  7717. format=pix_fmts=yuv420p
  7718. @end example
  7719. Convert the input video to any of the formats in the list
  7720. @example
  7721. format=pix_fmts=yuv420p|yuv444p|yuv410p
  7722. @end example
  7723. @end itemize
  7724. @anchor{fps}
  7725. @section fps
  7726. Convert the video to specified constant frame rate by duplicating or dropping
  7727. frames as necessary.
  7728. It accepts the following parameters:
  7729. @table @option
  7730. @item fps
  7731. The desired output frame rate. The default is @code{25}.
  7732. @item start_time
  7733. Assume the first PTS should be the given value, in seconds. This allows for
  7734. padding/trimming at the start of stream. By default, no assumption is made
  7735. about the first frame's expected PTS, so no padding or trimming is done.
  7736. For example, this could be set to 0 to pad the beginning with duplicates of
  7737. the first frame if a video stream starts after the audio stream or to trim any
  7738. frames with a negative PTS.
  7739. @item round
  7740. Timestamp (PTS) rounding method.
  7741. Possible values are:
  7742. @table @option
  7743. @item zero
  7744. round towards 0
  7745. @item inf
  7746. round away from 0
  7747. @item down
  7748. round towards -infinity
  7749. @item up
  7750. round towards +infinity
  7751. @item near
  7752. round to nearest
  7753. @end table
  7754. The default is @code{near}.
  7755. @item eof_action
  7756. Action performed when reading the last frame.
  7757. Possible values are:
  7758. @table @option
  7759. @item round
  7760. Use same timestamp rounding method as used for other frames.
  7761. @item pass
  7762. Pass through last frame if input duration has not been reached yet.
  7763. @end table
  7764. The default is @code{round}.
  7765. @end table
  7766. Alternatively, the options can be specified as a flat string:
  7767. @var{fps}[:@var{start_time}[:@var{round}]].
  7768. See also the @ref{setpts} filter.
  7769. @subsection Examples
  7770. @itemize
  7771. @item
  7772. A typical usage in order to set the fps to 25:
  7773. @example
  7774. fps=fps=25
  7775. @end example
  7776. @item
  7777. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  7778. @example
  7779. fps=fps=film:round=near
  7780. @end example
  7781. @end itemize
  7782. @section framepack
  7783. Pack two different video streams into a stereoscopic video, setting proper
  7784. metadata on supported codecs. The two views should have the same size and
  7785. framerate and processing will stop when the shorter video ends. Please note
  7786. that you may conveniently adjust view properties with the @ref{scale} and
  7787. @ref{fps} filters.
  7788. It accepts the following parameters:
  7789. @table @option
  7790. @item format
  7791. The desired packing format. Supported values are:
  7792. @table @option
  7793. @item sbs
  7794. The views are next to each other (default).
  7795. @item tab
  7796. The views are on top of each other.
  7797. @item lines
  7798. The views are packed by line.
  7799. @item columns
  7800. The views are packed by column.
  7801. @item frameseq
  7802. The views are temporally interleaved.
  7803. @end table
  7804. @end table
  7805. Some examples:
  7806. @example
  7807. # Convert left and right views into a frame-sequential video
  7808. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  7809. # Convert views into a side-by-side video with the same output resolution as the input
  7810. 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
  7811. @end example
  7812. @section framerate
  7813. Change the frame rate by interpolating new video output frames from the source
  7814. frames.
  7815. This filter is not designed to function correctly with interlaced media. If
  7816. you wish to change the frame rate of interlaced media then you are required
  7817. to deinterlace before this filter and re-interlace after this filter.
  7818. A description of the accepted options follows.
  7819. @table @option
  7820. @item fps
  7821. Specify the output frames per second. This option can also be specified
  7822. as a value alone. The default is @code{50}.
  7823. @item interp_start
  7824. Specify the start of a range where the output frame will be created as a
  7825. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7826. the default is @code{15}.
  7827. @item interp_end
  7828. Specify the end of a range where the output frame will be created as a
  7829. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7830. the default is @code{240}.
  7831. @item scene
  7832. Specify the level at which a scene change is detected as a value between
  7833. 0 and 100 to indicate a new scene; a low value reflects a low
  7834. probability for the current frame to introduce a new scene, while a higher
  7835. value means the current frame is more likely to be one.
  7836. The default is @code{8.2}.
  7837. @item flags
  7838. Specify flags influencing the filter process.
  7839. Available value for @var{flags} is:
  7840. @table @option
  7841. @item scene_change_detect, scd
  7842. Enable scene change detection using the value of the option @var{scene}.
  7843. This flag is enabled by default.
  7844. @end table
  7845. @end table
  7846. @section framestep
  7847. Select one frame every N-th frame.
  7848. This filter accepts the following option:
  7849. @table @option
  7850. @item step
  7851. Select frame after every @code{step} frames.
  7852. Allowed values are positive integers higher than 0. Default value is @code{1}.
  7853. @end table
  7854. @section freezedetect
  7855. Detect frozen video.
  7856. This filter logs a message and sets frame metadata when it detects that the
  7857. input video has no significant change in content during a specified duration.
  7858. Video freeze detection calculates the mean average absolute difference of all
  7859. the components of video frames and compares it to a noise floor.
  7860. The printed times and duration are expressed in seconds. The
  7861. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  7862. whose timestamp equals or exceeds the detection duration and it contains the
  7863. timestamp of the first frame of the freeze. The
  7864. @code{lavfi.freezedetect.freeze_duration} and
  7865. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  7866. after the freeze.
  7867. The filter accepts the following options:
  7868. @table @option
  7869. @item noise, n
  7870. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  7871. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  7872. 0.001.
  7873. @item duration, d
  7874. Set freeze duration until notification (default is 2 seconds).
  7875. @end table
  7876. @anchor{frei0r}
  7877. @section frei0r
  7878. Apply a frei0r effect to the input video.
  7879. To enable the compilation of this filter, you need to install the frei0r
  7880. header and configure FFmpeg with @code{--enable-frei0r}.
  7881. It accepts the following parameters:
  7882. @table @option
  7883. @item filter_name
  7884. The name of the frei0r effect to load. If the environment variable
  7885. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  7886. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  7887. Otherwise, the standard frei0r paths are searched, in this order:
  7888. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  7889. @file{/usr/lib/frei0r-1/}.
  7890. @item filter_params
  7891. A '|'-separated list of parameters to pass to the frei0r effect.
  7892. @end table
  7893. A frei0r effect parameter can be a boolean (its value is either
  7894. "y" or "n"), a double, a color (specified as
  7895. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  7896. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  7897. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  7898. a position (specified as @var{X}/@var{Y}, where
  7899. @var{X} and @var{Y} are floating point numbers) and/or a string.
  7900. The number and types of parameters depend on the loaded effect. If an
  7901. effect parameter is not specified, the default value is set.
  7902. @subsection Examples
  7903. @itemize
  7904. @item
  7905. Apply the distort0r effect, setting the first two double parameters:
  7906. @example
  7907. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  7908. @end example
  7909. @item
  7910. Apply the colordistance effect, taking a color as the first parameter:
  7911. @example
  7912. frei0r=colordistance:0.2/0.3/0.4
  7913. frei0r=colordistance:violet
  7914. frei0r=colordistance:0x112233
  7915. @end example
  7916. @item
  7917. Apply the perspective effect, specifying the top left and top right image
  7918. positions:
  7919. @example
  7920. frei0r=perspective:0.2/0.2|0.8/0.2
  7921. @end example
  7922. @end itemize
  7923. For more information, see
  7924. @url{http://frei0r.dyne.org}
  7925. @section fspp
  7926. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  7927. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  7928. processing filter, one of them is performed once per block, not per pixel.
  7929. This allows for much higher speed.
  7930. The filter accepts the following options:
  7931. @table @option
  7932. @item quality
  7933. Set quality. This option defines the number of levels for averaging. It accepts
  7934. an integer in the range 4-5. Default value is @code{4}.
  7935. @item qp
  7936. Force a constant quantization parameter. It accepts an integer in range 0-63.
  7937. If not set, the filter will use the QP from the video stream (if available).
  7938. @item strength
  7939. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  7940. more details but also more artifacts, while higher values make the image smoother
  7941. but also blurrier. Default value is @code{0} − PSNR optimal.
  7942. @item use_bframe_qp
  7943. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  7944. option may cause flicker since the B-Frames have often larger QP. Default is
  7945. @code{0} (not enabled).
  7946. @end table
  7947. @section gblur
  7948. Apply Gaussian blur filter.
  7949. The filter accepts the following options:
  7950. @table @option
  7951. @item sigma
  7952. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  7953. @item steps
  7954. Set number of steps for Gaussian approximation. Default is @code{1}.
  7955. @item planes
  7956. Set which planes to filter. By default all planes are filtered.
  7957. @item sigmaV
  7958. Set vertical sigma, if negative it will be same as @code{sigma}.
  7959. Default is @code{-1}.
  7960. @end table
  7961. @section geq
  7962. Apply generic equation to each pixel.
  7963. The filter accepts the following options:
  7964. @table @option
  7965. @item lum_expr, lum
  7966. Set the luminance expression.
  7967. @item cb_expr, cb
  7968. Set the chrominance blue expression.
  7969. @item cr_expr, cr
  7970. Set the chrominance red expression.
  7971. @item alpha_expr, a
  7972. Set the alpha expression.
  7973. @item red_expr, r
  7974. Set the red expression.
  7975. @item green_expr, g
  7976. Set the green expression.
  7977. @item blue_expr, b
  7978. Set the blue expression.
  7979. @end table
  7980. The colorspace is selected according to the specified options. If one
  7981. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  7982. options is specified, the filter will automatically select a YCbCr
  7983. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  7984. @option{blue_expr} options is specified, it will select an RGB
  7985. colorspace.
  7986. If one of the chrominance expression is not defined, it falls back on the other
  7987. one. If no alpha expression is specified it will evaluate to opaque value.
  7988. If none of chrominance expressions are specified, they will evaluate
  7989. to the luminance expression.
  7990. The expressions can use the following variables and functions:
  7991. @table @option
  7992. @item N
  7993. The sequential number of the filtered frame, starting from @code{0}.
  7994. @item X
  7995. @item Y
  7996. The coordinates of the current sample.
  7997. @item W
  7998. @item H
  7999. The width and height of the image.
  8000. @item SW
  8001. @item SH
  8002. Width and height scale depending on the currently filtered plane. It is the
  8003. ratio between the corresponding luma plane number of pixels and the current
  8004. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  8005. @code{0.5,0.5} for chroma planes.
  8006. @item T
  8007. Time of the current frame, expressed in seconds.
  8008. @item p(x, y)
  8009. Return the value of the pixel at location (@var{x},@var{y}) of the current
  8010. plane.
  8011. @item lum(x, y)
  8012. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  8013. plane.
  8014. @item cb(x, y)
  8015. Return the value of the pixel at location (@var{x},@var{y}) of the
  8016. blue-difference chroma plane. Return 0 if there is no such plane.
  8017. @item cr(x, y)
  8018. Return the value of the pixel at location (@var{x},@var{y}) of the
  8019. red-difference chroma plane. Return 0 if there is no such plane.
  8020. @item r(x, y)
  8021. @item g(x, y)
  8022. @item b(x, y)
  8023. Return the value of the pixel at location (@var{x},@var{y}) of the
  8024. red/green/blue component. Return 0 if there is no such component.
  8025. @item alpha(x, y)
  8026. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  8027. plane. Return 0 if there is no such plane.
  8028. @end table
  8029. For functions, if @var{x} and @var{y} are outside the area, the value will be
  8030. automatically clipped to the closer edge.
  8031. @subsection Examples
  8032. @itemize
  8033. @item
  8034. Flip the image horizontally:
  8035. @example
  8036. geq=p(W-X\,Y)
  8037. @end example
  8038. @item
  8039. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  8040. wavelength of 100 pixels:
  8041. @example
  8042. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  8043. @end example
  8044. @item
  8045. Generate a fancy enigmatic moving light:
  8046. @example
  8047. 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
  8048. @end example
  8049. @item
  8050. Generate a quick emboss effect:
  8051. @example
  8052. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  8053. @end example
  8054. @item
  8055. Modify RGB components depending on pixel position:
  8056. @example
  8057. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  8058. @end example
  8059. @item
  8060. Create a radial gradient that is the same size as the input (also see
  8061. the @ref{vignette} filter):
  8062. @example
  8063. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  8064. @end example
  8065. @end itemize
  8066. @section gradfun
  8067. Fix the banding artifacts that are sometimes introduced into nearly flat
  8068. regions by truncation to 8-bit color depth.
  8069. Interpolate the gradients that should go where the bands are, and
  8070. dither them.
  8071. It is designed for playback only. Do not use it prior to
  8072. lossy compression, because compression tends to lose the dither and
  8073. bring back the bands.
  8074. It accepts the following parameters:
  8075. @table @option
  8076. @item strength
  8077. The maximum amount by which the filter will change any one pixel. This is also
  8078. the threshold for detecting nearly flat regions. Acceptable values range from
  8079. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  8080. valid range.
  8081. @item radius
  8082. The neighborhood to fit the gradient to. A larger radius makes for smoother
  8083. gradients, but also prevents the filter from modifying the pixels near detailed
  8084. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  8085. values will be clipped to the valid range.
  8086. @end table
  8087. Alternatively, the options can be specified as a flat string:
  8088. @var{strength}[:@var{radius}]
  8089. @subsection Examples
  8090. @itemize
  8091. @item
  8092. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  8093. @example
  8094. gradfun=3.5:8
  8095. @end example
  8096. @item
  8097. Specify radius, omitting the strength (which will fall-back to the default
  8098. value):
  8099. @example
  8100. gradfun=radius=8
  8101. @end example
  8102. @end itemize
  8103. @section graphmonitor, agraphmonitor
  8104. Show various filtergraph stats.
  8105. With this filter one can debug complete filtergraph.
  8106. Especially issues with links filling with queued frames.
  8107. The filter accepts the following options:
  8108. @table @option
  8109. @item size, s
  8110. Set video output size. Default is @var{hd720}.
  8111. @item opacity, o
  8112. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  8113. @item mode, m
  8114. Set output mode, can be @var{fulll} or @var{compact}.
  8115. In @var{compact} mode only filters with some queued frames have displayed stats.
  8116. @item flags, f
  8117. Set flags which enable which stats are shown in video.
  8118. Available values for flags are:
  8119. @table @samp
  8120. @item queue
  8121. Display number of queued frames in each link.
  8122. @item frame_count_in
  8123. Display number of frames taken from filter.
  8124. @item frame_count_out
  8125. Display number of frames given out from filter.
  8126. @item pts
  8127. Display current filtered frame pts.
  8128. @item time
  8129. Display current filtered frame time.
  8130. @item timebase
  8131. Display time base for filter link.
  8132. @item format
  8133. Display used format for filter link.
  8134. @item size
  8135. Display video size or number of audio channels in case of audio used by filter link.
  8136. @item rate
  8137. Display video frame rate or sample rate in case of audio used by filter link.
  8138. @end table
  8139. @item rate, r
  8140. Set upper limit for video rate of output stream, Default value is @var{25}.
  8141. This guarantee that output video frame rate will not be higher than this value.
  8142. @end table
  8143. @section greyedge
  8144. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  8145. and corrects the scene colors accordingly.
  8146. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  8147. The filter accepts the following options:
  8148. @table @option
  8149. @item difford
  8150. The order of differentiation to be applied on the scene. Must be chosen in the range
  8151. [0,2] and default value is 1.
  8152. @item minknorm
  8153. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  8154. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  8155. max value instead of calculating Minkowski distance.
  8156. @item sigma
  8157. The standard deviation of Gaussian blur to be applied on the scene. Must be
  8158. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  8159. can't be equal to 0 if @var{difford} is greater than 0.
  8160. @end table
  8161. @subsection Examples
  8162. @itemize
  8163. @item
  8164. Grey Edge:
  8165. @example
  8166. greyedge=difford=1:minknorm=5:sigma=2
  8167. @end example
  8168. @item
  8169. Max Edge:
  8170. @example
  8171. greyedge=difford=1:minknorm=0:sigma=2
  8172. @end example
  8173. @end itemize
  8174. @anchor{haldclut}
  8175. @section haldclut
  8176. Apply a Hald CLUT to a video stream.
  8177. First input is the video stream to process, and second one is the Hald CLUT.
  8178. The Hald CLUT input can be a simple picture or a complete video stream.
  8179. The filter accepts the following options:
  8180. @table @option
  8181. @item shortest
  8182. Force termination when the shortest input terminates. Default is @code{0}.
  8183. @item repeatlast
  8184. Continue applying the last CLUT after the end of the stream. A value of
  8185. @code{0} disable the filter after the last frame of the CLUT is reached.
  8186. Default is @code{1}.
  8187. @end table
  8188. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  8189. filters share the same internals).
  8190. More information about the Hald CLUT can be found on Eskil Steenberg's website
  8191. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  8192. @subsection Workflow examples
  8193. @subsubsection Hald CLUT video stream
  8194. Generate an identity Hald CLUT stream altered with various effects:
  8195. @example
  8196. 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
  8197. @end example
  8198. Note: make sure you use a lossless codec.
  8199. Then use it with @code{haldclut} to apply it on some random stream:
  8200. @example
  8201. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  8202. @end example
  8203. The Hald CLUT will be applied to the 10 first seconds (duration of
  8204. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  8205. to the remaining frames of the @code{mandelbrot} stream.
  8206. @subsubsection Hald CLUT with preview
  8207. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  8208. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  8209. biggest possible square starting at the top left of the picture. The remaining
  8210. padding pixels (bottom or right) will be ignored. This area can be used to add
  8211. a preview of the Hald CLUT.
  8212. Typically, the following generated Hald CLUT will be supported by the
  8213. @code{haldclut} filter:
  8214. @example
  8215. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  8216. pad=iw+320 [padded_clut];
  8217. smptebars=s=320x256, split [a][b];
  8218. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  8219. [main][b] overlay=W-320" -frames:v 1 clut.png
  8220. @end example
  8221. It contains the original and a preview of the effect of the CLUT: SMPTE color
  8222. bars are displayed on the right-top, and below the same color bars processed by
  8223. the color changes.
  8224. Then, the effect of this Hald CLUT can be visualized with:
  8225. @example
  8226. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  8227. @end example
  8228. @section hflip
  8229. Flip the input video horizontally.
  8230. For example, to horizontally flip the input video with @command{ffmpeg}:
  8231. @example
  8232. ffmpeg -i in.avi -vf "hflip" out.avi
  8233. @end example
  8234. @section histeq
  8235. This filter applies a global color histogram equalization on a
  8236. per-frame basis.
  8237. It can be used to correct video that has a compressed range of pixel
  8238. intensities. The filter redistributes the pixel intensities to
  8239. equalize their distribution across the intensity range. It may be
  8240. viewed as an "automatically adjusting contrast filter". This filter is
  8241. useful only for correcting degraded or poorly captured source
  8242. video.
  8243. The filter accepts the following options:
  8244. @table @option
  8245. @item strength
  8246. Determine the amount of equalization to be applied. As the strength
  8247. is reduced, the distribution of pixel intensities more-and-more
  8248. approaches that of the input frame. The value must be a float number
  8249. in the range [0,1] and defaults to 0.200.
  8250. @item intensity
  8251. Set the maximum intensity that can generated and scale the output
  8252. values appropriately. The strength should be set as desired and then
  8253. the intensity can be limited if needed to avoid washing-out. The value
  8254. must be a float number in the range [0,1] and defaults to 0.210.
  8255. @item antibanding
  8256. Set the antibanding level. If enabled the filter will randomly vary
  8257. the luminance of output pixels by a small amount to avoid banding of
  8258. the histogram. Possible values are @code{none}, @code{weak} or
  8259. @code{strong}. It defaults to @code{none}.
  8260. @end table
  8261. @section histogram
  8262. Compute and draw a color distribution histogram for the input video.
  8263. The computed histogram is a representation of the color component
  8264. distribution in an image.
  8265. Standard histogram displays the color components distribution in an image.
  8266. Displays color graph for each color component. Shows distribution of
  8267. the Y, U, V, A or R, G, B components, depending on input format, in the
  8268. current frame. Below each graph a color component scale meter is shown.
  8269. The filter accepts the following options:
  8270. @table @option
  8271. @item level_height
  8272. Set height of level. Default value is @code{200}.
  8273. Allowed range is [50, 2048].
  8274. @item scale_height
  8275. Set height of color scale. Default value is @code{12}.
  8276. Allowed range is [0, 40].
  8277. @item display_mode
  8278. Set display mode.
  8279. It accepts the following values:
  8280. @table @samp
  8281. @item stack
  8282. Per color component graphs are placed below each other.
  8283. @item parade
  8284. Per color component graphs are placed side by side.
  8285. @item overlay
  8286. Presents information identical to that in the @code{parade}, except
  8287. that the graphs representing color components are superimposed directly
  8288. over one another.
  8289. @end table
  8290. Default is @code{stack}.
  8291. @item levels_mode
  8292. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  8293. Default is @code{linear}.
  8294. @item components
  8295. Set what color components to display.
  8296. Default is @code{7}.
  8297. @item fgopacity
  8298. Set foreground opacity. Default is @code{0.7}.
  8299. @item bgopacity
  8300. Set background opacity. Default is @code{0.5}.
  8301. @end table
  8302. @subsection Examples
  8303. @itemize
  8304. @item
  8305. Calculate and draw histogram:
  8306. @example
  8307. ffplay -i input -vf histogram
  8308. @end example
  8309. @end itemize
  8310. @anchor{hqdn3d}
  8311. @section hqdn3d
  8312. This is a high precision/quality 3d denoise filter. It aims to reduce
  8313. image noise, producing smooth images and making still images really
  8314. still. It should enhance compressibility.
  8315. It accepts the following optional parameters:
  8316. @table @option
  8317. @item luma_spatial
  8318. A non-negative floating point number which specifies spatial luma strength.
  8319. It defaults to 4.0.
  8320. @item chroma_spatial
  8321. A non-negative floating point number which specifies spatial chroma strength.
  8322. It defaults to 3.0*@var{luma_spatial}/4.0.
  8323. @item luma_tmp
  8324. A floating point number which specifies luma temporal strength. It defaults to
  8325. 6.0*@var{luma_spatial}/4.0.
  8326. @item chroma_tmp
  8327. A floating point number which specifies chroma temporal strength. It defaults to
  8328. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  8329. @end table
  8330. @anchor{hwdownload}
  8331. @section hwdownload
  8332. Download hardware frames to system memory.
  8333. The input must be in hardware frames, and the output a non-hardware format.
  8334. Not all formats will be supported on the output - it may be necessary to insert
  8335. an additional @option{format} filter immediately following in the graph to get
  8336. the output in a supported format.
  8337. @section hwmap
  8338. Map hardware frames to system memory or to another device.
  8339. This filter has several different modes of operation; which one is used depends
  8340. on the input and output formats:
  8341. @itemize
  8342. @item
  8343. Hardware frame input, normal frame output
  8344. Map the input frames to system memory and pass them to the output. If the
  8345. original hardware frame is later required (for example, after overlaying
  8346. something else on part of it), the @option{hwmap} filter can be used again
  8347. in the next mode to retrieve it.
  8348. @item
  8349. Normal frame input, hardware frame output
  8350. If the input is actually a software-mapped hardware frame, then unmap it -
  8351. that is, return the original hardware frame.
  8352. Otherwise, a device must be provided. Create new hardware surfaces on that
  8353. device for the output, then map them back to the software format at the input
  8354. and give those frames to the preceding filter. This will then act like the
  8355. @option{hwupload} filter, but may be able to avoid an additional copy when
  8356. the input is already in a compatible format.
  8357. @item
  8358. Hardware frame input and output
  8359. A device must be supplied for the output, either directly or with the
  8360. @option{derive_device} option. The input and output devices must be of
  8361. different types and compatible - the exact meaning of this is
  8362. system-dependent, but typically it means that they must refer to the same
  8363. underlying hardware context (for example, refer to the same graphics card).
  8364. If the input frames were originally created on the output device, then unmap
  8365. to retrieve the original frames.
  8366. Otherwise, map the frames to the output device - create new hardware frames
  8367. on the output corresponding to the frames on the input.
  8368. @end itemize
  8369. The following additional parameters are accepted:
  8370. @table @option
  8371. @item mode
  8372. Set the frame mapping mode. Some combination of:
  8373. @table @var
  8374. @item read
  8375. The mapped frame should be readable.
  8376. @item write
  8377. The mapped frame should be writeable.
  8378. @item overwrite
  8379. The mapping will always overwrite the entire frame.
  8380. This may improve performance in some cases, as the original contents of the
  8381. frame need not be loaded.
  8382. @item direct
  8383. The mapping must not involve any copying.
  8384. Indirect mappings to copies of frames are created in some cases where either
  8385. direct mapping is not possible or it would have unexpected properties.
  8386. Setting this flag ensures that the mapping is direct and will fail if that is
  8387. not possible.
  8388. @end table
  8389. Defaults to @var{read+write} if not specified.
  8390. @item derive_device @var{type}
  8391. Rather than using the device supplied at initialisation, instead derive a new
  8392. device of type @var{type} from the device the input frames exist on.
  8393. @item reverse
  8394. In a hardware to hardware mapping, map in reverse - create frames in the sink
  8395. and map them back to the source. This may be necessary in some cases where
  8396. a mapping in one direction is required but only the opposite direction is
  8397. supported by the devices being used.
  8398. This option is dangerous - it may break the preceding filter in undefined
  8399. ways if there are any additional constraints on that filter's output.
  8400. Do not use it without fully understanding the implications of its use.
  8401. @end table
  8402. @anchor{hwupload}
  8403. @section hwupload
  8404. Upload system memory frames to hardware surfaces.
  8405. The device to upload to must be supplied when the filter is initialised. If
  8406. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  8407. option.
  8408. @anchor{hwupload_cuda}
  8409. @section hwupload_cuda
  8410. Upload system memory frames to a CUDA device.
  8411. It accepts the following optional parameters:
  8412. @table @option
  8413. @item device
  8414. The number of the CUDA device to use
  8415. @end table
  8416. @section hqx
  8417. Apply a high-quality magnification filter designed for pixel art. This filter
  8418. was originally created by Maxim Stepin.
  8419. It accepts the following option:
  8420. @table @option
  8421. @item n
  8422. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  8423. @code{hq3x} and @code{4} for @code{hq4x}.
  8424. Default is @code{3}.
  8425. @end table
  8426. @section hstack
  8427. Stack input videos horizontally.
  8428. All streams must be of same pixel format and of same height.
  8429. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  8430. to create same output.
  8431. The filter accept the following option:
  8432. @table @option
  8433. @item inputs
  8434. Set number of input streams. Default is 2.
  8435. @item shortest
  8436. If set to 1, force the output to terminate when the shortest input
  8437. terminates. Default value is 0.
  8438. @end table
  8439. @section hue
  8440. Modify the hue and/or the saturation of the input.
  8441. It accepts the following parameters:
  8442. @table @option
  8443. @item h
  8444. Specify the hue angle as a number of degrees. It accepts an expression,
  8445. and defaults to "0".
  8446. @item s
  8447. Specify the saturation in the [-10,10] range. It accepts an expression and
  8448. defaults to "1".
  8449. @item H
  8450. Specify the hue angle as a number of radians. It accepts an
  8451. expression, and defaults to "0".
  8452. @item b
  8453. Specify the brightness in the [-10,10] range. It accepts an expression and
  8454. defaults to "0".
  8455. @end table
  8456. @option{h} and @option{H} are mutually exclusive, and can't be
  8457. specified at the same time.
  8458. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  8459. expressions containing the following constants:
  8460. @table @option
  8461. @item n
  8462. frame count of the input frame starting from 0
  8463. @item pts
  8464. presentation timestamp of the input frame expressed in time base units
  8465. @item r
  8466. frame rate of the input video, NAN if the input frame rate is unknown
  8467. @item t
  8468. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8469. @item tb
  8470. time base of the input video
  8471. @end table
  8472. @subsection Examples
  8473. @itemize
  8474. @item
  8475. Set the hue to 90 degrees and the saturation to 1.0:
  8476. @example
  8477. hue=h=90:s=1
  8478. @end example
  8479. @item
  8480. Same command but expressing the hue in radians:
  8481. @example
  8482. hue=H=PI/2:s=1
  8483. @end example
  8484. @item
  8485. Rotate hue and make the saturation swing between 0
  8486. and 2 over a period of 1 second:
  8487. @example
  8488. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  8489. @end example
  8490. @item
  8491. Apply a 3 seconds saturation fade-in effect starting at 0:
  8492. @example
  8493. hue="s=min(t/3\,1)"
  8494. @end example
  8495. The general fade-in expression can be written as:
  8496. @example
  8497. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  8498. @end example
  8499. @item
  8500. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  8501. @example
  8502. hue="s=max(0\, min(1\, (8-t)/3))"
  8503. @end example
  8504. The general fade-out expression can be written as:
  8505. @example
  8506. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  8507. @end example
  8508. @end itemize
  8509. @subsection Commands
  8510. This filter supports the following commands:
  8511. @table @option
  8512. @item b
  8513. @item s
  8514. @item h
  8515. @item H
  8516. Modify the hue and/or the saturation and/or brightness of the input video.
  8517. The command accepts the same syntax of the corresponding option.
  8518. If the specified expression is not valid, it is kept at its current
  8519. value.
  8520. @end table
  8521. @section hysteresis
  8522. Grow first stream into second stream by connecting components.
  8523. This makes it possible to build more robust edge masks.
  8524. This filter accepts the following options:
  8525. @table @option
  8526. @item planes
  8527. Set which planes will be processed as bitmap, unprocessed planes will be
  8528. copied from first stream.
  8529. By default value 0xf, all planes will be processed.
  8530. @item threshold
  8531. Set threshold which is used in filtering. If pixel component value is higher than
  8532. this value filter algorithm for connecting components is activated.
  8533. By default value is 0.
  8534. @end table
  8535. @section idet
  8536. Detect video interlacing type.
  8537. This filter tries to detect if the input frames are interlaced, progressive,
  8538. top or bottom field first. It will also try to detect fields that are
  8539. repeated between adjacent frames (a sign of telecine).
  8540. Single frame detection considers only immediately adjacent frames when classifying each frame.
  8541. Multiple frame detection incorporates the classification history of previous frames.
  8542. The filter will log these metadata values:
  8543. @table @option
  8544. @item single.current_frame
  8545. Detected type of current frame using single-frame detection. One of:
  8546. ``tff'' (top field first), ``bff'' (bottom field first),
  8547. ``progressive'', or ``undetermined''
  8548. @item single.tff
  8549. Cumulative number of frames detected as top field first using single-frame detection.
  8550. @item multiple.tff
  8551. Cumulative number of frames detected as top field first using multiple-frame detection.
  8552. @item single.bff
  8553. Cumulative number of frames detected as bottom field first using single-frame detection.
  8554. @item multiple.current_frame
  8555. Detected type of current frame using multiple-frame detection. One of:
  8556. ``tff'' (top field first), ``bff'' (bottom field first),
  8557. ``progressive'', or ``undetermined''
  8558. @item multiple.bff
  8559. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  8560. @item single.progressive
  8561. Cumulative number of frames detected as progressive using single-frame detection.
  8562. @item multiple.progressive
  8563. Cumulative number of frames detected as progressive using multiple-frame detection.
  8564. @item single.undetermined
  8565. Cumulative number of frames that could not be classified using single-frame detection.
  8566. @item multiple.undetermined
  8567. Cumulative number of frames that could not be classified using multiple-frame detection.
  8568. @item repeated.current_frame
  8569. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  8570. @item repeated.neither
  8571. Cumulative number of frames with no repeated field.
  8572. @item repeated.top
  8573. Cumulative number of frames with the top field repeated from the previous frame's top field.
  8574. @item repeated.bottom
  8575. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  8576. @end table
  8577. The filter accepts the following options:
  8578. @table @option
  8579. @item intl_thres
  8580. Set interlacing threshold.
  8581. @item prog_thres
  8582. Set progressive threshold.
  8583. @item rep_thres
  8584. Threshold for repeated field detection.
  8585. @item half_life
  8586. Number of frames after which a given frame's contribution to the
  8587. statistics is halved (i.e., it contributes only 0.5 to its
  8588. classification). The default of 0 means that all frames seen are given
  8589. full weight of 1.0 forever.
  8590. @item analyze_interlaced_flag
  8591. When this is not 0 then idet will use the specified number of frames to determine
  8592. if the interlaced flag is accurate, it will not count undetermined frames.
  8593. If the flag is found to be accurate it will be used without any further
  8594. computations, if it is found to be inaccurate it will be cleared without any
  8595. further computations. This allows inserting the idet filter as a low computational
  8596. method to clean up the interlaced flag
  8597. @end table
  8598. @section il
  8599. Deinterleave or interleave fields.
  8600. This filter allows one to process interlaced images fields without
  8601. deinterlacing them. Deinterleaving splits the input frame into 2
  8602. fields (so called half pictures). Odd lines are moved to the top
  8603. half of the output image, even lines to the bottom half.
  8604. You can process (filter) them independently and then re-interleave them.
  8605. The filter accepts the following options:
  8606. @table @option
  8607. @item luma_mode, l
  8608. @item chroma_mode, c
  8609. @item alpha_mode, a
  8610. Available values for @var{luma_mode}, @var{chroma_mode} and
  8611. @var{alpha_mode} are:
  8612. @table @samp
  8613. @item none
  8614. Do nothing.
  8615. @item deinterleave, d
  8616. Deinterleave fields, placing one above the other.
  8617. @item interleave, i
  8618. Interleave fields. Reverse the effect of deinterleaving.
  8619. @end table
  8620. Default value is @code{none}.
  8621. @item luma_swap, ls
  8622. @item chroma_swap, cs
  8623. @item alpha_swap, as
  8624. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  8625. @end table
  8626. @section inflate
  8627. Apply inflate effect to the video.
  8628. This filter replaces the pixel by the local(3x3) average by taking into account
  8629. only values higher than the pixel.
  8630. It accepts the following options:
  8631. @table @option
  8632. @item threshold0
  8633. @item threshold1
  8634. @item threshold2
  8635. @item threshold3
  8636. Limit the maximum change for each plane, default is 65535.
  8637. If 0, plane will remain unchanged.
  8638. @end table
  8639. @section interlace
  8640. Simple interlacing filter from progressive contents. This interleaves upper (or
  8641. lower) lines from odd frames with lower (or upper) lines from even frames,
  8642. halving the frame rate and preserving image height.
  8643. @example
  8644. Original Original New Frame
  8645. Frame 'j' Frame 'j+1' (tff)
  8646. ========== =========== ==================
  8647. Line 0 --------------------> Frame 'j' Line 0
  8648. Line 1 Line 1 ----> Frame 'j+1' Line 1
  8649. Line 2 ---------------------> Frame 'j' Line 2
  8650. Line 3 Line 3 ----> Frame 'j+1' Line 3
  8651. ... ... ...
  8652. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  8653. @end example
  8654. It accepts the following optional parameters:
  8655. @table @option
  8656. @item scan
  8657. This determines whether the interlaced frame is taken from the even
  8658. (tff - default) or odd (bff) lines of the progressive frame.
  8659. @item lowpass
  8660. Vertical lowpass filter to avoid twitter interlacing and
  8661. reduce moire patterns.
  8662. @table @samp
  8663. @item 0, off
  8664. Disable vertical lowpass filter
  8665. @item 1, linear
  8666. Enable linear filter (default)
  8667. @item 2, complex
  8668. Enable complex filter. This will slightly less reduce twitter and moire
  8669. but better retain detail and subjective sharpness impression.
  8670. @end table
  8671. @end table
  8672. @section kerndeint
  8673. Deinterlace input video by applying Donald Graft's adaptive kernel
  8674. deinterling. Work on interlaced parts of a video to produce
  8675. progressive frames.
  8676. The description of the accepted parameters follows.
  8677. @table @option
  8678. @item thresh
  8679. Set the threshold which affects the filter's tolerance when
  8680. determining if a pixel line must be processed. It must be an integer
  8681. in the range [0,255] and defaults to 10. A value of 0 will result in
  8682. applying the process on every pixels.
  8683. @item map
  8684. Paint pixels exceeding the threshold value to white if set to 1.
  8685. Default is 0.
  8686. @item order
  8687. Set the fields order. Swap fields if set to 1, leave fields alone if
  8688. 0. Default is 0.
  8689. @item sharp
  8690. Enable additional sharpening if set to 1. Default is 0.
  8691. @item twoway
  8692. Enable twoway sharpening if set to 1. Default is 0.
  8693. @end table
  8694. @subsection Examples
  8695. @itemize
  8696. @item
  8697. Apply default values:
  8698. @example
  8699. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  8700. @end example
  8701. @item
  8702. Enable additional sharpening:
  8703. @example
  8704. kerndeint=sharp=1
  8705. @end example
  8706. @item
  8707. Paint processed pixels in white:
  8708. @example
  8709. kerndeint=map=1
  8710. @end example
  8711. @end itemize
  8712. @section lagfun
  8713. Slowly update darker pixels.
  8714. This filter makes short flashes of light appear longer.
  8715. This filter accepts the following options:
  8716. @table @option
  8717. @item decay
  8718. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  8719. @item planes
  8720. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  8721. @end table
  8722. @section lenscorrection
  8723. Correct radial lens distortion
  8724. This filter can be used to correct for radial distortion as can result from the use
  8725. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  8726. one can use tools available for example as part of opencv or simply trial-and-error.
  8727. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  8728. and extract the k1 and k2 coefficients from the resulting matrix.
  8729. Note that effectively the same filter is available in the open-source tools Krita and
  8730. Digikam from the KDE project.
  8731. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  8732. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  8733. brightness distribution, so you may want to use both filters together in certain
  8734. cases, though you will have to take care of ordering, i.e. whether vignetting should
  8735. be applied before or after lens correction.
  8736. @subsection Options
  8737. The filter accepts the following options:
  8738. @table @option
  8739. @item cx
  8740. Relative x-coordinate of the focal point of the image, and thereby the center of the
  8741. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8742. width. Default is 0.5.
  8743. @item cy
  8744. Relative y-coordinate of the focal point of the image, and thereby the center of the
  8745. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8746. height. Default is 0.5.
  8747. @item k1
  8748. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  8749. no correction. Default is 0.
  8750. @item k2
  8751. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  8752. 0 means no correction. Default is 0.
  8753. @end table
  8754. The formula that generates the correction is:
  8755. @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)
  8756. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  8757. distances from the focal point in the source and target images, respectively.
  8758. @section lensfun
  8759. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  8760. The @code{lensfun} filter requires the camera make, camera model, and lens model
  8761. to apply the lens correction. The filter will load the lensfun database and
  8762. query it to find the corresponding camera and lens entries in the database. As
  8763. long as these entries can be found with the given options, the filter can
  8764. perform corrections on frames. Note that incomplete strings will result in the
  8765. filter choosing the best match with the given options, and the filter will
  8766. output the chosen camera and lens models (logged with level "info"). You must
  8767. provide the make, camera model, and lens model as they are required.
  8768. The filter accepts the following options:
  8769. @table @option
  8770. @item make
  8771. The make of the camera (for example, "Canon"). This option is required.
  8772. @item model
  8773. The model of the camera (for example, "Canon EOS 100D"). This option is
  8774. required.
  8775. @item lens_model
  8776. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  8777. option is required.
  8778. @item mode
  8779. The type of correction to apply. The following values are valid options:
  8780. @table @samp
  8781. @item vignetting
  8782. Enables fixing lens vignetting.
  8783. @item geometry
  8784. Enables fixing lens geometry. This is the default.
  8785. @item subpixel
  8786. Enables fixing chromatic aberrations.
  8787. @item vig_geo
  8788. Enables fixing lens vignetting and lens geometry.
  8789. @item vig_subpixel
  8790. Enables fixing lens vignetting and chromatic aberrations.
  8791. @item distortion
  8792. Enables fixing both lens geometry and chromatic aberrations.
  8793. @item all
  8794. Enables all possible corrections.
  8795. @end table
  8796. @item focal_length
  8797. The focal length of the image/video (zoom; expected constant for video). For
  8798. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  8799. range should be chosen when using that lens. Default 18.
  8800. @item aperture
  8801. The aperture of the image/video (expected constant for video). Note that
  8802. aperture is only used for vignetting correction. Default 3.5.
  8803. @item focus_distance
  8804. The focus distance of the image/video (expected constant for video). Note that
  8805. focus distance is only used for vignetting and only slightly affects the
  8806. vignetting correction process. If unknown, leave it at the default value (which
  8807. is 1000).
  8808. @item scale
  8809. The scale factor which is applied after transformation. After correction the
  8810. video is no longer necessarily rectangular. This parameter controls how much of
  8811. the resulting image is visible. The value 0 means that a value will be chosen
  8812. automatically such that there is little or no unmapped area in the output
  8813. image. 1.0 means that no additional scaling is done. Lower values may result
  8814. in more of the corrected image being visible, while higher values may avoid
  8815. unmapped areas in the output.
  8816. @item target_geometry
  8817. The target geometry of the output image/video. The following values are valid
  8818. options:
  8819. @table @samp
  8820. @item rectilinear (default)
  8821. @item fisheye
  8822. @item panoramic
  8823. @item equirectangular
  8824. @item fisheye_orthographic
  8825. @item fisheye_stereographic
  8826. @item fisheye_equisolid
  8827. @item fisheye_thoby
  8828. @end table
  8829. @item reverse
  8830. Apply the reverse of image correction (instead of correcting distortion, apply
  8831. it).
  8832. @item interpolation
  8833. The type of interpolation used when correcting distortion. The following values
  8834. are valid options:
  8835. @table @samp
  8836. @item nearest
  8837. @item linear (default)
  8838. @item lanczos
  8839. @end table
  8840. @end table
  8841. @subsection Examples
  8842. @itemize
  8843. @item
  8844. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  8845. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  8846. aperture of "8.0".
  8847. @example
  8848. 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
  8849. @end example
  8850. @item
  8851. Apply the same as before, but only for the first 5 seconds of video.
  8852. @example
  8853. 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
  8854. @end example
  8855. @end itemize
  8856. @section libvmaf
  8857. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  8858. score between two input videos.
  8859. The obtained VMAF score is printed through the logging system.
  8860. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  8861. After installing the library it can be enabled using:
  8862. @code{./configure --enable-libvmaf --enable-version3}.
  8863. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  8864. The filter has following options:
  8865. @table @option
  8866. @item model_path
  8867. Set the model path which is to be used for SVM.
  8868. Default value: @code{"vmaf_v0.6.1.pkl"}
  8869. @item log_path
  8870. Set the file path to be used to store logs.
  8871. @item log_fmt
  8872. Set the format of the log file (xml or json).
  8873. @item enable_transform
  8874. This option can enable/disable the @code{score_transform} applied to the final predicted VMAF score,
  8875. if you have specified score_transform option in the input parameter file passed to @code{run_vmaf_training.py}
  8876. Default value: @code{false}
  8877. @item phone_model
  8878. Invokes the phone model which will generate VMAF scores higher than in the
  8879. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  8880. @item psnr
  8881. Enables computing psnr along with vmaf.
  8882. @item ssim
  8883. Enables computing ssim along with vmaf.
  8884. @item ms_ssim
  8885. Enables computing ms_ssim along with vmaf.
  8886. @item pool
  8887. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  8888. @item n_threads
  8889. Set number of threads to be used when computing vmaf.
  8890. @item n_subsample
  8891. Set interval for frame subsampling used when computing vmaf.
  8892. @item enable_conf_interval
  8893. Enables confidence interval.
  8894. @end table
  8895. This filter also supports the @ref{framesync} options.
  8896. On the below examples the input file @file{main.mpg} being processed is
  8897. compared with the reference file @file{ref.mpg}.
  8898. @example
  8899. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  8900. @end example
  8901. Example with options:
  8902. @example
  8903. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:log_fmt=json" -f null -
  8904. @end example
  8905. @section limiter
  8906. Limits the pixel components values to the specified range [min, max].
  8907. The filter accepts the following options:
  8908. @table @option
  8909. @item min
  8910. Lower bound. Defaults to the lowest allowed value for the input.
  8911. @item max
  8912. Upper bound. Defaults to the highest allowed value for the input.
  8913. @item planes
  8914. Specify which planes will be processed. Defaults to all available.
  8915. @end table
  8916. @section loop
  8917. Loop video frames.
  8918. The filter accepts the following options:
  8919. @table @option
  8920. @item loop
  8921. Set the number of loops. Setting this value to -1 will result in infinite loops.
  8922. Default is 0.
  8923. @item size
  8924. Set maximal size in number of frames. Default is 0.
  8925. @item start
  8926. Set first frame of loop. Default is 0.
  8927. @end table
  8928. @subsection Examples
  8929. @itemize
  8930. @item
  8931. Loop single first frame infinitely:
  8932. @example
  8933. loop=loop=-1:size=1:start=0
  8934. @end example
  8935. @item
  8936. Loop single first frame 10 times:
  8937. @example
  8938. loop=loop=10:size=1:start=0
  8939. @end example
  8940. @item
  8941. Loop 10 first frames 5 times:
  8942. @example
  8943. loop=loop=5:size=10:start=0
  8944. @end example
  8945. @end itemize
  8946. @section lut1d
  8947. Apply a 1D LUT to an input video.
  8948. The filter accepts the following options:
  8949. @table @option
  8950. @item file
  8951. Set the 1D LUT file name.
  8952. Currently supported formats:
  8953. @table @samp
  8954. @item cube
  8955. Iridas
  8956. @item csp
  8957. cineSpace
  8958. @end table
  8959. @item interp
  8960. Select interpolation mode.
  8961. Available values are:
  8962. @table @samp
  8963. @item nearest
  8964. Use values from the nearest defined point.
  8965. @item linear
  8966. Interpolate values using the linear interpolation.
  8967. @item cosine
  8968. Interpolate values using the cosine interpolation.
  8969. @item cubic
  8970. Interpolate values using the cubic interpolation.
  8971. @item spline
  8972. Interpolate values using the spline interpolation.
  8973. @end table
  8974. @end table
  8975. @anchor{lut3d}
  8976. @section lut3d
  8977. Apply a 3D LUT to an input video.
  8978. The filter accepts the following options:
  8979. @table @option
  8980. @item file
  8981. Set the 3D LUT file name.
  8982. Currently supported formats:
  8983. @table @samp
  8984. @item 3dl
  8985. AfterEffects
  8986. @item cube
  8987. Iridas
  8988. @item dat
  8989. DaVinci
  8990. @item m3d
  8991. Pandora
  8992. @item csp
  8993. cineSpace
  8994. @end table
  8995. @item interp
  8996. Select interpolation mode.
  8997. Available values are:
  8998. @table @samp
  8999. @item nearest
  9000. Use values from the nearest defined point.
  9001. @item trilinear
  9002. Interpolate values using the 8 points defining a cube.
  9003. @item tetrahedral
  9004. Interpolate values using a tetrahedron.
  9005. @end table
  9006. @end table
  9007. This filter also supports the @ref{framesync} options.
  9008. @section lumakey
  9009. Turn certain luma values into transparency.
  9010. The filter accepts the following options:
  9011. @table @option
  9012. @item threshold
  9013. Set the luma which will be used as base for transparency.
  9014. Default value is @code{0}.
  9015. @item tolerance
  9016. Set the range of luma values to be keyed out.
  9017. Default value is @code{0}.
  9018. @item softness
  9019. Set the range of softness. Default value is @code{0}.
  9020. Use this to control gradual transition from zero to full transparency.
  9021. @end table
  9022. @section lut, lutrgb, lutyuv
  9023. Compute a look-up table for binding each pixel component input value
  9024. to an output value, and apply it to the input video.
  9025. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  9026. to an RGB input video.
  9027. These filters accept the following parameters:
  9028. @table @option
  9029. @item c0
  9030. set first pixel component expression
  9031. @item c1
  9032. set second pixel component expression
  9033. @item c2
  9034. set third pixel component expression
  9035. @item c3
  9036. set fourth pixel component expression, corresponds to the alpha component
  9037. @item r
  9038. set red component expression
  9039. @item g
  9040. set green component expression
  9041. @item b
  9042. set blue component expression
  9043. @item a
  9044. alpha component expression
  9045. @item y
  9046. set Y/luminance component expression
  9047. @item u
  9048. set U/Cb component expression
  9049. @item v
  9050. set V/Cr component expression
  9051. @end table
  9052. Each of them specifies the expression to use for computing the lookup table for
  9053. the corresponding pixel component values.
  9054. The exact component associated to each of the @var{c*} options depends on the
  9055. format in input.
  9056. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  9057. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  9058. The expressions can contain the following constants and functions:
  9059. @table @option
  9060. @item w
  9061. @item h
  9062. The input width and height.
  9063. @item val
  9064. The input value for the pixel component.
  9065. @item clipval
  9066. The input value, clipped to the @var{minval}-@var{maxval} range.
  9067. @item maxval
  9068. The maximum value for the pixel component.
  9069. @item minval
  9070. The minimum value for the pixel component.
  9071. @item negval
  9072. The negated value for the pixel component value, clipped to the
  9073. @var{minval}-@var{maxval} range; it corresponds to the expression
  9074. "maxval-clipval+minval".
  9075. @item clip(val)
  9076. The computed value in @var{val}, clipped to the
  9077. @var{minval}-@var{maxval} range.
  9078. @item gammaval(gamma)
  9079. The computed gamma correction value of the pixel component value,
  9080. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  9081. expression
  9082. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  9083. @end table
  9084. All expressions default to "val".
  9085. @subsection Examples
  9086. @itemize
  9087. @item
  9088. Negate input video:
  9089. @example
  9090. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  9091. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  9092. @end example
  9093. The above is the same as:
  9094. @example
  9095. lutrgb="r=negval:g=negval:b=negval"
  9096. lutyuv="y=negval:u=negval:v=negval"
  9097. @end example
  9098. @item
  9099. Negate luminance:
  9100. @example
  9101. lutyuv=y=negval
  9102. @end example
  9103. @item
  9104. Remove chroma components, turning the video into a graytone image:
  9105. @example
  9106. lutyuv="u=128:v=128"
  9107. @end example
  9108. @item
  9109. Apply a luma burning effect:
  9110. @example
  9111. lutyuv="y=2*val"
  9112. @end example
  9113. @item
  9114. Remove green and blue components:
  9115. @example
  9116. lutrgb="g=0:b=0"
  9117. @end example
  9118. @item
  9119. Set a constant alpha channel value on input:
  9120. @example
  9121. format=rgba,lutrgb=a="maxval-minval/2"
  9122. @end example
  9123. @item
  9124. Correct luminance gamma by a factor of 0.5:
  9125. @example
  9126. lutyuv=y=gammaval(0.5)
  9127. @end example
  9128. @item
  9129. Discard least significant bits of luma:
  9130. @example
  9131. lutyuv=y='bitand(val, 128+64+32)'
  9132. @end example
  9133. @item
  9134. Technicolor like effect:
  9135. @example
  9136. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  9137. @end example
  9138. @end itemize
  9139. @section lut2, tlut2
  9140. The @code{lut2} filter takes two input streams and outputs one
  9141. stream.
  9142. The @code{tlut2} (time lut2) filter takes two consecutive frames
  9143. from one single stream.
  9144. This filter accepts the following parameters:
  9145. @table @option
  9146. @item c0
  9147. set first pixel component expression
  9148. @item c1
  9149. set second pixel component expression
  9150. @item c2
  9151. set third pixel component expression
  9152. @item c3
  9153. set fourth pixel component expression, corresponds to the alpha component
  9154. @item d
  9155. set output bit depth, only available for @code{lut2} filter. By default is 0,
  9156. which means bit depth is automatically picked from first input format.
  9157. @end table
  9158. Each of them specifies the expression to use for computing the lookup table for
  9159. the corresponding pixel component values.
  9160. The exact component associated to each of the @var{c*} options depends on the
  9161. format in inputs.
  9162. The expressions can contain the following constants:
  9163. @table @option
  9164. @item w
  9165. @item h
  9166. The input width and height.
  9167. @item x
  9168. The first input value for the pixel component.
  9169. @item y
  9170. The second input value for the pixel component.
  9171. @item bdx
  9172. The first input video bit depth.
  9173. @item bdy
  9174. The second input video bit depth.
  9175. @end table
  9176. All expressions default to "x".
  9177. @subsection Examples
  9178. @itemize
  9179. @item
  9180. Highlight differences between two RGB video streams:
  9181. @example
  9182. 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)'
  9183. @end example
  9184. @item
  9185. Highlight differences between two YUV video streams:
  9186. @example
  9187. 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)'
  9188. @end example
  9189. @item
  9190. Show max difference between two video streams:
  9191. @example
  9192. 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)))'
  9193. @end example
  9194. @end itemize
  9195. @section maskedclamp
  9196. Clamp the first input stream with the second input and third input stream.
  9197. Returns the value of first stream to be between second input
  9198. stream - @code{undershoot} and third input stream + @code{overshoot}.
  9199. This filter accepts the following options:
  9200. @table @option
  9201. @item undershoot
  9202. Default value is @code{0}.
  9203. @item overshoot
  9204. Default value is @code{0}.
  9205. @item planes
  9206. Set which planes will be processed as bitmap, unprocessed planes will be
  9207. copied from first stream.
  9208. By default value 0xf, all planes will be processed.
  9209. @end table
  9210. @section maskedmerge
  9211. Merge the first input stream with the second input stream using per pixel
  9212. weights in the third input stream.
  9213. A value of 0 in the third stream pixel component means that pixel component
  9214. from first stream is returned unchanged, while maximum value (eg. 255 for
  9215. 8-bit videos) means that pixel component from second stream is returned
  9216. unchanged. Intermediate values define the amount of merging between both
  9217. input stream's pixel components.
  9218. This filter accepts the following options:
  9219. @table @option
  9220. @item planes
  9221. Set which planes will be processed as bitmap, unprocessed planes will be
  9222. copied from first stream.
  9223. By default value 0xf, all planes will be processed.
  9224. @end table
  9225. @section maskfun
  9226. Create mask from input video.
  9227. For example it is useful to create motion masks after @code{tblend} filter.
  9228. This filter accepts the following options:
  9229. @table @option
  9230. @item low
  9231. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  9232. @item high
  9233. Set high threshold. Any pixel component higher than this value will be set to max value
  9234. allowed for current pixel format.
  9235. @item planes
  9236. Set planes to filter, by default all available planes are filtered.
  9237. @item fill
  9238. Fill all frame pixels with this value.
  9239. @item sum
  9240. Set max average pixel value for frame. If sum of all pixel components is higher that this
  9241. average, output frame will be completely filled with value set by @var{fill} option.
  9242. Typically useful for scene changes when used in combination with @code{tblend} filter.
  9243. @end table
  9244. @section mcdeint
  9245. Apply motion-compensation deinterlacing.
  9246. It needs one field per frame as input and must thus be used together
  9247. with yadif=1/3 or equivalent.
  9248. This filter accepts the following options:
  9249. @table @option
  9250. @item mode
  9251. Set the deinterlacing mode.
  9252. It accepts one of the following values:
  9253. @table @samp
  9254. @item fast
  9255. @item medium
  9256. @item slow
  9257. use iterative motion estimation
  9258. @item extra_slow
  9259. like @samp{slow}, but use multiple reference frames.
  9260. @end table
  9261. Default value is @samp{fast}.
  9262. @item parity
  9263. Set the picture field parity assumed for the input video. It must be
  9264. one of the following values:
  9265. @table @samp
  9266. @item 0, tff
  9267. assume top field first
  9268. @item 1, bff
  9269. assume bottom field first
  9270. @end table
  9271. Default value is @samp{bff}.
  9272. @item qp
  9273. Set per-block quantization parameter (QP) used by the internal
  9274. encoder.
  9275. Higher values should result in a smoother motion vector field but less
  9276. optimal individual vectors. Default value is 1.
  9277. @end table
  9278. @section mergeplanes
  9279. Merge color channel components from several video streams.
  9280. The filter accepts up to 4 input streams, and merge selected input
  9281. planes to the output video.
  9282. This filter accepts the following options:
  9283. @table @option
  9284. @item mapping
  9285. Set input to output plane mapping. Default is @code{0}.
  9286. The mappings is specified as a bitmap. It should be specified as a
  9287. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  9288. mapping for the first plane of the output stream. 'A' sets the number of
  9289. the input stream to use (from 0 to 3), and 'a' the plane number of the
  9290. corresponding input to use (from 0 to 3). The rest of the mappings is
  9291. similar, 'Bb' describes the mapping for the output stream second
  9292. plane, 'Cc' describes the mapping for the output stream third plane and
  9293. 'Dd' describes the mapping for the output stream fourth plane.
  9294. @item format
  9295. Set output pixel format. Default is @code{yuva444p}.
  9296. @end table
  9297. @subsection Examples
  9298. @itemize
  9299. @item
  9300. Merge three gray video streams of same width and height into single video stream:
  9301. @example
  9302. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  9303. @end example
  9304. @item
  9305. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  9306. @example
  9307. [a0][a1]mergeplanes=0x00010210:yuva444p
  9308. @end example
  9309. @item
  9310. Swap Y and A plane in yuva444p stream:
  9311. @example
  9312. format=yuva444p,mergeplanes=0x03010200:yuva444p
  9313. @end example
  9314. @item
  9315. Swap U and V plane in yuv420p stream:
  9316. @example
  9317. format=yuv420p,mergeplanes=0x000201:yuv420p
  9318. @end example
  9319. @item
  9320. Cast a rgb24 clip to yuv444p:
  9321. @example
  9322. format=rgb24,mergeplanes=0x000102:yuv444p
  9323. @end example
  9324. @end itemize
  9325. @section mestimate
  9326. Estimate and export motion vectors using block matching algorithms.
  9327. Motion vectors are stored in frame side data to be used by other filters.
  9328. This filter accepts the following options:
  9329. @table @option
  9330. @item method
  9331. Specify the motion estimation method. Accepts one of the following values:
  9332. @table @samp
  9333. @item esa
  9334. Exhaustive search algorithm.
  9335. @item tss
  9336. Three step search algorithm.
  9337. @item tdls
  9338. Two dimensional logarithmic search algorithm.
  9339. @item ntss
  9340. New three step search algorithm.
  9341. @item fss
  9342. Four step search algorithm.
  9343. @item ds
  9344. Diamond search algorithm.
  9345. @item hexbs
  9346. Hexagon-based search algorithm.
  9347. @item epzs
  9348. Enhanced predictive zonal search algorithm.
  9349. @item umh
  9350. Uneven multi-hexagon search algorithm.
  9351. @end table
  9352. Default value is @samp{esa}.
  9353. @item mb_size
  9354. Macroblock size. Default @code{16}.
  9355. @item search_param
  9356. Search parameter. Default @code{7}.
  9357. @end table
  9358. @section midequalizer
  9359. Apply Midway Image Equalization effect using two video streams.
  9360. Midway Image Equalization adjusts a pair of images to have the same
  9361. histogram, while maintaining their dynamics as much as possible. It's
  9362. useful for e.g. matching exposures from a pair of stereo cameras.
  9363. This filter has two inputs and one output, which must be of same pixel format, but
  9364. may be of different sizes. The output of filter is first input adjusted with
  9365. midway histogram of both inputs.
  9366. This filter accepts the following option:
  9367. @table @option
  9368. @item planes
  9369. Set which planes to process. Default is @code{15}, which is all available planes.
  9370. @end table
  9371. @section minterpolate
  9372. Convert the video to specified frame rate using motion interpolation.
  9373. This filter accepts the following options:
  9374. @table @option
  9375. @item fps
  9376. 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}.
  9377. @item mi_mode
  9378. Motion interpolation mode. Following values are accepted:
  9379. @table @samp
  9380. @item dup
  9381. Duplicate previous or next frame for interpolating new ones.
  9382. @item blend
  9383. Blend source frames. Interpolated frame is mean of previous and next frames.
  9384. @item mci
  9385. Motion compensated interpolation. Following options are effective when this mode is selected:
  9386. @table @samp
  9387. @item mc_mode
  9388. Motion compensation mode. Following values are accepted:
  9389. @table @samp
  9390. @item obmc
  9391. Overlapped block motion compensation.
  9392. @item aobmc
  9393. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  9394. @end table
  9395. Default mode is @samp{obmc}.
  9396. @item me_mode
  9397. Motion estimation mode. Following values are accepted:
  9398. @table @samp
  9399. @item bidir
  9400. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  9401. @item bilat
  9402. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  9403. @end table
  9404. Default mode is @samp{bilat}.
  9405. @item me
  9406. The algorithm to be used for motion estimation. Following values are accepted:
  9407. @table @samp
  9408. @item esa
  9409. Exhaustive search algorithm.
  9410. @item tss
  9411. Three step search algorithm.
  9412. @item tdls
  9413. Two dimensional logarithmic search algorithm.
  9414. @item ntss
  9415. New three step search algorithm.
  9416. @item fss
  9417. Four step search algorithm.
  9418. @item ds
  9419. Diamond search algorithm.
  9420. @item hexbs
  9421. Hexagon-based search algorithm.
  9422. @item epzs
  9423. Enhanced predictive zonal search algorithm.
  9424. @item umh
  9425. Uneven multi-hexagon search algorithm.
  9426. @end table
  9427. Default algorithm is @samp{epzs}.
  9428. @item mb_size
  9429. Macroblock size. Default @code{16}.
  9430. @item search_param
  9431. Motion estimation search parameter. Default @code{32}.
  9432. @item vsbmc
  9433. 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).
  9434. @end table
  9435. @end table
  9436. @item scd
  9437. 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:
  9438. @table @samp
  9439. @item none
  9440. Disable scene change detection.
  9441. @item fdiff
  9442. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  9443. @end table
  9444. Default method is @samp{fdiff}.
  9445. @item scd_threshold
  9446. Scene change detection threshold. Default is @code{5.0}.
  9447. @end table
  9448. @section mix
  9449. Mix several video input streams into one video stream.
  9450. A description of the accepted options follows.
  9451. @table @option
  9452. @item nb_inputs
  9453. The number of inputs. If unspecified, it defaults to 2.
  9454. @item weights
  9455. Specify weight of each input video stream as sequence.
  9456. Each weight is separated by space. If number of weights
  9457. is smaller than number of @var{frames} last specified
  9458. weight will be used for all remaining unset weights.
  9459. @item scale
  9460. Specify scale, if it is set it will be multiplied with sum
  9461. of each weight multiplied with pixel values to give final destination
  9462. pixel value. By default @var{scale} is auto scaled to sum of weights.
  9463. @item duration
  9464. Specify how end of stream is determined.
  9465. @table @samp
  9466. @item longest
  9467. The duration of the longest input. (default)
  9468. @item shortest
  9469. The duration of the shortest input.
  9470. @item first
  9471. The duration of the first input.
  9472. @end table
  9473. @end table
  9474. @section mpdecimate
  9475. Drop frames that do not differ greatly from the previous frame in
  9476. order to reduce frame rate.
  9477. The main use of this filter is for very-low-bitrate encoding
  9478. (e.g. streaming over dialup modem), but it could in theory be used for
  9479. fixing movies that were inverse-telecined incorrectly.
  9480. A description of the accepted options follows.
  9481. @table @option
  9482. @item max
  9483. Set the maximum number of consecutive frames which can be dropped (if
  9484. positive), or the minimum interval between dropped frames (if
  9485. negative). If the value is 0, the frame is dropped disregarding the
  9486. number of previous sequentially dropped frames.
  9487. Default value is 0.
  9488. @item hi
  9489. @item lo
  9490. @item frac
  9491. Set the dropping threshold values.
  9492. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  9493. represent actual pixel value differences, so a threshold of 64
  9494. corresponds to 1 unit of difference for each pixel, or the same spread
  9495. out differently over the block.
  9496. A frame is a candidate for dropping if no 8x8 blocks differ by more
  9497. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  9498. meaning the whole image) differ by more than a threshold of @option{lo}.
  9499. Default value for @option{hi} is 64*12, default value for @option{lo} is
  9500. 64*5, and default value for @option{frac} is 0.33.
  9501. @end table
  9502. @section negate
  9503. Negate (invert) the input video.
  9504. It accepts the following option:
  9505. @table @option
  9506. @item negate_alpha
  9507. With value 1, it negates the alpha component, if present. Default value is 0.
  9508. @end table
  9509. @anchor{nlmeans}
  9510. @section nlmeans
  9511. Denoise frames using Non-Local Means algorithm.
  9512. Each pixel is adjusted by looking for other pixels with similar contexts. This
  9513. context similarity is defined by comparing their surrounding patches of size
  9514. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  9515. around the pixel.
  9516. Note that the research area defines centers for patches, which means some
  9517. patches will be made of pixels outside that research area.
  9518. The filter accepts the following options.
  9519. @table @option
  9520. @item s
  9521. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  9522. @item p
  9523. Set patch size. Default is 7. Must be odd number in range [0, 99].
  9524. @item pc
  9525. Same as @option{p} but for chroma planes.
  9526. The default value is @var{0} and means automatic.
  9527. @item r
  9528. Set research size. Default is 15. Must be odd number in range [0, 99].
  9529. @item rc
  9530. Same as @option{r} but for chroma planes.
  9531. The default value is @var{0} and means automatic.
  9532. @end table
  9533. @section nnedi
  9534. Deinterlace video using neural network edge directed interpolation.
  9535. This filter accepts the following options:
  9536. @table @option
  9537. @item weights
  9538. Mandatory option, without binary file filter can not work.
  9539. Currently file can be found here:
  9540. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  9541. @item deint
  9542. Set which frames to deinterlace, by default it is @code{all}.
  9543. Can be @code{all} or @code{interlaced}.
  9544. @item field
  9545. Set mode of operation.
  9546. Can be one of the following:
  9547. @table @samp
  9548. @item af
  9549. Use frame flags, both fields.
  9550. @item a
  9551. Use frame flags, single field.
  9552. @item t
  9553. Use top field only.
  9554. @item b
  9555. Use bottom field only.
  9556. @item tf
  9557. Use both fields, top first.
  9558. @item bf
  9559. Use both fields, bottom first.
  9560. @end table
  9561. @item planes
  9562. Set which planes to process, by default filter process all frames.
  9563. @item nsize
  9564. Set size of local neighborhood around each pixel, used by the predictor neural
  9565. network.
  9566. Can be one of the following:
  9567. @table @samp
  9568. @item s8x6
  9569. @item s16x6
  9570. @item s32x6
  9571. @item s48x6
  9572. @item s8x4
  9573. @item s16x4
  9574. @item s32x4
  9575. @end table
  9576. @item nns
  9577. Set the number of neurons in predictor neural network.
  9578. Can be one of the following:
  9579. @table @samp
  9580. @item n16
  9581. @item n32
  9582. @item n64
  9583. @item n128
  9584. @item n256
  9585. @end table
  9586. @item qual
  9587. Controls the number of different neural network predictions that are blended
  9588. together to compute the final output value. Can be @code{fast}, default or
  9589. @code{slow}.
  9590. @item etype
  9591. Set which set of weights to use in the predictor.
  9592. Can be one of the following:
  9593. @table @samp
  9594. @item a
  9595. weights trained to minimize absolute error
  9596. @item s
  9597. weights trained to minimize squared error
  9598. @end table
  9599. @item pscrn
  9600. Controls whether or not the prescreener neural network is used to decide
  9601. which pixels should be processed by the predictor neural network and which
  9602. can be handled by simple cubic interpolation.
  9603. The prescreener is trained to know whether cubic interpolation will be
  9604. sufficient for a pixel or whether it should be predicted by the predictor nn.
  9605. The computational complexity of the prescreener nn is much less than that of
  9606. the predictor nn. Since most pixels can be handled by cubic interpolation,
  9607. using the prescreener generally results in much faster processing.
  9608. The prescreener is pretty accurate, so the difference between using it and not
  9609. using it is almost always unnoticeable.
  9610. Can be one of the following:
  9611. @table @samp
  9612. @item none
  9613. @item original
  9614. @item new
  9615. @end table
  9616. Default is @code{new}.
  9617. @item fapprox
  9618. Set various debugging flags.
  9619. @end table
  9620. @section noformat
  9621. Force libavfilter not to use any of the specified pixel formats for the
  9622. input to the next filter.
  9623. It accepts the following parameters:
  9624. @table @option
  9625. @item pix_fmts
  9626. A '|'-separated list of pixel format names, such as
  9627. pix_fmts=yuv420p|monow|rgb24".
  9628. @end table
  9629. @subsection Examples
  9630. @itemize
  9631. @item
  9632. Force libavfilter to use a format different from @var{yuv420p} for the
  9633. input to the vflip filter:
  9634. @example
  9635. noformat=pix_fmts=yuv420p,vflip
  9636. @end example
  9637. @item
  9638. Convert the input video to any of the formats not contained in the list:
  9639. @example
  9640. noformat=yuv420p|yuv444p|yuv410p
  9641. @end example
  9642. @end itemize
  9643. @section noise
  9644. Add noise on video input frame.
  9645. The filter accepts the following options:
  9646. @table @option
  9647. @item all_seed
  9648. @item c0_seed
  9649. @item c1_seed
  9650. @item c2_seed
  9651. @item c3_seed
  9652. Set noise seed for specific pixel component or all pixel components in case
  9653. of @var{all_seed}. Default value is @code{123457}.
  9654. @item all_strength, alls
  9655. @item c0_strength, c0s
  9656. @item c1_strength, c1s
  9657. @item c2_strength, c2s
  9658. @item c3_strength, c3s
  9659. Set noise strength for specific pixel component or all pixel components in case
  9660. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  9661. @item all_flags, allf
  9662. @item c0_flags, c0f
  9663. @item c1_flags, c1f
  9664. @item c2_flags, c2f
  9665. @item c3_flags, c3f
  9666. Set pixel component flags or set flags for all components if @var{all_flags}.
  9667. Available values for component flags are:
  9668. @table @samp
  9669. @item a
  9670. averaged temporal noise (smoother)
  9671. @item p
  9672. mix random noise with a (semi)regular pattern
  9673. @item t
  9674. temporal noise (noise pattern changes between frames)
  9675. @item u
  9676. uniform noise (gaussian otherwise)
  9677. @end table
  9678. @end table
  9679. @subsection Examples
  9680. Add temporal and uniform noise to input video:
  9681. @example
  9682. noise=alls=20:allf=t+u
  9683. @end example
  9684. @section normalize
  9685. Normalize RGB video (aka histogram stretching, contrast stretching).
  9686. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  9687. For each channel of each frame, the filter computes the input range and maps
  9688. it linearly to the user-specified output range. The output range defaults
  9689. to the full dynamic range from pure black to pure white.
  9690. Temporal smoothing can be used on the input range to reduce flickering (rapid
  9691. changes in brightness) caused when small dark or bright objects enter or leave
  9692. the scene. This is similar to the auto-exposure (automatic gain control) on a
  9693. video camera, and, like a video camera, it may cause a period of over- or
  9694. under-exposure of the video.
  9695. The R,G,B channels can be normalized independently, which may cause some
  9696. color shifting, or linked together as a single channel, which prevents
  9697. color shifting. Linked normalization preserves hue. Independent normalization
  9698. does not, so it can be used to remove some color casts. Independent and linked
  9699. normalization can be combined in any ratio.
  9700. The normalize filter accepts the following options:
  9701. @table @option
  9702. @item blackpt
  9703. @item whitept
  9704. Colors which define the output range. The minimum input value is mapped to
  9705. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  9706. The defaults are black and white respectively. Specifying white for
  9707. @var{blackpt} and black for @var{whitept} will give color-inverted,
  9708. normalized video. Shades of grey can be used to reduce the dynamic range
  9709. (contrast). Specifying saturated colors here can create some interesting
  9710. effects.
  9711. @item smoothing
  9712. The number of previous frames to use for temporal smoothing. The input range
  9713. of each channel is smoothed using a rolling average over the current frame
  9714. and the @var{smoothing} previous frames. The default is 0 (no temporal
  9715. smoothing).
  9716. @item independence
  9717. Controls the ratio of independent (color shifting) channel normalization to
  9718. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  9719. independent. Defaults to 1.0 (fully independent).
  9720. @item strength
  9721. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  9722. expensive no-op. Defaults to 1.0 (full strength).
  9723. @end table
  9724. @subsection Examples
  9725. Stretch video contrast to use the full dynamic range, with no temporal
  9726. smoothing; may flicker depending on the source content:
  9727. @example
  9728. normalize=blackpt=black:whitept=white:smoothing=0
  9729. @end example
  9730. As above, but with 50 frames of temporal smoothing; flicker should be
  9731. reduced, depending on the source content:
  9732. @example
  9733. normalize=blackpt=black:whitept=white:smoothing=50
  9734. @end example
  9735. As above, but with hue-preserving linked channel normalization:
  9736. @example
  9737. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  9738. @end example
  9739. As above, but with half strength:
  9740. @example
  9741. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  9742. @end example
  9743. Map the darkest input color to red, the brightest input color to cyan:
  9744. @example
  9745. normalize=blackpt=red:whitept=cyan
  9746. @end example
  9747. @section null
  9748. Pass the video source unchanged to the output.
  9749. @section ocr
  9750. Optical Character Recognition
  9751. This filter uses Tesseract for optical character recognition. To enable
  9752. compilation of this filter, you need to configure FFmpeg with
  9753. @code{--enable-libtesseract}.
  9754. It accepts the following options:
  9755. @table @option
  9756. @item datapath
  9757. Set datapath to tesseract data. Default is to use whatever was
  9758. set at installation.
  9759. @item language
  9760. Set language, default is "eng".
  9761. @item whitelist
  9762. Set character whitelist.
  9763. @item blacklist
  9764. Set character blacklist.
  9765. @end table
  9766. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  9767. @section ocv
  9768. Apply a video transform using libopencv.
  9769. To enable this filter, install the libopencv library and headers and
  9770. configure FFmpeg with @code{--enable-libopencv}.
  9771. It accepts the following parameters:
  9772. @table @option
  9773. @item filter_name
  9774. The name of the libopencv filter to apply.
  9775. @item filter_params
  9776. The parameters to pass to the libopencv filter. If not specified, the default
  9777. values are assumed.
  9778. @end table
  9779. Refer to the official libopencv documentation for more precise
  9780. information:
  9781. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  9782. Several libopencv filters are supported; see the following subsections.
  9783. @anchor{dilate}
  9784. @subsection dilate
  9785. Dilate an image by using a specific structuring element.
  9786. It corresponds to the libopencv function @code{cvDilate}.
  9787. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  9788. @var{struct_el} represents a structuring element, and has the syntax:
  9789. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  9790. @var{cols} and @var{rows} represent the number of columns and rows of
  9791. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  9792. point, and @var{shape} the shape for the structuring element. @var{shape}
  9793. must be "rect", "cross", "ellipse", or "custom".
  9794. If the value for @var{shape} is "custom", it must be followed by a
  9795. string of the form "=@var{filename}". The file with name
  9796. @var{filename} is assumed to represent a binary image, with each
  9797. printable character corresponding to a bright pixel. When a custom
  9798. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  9799. or columns and rows of the read file are assumed instead.
  9800. The default value for @var{struct_el} is "3x3+0x0/rect".
  9801. @var{nb_iterations} specifies the number of times the transform is
  9802. applied to the image, and defaults to 1.
  9803. Some examples:
  9804. @example
  9805. # Use the default values
  9806. ocv=dilate
  9807. # Dilate using a structuring element with a 5x5 cross, iterating two times
  9808. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  9809. # Read the shape from the file diamond.shape, iterating two times.
  9810. # The file diamond.shape may contain a pattern of characters like this
  9811. # *
  9812. # ***
  9813. # *****
  9814. # ***
  9815. # *
  9816. # The specified columns and rows are ignored
  9817. # but the anchor point coordinates are not
  9818. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  9819. @end example
  9820. @subsection erode
  9821. Erode an image by using a specific structuring element.
  9822. It corresponds to the libopencv function @code{cvErode}.
  9823. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  9824. with the same syntax and semantics as the @ref{dilate} filter.
  9825. @subsection smooth
  9826. Smooth the input video.
  9827. The filter takes the following parameters:
  9828. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  9829. @var{type} is the type of smooth filter to apply, and must be one of
  9830. the following values: "blur", "blur_no_scale", "median", "gaussian",
  9831. or "bilateral". The default value is "gaussian".
  9832. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  9833. depend on the smooth type. @var{param1} and
  9834. @var{param2} accept integer positive values or 0. @var{param3} and
  9835. @var{param4} accept floating point values.
  9836. The default value for @var{param1} is 3. The default value for the
  9837. other parameters is 0.
  9838. These parameters correspond to the parameters assigned to the
  9839. libopencv function @code{cvSmooth}.
  9840. @section oscilloscope
  9841. 2D Video Oscilloscope.
  9842. Useful to measure spatial impulse, step responses, chroma delays, etc.
  9843. It accepts the following parameters:
  9844. @table @option
  9845. @item x
  9846. Set scope center x position.
  9847. @item y
  9848. Set scope center y position.
  9849. @item s
  9850. Set scope size, relative to frame diagonal.
  9851. @item t
  9852. Set scope tilt/rotation.
  9853. @item o
  9854. Set trace opacity.
  9855. @item tx
  9856. Set trace center x position.
  9857. @item ty
  9858. Set trace center y position.
  9859. @item tw
  9860. Set trace width, relative to width of frame.
  9861. @item th
  9862. Set trace height, relative to height of frame.
  9863. @item c
  9864. Set which components to trace. By default it traces first three components.
  9865. @item g
  9866. Draw trace grid. By default is enabled.
  9867. @item st
  9868. Draw some statistics. By default is enabled.
  9869. @item sc
  9870. Draw scope. By default is enabled.
  9871. @end table
  9872. @subsection Examples
  9873. @itemize
  9874. @item
  9875. Inspect full first row of video frame.
  9876. @example
  9877. oscilloscope=x=0.5:y=0:s=1
  9878. @end example
  9879. @item
  9880. Inspect full last row of video frame.
  9881. @example
  9882. oscilloscope=x=0.5:y=1:s=1
  9883. @end example
  9884. @item
  9885. Inspect full 5th line of video frame of height 1080.
  9886. @example
  9887. oscilloscope=x=0.5:y=5/1080:s=1
  9888. @end example
  9889. @item
  9890. Inspect full last column of video frame.
  9891. @example
  9892. oscilloscope=x=1:y=0.5:s=1:t=1
  9893. @end example
  9894. @end itemize
  9895. @anchor{overlay}
  9896. @section overlay
  9897. Overlay one video on top of another.
  9898. It takes two inputs and has one output. The first input is the "main"
  9899. video on which the second input is overlaid.
  9900. It accepts the following parameters:
  9901. A description of the accepted options follows.
  9902. @table @option
  9903. @item x
  9904. @item y
  9905. Set the expression for the x and y coordinates of the overlaid video
  9906. on the main video. Default value is "0" for both expressions. In case
  9907. the expression is invalid, it is set to a huge value (meaning that the
  9908. overlay will not be displayed within the output visible area).
  9909. @item eof_action
  9910. See @ref{framesync}.
  9911. @item eval
  9912. Set when the expressions for @option{x}, and @option{y} are evaluated.
  9913. It accepts the following values:
  9914. @table @samp
  9915. @item init
  9916. only evaluate expressions once during the filter initialization or
  9917. when a command is processed
  9918. @item frame
  9919. evaluate expressions for each incoming frame
  9920. @end table
  9921. Default value is @samp{frame}.
  9922. @item shortest
  9923. See @ref{framesync}.
  9924. @item format
  9925. Set the format for the output video.
  9926. It accepts the following values:
  9927. @table @samp
  9928. @item yuv420
  9929. force YUV420 output
  9930. @item yuv422
  9931. force YUV422 output
  9932. @item yuv444
  9933. force YUV444 output
  9934. @item rgb
  9935. force packed RGB output
  9936. @item gbrp
  9937. force planar RGB output
  9938. @item auto
  9939. automatically pick format
  9940. @end table
  9941. Default value is @samp{yuv420}.
  9942. @item repeatlast
  9943. See @ref{framesync}.
  9944. @item alpha
  9945. Set format of alpha of the overlaid video, it can be @var{straight} or
  9946. @var{premultiplied}. Default is @var{straight}.
  9947. @end table
  9948. The @option{x}, and @option{y} expressions can contain the following
  9949. parameters.
  9950. @table @option
  9951. @item main_w, W
  9952. @item main_h, H
  9953. The main input width and height.
  9954. @item overlay_w, w
  9955. @item overlay_h, h
  9956. The overlay input width and height.
  9957. @item x
  9958. @item y
  9959. The computed values for @var{x} and @var{y}. They are evaluated for
  9960. each new frame.
  9961. @item hsub
  9962. @item vsub
  9963. horizontal and vertical chroma subsample values of the output
  9964. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  9965. @var{vsub} is 1.
  9966. @item n
  9967. the number of input frame, starting from 0
  9968. @item pos
  9969. the position in the file of the input frame, NAN if unknown
  9970. @item t
  9971. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  9972. @end table
  9973. This filter also supports the @ref{framesync} options.
  9974. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  9975. when evaluation is done @emph{per frame}, and will evaluate to NAN
  9976. when @option{eval} is set to @samp{init}.
  9977. Be aware that frames are taken from each input video in timestamp
  9978. order, hence, if their initial timestamps differ, it is a good idea
  9979. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  9980. have them begin in the same zero timestamp, as the example for
  9981. the @var{movie} filter does.
  9982. You can chain together more overlays but you should test the
  9983. efficiency of such approach.
  9984. @subsection Commands
  9985. This filter supports the following commands:
  9986. @table @option
  9987. @item x
  9988. @item y
  9989. Modify the x and y of the overlay input.
  9990. The command accepts the same syntax of the corresponding option.
  9991. If the specified expression is not valid, it is kept at its current
  9992. value.
  9993. @end table
  9994. @subsection Examples
  9995. @itemize
  9996. @item
  9997. Draw the overlay at 10 pixels from the bottom right corner of the main
  9998. video:
  9999. @example
  10000. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  10001. @end example
  10002. Using named options the example above becomes:
  10003. @example
  10004. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  10005. @end example
  10006. @item
  10007. Insert a transparent PNG logo in the bottom left corner of the input,
  10008. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  10009. @example
  10010. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  10011. @end example
  10012. @item
  10013. Insert 2 different transparent PNG logos (second logo on bottom
  10014. right corner) using the @command{ffmpeg} tool:
  10015. @example
  10016. 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
  10017. @end example
  10018. @item
  10019. Add a transparent color layer on top of the main video; @code{WxH}
  10020. must specify the size of the main input to the overlay filter:
  10021. @example
  10022. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  10023. @end example
  10024. @item
  10025. Play an original video and a filtered version (here with the deshake
  10026. filter) side by side using the @command{ffplay} tool:
  10027. @example
  10028. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  10029. @end example
  10030. The above command is the same as:
  10031. @example
  10032. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  10033. @end example
  10034. @item
  10035. Make a sliding overlay appearing from the left to the right top part of the
  10036. screen starting since time 2:
  10037. @example
  10038. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  10039. @end example
  10040. @item
  10041. Compose output by putting two input videos side to side:
  10042. @example
  10043. ffmpeg -i left.avi -i right.avi -filter_complex "
  10044. nullsrc=size=200x100 [background];
  10045. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  10046. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  10047. [background][left] overlay=shortest=1 [background+left];
  10048. [background+left][right] overlay=shortest=1:x=100 [left+right]
  10049. "
  10050. @end example
  10051. @item
  10052. Mask 10-20 seconds of a video by applying the delogo filter to a section
  10053. @example
  10054. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  10055. -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]'
  10056. masked.avi
  10057. @end example
  10058. @item
  10059. Chain several overlays in cascade:
  10060. @example
  10061. nullsrc=s=200x200 [bg];
  10062. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  10063. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  10064. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  10065. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  10066. [in3] null, [mid2] overlay=100:100 [out0]
  10067. @end example
  10068. @end itemize
  10069. @section owdenoise
  10070. Apply Overcomplete Wavelet denoiser.
  10071. The filter accepts the following options:
  10072. @table @option
  10073. @item depth
  10074. Set depth.
  10075. Larger depth values will denoise lower frequency components more, but
  10076. slow down filtering.
  10077. Must be an int in the range 8-16, default is @code{8}.
  10078. @item luma_strength, ls
  10079. Set luma strength.
  10080. Must be a double value in the range 0-1000, default is @code{1.0}.
  10081. @item chroma_strength, cs
  10082. Set chroma strength.
  10083. Must be a double value in the range 0-1000, default is @code{1.0}.
  10084. @end table
  10085. @anchor{pad}
  10086. @section pad
  10087. Add paddings to the input image, and place the original input at the
  10088. provided @var{x}, @var{y} coordinates.
  10089. It accepts the following parameters:
  10090. @table @option
  10091. @item width, w
  10092. @item height, h
  10093. Specify an expression for the size of the output image with the
  10094. paddings added. If the value for @var{width} or @var{height} is 0, the
  10095. corresponding input size is used for the output.
  10096. The @var{width} expression can reference the value set by the
  10097. @var{height} expression, and vice versa.
  10098. The default value of @var{width} and @var{height} is 0.
  10099. @item x
  10100. @item y
  10101. Specify the offsets to place the input image at within the padded area,
  10102. with respect to the top/left border of the output image.
  10103. The @var{x} expression can reference the value set by the @var{y}
  10104. expression, and vice versa.
  10105. The default value of @var{x} and @var{y} is 0.
  10106. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  10107. so the input image is centered on the padded area.
  10108. @item color
  10109. Specify the color of the padded area. For the syntax of this option,
  10110. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  10111. manual,ffmpeg-utils}.
  10112. The default value of @var{color} is "black".
  10113. @item eval
  10114. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  10115. It accepts the following values:
  10116. @table @samp
  10117. @item init
  10118. Only evaluate expressions once during the filter initialization or when
  10119. a command is processed.
  10120. @item frame
  10121. Evaluate expressions for each incoming frame.
  10122. @end table
  10123. Default value is @samp{init}.
  10124. @item aspect
  10125. Pad to aspect instead to a resolution.
  10126. @end table
  10127. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  10128. options are expressions containing the following constants:
  10129. @table @option
  10130. @item in_w
  10131. @item in_h
  10132. The input video width and height.
  10133. @item iw
  10134. @item ih
  10135. These are the same as @var{in_w} and @var{in_h}.
  10136. @item out_w
  10137. @item out_h
  10138. The output width and height (the size of the padded area), as
  10139. specified by the @var{width} and @var{height} expressions.
  10140. @item ow
  10141. @item oh
  10142. These are the same as @var{out_w} and @var{out_h}.
  10143. @item x
  10144. @item y
  10145. The x and y offsets as specified by the @var{x} and @var{y}
  10146. expressions, or NAN if not yet specified.
  10147. @item a
  10148. same as @var{iw} / @var{ih}
  10149. @item sar
  10150. input sample aspect ratio
  10151. @item dar
  10152. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  10153. @item hsub
  10154. @item vsub
  10155. The horizontal and vertical chroma subsample values. For example for the
  10156. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10157. @end table
  10158. @subsection Examples
  10159. @itemize
  10160. @item
  10161. Add paddings with the color "violet" to the input video. The output video
  10162. size is 640x480, and the top-left corner of the input video is placed at
  10163. column 0, row 40
  10164. @example
  10165. pad=640:480:0:40:violet
  10166. @end example
  10167. The example above is equivalent to the following command:
  10168. @example
  10169. pad=width=640:height=480:x=0:y=40:color=violet
  10170. @end example
  10171. @item
  10172. Pad the input to get an output with dimensions increased by 3/2,
  10173. and put the input video at the center of the padded area:
  10174. @example
  10175. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  10176. @end example
  10177. @item
  10178. Pad the input to get a squared output with size equal to the maximum
  10179. value between the input width and height, and put the input video at
  10180. the center of the padded area:
  10181. @example
  10182. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  10183. @end example
  10184. @item
  10185. Pad the input to get a final w/h ratio of 16:9:
  10186. @example
  10187. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  10188. @end example
  10189. @item
  10190. In case of anamorphic video, in order to set the output display aspect
  10191. correctly, it is necessary to use @var{sar} in the expression,
  10192. according to the relation:
  10193. @example
  10194. (ih * X / ih) * sar = output_dar
  10195. X = output_dar / sar
  10196. @end example
  10197. Thus the previous example needs to be modified to:
  10198. @example
  10199. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  10200. @end example
  10201. @item
  10202. Double the output size and put the input video in the bottom-right
  10203. corner of the output padded area:
  10204. @example
  10205. pad="2*iw:2*ih:ow-iw:oh-ih"
  10206. @end example
  10207. @end itemize
  10208. @anchor{palettegen}
  10209. @section palettegen
  10210. Generate one palette for a whole video stream.
  10211. It accepts the following options:
  10212. @table @option
  10213. @item max_colors
  10214. Set the maximum number of colors to quantize in the palette.
  10215. Note: the palette will still contain 256 colors; the unused palette entries
  10216. will be black.
  10217. @item reserve_transparent
  10218. Create a palette of 255 colors maximum and reserve the last one for
  10219. transparency. Reserving the transparency color is useful for GIF optimization.
  10220. If not set, the maximum of colors in the palette will be 256. You probably want
  10221. to disable this option for a standalone image.
  10222. Set by default.
  10223. @item transparency_color
  10224. Set the color that will be used as background for transparency.
  10225. @item stats_mode
  10226. Set statistics mode.
  10227. It accepts the following values:
  10228. @table @samp
  10229. @item full
  10230. Compute full frame histograms.
  10231. @item diff
  10232. Compute histograms only for the part that differs from previous frame. This
  10233. might be relevant to give more importance to the moving part of your input if
  10234. the background is static.
  10235. @item single
  10236. Compute new histogram for each frame.
  10237. @end table
  10238. Default value is @var{full}.
  10239. @end table
  10240. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  10241. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  10242. color quantization of the palette. This information is also visible at
  10243. @var{info} logging level.
  10244. @subsection Examples
  10245. @itemize
  10246. @item
  10247. Generate a representative palette of a given video using @command{ffmpeg}:
  10248. @example
  10249. ffmpeg -i input.mkv -vf palettegen palette.png
  10250. @end example
  10251. @end itemize
  10252. @section paletteuse
  10253. Use a palette to downsample an input video stream.
  10254. The filter takes two inputs: one video stream and a palette. The palette must
  10255. be a 256 pixels image.
  10256. It accepts the following options:
  10257. @table @option
  10258. @item dither
  10259. Select dithering mode. Available algorithms are:
  10260. @table @samp
  10261. @item bayer
  10262. Ordered 8x8 bayer dithering (deterministic)
  10263. @item heckbert
  10264. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  10265. Note: this dithering is sometimes considered "wrong" and is included as a
  10266. reference.
  10267. @item floyd_steinberg
  10268. Floyd and Steingberg dithering (error diffusion)
  10269. @item sierra2
  10270. Frankie Sierra dithering v2 (error diffusion)
  10271. @item sierra2_4a
  10272. Frankie Sierra dithering v2 "Lite" (error diffusion)
  10273. @end table
  10274. Default is @var{sierra2_4a}.
  10275. @item bayer_scale
  10276. When @var{bayer} dithering is selected, this option defines the scale of the
  10277. pattern (how much the crosshatch pattern is visible). A low value means more
  10278. visible pattern for less banding, and higher value means less visible pattern
  10279. at the cost of more banding.
  10280. The option must be an integer value in the range [0,5]. Default is @var{2}.
  10281. @item diff_mode
  10282. If set, define the zone to process
  10283. @table @samp
  10284. @item rectangle
  10285. Only the changing rectangle will be reprocessed. This is similar to GIF
  10286. cropping/offsetting compression mechanism. This option can be useful for speed
  10287. if only a part of the image is changing, and has use cases such as limiting the
  10288. scope of the error diffusal @option{dither} to the rectangle that bounds the
  10289. moving scene (it leads to more deterministic output if the scene doesn't change
  10290. much, and as a result less moving noise and better GIF compression).
  10291. @end table
  10292. Default is @var{none}.
  10293. @item new
  10294. Take new palette for each output frame.
  10295. @item alpha_threshold
  10296. Sets the alpha threshold for transparency. Alpha values above this threshold
  10297. will be treated as completely opaque, and values below this threshold will be
  10298. treated as completely transparent.
  10299. The option must be an integer value in the range [0,255]. Default is @var{128}.
  10300. @end table
  10301. @subsection Examples
  10302. @itemize
  10303. @item
  10304. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  10305. using @command{ffmpeg}:
  10306. @example
  10307. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  10308. @end example
  10309. @end itemize
  10310. @section perspective
  10311. Correct perspective of video not recorded perpendicular to the screen.
  10312. A description of the accepted parameters follows.
  10313. @table @option
  10314. @item x0
  10315. @item y0
  10316. @item x1
  10317. @item y1
  10318. @item x2
  10319. @item y2
  10320. @item x3
  10321. @item y3
  10322. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  10323. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  10324. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  10325. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  10326. then the corners of the source will be sent to the specified coordinates.
  10327. The expressions can use the following variables:
  10328. @table @option
  10329. @item W
  10330. @item H
  10331. the width and height of video frame.
  10332. @item in
  10333. Input frame count.
  10334. @item on
  10335. Output frame count.
  10336. @end table
  10337. @item interpolation
  10338. Set interpolation for perspective correction.
  10339. It accepts the following values:
  10340. @table @samp
  10341. @item linear
  10342. @item cubic
  10343. @end table
  10344. Default value is @samp{linear}.
  10345. @item sense
  10346. Set interpretation of coordinate options.
  10347. It accepts the following values:
  10348. @table @samp
  10349. @item 0, source
  10350. Send point in the source specified by the given coordinates to
  10351. the corners of the destination.
  10352. @item 1, destination
  10353. Send the corners of the source to the point in the destination specified
  10354. by the given coordinates.
  10355. Default value is @samp{source}.
  10356. @end table
  10357. @item eval
  10358. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  10359. It accepts the following values:
  10360. @table @samp
  10361. @item init
  10362. only evaluate expressions once during the filter initialization or
  10363. when a command is processed
  10364. @item frame
  10365. evaluate expressions for each incoming frame
  10366. @end table
  10367. Default value is @samp{init}.
  10368. @end table
  10369. @section phase
  10370. Delay interlaced video by one field time so that the field order changes.
  10371. The intended use is to fix PAL movies that have been captured with the
  10372. opposite field order to the film-to-video transfer.
  10373. A description of the accepted parameters follows.
  10374. @table @option
  10375. @item mode
  10376. Set phase mode.
  10377. It accepts the following values:
  10378. @table @samp
  10379. @item t
  10380. Capture field order top-first, transfer bottom-first.
  10381. Filter will delay the bottom field.
  10382. @item b
  10383. Capture field order bottom-first, transfer top-first.
  10384. Filter will delay the top field.
  10385. @item p
  10386. Capture and transfer with the same field order. This mode only exists
  10387. for the documentation of the other options to refer to, but if you
  10388. actually select it, the filter will faithfully do nothing.
  10389. @item a
  10390. Capture field order determined automatically by field flags, transfer
  10391. opposite.
  10392. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  10393. basis using field flags. If no field information is available,
  10394. then this works just like @samp{u}.
  10395. @item u
  10396. Capture unknown or varying, transfer opposite.
  10397. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  10398. analyzing the images and selecting the alternative that produces best
  10399. match between the fields.
  10400. @item T
  10401. Capture top-first, transfer unknown or varying.
  10402. Filter selects among @samp{t} and @samp{p} using image analysis.
  10403. @item B
  10404. Capture bottom-first, transfer unknown or varying.
  10405. Filter selects among @samp{b} and @samp{p} using image analysis.
  10406. @item A
  10407. Capture determined by field flags, transfer unknown or varying.
  10408. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  10409. image analysis. If no field information is available, then this works just
  10410. like @samp{U}. This is the default mode.
  10411. @item U
  10412. Both capture and transfer unknown or varying.
  10413. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  10414. @end table
  10415. @end table
  10416. @section pixdesctest
  10417. Pixel format descriptor test filter, mainly useful for internal
  10418. testing. The output video should be equal to the input video.
  10419. For example:
  10420. @example
  10421. format=monow, pixdesctest
  10422. @end example
  10423. can be used to test the monowhite pixel format descriptor definition.
  10424. @section pixscope
  10425. Display sample values of color channels. Mainly useful for checking color
  10426. and levels. Minimum supported resolution is 640x480.
  10427. The filters accept the following options:
  10428. @table @option
  10429. @item x
  10430. Set scope X position, relative offset on X axis.
  10431. @item y
  10432. Set scope Y position, relative offset on Y axis.
  10433. @item w
  10434. Set scope width.
  10435. @item h
  10436. Set scope height.
  10437. @item o
  10438. Set window opacity. This window also holds statistics about pixel area.
  10439. @item wx
  10440. Set window X position, relative offset on X axis.
  10441. @item wy
  10442. Set window Y position, relative offset on Y axis.
  10443. @end table
  10444. @section pp
  10445. Enable the specified chain of postprocessing subfilters using libpostproc. This
  10446. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  10447. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  10448. Each subfilter and some options have a short and a long name that can be used
  10449. interchangeably, i.e. dr/dering are the same.
  10450. The filters accept the following options:
  10451. @table @option
  10452. @item subfilters
  10453. Set postprocessing subfilters string.
  10454. @end table
  10455. All subfilters share common options to determine their scope:
  10456. @table @option
  10457. @item a/autoq
  10458. Honor the quality commands for this subfilter.
  10459. @item c/chrom
  10460. Do chrominance filtering, too (default).
  10461. @item y/nochrom
  10462. Do luminance filtering only (no chrominance).
  10463. @item n/noluma
  10464. Do chrominance filtering only (no luminance).
  10465. @end table
  10466. These options can be appended after the subfilter name, separated by a '|'.
  10467. Available subfilters are:
  10468. @table @option
  10469. @item hb/hdeblock[|difference[|flatness]]
  10470. Horizontal deblocking filter
  10471. @table @option
  10472. @item difference
  10473. Difference factor where higher values mean more deblocking (default: @code{32}).
  10474. @item flatness
  10475. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10476. @end table
  10477. @item vb/vdeblock[|difference[|flatness]]
  10478. Vertical deblocking filter
  10479. @table @option
  10480. @item difference
  10481. Difference factor where higher values mean more deblocking (default: @code{32}).
  10482. @item flatness
  10483. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10484. @end table
  10485. @item ha/hadeblock[|difference[|flatness]]
  10486. Accurate horizontal deblocking filter
  10487. @table @option
  10488. @item difference
  10489. Difference factor where higher values mean more deblocking (default: @code{32}).
  10490. @item flatness
  10491. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10492. @end table
  10493. @item va/vadeblock[|difference[|flatness]]
  10494. Accurate vertical deblocking filter
  10495. @table @option
  10496. @item difference
  10497. Difference factor where higher values mean more deblocking (default: @code{32}).
  10498. @item flatness
  10499. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10500. @end table
  10501. @end table
  10502. The horizontal and vertical deblocking filters share the difference and
  10503. flatness values so you cannot set different horizontal and vertical
  10504. thresholds.
  10505. @table @option
  10506. @item h1/x1hdeblock
  10507. Experimental horizontal deblocking filter
  10508. @item v1/x1vdeblock
  10509. Experimental vertical deblocking filter
  10510. @item dr/dering
  10511. Deringing filter
  10512. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  10513. @table @option
  10514. @item threshold1
  10515. larger -> stronger filtering
  10516. @item threshold2
  10517. larger -> stronger filtering
  10518. @item threshold3
  10519. larger -> stronger filtering
  10520. @end table
  10521. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  10522. @table @option
  10523. @item f/fullyrange
  10524. Stretch luminance to @code{0-255}.
  10525. @end table
  10526. @item lb/linblenddeint
  10527. Linear blend deinterlacing filter that deinterlaces the given block by
  10528. filtering all lines with a @code{(1 2 1)} filter.
  10529. @item li/linipoldeint
  10530. Linear interpolating deinterlacing filter that deinterlaces the given block by
  10531. linearly interpolating every second line.
  10532. @item ci/cubicipoldeint
  10533. Cubic interpolating deinterlacing filter deinterlaces the given block by
  10534. cubically interpolating every second line.
  10535. @item md/mediandeint
  10536. Median deinterlacing filter that deinterlaces the given block by applying a
  10537. median filter to every second line.
  10538. @item fd/ffmpegdeint
  10539. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  10540. second line with a @code{(-1 4 2 4 -1)} filter.
  10541. @item l5/lowpass5
  10542. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  10543. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  10544. @item fq/forceQuant[|quantizer]
  10545. Overrides the quantizer table from the input with the constant quantizer you
  10546. specify.
  10547. @table @option
  10548. @item quantizer
  10549. Quantizer to use
  10550. @end table
  10551. @item de/default
  10552. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  10553. @item fa/fast
  10554. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  10555. @item ac
  10556. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  10557. @end table
  10558. @subsection Examples
  10559. @itemize
  10560. @item
  10561. Apply horizontal and vertical deblocking, deringing and automatic
  10562. brightness/contrast:
  10563. @example
  10564. pp=hb/vb/dr/al
  10565. @end example
  10566. @item
  10567. Apply default filters without brightness/contrast correction:
  10568. @example
  10569. pp=de/-al
  10570. @end example
  10571. @item
  10572. Apply default filters and temporal denoiser:
  10573. @example
  10574. pp=default/tmpnoise|1|2|3
  10575. @end example
  10576. @item
  10577. Apply deblocking on luminance only, and switch vertical deblocking on or off
  10578. automatically depending on available CPU time:
  10579. @example
  10580. pp=hb|y/vb|a
  10581. @end example
  10582. @end itemize
  10583. @section pp7
  10584. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  10585. similar to spp = 6 with 7 point DCT, where only the center sample is
  10586. used after IDCT.
  10587. The filter accepts the following options:
  10588. @table @option
  10589. @item qp
  10590. Force a constant quantization parameter. It accepts an integer in range
  10591. 0 to 63. If not set, the filter will use the QP from the video stream
  10592. (if available).
  10593. @item mode
  10594. Set thresholding mode. Available modes are:
  10595. @table @samp
  10596. @item hard
  10597. Set hard thresholding.
  10598. @item soft
  10599. Set soft thresholding (better de-ringing effect, but likely blurrier).
  10600. @item medium
  10601. Set medium thresholding (good results, default).
  10602. @end table
  10603. @end table
  10604. @section premultiply
  10605. Apply alpha premultiply effect to input video stream using first plane
  10606. of second stream as alpha.
  10607. Both streams must have same dimensions and same pixel format.
  10608. The filter accepts the following option:
  10609. @table @option
  10610. @item planes
  10611. Set which planes will be processed, unprocessed planes will be copied.
  10612. By default value 0xf, all planes will be processed.
  10613. @item inplace
  10614. Do not require 2nd input for processing, instead use alpha plane from input stream.
  10615. @end table
  10616. @section prewitt
  10617. Apply prewitt operator to input video stream.
  10618. The filter accepts the following option:
  10619. @table @option
  10620. @item planes
  10621. Set which planes will be processed, unprocessed planes will be copied.
  10622. By default value 0xf, all planes will be processed.
  10623. @item scale
  10624. Set value which will be multiplied with filtered result.
  10625. @item delta
  10626. Set value which will be added to filtered result.
  10627. @end table
  10628. @anchor{program_opencl}
  10629. @section program_opencl
  10630. Filter video using an OpenCL program.
  10631. @table @option
  10632. @item source
  10633. OpenCL program source file.
  10634. @item kernel
  10635. Kernel name in program.
  10636. @item inputs
  10637. Number of inputs to the filter. Defaults to 1.
  10638. @item size, s
  10639. Size of output frames. Defaults to the same as the first input.
  10640. @end table
  10641. The program source file must contain a kernel function with the given name,
  10642. which will be run once for each plane of the output. Each run on a plane
  10643. gets enqueued as a separate 2D global NDRange with one work-item for each
  10644. pixel to be generated. The global ID offset for each work-item is therefore
  10645. the coordinates of a pixel in the destination image.
  10646. The kernel function needs to take the following arguments:
  10647. @itemize
  10648. @item
  10649. Destination image, @var{__write_only image2d_t}.
  10650. This image will become the output; the kernel should write all of it.
  10651. @item
  10652. Frame index, @var{unsigned int}.
  10653. This is a counter starting from zero and increasing by one for each frame.
  10654. @item
  10655. Source images, @var{__read_only image2d_t}.
  10656. These are the most recent images on each input. The kernel may read from
  10657. them to generate the output, but they can't be written to.
  10658. @end itemize
  10659. Example programs:
  10660. @itemize
  10661. @item
  10662. Copy the input to the output (output must be the same size as the input).
  10663. @verbatim
  10664. __kernel void copy(__write_only image2d_t destination,
  10665. unsigned int index,
  10666. __read_only image2d_t source)
  10667. {
  10668. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  10669. int2 location = (int2)(get_global_id(0), get_global_id(1));
  10670. float4 value = read_imagef(source, sampler, location);
  10671. write_imagef(destination, location, value);
  10672. }
  10673. @end verbatim
  10674. @item
  10675. Apply a simple transformation, rotating the input by an amount increasing
  10676. with the index counter. Pixel values are linearly interpolated by the
  10677. sampler, and the output need not have the same dimensions as the input.
  10678. @verbatim
  10679. __kernel void rotate_image(__write_only image2d_t dst,
  10680. unsigned int index,
  10681. __read_only image2d_t src)
  10682. {
  10683. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  10684. CLK_FILTER_LINEAR);
  10685. float angle = (float)index / 100.0f;
  10686. float2 dst_dim = convert_float2(get_image_dim(dst));
  10687. float2 src_dim = convert_float2(get_image_dim(src));
  10688. float2 dst_cen = dst_dim / 2.0f;
  10689. float2 src_cen = src_dim / 2.0f;
  10690. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  10691. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  10692. float2 src_pos = {
  10693. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  10694. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  10695. };
  10696. src_pos = src_pos * src_dim / dst_dim;
  10697. float2 src_loc = src_pos + src_cen;
  10698. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  10699. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  10700. write_imagef(dst, dst_loc, 0.5f);
  10701. else
  10702. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  10703. }
  10704. @end verbatim
  10705. @item
  10706. Blend two inputs together, with the amount of each input used varying
  10707. with the index counter.
  10708. @verbatim
  10709. __kernel void blend_images(__write_only image2d_t dst,
  10710. unsigned int index,
  10711. __read_only image2d_t src1,
  10712. __read_only image2d_t src2)
  10713. {
  10714. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  10715. CLK_FILTER_LINEAR);
  10716. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  10717. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  10718. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  10719. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  10720. float4 val1 = read_imagef(src1, sampler, src1_loc);
  10721. float4 val2 = read_imagef(src2, sampler, src2_loc);
  10722. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  10723. }
  10724. @end verbatim
  10725. @end itemize
  10726. @section pseudocolor
  10727. Alter frame colors in video with pseudocolors.
  10728. This filter accept the following options:
  10729. @table @option
  10730. @item c0
  10731. set pixel first component expression
  10732. @item c1
  10733. set pixel second component expression
  10734. @item c2
  10735. set pixel third component expression
  10736. @item c3
  10737. set pixel fourth component expression, corresponds to the alpha component
  10738. @item i
  10739. set component to use as base for altering colors
  10740. @end table
  10741. Each of them specifies the expression to use for computing the lookup table for
  10742. the corresponding pixel component values.
  10743. The expressions can contain the following constants and functions:
  10744. @table @option
  10745. @item w
  10746. @item h
  10747. The input width and height.
  10748. @item val
  10749. The input value for the pixel component.
  10750. @item ymin, umin, vmin, amin
  10751. The minimum allowed component value.
  10752. @item ymax, umax, vmax, amax
  10753. The maximum allowed component value.
  10754. @end table
  10755. All expressions default to "val".
  10756. @subsection Examples
  10757. @itemize
  10758. @item
  10759. Change too high luma values to gradient:
  10760. @example
  10761. 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'"
  10762. @end example
  10763. @end itemize
  10764. @section psnr
  10765. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  10766. Ratio) between two input videos.
  10767. This filter takes in input two input videos, the first input is
  10768. considered the "main" source and is passed unchanged to the
  10769. output. The second input is used as a "reference" video for computing
  10770. the PSNR.
  10771. Both video inputs must have the same resolution and pixel format for
  10772. this filter to work correctly. Also it assumes that both inputs
  10773. have the same number of frames, which are compared one by one.
  10774. The obtained average PSNR is printed through the logging system.
  10775. The filter stores the accumulated MSE (mean squared error) of each
  10776. frame, and at the end of the processing it is averaged across all frames
  10777. equally, and the following formula is applied to obtain the PSNR:
  10778. @example
  10779. PSNR = 10*log10(MAX^2/MSE)
  10780. @end example
  10781. Where MAX is the average of the maximum values of each component of the
  10782. image.
  10783. The description of the accepted parameters follows.
  10784. @table @option
  10785. @item stats_file, f
  10786. If specified the filter will use the named file to save the PSNR of
  10787. each individual frame. When filename equals "-" the data is sent to
  10788. standard output.
  10789. @item stats_version
  10790. Specifies which version of the stats file format to use. Details of
  10791. each format are written below.
  10792. Default value is 1.
  10793. @item stats_add_max
  10794. Determines whether the max value is output to the stats log.
  10795. Default value is 0.
  10796. Requires stats_version >= 2. If this is set and stats_version < 2,
  10797. the filter will return an error.
  10798. @end table
  10799. This filter also supports the @ref{framesync} options.
  10800. The file printed if @var{stats_file} is selected, contains a sequence of
  10801. key/value pairs of the form @var{key}:@var{value} for each compared
  10802. couple of frames.
  10803. If a @var{stats_version} greater than 1 is specified, a header line precedes
  10804. the list of per-frame-pair stats, with key value pairs following the frame
  10805. format with the following parameters:
  10806. @table @option
  10807. @item psnr_log_version
  10808. The version of the log file format. Will match @var{stats_version}.
  10809. @item fields
  10810. A comma separated list of the per-frame-pair parameters included in
  10811. the log.
  10812. @end table
  10813. A description of each shown per-frame-pair parameter follows:
  10814. @table @option
  10815. @item n
  10816. sequential number of the input frame, starting from 1
  10817. @item mse_avg
  10818. Mean Square Error pixel-by-pixel average difference of the compared
  10819. frames, averaged over all the image components.
  10820. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  10821. Mean Square Error pixel-by-pixel average difference of the compared
  10822. frames for the component specified by the suffix.
  10823. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  10824. Peak Signal to Noise ratio of the compared frames for the component
  10825. specified by the suffix.
  10826. @item max_avg, max_y, max_u, max_v
  10827. Maximum allowed value for each channel, and average over all
  10828. channels.
  10829. @end table
  10830. For example:
  10831. @example
  10832. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  10833. [main][ref] psnr="stats_file=stats.log" [out]
  10834. @end example
  10835. On this example the input file being processed is compared with the
  10836. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  10837. is stored in @file{stats.log}.
  10838. @anchor{pullup}
  10839. @section pullup
  10840. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  10841. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  10842. content.
  10843. The pullup filter is designed to take advantage of future context in making
  10844. its decisions. This filter is stateless in the sense that it does not lock
  10845. onto a pattern to follow, but it instead looks forward to the following
  10846. fields in order to identify matches and rebuild progressive frames.
  10847. To produce content with an even framerate, insert the fps filter after
  10848. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  10849. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  10850. The filter accepts the following options:
  10851. @table @option
  10852. @item jl
  10853. @item jr
  10854. @item jt
  10855. @item jb
  10856. These options set the amount of "junk" to ignore at the left, right, top, and
  10857. bottom of the image, respectively. Left and right are in units of 8 pixels,
  10858. while top and bottom are in units of 2 lines.
  10859. The default is 8 pixels on each side.
  10860. @item sb
  10861. Set the strict breaks. Setting this option to 1 will reduce the chances of
  10862. filter generating an occasional mismatched frame, but it may also cause an
  10863. excessive number of frames to be dropped during high motion sequences.
  10864. Conversely, setting it to -1 will make filter match fields more easily.
  10865. This may help processing of video where there is slight blurring between
  10866. the fields, but may also cause there to be interlaced frames in the output.
  10867. Default value is @code{0}.
  10868. @item mp
  10869. Set the metric plane to use. It accepts the following values:
  10870. @table @samp
  10871. @item l
  10872. Use luma plane.
  10873. @item u
  10874. Use chroma blue plane.
  10875. @item v
  10876. Use chroma red plane.
  10877. @end table
  10878. This option may be set to use chroma plane instead of the default luma plane
  10879. for doing filter's computations. This may improve accuracy on very clean
  10880. source material, but more likely will decrease accuracy, especially if there
  10881. is chroma noise (rainbow effect) or any grayscale video.
  10882. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  10883. load and make pullup usable in realtime on slow machines.
  10884. @end table
  10885. For best results (without duplicated frames in the output file) it is
  10886. necessary to change the output frame rate. For example, to inverse
  10887. telecine NTSC input:
  10888. @example
  10889. ffmpeg -i input -vf pullup -r 24000/1001 ...
  10890. @end example
  10891. @section qp
  10892. Change video quantization parameters (QP).
  10893. The filter accepts the following option:
  10894. @table @option
  10895. @item qp
  10896. Set expression for quantization parameter.
  10897. @end table
  10898. The expression is evaluated through the eval API and can contain, among others,
  10899. the following constants:
  10900. @table @var
  10901. @item known
  10902. 1 if index is not 129, 0 otherwise.
  10903. @item qp
  10904. Sequential index starting from -129 to 128.
  10905. @end table
  10906. @subsection Examples
  10907. @itemize
  10908. @item
  10909. Some equation like:
  10910. @example
  10911. qp=2+2*sin(PI*qp)
  10912. @end example
  10913. @end itemize
  10914. @section random
  10915. Flush video frames from internal cache of frames into a random order.
  10916. No frame is discarded.
  10917. Inspired by @ref{frei0r} nervous filter.
  10918. @table @option
  10919. @item frames
  10920. Set size in number of frames of internal cache, in range from @code{2} to
  10921. @code{512}. Default is @code{30}.
  10922. @item seed
  10923. Set seed for random number generator, must be an integer included between
  10924. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  10925. less than @code{0}, the filter will try to use a good random seed on a
  10926. best effort basis.
  10927. @end table
  10928. @section readeia608
  10929. Read closed captioning (EIA-608) information from the top lines of a video frame.
  10930. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  10931. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  10932. with EIA-608 data (starting from 0). A description of each metadata value follows:
  10933. @table @option
  10934. @item lavfi.readeia608.X.cc
  10935. The two bytes stored as EIA-608 data (printed in hexadecimal).
  10936. @item lavfi.readeia608.X.line
  10937. The number of the line on which the EIA-608 data was identified and read.
  10938. @end table
  10939. This filter accepts the following options:
  10940. @table @option
  10941. @item scan_min
  10942. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  10943. @item scan_max
  10944. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  10945. @item mac
  10946. Set minimal acceptable amplitude change for sync codes detection.
  10947. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  10948. @item spw
  10949. Set the ratio of width reserved for sync code detection.
  10950. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  10951. @item mhd
  10952. Set the max peaks height difference for sync code detection.
  10953. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  10954. @item mpd
  10955. Set max peaks period difference for sync code detection.
  10956. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  10957. @item msd
  10958. Set the first two max start code bits differences.
  10959. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  10960. @item bhd
  10961. Set the minimum ratio of bits height compared to 3rd start code bit.
  10962. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  10963. @item th_w
  10964. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  10965. @item th_b
  10966. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  10967. @item chp
  10968. Enable checking the parity bit. In the event of a parity error, the filter will output
  10969. @code{0x00} for that character. Default is false.
  10970. @end table
  10971. @subsection Examples
  10972. @itemize
  10973. @item
  10974. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  10975. @example
  10976. ffprobe -f lavfi -i movie=captioned_video.mov,readeia608 -show_entries frame=pkt_pts_time:frame_tags=lavfi.readeia608.0.cc,lavfi.readeia608.1.cc -of csv
  10977. @end example
  10978. @end itemize
  10979. @section readvitc
  10980. Read vertical interval timecode (VITC) information from the top lines of a
  10981. video frame.
  10982. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  10983. timecode value, if a valid timecode has been detected. Further metadata key
  10984. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  10985. timecode data has been found or not.
  10986. This filter accepts the following options:
  10987. @table @option
  10988. @item scan_max
  10989. Set the maximum number of lines to scan for VITC data. If the value is set to
  10990. @code{-1} the full video frame is scanned. Default is @code{45}.
  10991. @item thr_b
  10992. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  10993. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  10994. @item thr_w
  10995. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  10996. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  10997. @end table
  10998. @subsection Examples
  10999. @itemize
  11000. @item
  11001. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  11002. draw @code{--:--:--:--} as a placeholder:
  11003. @example
  11004. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  11005. @end example
  11006. @end itemize
  11007. @section remap
  11008. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  11009. Destination pixel at position (X, Y) will be picked from source (x, y) position
  11010. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  11011. value for pixel will be used for destination pixel.
  11012. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  11013. will have Xmap/Ymap video stream dimensions.
  11014. Xmap and Ymap input video streams are 16bit depth, single channel.
  11015. @section removegrain
  11016. The removegrain filter is a spatial denoiser for progressive video.
  11017. @table @option
  11018. @item m0
  11019. Set mode for the first plane.
  11020. @item m1
  11021. Set mode for the second plane.
  11022. @item m2
  11023. Set mode for the third plane.
  11024. @item m3
  11025. Set mode for the fourth plane.
  11026. @end table
  11027. Range of mode is from 0 to 24. Description of each mode follows:
  11028. @table @var
  11029. @item 0
  11030. Leave input plane unchanged. Default.
  11031. @item 1
  11032. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  11033. @item 2
  11034. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  11035. @item 3
  11036. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  11037. @item 4
  11038. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  11039. This is equivalent to a median filter.
  11040. @item 5
  11041. Line-sensitive clipping giving the minimal change.
  11042. @item 6
  11043. Line-sensitive clipping, intermediate.
  11044. @item 7
  11045. Line-sensitive clipping, intermediate.
  11046. @item 8
  11047. Line-sensitive clipping, intermediate.
  11048. @item 9
  11049. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  11050. @item 10
  11051. Replaces the target pixel with the closest neighbour.
  11052. @item 11
  11053. [1 2 1] horizontal and vertical kernel blur.
  11054. @item 12
  11055. Same as mode 11.
  11056. @item 13
  11057. Bob mode, interpolates top field from the line where the neighbours
  11058. pixels are the closest.
  11059. @item 14
  11060. Bob mode, interpolates bottom field from the line where the neighbours
  11061. pixels are the closest.
  11062. @item 15
  11063. Bob mode, interpolates top field. Same as 13 but with a more complicated
  11064. interpolation formula.
  11065. @item 16
  11066. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  11067. interpolation formula.
  11068. @item 17
  11069. Clips the pixel with the minimum and maximum of respectively the maximum and
  11070. minimum of each pair of opposite neighbour pixels.
  11071. @item 18
  11072. Line-sensitive clipping using opposite neighbours whose greatest distance from
  11073. the current pixel is minimal.
  11074. @item 19
  11075. Replaces the pixel with the average of its 8 neighbours.
  11076. @item 20
  11077. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  11078. @item 21
  11079. Clips pixels using the averages of opposite neighbour.
  11080. @item 22
  11081. Same as mode 21 but simpler and faster.
  11082. @item 23
  11083. Small edge and halo removal, but reputed useless.
  11084. @item 24
  11085. Similar as 23.
  11086. @end table
  11087. @section removelogo
  11088. Suppress a TV station logo, using an image file to determine which
  11089. pixels comprise the logo. It works by filling in the pixels that
  11090. comprise the logo with neighboring pixels.
  11091. The filter accepts the following options:
  11092. @table @option
  11093. @item filename, f
  11094. Set the filter bitmap file, which can be any image format supported by
  11095. libavformat. The width and height of the image file must match those of the
  11096. video stream being processed.
  11097. @end table
  11098. Pixels in the provided bitmap image with a value of zero are not
  11099. considered part of the logo, non-zero pixels are considered part of
  11100. the logo. If you use white (255) for the logo and black (0) for the
  11101. rest, you will be safe. For making the filter bitmap, it is
  11102. recommended to take a screen capture of a black frame with the logo
  11103. visible, and then using a threshold filter followed by the erode
  11104. filter once or twice.
  11105. If needed, little splotches can be fixed manually. Remember that if
  11106. logo pixels are not covered, the filter quality will be much
  11107. reduced. Marking too many pixels as part of the logo does not hurt as
  11108. much, but it will increase the amount of blurring needed to cover over
  11109. the image and will destroy more information than necessary, and extra
  11110. pixels will slow things down on a large logo.
  11111. @section repeatfields
  11112. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  11113. fields based on its value.
  11114. @section reverse
  11115. Reverse a video clip.
  11116. Warning: This filter requires memory to buffer the entire clip, so trimming
  11117. is suggested.
  11118. @subsection Examples
  11119. @itemize
  11120. @item
  11121. Take the first 5 seconds of a clip, and reverse it.
  11122. @example
  11123. trim=end=5,reverse
  11124. @end example
  11125. @end itemize
  11126. @section rgbashift
  11127. Shift R/G/B/A pixels horizontally and/or vertically.
  11128. The filter accepts the following options:
  11129. @table @option
  11130. @item rh
  11131. Set amount to shift red horizontally.
  11132. @item rv
  11133. Set amount to shift red vertically.
  11134. @item gh
  11135. Set amount to shift green horizontally.
  11136. @item gv
  11137. Set amount to shift green vertically.
  11138. @item bh
  11139. Set amount to shift blue horizontally.
  11140. @item bv
  11141. Set amount to shift blue vertically.
  11142. @item ah
  11143. Set amount to shift alpha horizontally.
  11144. @item av
  11145. Set amount to shift alpha vertically.
  11146. @item edge
  11147. Set edge mode, can be @var{smear}, default, or @var{warp}.
  11148. @end table
  11149. @section roberts
  11150. Apply roberts cross operator to input video stream.
  11151. The filter accepts the following option:
  11152. @table @option
  11153. @item planes
  11154. Set which planes will be processed, unprocessed planes will be copied.
  11155. By default value 0xf, all planes will be processed.
  11156. @item scale
  11157. Set value which will be multiplied with filtered result.
  11158. @item delta
  11159. Set value which will be added to filtered result.
  11160. @end table
  11161. @section rotate
  11162. Rotate video by an arbitrary angle expressed in radians.
  11163. The filter accepts the following options:
  11164. A description of the optional parameters follows.
  11165. @table @option
  11166. @item angle, a
  11167. Set an expression for the angle by which to rotate the input video
  11168. clockwise, expressed as a number of radians. A negative value will
  11169. result in a counter-clockwise rotation. By default it is set to "0".
  11170. This expression is evaluated for each frame.
  11171. @item out_w, ow
  11172. Set the output width expression, default value is "iw".
  11173. This expression is evaluated just once during configuration.
  11174. @item out_h, oh
  11175. Set the output height expression, default value is "ih".
  11176. This expression is evaluated just once during configuration.
  11177. @item bilinear
  11178. Enable bilinear interpolation if set to 1, a value of 0 disables
  11179. it. Default value is 1.
  11180. @item fillcolor, c
  11181. Set the color used to fill the output area not covered by the rotated
  11182. image. For the general syntax of this option, check the
  11183. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11184. If the special value "none" is selected then no
  11185. background is printed (useful for example if the background is never shown).
  11186. Default value is "black".
  11187. @end table
  11188. The expressions for the angle and the output size can contain the
  11189. following constants and functions:
  11190. @table @option
  11191. @item n
  11192. sequential number of the input frame, starting from 0. It is always NAN
  11193. before the first frame is filtered.
  11194. @item t
  11195. time in seconds of the input frame, it is set to 0 when the filter is
  11196. configured. It is always NAN before the first frame is filtered.
  11197. @item hsub
  11198. @item vsub
  11199. horizontal and vertical chroma subsample values. For example for the
  11200. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11201. @item in_w, iw
  11202. @item in_h, ih
  11203. the input video width and height
  11204. @item out_w, ow
  11205. @item out_h, oh
  11206. the output width and height, that is the size of the padded area as
  11207. specified by the @var{width} and @var{height} expressions
  11208. @item rotw(a)
  11209. @item roth(a)
  11210. the minimal width/height required for completely containing the input
  11211. video rotated by @var{a} radians.
  11212. These are only available when computing the @option{out_w} and
  11213. @option{out_h} expressions.
  11214. @end table
  11215. @subsection Examples
  11216. @itemize
  11217. @item
  11218. Rotate the input by PI/6 radians clockwise:
  11219. @example
  11220. rotate=PI/6
  11221. @end example
  11222. @item
  11223. Rotate the input by PI/6 radians counter-clockwise:
  11224. @example
  11225. rotate=-PI/6
  11226. @end example
  11227. @item
  11228. Rotate the input by 45 degrees clockwise:
  11229. @example
  11230. rotate=45*PI/180
  11231. @end example
  11232. @item
  11233. Apply a constant rotation with period T, starting from an angle of PI/3:
  11234. @example
  11235. rotate=PI/3+2*PI*t/T
  11236. @end example
  11237. @item
  11238. Make the input video rotation oscillating with a period of T
  11239. seconds and an amplitude of A radians:
  11240. @example
  11241. rotate=A*sin(2*PI/T*t)
  11242. @end example
  11243. @item
  11244. Rotate the video, output size is chosen so that the whole rotating
  11245. input video is always completely contained in the output:
  11246. @example
  11247. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  11248. @end example
  11249. @item
  11250. Rotate the video, reduce the output size so that no background is ever
  11251. shown:
  11252. @example
  11253. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  11254. @end example
  11255. @end itemize
  11256. @subsection Commands
  11257. The filter supports the following commands:
  11258. @table @option
  11259. @item a, angle
  11260. Set the angle expression.
  11261. The command accepts the same syntax of the corresponding option.
  11262. If the specified expression is not valid, it is kept at its current
  11263. value.
  11264. @end table
  11265. @section sab
  11266. Apply Shape Adaptive Blur.
  11267. The filter accepts the following options:
  11268. @table @option
  11269. @item luma_radius, lr
  11270. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  11271. value is 1.0. A greater value will result in a more blurred image, and
  11272. in slower processing.
  11273. @item luma_pre_filter_radius, lpfr
  11274. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  11275. value is 1.0.
  11276. @item luma_strength, ls
  11277. Set luma maximum difference between pixels to still be considered, must
  11278. be a value in the 0.1-100.0 range, default value is 1.0.
  11279. @item chroma_radius, cr
  11280. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  11281. greater value will result in a more blurred image, and in slower
  11282. processing.
  11283. @item chroma_pre_filter_radius, cpfr
  11284. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  11285. @item chroma_strength, cs
  11286. Set chroma maximum difference between pixels to still be considered,
  11287. must be a value in the -0.9-100.0 range.
  11288. @end table
  11289. Each chroma option value, if not explicitly specified, is set to the
  11290. corresponding luma option value.
  11291. @anchor{scale}
  11292. @section scale
  11293. Scale (resize) the input video, using the libswscale library.
  11294. The scale filter forces the output display aspect ratio to be the same
  11295. of the input, by changing the output sample aspect ratio.
  11296. If the input image format is different from the format requested by
  11297. the next filter, the scale filter will convert the input to the
  11298. requested format.
  11299. @subsection Options
  11300. The filter accepts the following options, or any of the options
  11301. supported by the libswscale scaler.
  11302. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  11303. the complete list of scaler options.
  11304. @table @option
  11305. @item width, w
  11306. @item height, h
  11307. Set the output video dimension expression. Default value is the input
  11308. dimension.
  11309. If the @var{width} or @var{w} value is 0, the input width is used for
  11310. the output. If the @var{height} or @var{h} value is 0, the input height
  11311. is used for the output.
  11312. If one and only one of the values is -n with n >= 1, the scale filter
  11313. will use a value that maintains the aspect ratio of the input image,
  11314. calculated from the other specified dimension. After that it will,
  11315. however, make sure that the calculated dimension is divisible by n and
  11316. adjust the value if necessary.
  11317. If both values are -n with n >= 1, the behavior will be identical to
  11318. both values being set to 0 as previously detailed.
  11319. See below for the list of accepted constants for use in the dimension
  11320. expression.
  11321. @item eval
  11322. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  11323. @table @samp
  11324. @item init
  11325. Only evaluate expressions once during the filter initialization or when a command is processed.
  11326. @item frame
  11327. Evaluate expressions for each incoming frame.
  11328. @end table
  11329. Default value is @samp{init}.
  11330. @item interl
  11331. Set the interlacing mode. It accepts the following values:
  11332. @table @samp
  11333. @item 1
  11334. Force interlaced aware scaling.
  11335. @item 0
  11336. Do not apply interlaced scaling.
  11337. @item -1
  11338. Select interlaced aware scaling depending on whether the source frames
  11339. are flagged as interlaced or not.
  11340. @end table
  11341. Default value is @samp{0}.
  11342. @item flags
  11343. Set libswscale scaling flags. See
  11344. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11345. complete list of values. If not explicitly specified the filter applies
  11346. the default flags.
  11347. @item param0, param1
  11348. Set libswscale input parameters for scaling algorithms that need them. See
  11349. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11350. complete documentation. If not explicitly specified the filter applies
  11351. empty parameters.
  11352. @item size, s
  11353. Set the video size. For the syntax of this option, check the
  11354. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11355. @item in_color_matrix
  11356. @item out_color_matrix
  11357. Set in/output YCbCr color space type.
  11358. This allows the autodetected value to be overridden as well as allows forcing
  11359. a specific value used for the output and encoder.
  11360. If not specified, the color space type depends on the pixel format.
  11361. Possible values:
  11362. @table @samp
  11363. @item auto
  11364. Choose automatically.
  11365. @item bt709
  11366. Format conforming to International Telecommunication Union (ITU)
  11367. Recommendation BT.709.
  11368. @item fcc
  11369. Set color space conforming to the United States Federal Communications
  11370. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  11371. @item bt601
  11372. Set color space conforming to:
  11373. @itemize
  11374. @item
  11375. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  11376. @item
  11377. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  11378. @item
  11379. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  11380. @end itemize
  11381. @item smpte240m
  11382. Set color space conforming to SMPTE ST 240:1999.
  11383. @end table
  11384. @item in_range
  11385. @item out_range
  11386. Set in/output YCbCr sample range.
  11387. This allows the autodetected value to be overridden as well as allows forcing
  11388. a specific value used for the output and encoder. If not specified, the
  11389. range depends on the pixel format. Possible values:
  11390. @table @samp
  11391. @item auto/unknown
  11392. Choose automatically.
  11393. @item jpeg/full/pc
  11394. Set full range (0-255 in case of 8-bit luma).
  11395. @item mpeg/limited/tv
  11396. Set "MPEG" range (16-235 in case of 8-bit luma).
  11397. @end table
  11398. @item force_original_aspect_ratio
  11399. Enable decreasing or increasing output video width or height if necessary to
  11400. keep the original aspect ratio. Possible values:
  11401. @table @samp
  11402. @item disable
  11403. Scale the video as specified and disable this feature.
  11404. @item decrease
  11405. The output video dimensions will automatically be decreased if needed.
  11406. @item increase
  11407. The output video dimensions will automatically be increased if needed.
  11408. @end table
  11409. One useful instance of this option is that when you know a specific device's
  11410. maximum allowed resolution, you can use this to limit the output video to
  11411. that, while retaining the aspect ratio. For example, device A allows
  11412. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  11413. decrease) and specifying 1280x720 to the command line makes the output
  11414. 1280x533.
  11415. Please note that this is a different thing than specifying -1 for @option{w}
  11416. or @option{h}, you still need to specify the output resolution for this option
  11417. to work.
  11418. @end table
  11419. The values of the @option{w} and @option{h} options are expressions
  11420. containing the following constants:
  11421. @table @var
  11422. @item in_w
  11423. @item in_h
  11424. The input width and height
  11425. @item iw
  11426. @item ih
  11427. These are the same as @var{in_w} and @var{in_h}.
  11428. @item out_w
  11429. @item out_h
  11430. The output (scaled) width and height
  11431. @item ow
  11432. @item oh
  11433. These are the same as @var{out_w} and @var{out_h}
  11434. @item a
  11435. The same as @var{iw} / @var{ih}
  11436. @item sar
  11437. input sample aspect ratio
  11438. @item dar
  11439. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  11440. @item hsub
  11441. @item vsub
  11442. horizontal and vertical input chroma subsample values. For example for the
  11443. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11444. @item ohsub
  11445. @item ovsub
  11446. horizontal and vertical output chroma subsample values. For example for the
  11447. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11448. @end table
  11449. @subsection Examples
  11450. @itemize
  11451. @item
  11452. Scale the input video to a size of 200x100
  11453. @example
  11454. scale=w=200:h=100
  11455. @end example
  11456. This is equivalent to:
  11457. @example
  11458. scale=200:100
  11459. @end example
  11460. or:
  11461. @example
  11462. scale=200x100
  11463. @end example
  11464. @item
  11465. Specify a size abbreviation for the output size:
  11466. @example
  11467. scale=qcif
  11468. @end example
  11469. which can also be written as:
  11470. @example
  11471. scale=size=qcif
  11472. @end example
  11473. @item
  11474. Scale the input to 2x:
  11475. @example
  11476. scale=w=2*iw:h=2*ih
  11477. @end example
  11478. @item
  11479. The above is the same as:
  11480. @example
  11481. scale=2*in_w:2*in_h
  11482. @end example
  11483. @item
  11484. Scale the input to 2x with forced interlaced scaling:
  11485. @example
  11486. scale=2*iw:2*ih:interl=1
  11487. @end example
  11488. @item
  11489. Scale the input to half size:
  11490. @example
  11491. scale=w=iw/2:h=ih/2
  11492. @end example
  11493. @item
  11494. Increase the width, and set the height to the same size:
  11495. @example
  11496. scale=3/2*iw:ow
  11497. @end example
  11498. @item
  11499. Seek Greek harmony:
  11500. @example
  11501. scale=iw:1/PHI*iw
  11502. scale=ih*PHI:ih
  11503. @end example
  11504. @item
  11505. Increase the height, and set the width to 3/2 of the height:
  11506. @example
  11507. scale=w=3/2*oh:h=3/5*ih
  11508. @end example
  11509. @item
  11510. Increase the size, making the size a multiple of the chroma
  11511. subsample values:
  11512. @example
  11513. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  11514. @end example
  11515. @item
  11516. Increase the width to a maximum of 500 pixels,
  11517. keeping the same aspect ratio as the input:
  11518. @example
  11519. scale=w='min(500\, iw*3/2):h=-1'
  11520. @end example
  11521. @item
  11522. Make pixels square by combining scale and setsar:
  11523. @example
  11524. scale='trunc(ih*dar):ih',setsar=1/1
  11525. @end example
  11526. @item
  11527. Make pixels square by combining scale and setsar,
  11528. making sure the resulting resolution is even (required by some codecs):
  11529. @example
  11530. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  11531. @end example
  11532. @end itemize
  11533. @subsection Commands
  11534. This filter supports the following commands:
  11535. @table @option
  11536. @item width, w
  11537. @item height, h
  11538. Set the output video dimension expression.
  11539. The command accepts the same syntax of the corresponding option.
  11540. If the specified expression is not valid, it is kept at its current
  11541. value.
  11542. @end table
  11543. @section scale_npp
  11544. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  11545. format conversion on CUDA video frames. Setting the output width and height
  11546. works in the same way as for the @var{scale} filter.
  11547. The following additional options are accepted:
  11548. @table @option
  11549. @item format
  11550. The pixel format of the output CUDA frames. If set to the string "same" (the
  11551. default), the input format will be kept. Note that automatic format negotiation
  11552. and conversion is not yet supported for hardware frames
  11553. @item interp_algo
  11554. The interpolation algorithm used for resizing. One of the following:
  11555. @table @option
  11556. @item nn
  11557. Nearest neighbour.
  11558. @item linear
  11559. @item cubic
  11560. @item cubic2p_bspline
  11561. 2-parameter cubic (B=1, C=0)
  11562. @item cubic2p_catmullrom
  11563. 2-parameter cubic (B=0, C=1/2)
  11564. @item cubic2p_b05c03
  11565. 2-parameter cubic (B=1/2, C=3/10)
  11566. @item super
  11567. Supersampling
  11568. @item lanczos
  11569. @end table
  11570. @end table
  11571. @section scale2ref
  11572. Scale (resize) the input video, based on a reference video.
  11573. See the scale filter for available options, scale2ref supports the same but
  11574. uses the reference video instead of the main input as basis. scale2ref also
  11575. supports the following additional constants for the @option{w} and
  11576. @option{h} options:
  11577. @table @var
  11578. @item main_w
  11579. @item main_h
  11580. The main input video's width and height
  11581. @item main_a
  11582. The same as @var{main_w} / @var{main_h}
  11583. @item main_sar
  11584. The main input video's sample aspect ratio
  11585. @item main_dar, mdar
  11586. The main input video's display aspect ratio. Calculated from
  11587. @code{(main_w / main_h) * main_sar}.
  11588. @item main_hsub
  11589. @item main_vsub
  11590. The main input video's horizontal and vertical chroma subsample values.
  11591. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  11592. is 1.
  11593. @end table
  11594. @subsection Examples
  11595. @itemize
  11596. @item
  11597. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  11598. @example
  11599. 'scale2ref[b][a];[a][b]overlay'
  11600. @end example
  11601. @end itemize
  11602. @anchor{selectivecolor}
  11603. @section selectivecolor
  11604. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  11605. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  11606. by the "purity" of the color (that is, how saturated it already is).
  11607. This filter is similar to the Adobe Photoshop Selective Color tool.
  11608. The filter accepts the following options:
  11609. @table @option
  11610. @item correction_method
  11611. Select color correction method.
  11612. Available values are:
  11613. @table @samp
  11614. @item absolute
  11615. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  11616. component value).
  11617. @item relative
  11618. Specified adjustments are relative to the original component value.
  11619. @end table
  11620. Default is @code{absolute}.
  11621. @item reds
  11622. Adjustments for red pixels (pixels where the red component is the maximum)
  11623. @item yellows
  11624. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  11625. @item greens
  11626. Adjustments for green pixels (pixels where the green component is the maximum)
  11627. @item cyans
  11628. Adjustments for cyan pixels (pixels where the red component is the minimum)
  11629. @item blues
  11630. Adjustments for blue pixels (pixels where the blue component is the maximum)
  11631. @item magentas
  11632. Adjustments for magenta pixels (pixels where the green component is the minimum)
  11633. @item whites
  11634. Adjustments for white pixels (pixels where all components are greater than 128)
  11635. @item neutrals
  11636. Adjustments for all pixels except pure black and pure white
  11637. @item blacks
  11638. Adjustments for black pixels (pixels where all components are lesser than 128)
  11639. @item psfile
  11640. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  11641. @end table
  11642. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  11643. 4 space separated floating point adjustment values in the [-1,1] range,
  11644. respectively to adjust the amount of cyan, magenta, yellow and black for the
  11645. pixels of its range.
  11646. @subsection Examples
  11647. @itemize
  11648. @item
  11649. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  11650. increase magenta by 27% in blue areas:
  11651. @example
  11652. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  11653. @end example
  11654. @item
  11655. Use a Photoshop selective color preset:
  11656. @example
  11657. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  11658. @end example
  11659. @end itemize
  11660. @anchor{separatefields}
  11661. @section separatefields
  11662. The @code{separatefields} takes a frame-based video input and splits
  11663. each frame into its components fields, producing a new half height clip
  11664. with twice the frame rate and twice the frame count.
  11665. This filter use field-dominance information in frame to decide which
  11666. of each pair of fields to place first in the output.
  11667. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  11668. @section setdar, setsar
  11669. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  11670. output video.
  11671. This is done by changing the specified Sample (aka Pixel) Aspect
  11672. Ratio, according to the following equation:
  11673. @example
  11674. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  11675. @end example
  11676. Keep in mind that the @code{setdar} filter does not modify the pixel
  11677. dimensions of the video frame. Also, the display aspect ratio set by
  11678. this filter may be changed by later filters in the filterchain,
  11679. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  11680. applied.
  11681. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  11682. the filter output video.
  11683. Note that as a consequence of the application of this filter, the
  11684. output display aspect ratio will change according to the equation
  11685. above.
  11686. Keep in mind that the sample aspect ratio set by the @code{setsar}
  11687. filter may be changed by later filters in the filterchain, e.g. if
  11688. another "setsar" or a "setdar" filter is applied.
  11689. It accepts the following parameters:
  11690. @table @option
  11691. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  11692. Set the aspect ratio used by the filter.
  11693. The parameter can be a floating point number string, an expression, or
  11694. a string of the form @var{num}:@var{den}, where @var{num} and
  11695. @var{den} are the numerator and denominator of the aspect ratio. If
  11696. the parameter is not specified, it is assumed the value "0".
  11697. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  11698. should be escaped.
  11699. @item max
  11700. Set the maximum integer value to use for expressing numerator and
  11701. denominator when reducing the expressed aspect ratio to a rational.
  11702. Default value is @code{100}.
  11703. @end table
  11704. The parameter @var{sar} is an expression containing
  11705. the following constants:
  11706. @table @option
  11707. @item E, PI, PHI
  11708. These are approximated values for the mathematical constants e
  11709. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  11710. @item w, h
  11711. The input width and height.
  11712. @item a
  11713. These are the same as @var{w} / @var{h}.
  11714. @item sar
  11715. The input sample aspect ratio.
  11716. @item dar
  11717. The input display aspect ratio. It is the same as
  11718. (@var{w} / @var{h}) * @var{sar}.
  11719. @item hsub, vsub
  11720. Horizontal and vertical chroma subsample values. For example, for the
  11721. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11722. @end table
  11723. @subsection Examples
  11724. @itemize
  11725. @item
  11726. To change the display aspect ratio to 16:9, specify one of the following:
  11727. @example
  11728. setdar=dar=1.77777
  11729. setdar=dar=16/9
  11730. @end example
  11731. @item
  11732. To change the sample aspect ratio to 10:11, specify:
  11733. @example
  11734. setsar=sar=10/11
  11735. @end example
  11736. @item
  11737. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  11738. 1000 in the aspect ratio reduction, use the command:
  11739. @example
  11740. setdar=ratio=16/9:max=1000
  11741. @end example
  11742. @end itemize
  11743. @anchor{setfield}
  11744. @section setfield
  11745. Force field for the output video frame.
  11746. The @code{setfield} filter marks the interlace type field for the
  11747. output frames. It does not change the input frame, but only sets the
  11748. corresponding property, which affects how the frame is treated by
  11749. following filters (e.g. @code{fieldorder} or @code{yadif}).
  11750. The filter accepts the following options:
  11751. @table @option
  11752. @item mode
  11753. Available values are:
  11754. @table @samp
  11755. @item auto
  11756. Keep the same field property.
  11757. @item bff
  11758. Mark the frame as bottom-field-first.
  11759. @item tff
  11760. Mark the frame as top-field-first.
  11761. @item prog
  11762. Mark the frame as progressive.
  11763. @end table
  11764. @end table
  11765. @anchor{setparams}
  11766. @section setparams
  11767. Force frame parameter for the output video frame.
  11768. The @code{setparams} filter marks interlace and color range for the
  11769. output frames. It does not change the input frame, but only sets the
  11770. corresponding property, which affects how the frame is treated by
  11771. filters/encoders.
  11772. @table @option
  11773. @item field_mode
  11774. Available values are:
  11775. @table @samp
  11776. @item auto
  11777. Keep the same field property (default).
  11778. @item bff
  11779. Mark the frame as bottom-field-first.
  11780. @item tff
  11781. Mark the frame as top-field-first.
  11782. @item prog
  11783. Mark the frame as progressive.
  11784. @end table
  11785. @item range
  11786. Available values are:
  11787. @table @samp
  11788. @item auto
  11789. Keep the same color range property (default).
  11790. @item unspecified, unknown
  11791. Mark the frame as unspecified color range.
  11792. @item limited, tv, mpeg
  11793. Mark the frame as limited range.
  11794. @item full, pc, jpeg
  11795. Mark the frame as full range.
  11796. @end table
  11797. @item color_primaries
  11798. Set the color primaries.
  11799. Available values are:
  11800. @table @samp
  11801. @item auto
  11802. Keep the same color primaries property (default).
  11803. @item bt709
  11804. @item unknown
  11805. @item bt470m
  11806. @item bt470bg
  11807. @item smpte170m
  11808. @item smpte240m
  11809. @item film
  11810. @item bt2020
  11811. @item smpte428
  11812. @item smpte431
  11813. @item smpte432
  11814. @item jedec-p22
  11815. @end table
  11816. @item color_trc
  11817. Set the color transfer.
  11818. Available values are:
  11819. @table @samp
  11820. @item auto
  11821. Keep the same color trc property (default).
  11822. @item bt709
  11823. @item unknown
  11824. @item bt470m
  11825. @item bt470bg
  11826. @item smpte170m
  11827. @item smpte240m
  11828. @item linear
  11829. @item log100
  11830. @item log316
  11831. @item iec61966-2-4
  11832. @item bt1361e
  11833. @item iec61966-2-1
  11834. @item bt2020-10
  11835. @item bt2020-12
  11836. @item smpte2084
  11837. @item smpte428
  11838. @item arib-std-b67
  11839. @end table
  11840. @item colorspace
  11841. Set the colorspace.
  11842. Available values are:
  11843. @table @samp
  11844. @item auto
  11845. Keep the same colorspace property (default).
  11846. @item gbr
  11847. @item bt709
  11848. @item unknown
  11849. @item fcc
  11850. @item bt470bg
  11851. @item smpte170m
  11852. @item smpte240m
  11853. @item ycgco
  11854. @item bt2020nc
  11855. @item bt2020c
  11856. @item smpte2085
  11857. @item chroma-derived-nc
  11858. @item chroma-derived-c
  11859. @item ictcp
  11860. @end table
  11861. @end table
  11862. @section showinfo
  11863. Show a line containing various information for each input video frame.
  11864. The input video is not modified.
  11865. This filter supports the following options:
  11866. @table @option
  11867. @item checksum
  11868. Calculate checksums of each plane. By default enabled.
  11869. @end table
  11870. The shown line contains a sequence of key/value pairs of the form
  11871. @var{key}:@var{value}.
  11872. The following values are shown in the output:
  11873. @table @option
  11874. @item n
  11875. The (sequential) number of the input frame, starting from 0.
  11876. @item pts
  11877. The Presentation TimeStamp of the input frame, expressed as a number of
  11878. time base units. The time base unit depends on the filter input pad.
  11879. @item pts_time
  11880. The Presentation TimeStamp of the input frame, expressed as a number of
  11881. seconds.
  11882. @item pos
  11883. The position of the frame in the input stream, or -1 if this information is
  11884. unavailable and/or meaningless (for example in case of synthetic video).
  11885. @item fmt
  11886. The pixel format name.
  11887. @item sar
  11888. The sample aspect ratio of the input frame, expressed in the form
  11889. @var{num}/@var{den}.
  11890. @item s
  11891. The size of the input frame. For the syntax of this option, check the
  11892. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11893. @item i
  11894. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  11895. for bottom field first).
  11896. @item iskey
  11897. This is 1 if the frame is a key frame, 0 otherwise.
  11898. @item type
  11899. The picture type of the input frame ("I" for an I-frame, "P" for a
  11900. P-frame, "B" for a B-frame, or "?" for an unknown type).
  11901. Also refer to the documentation of the @code{AVPictureType} enum and of
  11902. the @code{av_get_picture_type_char} function defined in
  11903. @file{libavutil/avutil.h}.
  11904. @item checksum
  11905. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  11906. @item plane_checksum
  11907. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  11908. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  11909. @end table
  11910. @section showpalette
  11911. Displays the 256 colors palette of each frame. This filter is only relevant for
  11912. @var{pal8} pixel format frames.
  11913. It accepts the following option:
  11914. @table @option
  11915. @item s
  11916. Set the size of the box used to represent one palette color entry. Default is
  11917. @code{30} (for a @code{30x30} pixel box).
  11918. @end table
  11919. @section shuffleframes
  11920. Reorder and/or duplicate and/or drop video frames.
  11921. It accepts the following parameters:
  11922. @table @option
  11923. @item mapping
  11924. Set the destination indexes of input frames.
  11925. This is space or '|' separated list of indexes that maps input frames to output
  11926. frames. Number of indexes also sets maximal value that each index may have.
  11927. '-1' index have special meaning and that is to drop frame.
  11928. @end table
  11929. The first frame has the index 0. The default is to keep the input unchanged.
  11930. @subsection Examples
  11931. @itemize
  11932. @item
  11933. Swap second and third frame of every three frames of the input:
  11934. @example
  11935. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  11936. @end example
  11937. @item
  11938. Swap 10th and 1st frame of every ten frames of the input:
  11939. @example
  11940. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  11941. @end example
  11942. @end itemize
  11943. @section shuffleplanes
  11944. Reorder and/or duplicate video planes.
  11945. It accepts the following parameters:
  11946. @table @option
  11947. @item map0
  11948. The index of the input plane to be used as the first output plane.
  11949. @item map1
  11950. The index of the input plane to be used as the second output plane.
  11951. @item map2
  11952. The index of the input plane to be used as the third output plane.
  11953. @item map3
  11954. The index of the input plane to be used as the fourth output plane.
  11955. @end table
  11956. The first plane has the index 0. The default is to keep the input unchanged.
  11957. @subsection Examples
  11958. @itemize
  11959. @item
  11960. Swap the second and third planes of the input:
  11961. @example
  11962. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  11963. @end example
  11964. @end itemize
  11965. @anchor{signalstats}
  11966. @section signalstats
  11967. Evaluate various visual metrics that assist in determining issues associated
  11968. with the digitization of analog video media.
  11969. By default the filter will log these metadata values:
  11970. @table @option
  11971. @item YMIN
  11972. Display the minimal Y value contained within the input frame. Expressed in
  11973. range of [0-255].
  11974. @item YLOW
  11975. Display the Y value at the 10% percentile within the input frame. Expressed in
  11976. range of [0-255].
  11977. @item YAVG
  11978. Display the average Y value within the input frame. Expressed in range of
  11979. [0-255].
  11980. @item YHIGH
  11981. Display the Y value at the 90% percentile within the input frame. Expressed in
  11982. range of [0-255].
  11983. @item YMAX
  11984. Display the maximum Y value contained within the input frame. Expressed in
  11985. range of [0-255].
  11986. @item UMIN
  11987. Display the minimal U value contained within the input frame. Expressed in
  11988. range of [0-255].
  11989. @item ULOW
  11990. Display the U value at the 10% percentile within the input frame. Expressed in
  11991. range of [0-255].
  11992. @item UAVG
  11993. Display the average U value within the input frame. Expressed in range of
  11994. [0-255].
  11995. @item UHIGH
  11996. Display the U value at the 90% percentile within the input frame. Expressed in
  11997. range of [0-255].
  11998. @item UMAX
  11999. Display the maximum U value contained within the input frame. Expressed in
  12000. range of [0-255].
  12001. @item VMIN
  12002. Display the minimal V value contained within the input frame. Expressed in
  12003. range of [0-255].
  12004. @item VLOW
  12005. Display the V value at the 10% percentile within the input frame. Expressed in
  12006. range of [0-255].
  12007. @item VAVG
  12008. Display the average V value within the input frame. Expressed in range of
  12009. [0-255].
  12010. @item VHIGH
  12011. Display the V value at the 90% percentile within the input frame. Expressed in
  12012. range of [0-255].
  12013. @item VMAX
  12014. Display the maximum V value contained within the input frame. Expressed in
  12015. range of [0-255].
  12016. @item SATMIN
  12017. Display the minimal saturation value contained within the input frame.
  12018. Expressed in range of [0-~181.02].
  12019. @item SATLOW
  12020. Display the saturation value at the 10% percentile within the input frame.
  12021. Expressed in range of [0-~181.02].
  12022. @item SATAVG
  12023. Display the average saturation value within the input frame. Expressed in range
  12024. of [0-~181.02].
  12025. @item SATHIGH
  12026. Display the saturation value at the 90% percentile within the input frame.
  12027. Expressed in range of [0-~181.02].
  12028. @item SATMAX
  12029. Display the maximum saturation value contained within the input frame.
  12030. Expressed in range of [0-~181.02].
  12031. @item HUEMED
  12032. Display the median value for hue within the input frame. Expressed in range of
  12033. [0-360].
  12034. @item HUEAVG
  12035. Display the average value for hue within the input frame. Expressed in range of
  12036. [0-360].
  12037. @item YDIF
  12038. Display the average of sample value difference between all values of the Y
  12039. plane in the current frame and corresponding values of the previous input frame.
  12040. Expressed in range of [0-255].
  12041. @item UDIF
  12042. Display the average of sample value difference between all values of the U
  12043. plane in the current frame and corresponding values of the previous input frame.
  12044. Expressed in range of [0-255].
  12045. @item VDIF
  12046. Display the average of sample value difference between all values of the V
  12047. plane in the current frame and corresponding values of the previous input frame.
  12048. Expressed in range of [0-255].
  12049. @item YBITDEPTH
  12050. Display bit depth of Y plane in current frame.
  12051. Expressed in range of [0-16].
  12052. @item UBITDEPTH
  12053. Display bit depth of U plane in current frame.
  12054. Expressed in range of [0-16].
  12055. @item VBITDEPTH
  12056. Display bit depth of V plane in current frame.
  12057. Expressed in range of [0-16].
  12058. @end table
  12059. The filter accepts the following options:
  12060. @table @option
  12061. @item stat
  12062. @item out
  12063. @option{stat} specify an additional form of image analysis.
  12064. @option{out} output video with the specified type of pixel highlighted.
  12065. Both options accept the following values:
  12066. @table @samp
  12067. @item tout
  12068. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  12069. unlike the neighboring pixels of the same field. Examples of temporal outliers
  12070. include the results of video dropouts, head clogs, or tape tracking issues.
  12071. @item vrep
  12072. Identify @var{vertical line repetition}. Vertical line repetition includes
  12073. similar rows of pixels within a frame. In born-digital video vertical line
  12074. repetition is common, but this pattern is uncommon in video digitized from an
  12075. analog source. When it occurs in video that results from the digitization of an
  12076. analog source it can indicate concealment from a dropout compensator.
  12077. @item brng
  12078. Identify pixels that fall outside of legal broadcast range.
  12079. @end table
  12080. @item color, c
  12081. Set the highlight color for the @option{out} option. The default color is
  12082. yellow.
  12083. @end table
  12084. @subsection Examples
  12085. @itemize
  12086. @item
  12087. Output data of various video metrics:
  12088. @example
  12089. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  12090. @end example
  12091. @item
  12092. Output specific data about the minimum and maximum values of the Y plane per frame:
  12093. @example
  12094. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  12095. @end example
  12096. @item
  12097. Playback video while highlighting pixels that are outside of broadcast range in red.
  12098. @example
  12099. ffplay example.mov -vf signalstats="out=brng:color=red"
  12100. @end example
  12101. @item
  12102. Playback video with signalstats metadata drawn over the frame.
  12103. @example
  12104. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  12105. @end example
  12106. The contents of signalstat_drawtext.txt used in the command are:
  12107. @example
  12108. time %@{pts:hms@}
  12109. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  12110. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  12111. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  12112. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  12113. @end example
  12114. @end itemize
  12115. @anchor{signature}
  12116. @section signature
  12117. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  12118. input. In this case the matching between the inputs can be calculated additionally.
  12119. The filter always passes through the first input. The signature of each stream can
  12120. be written into a file.
  12121. It accepts the following options:
  12122. @table @option
  12123. @item detectmode
  12124. Enable or disable the matching process.
  12125. Available values are:
  12126. @table @samp
  12127. @item off
  12128. Disable the calculation of a matching (default).
  12129. @item full
  12130. Calculate the matching for the whole video and output whether the whole video
  12131. matches or only parts.
  12132. @item fast
  12133. Calculate only until a matching is found or the video ends. Should be faster in
  12134. some cases.
  12135. @end table
  12136. @item nb_inputs
  12137. Set the number of inputs. The option value must be a non negative integer.
  12138. Default value is 1.
  12139. @item filename
  12140. Set the path to which the output is written. If there is more than one input,
  12141. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  12142. integer), that will be replaced with the input number. If no filename is
  12143. specified, no output will be written. This is the default.
  12144. @item format
  12145. Choose the output format.
  12146. Available values are:
  12147. @table @samp
  12148. @item binary
  12149. Use the specified binary representation (default).
  12150. @item xml
  12151. Use the specified xml representation.
  12152. @end table
  12153. @item th_d
  12154. Set threshold to detect one word as similar. The option value must be an integer
  12155. greater than zero. The default value is 9000.
  12156. @item th_dc
  12157. Set threshold to detect all words as similar. The option value must be an integer
  12158. greater than zero. The default value is 60000.
  12159. @item th_xh
  12160. Set threshold to detect frames as similar. The option value must be an integer
  12161. greater than zero. The default value is 116.
  12162. @item th_di
  12163. Set the minimum length of a sequence in frames to recognize it as matching
  12164. sequence. The option value must be a non negative integer value.
  12165. The default value is 0.
  12166. @item th_it
  12167. Set the minimum relation, that matching frames to all frames must have.
  12168. The option value must be a double value between 0 and 1. The default value is 0.5.
  12169. @end table
  12170. @subsection Examples
  12171. @itemize
  12172. @item
  12173. To calculate the signature of an input video and store it in signature.bin:
  12174. @example
  12175. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  12176. @end example
  12177. @item
  12178. To detect whether two videos match and store the signatures in XML format in
  12179. signature0.xml and signature1.xml:
  12180. @example
  12181. 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 -
  12182. @end example
  12183. @end itemize
  12184. @anchor{smartblur}
  12185. @section smartblur
  12186. Blur the input video without impacting the outlines.
  12187. It accepts the following options:
  12188. @table @option
  12189. @item luma_radius, lr
  12190. Set the luma radius. The option value must be a float number in
  12191. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12192. used to blur the image (slower if larger). Default value is 1.0.
  12193. @item luma_strength, ls
  12194. Set the luma strength. The option value must be a float number
  12195. in the range [-1.0,1.0] that configures the blurring. A value included
  12196. in [0.0,1.0] will blur the image whereas a value included in
  12197. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  12198. @item luma_threshold, lt
  12199. Set the luma threshold used as a coefficient to determine
  12200. whether a pixel should be blurred or not. The option value must be an
  12201. integer in the range [-30,30]. A value of 0 will filter all the image,
  12202. a value included in [0,30] will filter flat areas and a value included
  12203. in [-30,0] will filter edges. Default value is 0.
  12204. @item chroma_radius, cr
  12205. Set the chroma radius. The option value must be a float number in
  12206. the range [0.1,5.0] that specifies the variance of the gaussian filter
  12207. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  12208. @item chroma_strength, cs
  12209. Set the chroma strength. The option value must be a float number
  12210. in the range [-1.0,1.0] that configures the blurring. A value included
  12211. in [0.0,1.0] will blur the image whereas a value included in
  12212. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  12213. @item chroma_threshold, ct
  12214. Set the chroma threshold used as a coefficient to determine
  12215. whether a pixel should be blurred or not. The option value must be an
  12216. integer in the range [-30,30]. A value of 0 will filter all the image,
  12217. a value included in [0,30] will filter flat areas and a value included
  12218. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  12219. @end table
  12220. If a chroma option is not explicitly set, the corresponding luma value
  12221. is set.
  12222. @section ssim
  12223. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  12224. This filter takes in input two input videos, the first input is
  12225. considered the "main" source and is passed unchanged to the
  12226. output. The second input is used as a "reference" video for computing
  12227. the SSIM.
  12228. Both video inputs must have the same resolution and pixel format for
  12229. this filter to work correctly. Also it assumes that both inputs
  12230. have the same number of frames, which are compared one by one.
  12231. The filter stores the calculated SSIM of each frame.
  12232. The description of the accepted parameters follows.
  12233. @table @option
  12234. @item stats_file, f
  12235. If specified the filter will use the named file to save the SSIM of
  12236. each individual frame. When filename equals "-" the data is sent to
  12237. standard output.
  12238. @end table
  12239. The file printed if @var{stats_file} is selected, contains a sequence of
  12240. key/value pairs of the form @var{key}:@var{value} for each compared
  12241. couple of frames.
  12242. A description of each shown parameter follows:
  12243. @table @option
  12244. @item n
  12245. sequential number of the input frame, starting from 1
  12246. @item Y, U, V, R, G, B
  12247. SSIM of the compared frames for the component specified by the suffix.
  12248. @item All
  12249. SSIM of the compared frames for the whole frame.
  12250. @item dB
  12251. Same as above but in dB representation.
  12252. @end table
  12253. This filter also supports the @ref{framesync} options.
  12254. For example:
  12255. @example
  12256. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  12257. [main][ref] ssim="stats_file=stats.log" [out]
  12258. @end example
  12259. On this example the input file being processed is compared with the
  12260. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  12261. is stored in @file{stats.log}.
  12262. Another example with both psnr and ssim at same time:
  12263. @example
  12264. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  12265. @end example
  12266. @section stereo3d
  12267. Convert between different stereoscopic image formats.
  12268. The filters accept the following options:
  12269. @table @option
  12270. @item in
  12271. Set stereoscopic image format of input.
  12272. Available values for input image formats are:
  12273. @table @samp
  12274. @item sbsl
  12275. side by side parallel (left eye left, right eye right)
  12276. @item sbsr
  12277. side by side crosseye (right eye left, left eye right)
  12278. @item sbs2l
  12279. side by side parallel with half width resolution
  12280. (left eye left, right eye right)
  12281. @item sbs2r
  12282. side by side crosseye with half width resolution
  12283. (right eye left, left eye right)
  12284. @item abl
  12285. above-below (left eye above, right eye below)
  12286. @item abr
  12287. above-below (right eye above, left eye below)
  12288. @item ab2l
  12289. above-below with half height resolution
  12290. (left eye above, right eye below)
  12291. @item ab2r
  12292. above-below with half height resolution
  12293. (right eye above, left eye below)
  12294. @item al
  12295. alternating frames (left eye first, right eye second)
  12296. @item ar
  12297. alternating frames (right eye first, left eye second)
  12298. @item irl
  12299. interleaved rows (left eye has top row, right eye starts on next row)
  12300. @item irr
  12301. interleaved rows (right eye has top row, left eye starts on next row)
  12302. @item icl
  12303. interleaved columns, left eye first
  12304. @item icr
  12305. interleaved columns, right eye first
  12306. Default value is @samp{sbsl}.
  12307. @end table
  12308. @item out
  12309. Set stereoscopic image format of output.
  12310. @table @samp
  12311. @item sbsl
  12312. side by side parallel (left eye left, right eye right)
  12313. @item sbsr
  12314. side by side crosseye (right eye left, left eye right)
  12315. @item sbs2l
  12316. side by side parallel with half width resolution
  12317. (left eye left, right eye right)
  12318. @item sbs2r
  12319. side by side crosseye with half width resolution
  12320. (right eye left, left eye right)
  12321. @item abl
  12322. above-below (left eye above, right eye below)
  12323. @item abr
  12324. above-below (right eye above, left eye below)
  12325. @item ab2l
  12326. above-below with half height resolution
  12327. (left eye above, right eye below)
  12328. @item ab2r
  12329. above-below with half height resolution
  12330. (right eye above, left eye below)
  12331. @item al
  12332. alternating frames (left eye first, right eye second)
  12333. @item ar
  12334. alternating frames (right eye first, left eye second)
  12335. @item irl
  12336. interleaved rows (left eye has top row, right eye starts on next row)
  12337. @item irr
  12338. interleaved rows (right eye has top row, left eye starts on next row)
  12339. @item arbg
  12340. anaglyph red/blue gray
  12341. (red filter on left eye, blue filter on right eye)
  12342. @item argg
  12343. anaglyph red/green gray
  12344. (red filter on left eye, green filter on right eye)
  12345. @item arcg
  12346. anaglyph red/cyan gray
  12347. (red filter on left eye, cyan filter on right eye)
  12348. @item arch
  12349. anaglyph red/cyan half colored
  12350. (red filter on left eye, cyan filter on right eye)
  12351. @item arcc
  12352. anaglyph red/cyan color
  12353. (red filter on left eye, cyan filter on right eye)
  12354. @item arcd
  12355. anaglyph red/cyan color optimized with the least squares projection of dubois
  12356. (red filter on left eye, cyan filter on right eye)
  12357. @item agmg
  12358. anaglyph green/magenta gray
  12359. (green filter on left eye, magenta filter on right eye)
  12360. @item agmh
  12361. anaglyph green/magenta half colored
  12362. (green filter on left eye, magenta filter on right eye)
  12363. @item agmc
  12364. anaglyph green/magenta colored
  12365. (green filter on left eye, magenta filter on right eye)
  12366. @item agmd
  12367. anaglyph green/magenta color optimized with the least squares projection of dubois
  12368. (green filter on left eye, magenta filter on right eye)
  12369. @item aybg
  12370. anaglyph yellow/blue gray
  12371. (yellow filter on left eye, blue filter on right eye)
  12372. @item aybh
  12373. anaglyph yellow/blue half colored
  12374. (yellow filter on left eye, blue filter on right eye)
  12375. @item aybc
  12376. anaglyph yellow/blue colored
  12377. (yellow filter on left eye, blue filter on right eye)
  12378. @item aybd
  12379. anaglyph yellow/blue color optimized with the least squares projection of dubois
  12380. (yellow filter on left eye, blue filter on right eye)
  12381. @item ml
  12382. mono output (left eye only)
  12383. @item mr
  12384. mono output (right eye only)
  12385. @item chl
  12386. checkerboard, left eye first
  12387. @item chr
  12388. checkerboard, right eye first
  12389. @item icl
  12390. interleaved columns, left eye first
  12391. @item icr
  12392. interleaved columns, right eye first
  12393. @item hdmi
  12394. HDMI frame pack
  12395. @end table
  12396. Default value is @samp{arcd}.
  12397. @end table
  12398. @subsection Examples
  12399. @itemize
  12400. @item
  12401. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  12402. @example
  12403. stereo3d=sbsl:aybd
  12404. @end example
  12405. @item
  12406. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  12407. @example
  12408. stereo3d=abl:sbsr
  12409. @end example
  12410. @end itemize
  12411. @section streamselect, astreamselect
  12412. Select video or audio streams.
  12413. The filter accepts the following options:
  12414. @table @option
  12415. @item inputs
  12416. Set number of inputs. Default is 2.
  12417. @item map
  12418. Set input indexes to remap to outputs.
  12419. @end table
  12420. @subsection Commands
  12421. The @code{streamselect} and @code{astreamselect} filter supports the following
  12422. commands:
  12423. @table @option
  12424. @item map
  12425. Set input indexes to remap to outputs.
  12426. @end table
  12427. @subsection Examples
  12428. @itemize
  12429. @item
  12430. Select first 5 seconds 1st stream and rest of time 2nd stream:
  12431. @example
  12432. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  12433. @end example
  12434. @item
  12435. Same as above, but for audio:
  12436. @example
  12437. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  12438. @end example
  12439. @end itemize
  12440. @section sobel
  12441. Apply sobel operator to input video stream.
  12442. The filter accepts the following option:
  12443. @table @option
  12444. @item planes
  12445. Set which planes will be processed, unprocessed planes will be copied.
  12446. By default value 0xf, all planes will be processed.
  12447. @item scale
  12448. Set value which will be multiplied with filtered result.
  12449. @item delta
  12450. Set value which will be added to filtered result.
  12451. @end table
  12452. @anchor{spp}
  12453. @section spp
  12454. Apply a simple postprocessing filter that compresses and decompresses the image
  12455. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  12456. and average the results.
  12457. The filter accepts the following options:
  12458. @table @option
  12459. @item quality
  12460. Set quality. This option defines the number of levels for averaging. It accepts
  12461. an integer in the range 0-6. If set to @code{0}, the filter will have no
  12462. effect. A value of @code{6} means the higher quality. For each increment of
  12463. that value the speed drops by a factor of approximately 2. Default value is
  12464. @code{3}.
  12465. @item qp
  12466. Force a constant quantization parameter. If not set, the filter will use the QP
  12467. from the video stream (if available).
  12468. @item mode
  12469. Set thresholding mode. Available modes are:
  12470. @table @samp
  12471. @item hard
  12472. Set hard thresholding (default).
  12473. @item soft
  12474. Set soft thresholding (better de-ringing effect, but likely blurrier).
  12475. @end table
  12476. @item use_bframe_qp
  12477. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  12478. option may cause flicker since the B-Frames have often larger QP. Default is
  12479. @code{0} (not enabled).
  12480. @end table
  12481. @section sr
  12482. Scale the input by applying one of the super-resolution methods based on
  12483. convolutional neural networks. Supported models:
  12484. @itemize
  12485. @item
  12486. Super-Resolution Convolutional Neural Network model (SRCNN).
  12487. See @url{https://arxiv.org/abs/1501.00092}.
  12488. @item
  12489. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  12490. See @url{https://arxiv.org/abs/1609.05158}.
  12491. @end itemize
  12492. Training scripts as well as scripts for model generation are provided in
  12493. the repository at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  12494. The filter accepts the following options:
  12495. @table @option
  12496. @item dnn_backend
  12497. Specify which DNN backend to use for model loading and execution. This option accepts
  12498. the following values:
  12499. @table @samp
  12500. @item native
  12501. Native implementation of DNN loading and execution.
  12502. @item tensorflow
  12503. TensorFlow backend. To enable this backend you
  12504. need to install the TensorFlow for C library (see
  12505. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  12506. @code{--enable-libtensorflow}
  12507. @end table
  12508. Default value is @samp{native}.
  12509. @item model
  12510. Set path to model file specifying network architecture and its parameters.
  12511. Note that different backends use different file formats. TensorFlow backend
  12512. can load files for both formats, while native backend can load files for only
  12513. its format.
  12514. @item scale_factor
  12515. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  12516. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  12517. input upscaled using bicubic upscaling with proper scale factor.
  12518. @end table
  12519. @anchor{subtitles}
  12520. @section subtitles
  12521. Draw subtitles on top of input video using the libass library.
  12522. To enable compilation of this filter you need to configure FFmpeg with
  12523. @code{--enable-libass}. This filter also requires a build with libavcodec and
  12524. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  12525. Alpha) subtitles format.
  12526. The filter accepts the following options:
  12527. @table @option
  12528. @item filename, f
  12529. Set the filename of the subtitle file to read. It must be specified.
  12530. @item original_size
  12531. Specify the size of the original video, the video for which the ASS file
  12532. was composed. For the syntax of this option, check the
  12533. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12534. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  12535. correctly scale the fonts if the aspect ratio has been changed.
  12536. @item fontsdir
  12537. Set a directory path containing fonts that can be used by the filter.
  12538. These fonts will be used in addition to whatever the font provider uses.
  12539. @item alpha
  12540. Process alpha channel, by default alpha channel is untouched.
  12541. @item charenc
  12542. Set subtitles input character encoding. @code{subtitles} filter only. Only
  12543. useful if not UTF-8.
  12544. @item stream_index, si
  12545. Set subtitles stream index. @code{subtitles} filter only.
  12546. @item force_style
  12547. Override default style or script info parameters of the subtitles. It accepts a
  12548. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  12549. @end table
  12550. If the first key is not specified, it is assumed that the first value
  12551. specifies the @option{filename}.
  12552. For example, to render the file @file{sub.srt} on top of the input
  12553. video, use the command:
  12554. @example
  12555. subtitles=sub.srt
  12556. @end example
  12557. which is equivalent to:
  12558. @example
  12559. subtitles=filename=sub.srt
  12560. @end example
  12561. To render the default subtitles stream from file @file{video.mkv}, use:
  12562. @example
  12563. subtitles=video.mkv
  12564. @end example
  12565. To render the second subtitles stream from that file, use:
  12566. @example
  12567. subtitles=video.mkv:si=1
  12568. @end example
  12569. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  12570. @code{DejaVu Serif}, use:
  12571. @example
  12572. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HCCFF0000'
  12573. @end example
  12574. @section super2xsai
  12575. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  12576. Interpolate) pixel art scaling algorithm.
  12577. Useful for enlarging pixel art images without reducing sharpness.
  12578. @section swaprect
  12579. Swap two rectangular objects in video.
  12580. This filter accepts the following options:
  12581. @table @option
  12582. @item w
  12583. Set object width.
  12584. @item h
  12585. Set object height.
  12586. @item x1
  12587. Set 1st rect x coordinate.
  12588. @item y1
  12589. Set 1st rect y coordinate.
  12590. @item x2
  12591. Set 2nd rect x coordinate.
  12592. @item y2
  12593. Set 2nd rect y coordinate.
  12594. All expressions are evaluated once for each frame.
  12595. @end table
  12596. The all options are expressions containing the following constants:
  12597. @table @option
  12598. @item w
  12599. @item h
  12600. The input width and height.
  12601. @item a
  12602. same as @var{w} / @var{h}
  12603. @item sar
  12604. input sample aspect ratio
  12605. @item dar
  12606. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  12607. @item n
  12608. The number of the input frame, starting from 0.
  12609. @item t
  12610. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  12611. @item pos
  12612. the position in the file of the input frame, NAN if unknown
  12613. @end table
  12614. @section swapuv
  12615. Swap U & V plane.
  12616. @section telecine
  12617. Apply telecine process to the video.
  12618. This filter accepts the following options:
  12619. @table @option
  12620. @item first_field
  12621. @table @samp
  12622. @item top, t
  12623. top field first
  12624. @item bottom, b
  12625. bottom field first
  12626. The default value is @code{top}.
  12627. @end table
  12628. @item pattern
  12629. A string of numbers representing the pulldown pattern you wish to apply.
  12630. The default value is @code{23}.
  12631. @end table
  12632. @example
  12633. Some typical patterns:
  12634. NTSC output (30i):
  12635. 27.5p: 32222
  12636. 24p: 23 (classic)
  12637. 24p: 2332 (preferred)
  12638. 20p: 33
  12639. 18p: 334
  12640. 16p: 3444
  12641. PAL output (25i):
  12642. 27.5p: 12222
  12643. 24p: 222222222223 ("Euro pulldown")
  12644. 16.67p: 33
  12645. 16p: 33333334
  12646. @end example
  12647. @section threshold
  12648. Apply threshold effect to video stream.
  12649. This filter needs four video streams to perform thresholding.
  12650. First stream is stream we are filtering.
  12651. Second stream is holding threshold values, third stream is holding min values,
  12652. and last, fourth stream is holding max values.
  12653. The filter accepts the following option:
  12654. @table @option
  12655. @item planes
  12656. Set which planes will be processed, unprocessed planes will be copied.
  12657. By default value 0xf, all planes will be processed.
  12658. @end table
  12659. For example if first stream pixel's component value is less then threshold value
  12660. of pixel component from 2nd threshold stream, third stream value will picked,
  12661. otherwise fourth stream pixel component value will be picked.
  12662. Using color source filter one can perform various types of thresholding:
  12663. @subsection Examples
  12664. @itemize
  12665. @item
  12666. Binary threshold, using gray color as threshold:
  12667. @example
  12668. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  12669. @end example
  12670. @item
  12671. Inverted binary threshold, using gray color as threshold:
  12672. @example
  12673. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  12674. @end example
  12675. @item
  12676. Truncate binary threshold, using gray color as threshold:
  12677. @example
  12678. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  12679. @end example
  12680. @item
  12681. Threshold to zero, using gray color as threshold:
  12682. @example
  12683. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  12684. @end example
  12685. @item
  12686. Inverted threshold to zero, using gray color as threshold:
  12687. @example
  12688. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  12689. @end example
  12690. @end itemize
  12691. @section thumbnail
  12692. Select the most representative frame in a given sequence of consecutive frames.
  12693. The filter accepts the following options:
  12694. @table @option
  12695. @item n
  12696. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  12697. will pick one of them, and then handle the next batch of @var{n} frames until
  12698. the end. Default is @code{100}.
  12699. @end table
  12700. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  12701. value will result in a higher memory usage, so a high value is not recommended.
  12702. @subsection Examples
  12703. @itemize
  12704. @item
  12705. Extract one picture each 50 frames:
  12706. @example
  12707. thumbnail=50
  12708. @end example
  12709. @item
  12710. Complete example of a thumbnail creation with @command{ffmpeg}:
  12711. @example
  12712. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  12713. @end example
  12714. @end itemize
  12715. @section tile
  12716. Tile several successive frames together.
  12717. The filter accepts the following options:
  12718. @table @option
  12719. @item layout
  12720. Set the grid size (i.e. the number of lines and columns). For the syntax of
  12721. this option, check the
  12722. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12723. @item nb_frames
  12724. Set the maximum number of frames to render in the given area. It must be less
  12725. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  12726. the area will be used.
  12727. @item margin
  12728. Set the outer border margin in pixels.
  12729. @item padding
  12730. Set the inner border thickness (i.e. the number of pixels between frames). For
  12731. more advanced padding options (such as having different values for the edges),
  12732. refer to the pad video filter.
  12733. @item color
  12734. Specify the color of the unused area. For the syntax of this option, check the
  12735. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12736. The default value of @var{color} is "black".
  12737. @item overlap
  12738. Set the number of frames to overlap when tiling several successive frames together.
  12739. The value must be between @code{0} and @var{nb_frames - 1}.
  12740. @item init_padding
  12741. Set the number of frames to initially be empty before displaying first output frame.
  12742. This controls how soon will one get first output frame.
  12743. The value must be between @code{0} and @var{nb_frames - 1}.
  12744. @end table
  12745. @subsection Examples
  12746. @itemize
  12747. @item
  12748. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  12749. @example
  12750. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  12751. @end example
  12752. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  12753. duplicating each output frame to accommodate the originally detected frame
  12754. rate.
  12755. @item
  12756. Display @code{5} pictures in an area of @code{3x2} frames,
  12757. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  12758. mixed flat and named options:
  12759. @example
  12760. tile=3x2:nb_frames=5:padding=7:margin=2
  12761. @end example
  12762. @end itemize
  12763. @section tinterlace
  12764. Perform various types of temporal field interlacing.
  12765. Frames are counted starting from 1, so the first input frame is
  12766. considered odd.
  12767. The filter accepts the following options:
  12768. @table @option
  12769. @item mode
  12770. Specify the mode of the interlacing. This option can also be specified
  12771. as a value alone. See below for a list of values for this option.
  12772. Available values are:
  12773. @table @samp
  12774. @item merge, 0
  12775. Move odd frames into the upper field, even into the lower field,
  12776. generating a double height frame at half frame rate.
  12777. @example
  12778. ------> time
  12779. Input:
  12780. Frame 1 Frame 2 Frame 3 Frame 4
  12781. 11111 22222 33333 44444
  12782. 11111 22222 33333 44444
  12783. 11111 22222 33333 44444
  12784. 11111 22222 33333 44444
  12785. Output:
  12786. 11111 33333
  12787. 22222 44444
  12788. 11111 33333
  12789. 22222 44444
  12790. 11111 33333
  12791. 22222 44444
  12792. 11111 33333
  12793. 22222 44444
  12794. @end example
  12795. @item drop_even, 1
  12796. Only output odd frames, even frames are dropped, generating a frame with
  12797. unchanged height at half frame rate.
  12798. @example
  12799. ------> time
  12800. Input:
  12801. Frame 1 Frame 2 Frame 3 Frame 4
  12802. 11111 22222 33333 44444
  12803. 11111 22222 33333 44444
  12804. 11111 22222 33333 44444
  12805. 11111 22222 33333 44444
  12806. Output:
  12807. 11111 33333
  12808. 11111 33333
  12809. 11111 33333
  12810. 11111 33333
  12811. @end example
  12812. @item drop_odd, 2
  12813. Only output even frames, odd frames are dropped, generating a frame with
  12814. unchanged height at half frame rate.
  12815. @example
  12816. ------> time
  12817. Input:
  12818. Frame 1 Frame 2 Frame 3 Frame 4
  12819. 11111 22222 33333 44444
  12820. 11111 22222 33333 44444
  12821. 11111 22222 33333 44444
  12822. 11111 22222 33333 44444
  12823. Output:
  12824. 22222 44444
  12825. 22222 44444
  12826. 22222 44444
  12827. 22222 44444
  12828. @end example
  12829. @item pad, 3
  12830. Expand each frame to full height, but pad alternate lines with black,
  12831. generating a frame with double height at the same input frame rate.
  12832. @example
  12833. ------> time
  12834. Input:
  12835. Frame 1 Frame 2 Frame 3 Frame 4
  12836. 11111 22222 33333 44444
  12837. 11111 22222 33333 44444
  12838. 11111 22222 33333 44444
  12839. 11111 22222 33333 44444
  12840. Output:
  12841. 11111 ..... 33333 .....
  12842. ..... 22222 ..... 44444
  12843. 11111 ..... 33333 .....
  12844. ..... 22222 ..... 44444
  12845. 11111 ..... 33333 .....
  12846. ..... 22222 ..... 44444
  12847. 11111 ..... 33333 .....
  12848. ..... 22222 ..... 44444
  12849. @end example
  12850. @item interleave_top, 4
  12851. Interleave the upper field from odd frames with the lower field from
  12852. even frames, generating a frame with unchanged height at half frame rate.
  12853. @example
  12854. ------> time
  12855. Input:
  12856. Frame 1 Frame 2 Frame 3 Frame 4
  12857. 11111<- 22222 33333<- 44444
  12858. 11111 22222<- 33333 44444<-
  12859. 11111<- 22222 33333<- 44444
  12860. 11111 22222<- 33333 44444<-
  12861. Output:
  12862. 11111 33333
  12863. 22222 44444
  12864. 11111 33333
  12865. 22222 44444
  12866. @end example
  12867. @item interleave_bottom, 5
  12868. Interleave the lower field from odd frames with the upper field from
  12869. even frames, generating a frame with unchanged height at half frame rate.
  12870. @example
  12871. ------> time
  12872. Input:
  12873. Frame 1 Frame 2 Frame 3 Frame 4
  12874. 11111 22222<- 33333 44444<-
  12875. 11111<- 22222 33333<- 44444
  12876. 11111 22222<- 33333 44444<-
  12877. 11111<- 22222 33333<- 44444
  12878. Output:
  12879. 22222 44444
  12880. 11111 33333
  12881. 22222 44444
  12882. 11111 33333
  12883. @end example
  12884. @item interlacex2, 6
  12885. Double frame rate with unchanged height. Frames are inserted each
  12886. containing the second temporal field from the previous input frame and
  12887. the first temporal field from the next input frame. This mode relies on
  12888. the top_field_first flag. Useful for interlaced video displays with no
  12889. field synchronisation.
  12890. @example
  12891. ------> time
  12892. Input:
  12893. Frame 1 Frame 2 Frame 3 Frame 4
  12894. 11111 22222 33333 44444
  12895. 11111 22222 33333 44444
  12896. 11111 22222 33333 44444
  12897. 11111 22222 33333 44444
  12898. Output:
  12899. 11111 22222 22222 33333 33333 44444 44444
  12900. 11111 11111 22222 22222 33333 33333 44444
  12901. 11111 22222 22222 33333 33333 44444 44444
  12902. 11111 11111 22222 22222 33333 33333 44444
  12903. @end example
  12904. @item mergex2, 7
  12905. Move odd frames into the upper field, even into the lower field,
  12906. generating a double height frame at same frame rate.
  12907. @example
  12908. ------> time
  12909. Input:
  12910. Frame 1 Frame 2 Frame 3 Frame 4
  12911. 11111 22222 33333 44444
  12912. 11111 22222 33333 44444
  12913. 11111 22222 33333 44444
  12914. 11111 22222 33333 44444
  12915. Output:
  12916. 11111 33333 33333 55555
  12917. 22222 22222 44444 44444
  12918. 11111 33333 33333 55555
  12919. 22222 22222 44444 44444
  12920. 11111 33333 33333 55555
  12921. 22222 22222 44444 44444
  12922. 11111 33333 33333 55555
  12923. 22222 22222 44444 44444
  12924. @end example
  12925. @end table
  12926. Numeric values are deprecated but are accepted for backward
  12927. compatibility reasons.
  12928. Default mode is @code{merge}.
  12929. @item flags
  12930. Specify flags influencing the filter process.
  12931. Available value for @var{flags} is:
  12932. @table @option
  12933. @item low_pass_filter, vlfp
  12934. Enable linear vertical low-pass filtering in the filter.
  12935. Vertical low-pass filtering is required when creating an interlaced
  12936. destination from a progressive source which contains high-frequency
  12937. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  12938. patterning.
  12939. @item complex_filter, cvlfp
  12940. Enable complex vertical low-pass filtering.
  12941. This will slightly less reduce interlace 'twitter' and Moire
  12942. patterning but better retain detail and subjective sharpness impression.
  12943. @end table
  12944. Vertical low-pass filtering can only be enabled for @option{mode}
  12945. @var{interleave_top} and @var{interleave_bottom}.
  12946. @end table
  12947. @section tmix
  12948. Mix successive video frames.
  12949. A description of the accepted options follows.
  12950. @table @option
  12951. @item frames
  12952. The number of successive frames to mix. If unspecified, it defaults to 3.
  12953. @item weights
  12954. Specify weight of each input video frame.
  12955. Each weight is separated by space. If number of weights is smaller than
  12956. number of @var{frames} last specified weight will be used for all remaining
  12957. unset weights.
  12958. @item scale
  12959. Specify scale, if it is set it will be multiplied with sum
  12960. of each weight multiplied with pixel values to give final destination
  12961. pixel value. By default @var{scale} is auto scaled to sum of weights.
  12962. @end table
  12963. @subsection Examples
  12964. @itemize
  12965. @item
  12966. Average 7 successive frames:
  12967. @example
  12968. tmix=frames=7:weights="1 1 1 1 1 1 1"
  12969. @end example
  12970. @item
  12971. Apply simple temporal convolution:
  12972. @example
  12973. tmix=frames=3:weights="-1 3 -1"
  12974. @end example
  12975. @item
  12976. Similar as above but only showing temporal differences:
  12977. @example
  12978. tmix=frames=3:weights="-1 2 -1":scale=1
  12979. @end example
  12980. @end itemize
  12981. @anchor{tonemap}
  12982. @section tonemap
  12983. Tone map colors from different dynamic ranges.
  12984. This filter expects data in single precision floating point, as it needs to
  12985. operate on (and can output) out-of-range values. Another filter, such as
  12986. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  12987. The tonemapping algorithms implemented only work on linear light, so input
  12988. data should be linearized beforehand (and possibly correctly tagged).
  12989. @example
  12990. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  12991. @end example
  12992. @subsection Options
  12993. The filter accepts the following options.
  12994. @table @option
  12995. @item tonemap
  12996. Set the tone map algorithm to use.
  12997. Possible values are:
  12998. @table @var
  12999. @item none
  13000. Do not apply any tone map, only desaturate overbright pixels.
  13001. @item clip
  13002. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  13003. in-range values, while distorting out-of-range values.
  13004. @item linear
  13005. Stretch the entire reference gamut to a linear multiple of the display.
  13006. @item gamma
  13007. Fit a logarithmic transfer between the tone curves.
  13008. @item reinhard
  13009. Preserve overall image brightness with a simple curve, using nonlinear
  13010. contrast, which results in flattening details and degrading color accuracy.
  13011. @item hable
  13012. Preserve both dark and bright details better than @var{reinhard}, at the cost
  13013. of slightly darkening everything. Use it when detail preservation is more
  13014. important than color and brightness accuracy.
  13015. @item mobius
  13016. Smoothly map out-of-range values, while retaining contrast and colors for
  13017. in-range material as much as possible. Use it when color accuracy is more
  13018. important than detail preservation.
  13019. @end table
  13020. Default is none.
  13021. @item param
  13022. Tune the tone mapping algorithm.
  13023. This affects the following algorithms:
  13024. @table @var
  13025. @item none
  13026. Ignored.
  13027. @item linear
  13028. Specifies the scale factor to use while stretching.
  13029. Default to 1.0.
  13030. @item gamma
  13031. Specifies the exponent of the function.
  13032. Default to 1.8.
  13033. @item clip
  13034. Specify an extra linear coefficient to multiply into the signal before clipping.
  13035. Default to 1.0.
  13036. @item reinhard
  13037. Specify the local contrast coefficient at the display peak.
  13038. Default to 0.5, which means that in-gamut values will be about half as bright
  13039. as when clipping.
  13040. @item hable
  13041. Ignored.
  13042. @item mobius
  13043. Specify the transition point from linear to mobius transform. Every value
  13044. below this point is guaranteed to be mapped 1:1. The higher the value, the
  13045. more accurate the result will be, at the cost of losing bright details.
  13046. Default to 0.3, which due to the steep initial slope still preserves in-range
  13047. colors fairly accurately.
  13048. @end table
  13049. @item desat
  13050. Apply desaturation for highlights that exceed this level of brightness. The
  13051. higher the parameter, the more color information will be preserved. This
  13052. setting helps prevent unnaturally blown-out colors for super-highlights, by
  13053. (smoothly) turning into white instead. This makes images feel more natural,
  13054. at the cost of reducing information about out-of-range colors.
  13055. The default of 2.0 is somewhat conservative and will mostly just apply to
  13056. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  13057. This option works only if the input frame has a supported color tag.
  13058. @item peak
  13059. Override signal/nominal/reference peak with this value. Useful when the
  13060. embedded peak information in display metadata is not reliable or when tone
  13061. mapping from a lower range to a higher range.
  13062. @end table
  13063. @section tpad
  13064. Temporarily pad video frames.
  13065. The filter accepts the following options:
  13066. @table @option
  13067. @item start
  13068. Specify number of delay frames before input video stream.
  13069. @item stop
  13070. Specify number of padding frames after input video stream.
  13071. Set to -1 to pad indefinitely.
  13072. @item start_mode
  13073. Set kind of frames added to beginning of stream.
  13074. Can be either @var{add} or @var{clone}.
  13075. With @var{add} frames of solid-color are added.
  13076. With @var{clone} frames are clones of first frame.
  13077. @item stop_mode
  13078. Set kind of frames added to end of stream.
  13079. Can be either @var{add} or @var{clone}.
  13080. With @var{add} frames of solid-color are added.
  13081. With @var{clone} frames are clones of last frame.
  13082. @item start_duration, stop_duration
  13083. Specify the duration of the start/stop delay. See
  13084. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13085. for the accepted syntax.
  13086. These options override @var{start} and @var{stop}.
  13087. @item color
  13088. Specify the color of the padded area. For the syntax of this option,
  13089. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  13090. manual,ffmpeg-utils}.
  13091. The default value of @var{color} is "black".
  13092. @end table
  13093. @anchor{transpose}
  13094. @section transpose
  13095. Transpose rows with columns in the input video and optionally flip it.
  13096. It accepts the following parameters:
  13097. @table @option
  13098. @item dir
  13099. Specify the transposition direction.
  13100. Can assume the following values:
  13101. @table @samp
  13102. @item 0, 4, cclock_flip
  13103. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  13104. @example
  13105. L.R L.l
  13106. . . -> . .
  13107. l.r R.r
  13108. @end example
  13109. @item 1, 5, clock
  13110. Rotate by 90 degrees clockwise, that is:
  13111. @example
  13112. L.R l.L
  13113. . . -> . .
  13114. l.r r.R
  13115. @end example
  13116. @item 2, 6, cclock
  13117. Rotate by 90 degrees counterclockwise, that is:
  13118. @example
  13119. L.R R.r
  13120. . . -> . .
  13121. l.r L.l
  13122. @end example
  13123. @item 3, 7, clock_flip
  13124. Rotate by 90 degrees clockwise and vertically flip, that is:
  13125. @example
  13126. L.R r.R
  13127. . . -> . .
  13128. l.r l.L
  13129. @end example
  13130. @end table
  13131. For values between 4-7, the transposition is only done if the input
  13132. video geometry is portrait and not landscape. These values are
  13133. deprecated, the @code{passthrough} option should be used instead.
  13134. Numerical values are deprecated, and should be dropped in favor of
  13135. symbolic constants.
  13136. @item passthrough
  13137. Do not apply the transposition if the input geometry matches the one
  13138. specified by the specified value. It accepts the following values:
  13139. @table @samp
  13140. @item none
  13141. Always apply transposition.
  13142. @item portrait
  13143. Preserve portrait geometry (when @var{height} >= @var{width}).
  13144. @item landscape
  13145. Preserve landscape geometry (when @var{width} >= @var{height}).
  13146. @end table
  13147. Default value is @code{none}.
  13148. @end table
  13149. For example to rotate by 90 degrees clockwise and preserve portrait
  13150. layout:
  13151. @example
  13152. transpose=dir=1:passthrough=portrait
  13153. @end example
  13154. The command above can also be specified as:
  13155. @example
  13156. transpose=1:portrait
  13157. @end example
  13158. @section transpose_npp
  13159. Transpose rows with columns in the input video and optionally flip it.
  13160. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  13161. It accepts the following parameters:
  13162. @table @option
  13163. @item dir
  13164. Specify the transposition direction.
  13165. Can assume the following values:
  13166. @table @samp
  13167. @item cclock_flip
  13168. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  13169. @item clock
  13170. Rotate by 90 degrees clockwise.
  13171. @item cclock
  13172. Rotate by 90 degrees counterclockwise.
  13173. @item clock_flip
  13174. Rotate by 90 degrees clockwise and vertically flip.
  13175. @end table
  13176. @item passthrough
  13177. Do not apply the transposition if the input geometry matches the one
  13178. specified by the specified value. It accepts the following values:
  13179. @table @samp
  13180. @item none
  13181. Always apply transposition. (default)
  13182. @item portrait
  13183. Preserve portrait geometry (when @var{height} >= @var{width}).
  13184. @item landscape
  13185. Preserve landscape geometry (when @var{width} >= @var{height}).
  13186. @end table
  13187. @end table
  13188. @section trim
  13189. Trim the input so that the output contains one continuous subpart of the input.
  13190. It accepts the following parameters:
  13191. @table @option
  13192. @item start
  13193. Specify the time of the start of the kept section, i.e. the frame with the
  13194. timestamp @var{start} will be the first frame in the output.
  13195. @item end
  13196. Specify the time of the first frame that will be dropped, i.e. the frame
  13197. immediately preceding the one with the timestamp @var{end} will be the last
  13198. frame in the output.
  13199. @item start_pts
  13200. This is the same as @var{start}, except this option sets the start timestamp
  13201. in timebase units instead of seconds.
  13202. @item end_pts
  13203. This is the same as @var{end}, except this option sets the end timestamp
  13204. in timebase units instead of seconds.
  13205. @item duration
  13206. The maximum duration of the output in seconds.
  13207. @item start_frame
  13208. The number of the first frame that should be passed to the output.
  13209. @item end_frame
  13210. The number of the first frame that should be dropped.
  13211. @end table
  13212. @option{start}, @option{end}, and @option{duration} are expressed as time
  13213. duration specifications; see
  13214. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13215. for the accepted syntax.
  13216. Note that the first two sets of the start/end options and the @option{duration}
  13217. option look at the frame timestamp, while the _frame variants simply count the
  13218. frames that pass through the filter. Also note that this filter does not modify
  13219. the timestamps. If you wish for the output timestamps to start at zero, insert a
  13220. setpts filter after the trim filter.
  13221. If multiple start or end options are set, this filter tries to be greedy and
  13222. keep all the frames that match at least one of the specified constraints. To keep
  13223. only the part that matches all the constraints at once, chain multiple trim
  13224. filters.
  13225. The defaults are such that all the input is kept. So it is possible to set e.g.
  13226. just the end values to keep everything before the specified time.
  13227. Examples:
  13228. @itemize
  13229. @item
  13230. Drop everything except the second minute of input:
  13231. @example
  13232. ffmpeg -i INPUT -vf trim=60:120
  13233. @end example
  13234. @item
  13235. Keep only the first second:
  13236. @example
  13237. ffmpeg -i INPUT -vf trim=duration=1
  13238. @end example
  13239. @end itemize
  13240. @section unpremultiply
  13241. Apply alpha unpremultiply effect to input video stream using first plane
  13242. of second stream as alpha.
  13243. Both streams must have same dimensions and same pixel format.
  13244. The filter accepts the following option:
  13245. @table @option
  13246. @item planes
  13247. Set which planes will be processed, unprocessed planes will be copied.
  13248. By default value 0xf, all planes will be processed.
  13249. If the format has 1 or 2 components, then luma is bit 0.
  13250. If the format has 3 or 4 components:
  13251. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  13252. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  13253. If present, the alpha channel is always the last bit.
  13254. @item inplace
  13255. Do not require 2nd input for processing, instead use alpha plane from input stream.
  13256. @end table
  13257. @anchor{unsharp}
  13258. @section unsharp
  13259. Sharpen or blur the input video.
  13260. It accepts the following parameters:
  13261. @table @option
  13262. @item luma_msize_x, lx
  13263. Set the luma matrix horizontal size. It must be an odd integer between
  13264. 3 and 23. The default value is 5.
  13265. @item luma_msize_y, ly
  13266. Set the luma matrix vertical size. It must be an odd integer between 3
  13267. and 23. The default value is 5.
  13268. @item luma_amount, la
  13269. Set the luma effect strength. It must be a floating point number, reasonable
  13270. values lay between -1.5 and 1.5.
  13271. Negative values will blur the input video, while positive values will
  13272. sharpen it, a value of zero will disable the effect.
  13273. Default value is 1.0.
  13274. @item chroma_msize_x, cx
  13275. Set the chroma matrix horizontal size. It must be an odd integer
  13276. between 3 and 23. The default value is 5.
  13277. @item chroma_msize_y, cy
  13278. Set the chroma matrix vertical size. It must be an odd integer
  13279. between 3 and 23. The default value is 5.
  13280. @item chroma_amount, ca
  13281. Set the chroma effect strength. It must be a floating point number, reasonable
  13282. values lay between -1.5 and 1.5.
  13283. Negative values will blur the input video, while positive values will
  13284. sharpen it, a value of zero will disable the effect.
  13285. Default value is 0.0.
  13286. @end table
  13287. All parameters are optional and default to the equivalent of the
  13288. string '5:5:1.0:5:5:0.0'.
  13289. @subsection Examples
  13290. @itemize
  13291. @item
  13292. Apply strong luma sharpen effect:
  13293. @example
  13294. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  13295. @end example
  13296. @item
  13297. Apply a strong blur of both luma and chroma parameters:
  13298. @example
  13299. unsharp=7:7:-2:7:7:-2
  13300. @end example
  13301. @end itemize
  13302. @section uspp
  13303. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  13304. the image at several (or - in the case of @option{quality} level @code{8} - all)
  13305. shifts and average the results.
  13306. The way this differs from the behavior of spp is that uspp actually encodes &
  13307. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  13308. DCT similar to MJPEG.
  13309. The filter accepts the following options:
  13310. @table @option
  13311. @item quality
  13312. Set quality. This option defines the number of levels for averaging. It accepts
  13313. an integer in the range 0-8. If set to @code{0}, the filter will have no
  13314. effect. A value of @code{8} means the higher quality. For each increment of
  13315. that value the speed drops by a factor of approximately 2. Default value is
  13316. @code{3}.
  13317. @item qp
  13318. Force a constant quantization parameter. If not set, the filter will use the QP
  13319. from the video stream (if available).
  13320. @end table
  13321. @section vaguedenoiser
  13322. Apply a wavelet based denoiser.
  13323. It transforms each frame from the video input into the wavelet domain,
  13324. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  13325. the obtained coefficients. It does an inverse wavelet transform after.
  13326. Due to wavelet properties, it should give a nice smoothed result, and
  13327. reduced noise, without blurring picture features.
  13328. This filter accepts the following options:
  13329. @table @option
  13330. @item threshold
  13331. The filtering strength. The higher, the more filtered the video will be.
  13332. Hard thresholding can use a higher threshold than soft thresholding
  13333. before the video looks overfiltered. Default value is 2.
  13334. @item method
  13335. The filtering method the filter will use.
  13336. It accepts the following values:
  13337. @table @samp
  13338. @item hard
  13339. All values under the threshold will be zeroed.
  13340. @item soft
  13341. All values under the threshold will be zeroed. All values above will be
  13342. reduced by the threshold.
  13343. @item garrote
  13344. Scales or nullifies coefficients - intermediary between (more) soft and
  13345. (less) hard thresholding.
  13346. @end table
  13347. Default is garrote.
  13348. @item nsteps
  13349. Number of times, the wavelet will decompose the picture. Picture can't
  13350. be decomposed beyond a particular point (typically, 8 for a 640x480
  13351. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  13352. @item percent
  13353. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  13354. @item planes
  13355. A list of the planes to process. By default all planes are processed.
  13356. @end table
  13357. @section vectorscope
  13358. Display 2 color component values in the two dimensional graph (which is called
  13359. a vectorscope).
  13360. This filter accepts the following options:
  13361. @table @option
  13362. @item mode, m
  13363. Set vectorscope mode.
  13364. It accepts the following values:
  13365. @table @samp
  13366. @item gray
  13367. Gray values are displayed on graph, higher brightness means more pixels have
  13368. same component color value on location in graph. This is the default mode.
  13369. @item color
  13370. Gray values are displayed on graph. Surrounding pixels values which are not
  13371. present in video frame are drawn in gradient of 2 color components which are
  13372. set by option @code{x} and @code{y}. The 3rd color component is static.
  13373. @item color2
  13374. Actual color components values present in video frame are displayed on graph.
  13375. @item color3
  13376. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  13377. on graph increases value of another color component, which is luminance by
  13378. default values of @code{x} and @code{y}.
  13379. @item color4
  13380. Actual colors present in video frame are displayed on graph. If two different
  13381. colors map to same position on graph then color with higher value of component
  13382. not present in graph is picked.
  13383. @item color5
  13384. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  13385. component picked from radial gradient.
  13386. @end table
  13387. @item x
  13388. Set which color component will be represented on X-axis. Default is @code{1}.
  13389. @item y
  13390. Set which color component will be represented on Y-axis. Default is @code{2}.
  13391. @item intensity, i
  13392. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  13393. of color component which represents frequency of (X, Y) location in graph.
  13394. @item envelope, e
  13395. @table @samp
  13396. @item none
  13397. No envelope, this is default.
  13398. @item instant
  13399. Instant envelope, even darkest single pixel will be clearly highlighted.
  13400. @item peak
  13401. Hold maximum and minimum values presented in graph over time. This way you
  13402. can still spot out of range values without constantly looking at vectorscope.
  13403. @item peak+instant
  13404. Peak and instant envelope combined together.
  13405. @end table
  13406. @item graticule, g
  13407. Set what kind of graticule to draw.
  13408. @table @samp
  13409. @item none
  13410. @item green
  13411. @item color
  13412. @end table
  13413. @item opacity, o
  13414. Set graticule opacity.
  13415. @item flags, f
  13416. Set graticule flags.
  13417. @table @samp
  13418. @item white
  13419. Draw graticule for white point.
  13420. @item black
  13421. Draw graticule for black point.
  13422. @item name
  13423. Draw color points short names.
  13424. @end table
  13425. @item bgopacity, b
  13426. Set background opacity.
  13427. @item lthreshold, l
  13428. Set low threshold for color component not represented on X or Y axis.
  13429. Values lower than this value will be ignored. Default is 0.
  13430. Note this value is multiplied with actual max possible value one pixel component
  13431. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  13432. is 0.1 * 255 = 25.
  13433. @item hthreshold, h
  13434. Set high threshold for color component not represented on X or Y axis.
  13435. Values higher than this value will be ignored. Default is 1.
  13436. Note this value is multiplied with actual max possible value one pixel component
  13437. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  13438. is 0.9 * 255 = 230.
  13439. @item colorspace, c
  13440. Set what kind of colorspace to use when drawing graticule.
  13441. @table @samp
  13442. @item auto
  13443. @item 601
  13444. @item 709
  13445. @end table
  13446. Default is auto.
  13447. @end table
  13448. @anchor{vidstabdetect}
  13449. @section vidstabdetect
  13450. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  13451. @ref{vidstabtransform} for pass 2.
  13452. This filter generates a file with relative translation and rotation
  13453. transform information about subsequent frames, which is then used by
  13454. the @ref{vidstabtransform} filter.
  13455. To enable compilation of this filter you need to configure FFmpeg with
  13456. @code{--enable-libvidstab}.
  13457. This filter accepts the following options:
  13458. @table @option
  13459. @item result
  13460. Set the path to the file used to write the transforms information.
  13461. Default value is @file{transforms.trf}.
  13462. @item shakiness
  13463. Set how shaky the video is and how quick the camera is. It accepts an
  13464. integer in the range 1-10, a value of 1 means little shakiness, a
  13465. value of 10 means strong shakiness. Default value is 5.
  13466. @item accuracy
  13467. Set the accuracy of the detection process. It must be a value in the
  13468. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  13469. accuracy. Default value is 15.
  13470. @item stepsize
  13471. Set stepsize of the search process. The region around minimum is
  13472. scanned with 1 pixel resolution. Default value is 6.
  13473. @item mincontrast
  13474. Set minimum contrast. Below this value a local measurement field is
  13475. discarded. Must be a floating point value in the range 0-1. Default
  13476. value is 0.3.
  13477. @item tripod
  13478. Set reference frame number for tripod mode.
  13479. If enabled, the motion of the frames is compared to a reference frame
  13480. in the filtered stream, identified by the specified number. The idea
  13481. is to compensate all movements in a more-or-less static scene and keep
  13482. the camera view absolutely still.
  13483. If set to 0, it is disabled. The frames are counted starting from 1.
  13484. @item show
  13485. Show fields and transforms in the resulting frames. It accepts an
  13486. integer in the range 0-2. Default value is 0, which disables any
  13487. visualization.
  13488. @end table
  13489. @subsection Examples
  13490. @itemize
  13491. @item
  13492. Use default values:
  13493. @example
  13494. vidstabdetect
  13495. @end example
  13496. @item
  13497. Analyze strongly shaky movie and put the results in file
  13498. @file{mytransforms.trf}:
  13499. @example
  13500. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  13501. @end example
  13502. @item
  13503. Visualize the result of internal transformations in the resulting
  13504. video:
  13505. @example
  13506. vidstabdetect=show=1
  13507. @end example
  13508. @item
  13509. Analyze a video with medium shakiness using @command{ffmpeg}:
  13510. @example
  13511. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  13512. @end example
  13513. @end itemize
  13514. @anchor{vidstabtransform}
  13515. @section vidstabtransform
  13516. Video stabilization/deshaking: pass 2 of 2,
  13517. see @ref{vidstabdetect} for pass 1.
  13518. Read a file with transform information for each frame and
  13519. apply/compensate them. Together with the @ref{vidstabdetect}
  13520. filter this can be used to deshake videos. See also
  13521. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  13522. the @ref{unsharp} filter, see below.
  13523. To enable compilation of this filter you need to configure FFmpeg with
  13524. @code{--enable-libvidstab}.
  13525. @subsection Options
  13526. @table @option
  13527. @item input
  13528. Set path to the file used to read the transforms. Default value is
  13529. @file{transforms.trf}.
  13530. @item smoothing
  13531. Set the number of frames (value*2 + 1) used for lowpass filtering the
  13532. camera movements. Default value is 10.
  13533. For example a number of 10 means that 21 frames are used (10 in the
  13534. past and 10 in the future) to smoothen the motion in the video. A
  13535. larger value leads to a smoother video, but limits the acceleration of
  13536. the camera (pan/tilt movements). 0 is a special case where a static
  13537. camera is simulated.
  13538. @item optalgo
  13539. Set the camera path optimization algorithm.
  13540. Accepted values are:
  13541. @table @samp
  13542. @item gauss
  13543. gaussian kernel low-pass filter on camera motion (default)
  13544. @item avg
  13545. averaging on transformations
  13546. @end table
  13547. @item maxshift
  13548. Set maximal number of pixels to translate frames. Default value is -1,
  13549. meaning no limit.
  13550. @item maxangle
  13551. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  13552. value is -1, meaning no limit.
  13553. @item crop
  13554. Specify how to deal with borders that may be visible due to movement
  13555. compensation.
  13556. Available values are:
  13557. @table @samp
  13558. @item keep
  13559. keep image information from previous frame (default)
  13560. @item black
  13561. fill the border black
  13562. @end table
  13563. @item invert
  13564. Invert transforms if set to 1. Default value is 0.
  13565. @item relative
  13566. Consider transforms as relative to previous frame if set to 1,
  13567. absolute if set to 0. Default value is 0.
  13568. @item zoom
  13569. Set percentage to zoom. A positive value will result in a zoom-in
  13570. effect, a negative value in a zoom-out effect. Default value is 0 (no
  13571. zoom).
  13572. @item optzoom
  13573. Set optimal zooming to avoid borders.
  13574. Accepted values are:
  13575. @table @samp
  13576. @item 0
  13577. disabled
  13578. @item 1
  13579. optimal static zoom value is determined (only very strong movements
  13580. will lead to visible borders) (default)
  13581. @item 2
  13582. optimal adaptive zoom value is determined (no borders will be
  13583. visible), see @option{zoomspeed}
  13584. @end table
  13585. Note that the value given at zoom is added to the one calculated here.
  13586. @item zoomspeed
  13587. Set percent to zoom maximally each frame (enabled when
  13588. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  13589. 0.25.
  13590. @item interpol
  13591. Specify type of interpolation.
  13592. Available values are:
  13593. @table @samp
  13594. @item no
  13595. no interpolation
  13596. @item linear
  13597. linear only horizontal
  13598. @item bilinear
  13599. linear in both directions (default)
  13600. @item bicubic
  13601. cubic in both directions (slow)
  13602. @end table
  13603. @item tripod
  13604. Enable virtual tripod mode if set to 1, which is equivalent to
  13605. @code{relative=0:smoothing=0}. Default value is 0.
  13606. Use also @code{tripod} option of @ref{vidstabdetect}.
  13607. @item debug
  13608. Increase log verbosity if set to 1. Also the detected global motions
  13609. are written to the temporary file @file{global_motions.trf}. Default
  13610. value is 0.
  13611. @end table
  13612. @subsection Examples
  13613. @itemize
  13614. @item
  13615. Use @command{ffmpeg} for a typical stabilization with default values:
  13616. @example
  13617. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  13618. @end example
  13619. Note the use of the @ref{unsharp} filter which is always recommended.
  13620. @item
  13621. Zoom in a bit more and load transform data from a given file:
  13622. @example
  13623. vidstabtransform=zoom=5:input="mytransforms.trf"
  13624. @end example
  13625. @item
  13626. Smoothen the video even more:
  13627. @example
  13628. vidstabtransform=smoothing=30
  13629. @end example
  13630. @end itemize
  13631. @section vflip
  13632. Flip the input video vertically.
  13633. For example, to vertically flip a video with @command{ffmpeg}:
  13634. @example
  13635. ffmpeg -i in.avi -vf "vflip" out.avi
  13636. @end example
  13637. @section vfrdet
  13638. Detect variable frame rate video.
  13639. This filter tries to detect if the input is variable or constant frame rate.
  13640. At end it will output number of frames detected as having variable delta pts,
  13641. and ones with constant delta pts.
  13642. If there was frames with variable delta, than it will also show min and max delta
  13643. encountered.
  13644. @section vibrance
  13645. Boost or alter saturation.
  13646. The filter accepts the following options:
  13647. @table @option
  13648. @item intensity
  13649. Set strength of boost if positive value or strength of alter if negative value.
  13650. Default is 0. Allowed range is from -2 to 2.
  13651. @item rbal
  13652. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  13653. @item gbal
  13654. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  13655. @item bbal
  13656. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  13657. @item rlum
  13658. Set the red luma coefficient.
  13659. @item glum
  13660. Set the green luma coefficient.
  13661. @item blum
  13662. Set the blue luma coefficient.
  13663. @end table
  13664. @anchor{vignette}
  13665. @section vignette
  13666. Make or reverse a natural vignetting effect.
  13667. The filter accepts the following options:
  13668. @table @option
  13669. @item angle, a
  13670. Set lens angle expression as a number of radians.
  13671. The value is clipped in the @code{[0,PI/2]} range.
  13672. Default value: @code{"PI/5"}
  13673. @item x0
  13674. @item y0
  13675. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  13676. by default.
  13677. @item mode
  13678. Set forward/backward mode.
  13679. Available modes are:
  13680. @table @samp
  13681. @item forward
  13682. The larger the distance from the central point, the darker the image becomes.
  13683. @item backward
  13684. The larger the distance from the central point, the brighter the image becomes.
  13685. This can be used to reverse a vignette effect, though there is no automatic
  13686. detection to extract the lens @option{angle} and other settings (yet). It can
  13687. also be used to create a burning effect.
  13688. @end table
  13689. Default value is @samp{forward}.
  13690. @item eval
  13691. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  13692. It accepts the following values:
  13693. @table @samp
  13694. @item init
  13695. Evaluate expressions only once during the filter initialization.
  13696. @item frame
  13697. Evaluate expressions for each incoming frame. This is way slower than the
  13698. @samp{init} mode since it requires all the scalers to be re-computed, but it
  13699. allows advanced dynamic expressions.
  13700. @end table
  13701. Default value is @samp{init}.
  13702. @item dither
  13703. Set dithering to reduce the circular banding effects. Default is @code{1}
  13704. (enabled).
  13705. @item aspect
  13706. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  13707. Setting this value to the SAR of the input will make a rectangular vignetting
  13708. following the dimensions of the video.
  13709. Default is @code{1/1}.
  13710. @end table
  13711. @subsection Expressions
  13712. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  13713. following parameters.
  13714. @table @option
  13715. @item w
  13716. @item h
  13717. input width and height
  13718. @item n
  13719. the number of input frame, starting from 0
  13720. @item pts
  13721. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  13722. @var{TB} units, NAN if undefined
  13723. @item r
  13724. frame rate of the input video, NAN if the input frame rate is unknown
  13725. @item t
  13726. the PTS (Presentation TimeStamp) of the filtered video frame,
  13727. expressed in seconds, NAN if undefined
  13728. @item tb
  13729. time base of the input video
  13730. @end table
  13731. @subsection Examples
  13732. @itemize
  13733. @item
  13734. Apply simple strong vignetting effect:
  13735. @example
  13736. vignette=PI/4
  13737. @end example
  13738. @item
  13739. Make a flickering vignetting:
  13740. @example
  13741. vignette='PI/4+random(1)*PI/50':eval=frame
  13742. @end example
  13743. @end itemize
  13744. @section vmafmotion
  13745. Obtain the average vmaf motion score of a video.
  13746. It is one of the component filters of VMAF.
  13747. The obtained average motion score is printed through the logging system.
  13748. In the below example the input file @file{ref.mpg} is being processed and score
  13749. is computed.
  13750. @example
  13751. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  13752. @end example
  13753. @section vstack
  13754. Stack input videos vertically.
  13755. All streams must be of same pixel format and of same width.
  13756. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  13757. to create same output.
  13758. The filter accept the following option:
  13759. @table @option
  13760. @item inputs
  13761. Set number of input streams. Default is 2.
  13762. @item shortest
  13763. If set to 1, force the output to terminate when the shortest input
  13764. terminates. Default value is 0.
  13765. @end table
  13766. @section w3fdif
  13767. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  13768. Deinterlacing Filter").
  13769. Based on the process described by Martin Weston for BBC R&D, and
  13770. implemented based on the de-interlace algorithm written by Jim
  13771. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  13772. uses filter coefficients calculated by BBC R&D.
  13773. There are two sets of filter coefficients, so called "simple":
  13774. and "complex". Which set of filter coefficients is used can
  13775. be set by passing an optional parameter:
  13776. @table @option
  13777. @item filter
  13778. Set the interlacing filter coefficients. Accepts one of the following values:
  13779. @table @samp
  13780. @item simple
  13781. Simple filter coefficient set.
  13782. @item complex
  13783. More-complex filter coefficient set.
  13784. @end table
  13785. Default value is @samp{complex}.
  13786. @item deint
  13787. Specify which frames to deinterlace. Accept one of the following values:
  13788. @table @samp
  13789. @item all
  13790. Deinterlace all frames,
  13791. @item interlaced
  13792. Only deinterlace frames marked as interlaced.
  13793. @end table
  13794. Default value is @samp{all}.
  13795. @end table
  13796. @section waveform
  13797. Video waveform monitor.
  13798. The waveform monitor plots color component intensity. By default luminance
  13799. only. Each column of the waveform corresponds to a column of pixels in the
  13800. source video.
  13801. It accepts the following options:
  13802. @table @option
  13803. @item mode, m
  13804. Can be either @code{row}, or @code{column}. Default is @code{column}.
  13805. In row mode, the graph on the left side represents color component value 0 and
  13806. the right side represents value = 255. In column mode, the top side represents
  13807. color component value = 0 and bottom side represents value = 255.
  13808. @item intensity, i
  13809. Set intensity. Smaller values are useful to find out how many values of the same
  13810. luminance are distributed across input rows/columns.
  13811. Default value is @code{0.04}. Allowed range is [0, 1].
  13812. @item mirror, r
  13813. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  13814. In mirrored mode, higher values will be represented on the left
  13815. side for @code{row} mode and at the top for @code{column} mode. Default is
  13816. @code{1} (mirrored).
  13817. @item display, d
  13818. Set display mode.
  13819. It accepts the following values:
  13820. @table @samp
  13821. @item overlay
  13822. Presents information identical to that in the @code{parade}, except
  13823. that the graphs representing color components are superimposed directly
  13824. over one another.
  13825. This display mode makes it easier to spot relative differences or similarities
  13826. in overlapping areas of the color components that are supposed to be identical,
  13827. such as neutral whites, grays, or blacks.
  13828. @item stack
  13829. Display separate graph for the color components side by side in
  13830. @code{row} mode or one below the other in @code{column} mode.
  13831. @item parade
  13832. Display separate graph for the color components side by side in
  13833. @code{column} mode or one below the other in @code{row} mode.
  13834. Using this display mode makes it easy to spot color casts in the highlights
  13835. and shadows of an image, by comparing the contours of the top and the bottom
  13836. graphs of each waveform. Since whites, grays, and blacks are characterized
  13837. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  13838. should display three waveforms of roughly equal width/height. If not, the
  13839. correction is easy to perform by making level adjustments the three waveforms.
  13840. @end table
  13841. Default is @code{stack}.
  13842. @item components, c
  13843. Set which color components to display. Default is 1, which means only luminance
  13844. or red color component if input is in RGB colorspace. If is set for example to
  13845. 7 it will display all 3 (if) available color components.
  13846. @item envelope, e
  13847. @table @samp
  13848. @item none
  13849. No envelope, this is default.
  13850. @item instant
  13851. Instant envelope, minimum and maximum values presented in graph will be easily
  13852. visible even with small @code{step} value.
  13853. @item peak
  13854. Hold minimum and maximum values presented in graph across time. This way you
  13855. can still spot out of range values without constantly looking at waveforms.
  13856. @item peak+instant
  13857. Peak and instant envelope combined together.
  13858. @end table
  13859. @item filter, f
  13860. @table @samp
  13861. @item lowpass
  13862. No filtering, this is default.
  13863. @item flat
  13864. Luma and chroma combined together.
  13865. @item aflat
  13866. Similar as above, but shows difference between blue and red chroma.
  13867. @item xflat
  13868. Similar as above, but use different colors.
  13869. @item chroma
  13870. Displays only chroma.
  13871. @item color
  13872. Displays actual color value on waveform.
  13873. @item acolor
  13874. Similar as above, but with luma showing frequency of chroma values.
  13875. @end table
  13876. @item graticule, g
  13877. Set which graticule to display.
  13878. @table @samp
  13879. @item none
  13880. Do not display graticule.
  13881. @item green
  13882. Display green graticule showing legal broadcast ranges.
  13883. @item orange
  13884. Display orange graticule showing legal broadcast ranges.
  13885. @end table
  13886. @item opacity, o
  13887. Set graticule opacity.
  13888. @item flags, fl
  13889. Set graticule flags.
  13890. @table @samp
  13891. @item numbers
  13892. Draw numbers above lines. By default enabled.
  13893. @item dots
  13894. Draw dots instead of lines.
  13895. @end table
  13896. @item scale, s
  13897. Set scale used for displaying graticule.
  13898. @table @samp
  13899. @item digital
  13900. @item millivolts
  13901. @item ire
  13902. @end table
  13903. Default is digital.
  13904. @item bgopacity, b
  13905. Set background opacity.
  13906. @end table
  13907. @section weave, doubleweave
  13908. The @code{weave} takes a field-based video input and join
  13909. each two sequential fields into single frame, producing a new double
  13910. height clip with half the frame rate and half the frame count.
  13911. The @code{doubleweave} works same as @code{weave} but without
  13912. halving frame rate and frame count.
  13913. It accepts the following option:
  13914. @table @option
  13915. @item first_field
  13916. Set first field. Available values are:
  13917. @table @samp
  13918. @item top, t
  13919. Set the frame as top-field-first.
  13920. @item bottom, b
  13921. Set the frame as bottom-field-first.
  13922. @end table
  13923. @end table
  13924. @subsection Examples
  13925. @itemize
  13926. @item
  13927. Interlace video using @ref{select} and @ref{separatefields} filter:
  13928. @example
  13929. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  13930. @end example
  13931. @end itemize
  13932. @section xbr
  13933. Apply the xBR high-quality magnification filter which is designed for pixel
  13934. art. It follows a set of edge-detection rules, see
  13935. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  13936. It accepts the following option:
  13937. @table @option
  13938. @item n
  13939. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  13940. @code{3xBR} and @code{4} for @code{4xBR}.
  13941. Default is @code{3}.
  13942. @end table
  13943. @section xstack
  13944. Stack video inputs into custom layout.
  13945. All streams must be of same pixel format.
  13946. The filter accept the following option:
  13947. @table @option
  13948. @item inputs
  13949. Set number of input streams. Default is 2.
  13950. @item layout
  13951. Specify layout of inputs.
  13952. This option requires the desired layout configuration to be explicitly set by the user.
  13953. This sets position of each video input in output. Each input
  13954. is separated by '|'.
  13955. The first number represents the column, and the second number represents the row.
  13956. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  13957. where X is video input from which to take width or height.
  13958. Multiple values can be used when separated by '+'. In such
  13959. case values are summed together.
  13960. @item shortest
  13961. If set to 1, force the output to terminate when the shortest input
  13962. terminates. Default value is 0.
  13963. @end table
  13964. @subsection Examples
  13965. @itemize
  13966. @item
  13967. Display 4 inputs into 2x2 grid,
  13968. note that if inputs are of different sizes unused gaps might appear,
  13969. as not all of output video is used.
  13970. @example
  13971. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  13972. @end example
  13973. @item
  13974. Display 4 inputs into 1x4 grid,
  13975. note that if inputs are of different sizes unused gaps might appear,
  13976. as not all of output video is used.
  13977. @example
  13978. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  13979. @end example
  13980. @item
  13981. Display 9 inputs into 3x3 grid,
  13982. note that if inputs are of different sizes unused gaps might appear,
  13983. as not all of output video is used.
  13984. @example
  13985. xstack=inputs=9:layout=w3_0|w3_h0+h2|w3_h0|0_h4|0_0|w3+w1_0|0_h1+h2|w3+w1_h0|w3+w1_h1+h2
  13986. @end example
  13987. @end itemize
  13988. @anchor{yadif}
  13989. @section yadif
  13990. Deinterlace the input video ("yadif" means "yet another deinterlacing
  13991. filter").
  13992. It accepts the following parameters:
  13993. @table @option
  13994. @item mode
  13995. The interlacing mode to adopt. It accepts one of the following values:
  13996. @table @option
  13997. @item 0, send_frame
  13998. Output one frame for each frame.
  13999. @item 1, send_field
  14000. Output one frame for each field.
  14001. @item 2, send_frame_nospatial
  14002. Like @code{send_frame}, but it skips the spatial interlacing check.
  14003. @item 3, send_field_nospatial
  14004. Like @code{send_field}, but it skips the spatial interlacing check.
  14005. @end table
  14006. The default value is @code{send_frame}.
  14007. @item parity
  14008. The picture field parity assumed for the input interlaced video. It accepts one
  14009. of the following values:
  14010. @table @option
  14011. @item 0, tff
  14012. Assume the top field is first.
  14013. @item 1, bff
  14014. Assume the bottom field is first.
  14015. @item -1, auto
  14016. Enable automatic detection of field parity.
  14017. @end table
  14018. The default value is @code{auto}.
  14019. If the interlacing is unknown or the decoder does not export this information,
  14020. top field first will be assumed.
  14021. @item deint
  14022. Specify which frames to deinterlace. Accept one of the following
  14023. values:
  14024. @table @option
  14025. @item 0, all
  14026. Deinterlace all frames.
  14027. @item 1, interlaced
  14028. Only deinterlace frames marked as interlaced.
  14029. @end table
  14030. The default value is @code{all}.
  14031. @end table
  14032. @section yadif_cuda
  14033. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  14034. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  14035. and/or nvenc.
  14036. It accepts the following parameters:
  14037. @table @option
  14038. @item mode
  14039. The interlacing mode to adopt. It accepts one of the following values:
  14040. @table @option
  14041. @item 0, send_frame
  14042. Output one frame for each frame.
  14043. @item 1, send_field
  14044. Output one frame for each field.
  14045. @item 2, send_frame_nospatial
  14046. Like @code{send_frame}, but it skips the spatial interlacing check.
  14047. @item 3, send_field_nospatial
  14048. Like @code{send_field}, but it skips the spatial interlacing check.
  14049. @end table
  14050. The default value is @code{send_frame}.
  14051. @item parity
  14052. The picture field parity assumed for the input interlaced video. It accepts one
  14053. of the following values:
  14054. @table @option
  14055. @item 0, tff
  14056. Assume the top field is first.
  14057. @item 1, bff
  14058. Assume the bottom field is first.
  14059. @item -1, auto
  14060. Enable automatic detection of field parity.
  14061. @end table
  14062. The default value is @code{auto}.
  14063. If the interlacing is unknown or the decoder does not export this information,
  14064. top field first will be assumed.
  14065. @item deint
  14066. Specify which frames to deinterlace. Accept one of the following
  14067. values:
  14068. @table @option
  14069. @item 0, all
  14070. Deinterlace all frames.
  14071. @item 1, interlaced
  14072. Only deinterlace frames marked as interlaced.
  14073. @end table
  14074. The default value is @code{all}.
  14075. @end table
  14076. @section zoompan
  14077. Apply Zoom & Pan effect.
  14078. This filter accepts the following options:
  14079. @table @option
  14080. @item zoom, z
  14081. Set the zoom expression. Range is 1-10. Default is 1.
  14082. @item x
  14083. @item y
  14084. Set the x and y expression. Default is 0.
  14085. @item d
  14086. Set the duration expression in number of frames.
  14087. This sets for how many number of frames effect will last for
  14088. single input image.
  14089. @item s
  14090. Set the output image size, default is 'hd720'.
  14091. @item fps
  14092. Set the output frame rate, default is '25'.
  14093. @end table
  14094. Each expression can contain the following constants:
  14095. @table @option
  14096. @item in_w, iw
  14097. Input width.
  14098. @item in_h, ih
  14099. Input height.
  14100. @item out_w, ow
  14101. Output width.
  14102. @item out_h, oh
  14103. Output height.
  14104. @item in
  14105. Input frame count.
  14106. @item on
  14107. Output frame count.
  14108. @item x
  14109. @item y
  14110. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  14111. for current input frame.
  14112. @item px
  14113. @item py
  14114. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  14115. not yet such frame (first input frame).
  14116. @item zoom
  14117. Last calculated zoom from 'z' expression for current input frame.
  14118. @item pzoom
  14119. Last calculated zoom of last output frame of previous input frame.
  14120. @item duration
  14121. Number of output frames for current input frame. Calculated from 'd' expression
  14122. for each input frame.
  14123. @item pduration
  14124. number of output frames created for previous input frame
  14125. @item a
  14126. Rational number: input width / input height
  14127. @item sar
  14128. sample aspect ratio
  14129. @item dar
  14130. display aspect ratio
  14131. @end table
  14132. @subsection Examples
  14133. @itemize
  14134. @item
  14135. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  14136. @example
  14137. 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
  14138. @end example
  14139. @item
  14140. Zoom-in up to 1.5 and pan always at center of picture:
  14141. @example
  14142. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  14143. @end example
  14144. @item
  14145. Same as above but without pausing:
  14146. @example
  14147. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  14148. @end example
  14149. @end itemize
  14150. @anchor{zscale}
  14151. @section zscale
  14152. Scale (resize) the input video, using the z.lib library:
  14153. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  14154. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  14155. The zscale filter forces the output display aspect ratio to be the same
  14156. as the input, by changing the output sample aspect ratio.
  14157. If the input image format is different from the format requested by
  14158. the next filter, the zscale filter will convert the input to the
  14159. requested format.
  14160. @subsection Options
  14161. The filter accepts the following options.
  14162. @table @option
  14163. @item width, w
  14164. @item height, h
  14165. Set the output video dimension expression. Default value is the input
  14166. dimension.
  14167. If the @var{width} or @var{w} value is 0, the input width is used for
  14168. the output. If the @var{height} or @var{h} value is 0, the input height
  14169. is used for the output.
  14170. If one and only one of the values is -n with n >= 1, the zscale filter
  14171. will use a value that maintains the aspect ratio of the input image,
  14172. calculated from the other specified dimension. After that it will,
  14173. however, make sure that the calculated dimension is divisible by n and
  14174. adjust the value if necessary.
  14175. If both values are -n with n >= 1, the behavior will be identical to
  14176. both values being set to 0 as previously detailed.
  14177. See below for the list of accepted constants for use in the dimension
  14178. expression.
  14179. @item size, s
  14180. Set the video size. For the syntax of this option, check the
  14181. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14182. @item dither, d
  14183. Set the dither type.
  14184. Possible values are:
  14185. @table @var
  14186. @item none
  14187. @item ordered
  14188. @item random
  14189. @item error_diffusion
  14190. @end table
  14191. Default is none.
  14192. @item filter, f
  14193. Set the resize filter type.
  14194. Possible values are:
  14195. @table @var
  14196. @item point
  14197. @item bilinear
  14198. @item bicubic
  14199. @item spline16
  14200. @item spline36
  14201. @item lanczos
  14202. @end table
  14203. Default is bilinear.
  14204. @item range, r
  14205. Set the color range.
  14206. Possible values are:
  14207. @table @var
  14208. @item input
  14209. @item limited
  14210. @item full
  14211. @end table
  14212. Default is same as input.
  14213. @item primaries, p
  14214. Set the color primaries.
  14215. Possible values are:
  14216. @table @var
  14217. @item input
  14218. @item 709
  14219. @item unspecified
  14220. @item 170m
  14221. @item 240m
  14222. @item 2020
  14223. @end table
  14224. Default is same as input.
  14225. @item transfer, t
  14226. Set the transfer characteristics.
  14227. Possible values are:
  14228. @table @var
  14229. @item input
  14230. @item 709
  14231. @item unspecified
  14232. @item 601
  14233. @item linear
  14234. @item 2020_10
  14235. @item 2020_12
  14236. @item smpte2084
  14237. @item iec61966-2-1
  14238. @item arib-std-b67
  14239. @end table
  14240. Default is same as input.
  14241. @item matrix, m
  14242. Set the colorspace matrix.
  14243. Possible value are:
  14244. @table @var
  14245. @item input
  14246. @item 709
  14247. @item unspecified
  14248. @item 470bg
  14249. @item 170m
  14250. @item 2020_ncl
  14251. @item 2020_cl
  14252. @end table
  14253. Default is same as input.
  14254. @item rangein, rin
  14255. Set the input color range.
  14256. Possible values are:
  14257. @table @var
  14258. @item input
  14259. @item limited
  14260. @item full
  14261. @end table
  14262. Default is same as input.
  14263. @item primariesin, pin
  14264. Set the input color primaries.
  14265. Possible values are:
  14266. @table @var
  14267. @item input
  14268. @item 709
  14269. @item unspecified
  14270. @item 170m
  14271. @item 240m
  14272. @item 2020
  14273. @end table
  14274. Default is same as input.
  14275. @item transferin, tin
  14276. Set the input transfer characteristics.
  14277. Possible values are:
  14278. @table @var
  14279. @item input
  14280. @item 709
  14281. @item unspecified
  14282. @item 601
  14283. @item linear
  14284. @item 2020_10
  14285. @item 2020_12
  14286. @end table
  14287. Default is same as input.
  14288. @item matrixin, min
  14289. Set the input colorspace matrix.
  14290. Possible value are:
  14291. @table @var
  14292. @item input
  14293. @item 709
  14294. @item unspecified
  14295. @item 470bg
  14296. @item 170m
  14297. @item 2020_ncl
  14298. @item 2020_cl
  14299. @end table
  14300. @item chromal, c
  14301. Set the output chroma location.
  14302. Possible values are:
  14303. @table @var
  14304. @item input
  14305. @item left
  14306. @item center
  14307. @item topleft
  14308. @item top
  14309. @item bottomleft
  14310. @item bottom
  14311. @end table
  14312. @item chromalin, cin
  14313. Set the input chroma location.
  14314. Possible values are:
  14315. @table @var
  14316. @item input
  14317. @item left
  14318. @item center
  14319. @item topleft
  14320. @item top
  14321. @item bottomleft
  14322. @item bottom
  14323. @end table
  14324. @item npl
  14325. Set the nominal peak luminance.
  14326. @end table
  14327. The values of the @option{w} and @option{h} options are expressions
  14328. containing the following constants:
  14329. @table @var
  14330. @item in_w
  14331. @item in_h
  14332. The input width and height
  14333. @item iw
  14334. @item ih
  14335. These are the same as @var{in_w} and @var{in_h}.
  14336. @item out_w
  14337. @item out_h
  14338. The output (scaled) width and height
  14339. @item ow
  14340. @item oh
  14341. These are the same as @var{out_w} and @var{out_h}
  14342. @item a
  14343. The same as @var{iw} / @var{ih}
  14344. @item sar
  14345. input sample aspect ratio
  14346. @item dar
  14347. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  14348. @item hsub
  14349. @item vsub
  14350. horizontal and vertical input chroma subsample values. For example for the
  14351. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14352. @item ohsub
  14353. @item ovsub
  14354. horizontal and vertical output chroma subsample values. For example for the
  14355. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14356. @end table
  14357. @table @option
  14358. @end table
  14359. @c man end VIDEO FILTERS
  14360. @chapter OpenCL Video Filters
  14361. @c man begin OPENCL VIDEO FILTERS
  14362. Below is a description of the currently available OpenCL video filters.
  14363. To enable compilation of these filters you need to configure FFmpeg with
  14364. @code{--enable-opencl}.
  14365. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  14366. @table @option
  14367. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  14368. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  14369. given device parameters.
  14370. @item -filter_hw_device @var{name}
  14371. Pass the hardware device called @var{name} to all filters in any filter graph.
  14372. @end table
  14373. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  14374. @itemize
  14375. @item
  14376. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  14377. @example
  14378. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  14379. @end example
  14380. @end itemize
  14381. 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.
  14382. @section avgblur_opencl
  14383. Apply average blur filter.
  14384. The filter accepts the following options:
  14385. @table @option
  14386. @item sizeX
  14387. Set horizontal radius size.
  14388. Range is @code{[1, 1024]} and default value is @code{1}.
  14389. @item planes
  14390. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14391. @item sizeY
  14392. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  14393. @end table
  14394. @subsection Example
  14395. @itemize
  14396. @item
  14397. 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.
  14398. @example
  14399. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  14400. @end example
  14401. @end itemize
  14402. @section boxblur_opencl
  14403. Apply a boxblur algorithm to the input video.
  14404. It accepts the following parameters:
  14405. @table @option
  14406. @item luma_radius, lr
  14407. @item luma_power, lp
  14408. @item chroma_radius, cr
  14409. @item chroma_power, cp
  14410. @item alpha_radius, ar
  14411. @item alpha_power, ap
  14412. @end table
  14413. A description of the accepted options follows.
  14414. @table @option
  14415. @item luma_radius, lr
  14416. @item chroma_radius, cr
  14417. @item alpha_radius, ar
  14418. Set an expression for the box radius in pixels used for blurring the
  14419. corresponding input plane.
  14420. The radius value must be a non-negative number, and must not be
  14421. greater than the value of the expression @code{min(w,h)/2} for the
  14422. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  14423. planes.
  14424. Default value for @option{luma_radius} is "2". If not specified,
  14425. @option{chroma_radius} and @option{alpha_radius} default to the
  14426. corresponding value set for @option{luma_radius}.
  14427. The expressions can contain the following constants:
  14428. @table @option
  14429. @item w
  14430. @item h
  14431. The input width and height in pixels.
  14432. @item cw
  14433. @item ch
  14434. The input chroma image width and height in pixels.
  14435. @item hsub
  14436. @item vsub
  14437. The horizontal and vertical chroma subsample values. For example, for the
  14438. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  14439. @end table
  14440. @item luma_power, lp
  14441. @item chroma_power, cp
  14442. @item alpha_power, ap
  14443. Specify how many times the boxblur filter is applied to the
  14444. corresponding plane.
  14445. Default value for @option{luma_power} is 2. If not specified,
  14446. @option{chroma_power} and @option{alpha_power} default to the
  14447. corresponding value set for @option{luma_power}.
  14448. A value of 0 will disable the effect.
  14449. @end table
  14450. @subsection Examples
  14451. 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.
  14452. @itemize
  14453. @item
  14454. Apply a boxblur filter with the luma, chroma, and alpha radius
  14455. 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.
  14456. @example
  14457. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  14458. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  14459. @end example
  14460. @item
  14461. 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.
  14462. For the luma plane, a 2x2 box radius will be run once.
  14463. For the chroma plane, a 4x4 box radius will be run 5 times.
  14464. For the alpha plane, a 3x3 box radius will be run 7 times.
  14465. @example
  14466. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  14467. @end example
  14468. @end itemize
  14469. @section convolution_opencl
  14470. Apply convolution of 3x3, 5x5, 7x7 matrix.
  14471. The filter accepts the following options:
  14472. @table @option
  14473. @item 0m
  14474. @item 1m
  14475. @item 2m
  14476. @item 3m
  14477. Set matrix for each plane.
  14478. Matrix is sequence of 9, 25 or 49 signed numbers.
  14479. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  14480. @item 0rdiv
  14481. @item 1rdiv
  14482. @item 2rdiv
  14483. @item 3rdiv
  14484. Set multiplier for calculated value for each plane.
  14485. If unset or 0, it will be sum of all matrix elements.
  14486. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  14487. @item 0bias
  14488. @item 1bias
  14489. @item 2bias
  14490. @item 3bias
  14491. Set bias for each plane. This value is added to the result of the multiplication.
  14492. Useful for making the overall image brighter or darker.
  14493. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  14494. @end table
  14495. @subsection Examples
  14496. @itemize
  14497. @item
  14498. Apply sharpen:
  14499. @example
  14500. -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
  14501. @end example
  14502. @item
  14503. Apply blur:
  14504. @example
  14505. -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
  14506. @end example
  14507. @item
  14508. Apply edge enhance:
  14509. @example
  14510. -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
  14511. @end example
  14512. @item
  14513. Apply edge detect:
  14514. @example
  14515. -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
  14516. @end example
  14517. @item
  14518. Apply laplacian edge detector which includes diagonals:
  14519. @example
  14520. -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
  14521. @end example
  14522. @item
  14523. Apply emboss:
  14524. @example
  14525. -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
  14526. @end example
  14527. @end itemize
  14528. @section dilation_opencl
  14529. Apply dilation effect to the video.
  14530. This filter replaces the pixel by the local(3x3) maximum.
  14531. It accepts the following options:
  14532. @table @option
  14533. @item threshold0
  14534. @item threshold1
  14535. @item threshold2
  14536. @item threshold3
  14537. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  14538. If @code{0}, plane will remain unchanged.
  14539. @item coordinates
  14540. Flag which specifies the pixel to refer to.
  14541. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  14542. Flags to local 3x3 coordinates region centered on @code{x}:
  14543. 1 2 3
  14544. 4 x 5
  14545. 6 7 8
  14546. @end table
  14547. @subsection Example
  14548. @itemize
  14549. @item
  14550. 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.
  14551. @example
  14552. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  14553. @end example
  14554. @end itemize
  14555. @section erosion_opencl
  14556. Apply erosion effect to the video.
  14557. This filter replaces the pixel by the local(3x3) minimum.
  14558. It accepts the following options:
  14559. @table @option
  14560. @item threshold0
  14561. @item threshold1
  14562. @item threshold2
  14563. @item threshold3
  14564. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  14565. If @code{0}, plane will remain unchanged.
  14566. @item coordinates
  14567. Flag which specifies the pixel to refer to.
  14568. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  14569. Flags to local 3x3 coordinates region centered on @code{x}:
  14570. 1 2 3
  14571. 4 x 5
  14572. 6 7 8
  14573. @end table
  14574. @subsection Example
  14575. @itemize
  14576. @item
  14577. 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.
  14578. @example
  14579. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  14580. @end example
  14581. @end itemize
  14582. @section colorkey_opencl
  14583. RGB colorspace color keying.
  14584. The filter accepts the following options:
  14585. @table @option
  14586. @item color
  14587. The color which will be replaced with transparency.
  14588. @item similarity
  14589. Similarity percentage with the key color.
  14590. 0.01 matches only the exact key color, while 1.0 matches everything.
  14591. @item blend
  14592. Blend percentage.
  14593. 0.0 makes pixels either fully transparent, or not transparent at all.
  14594. Higher values result in semi-transparent pixels, with a higher transparency
  14595. the more similar the pixels color is to the key color.
  14596. @end table
  14597. @subsection Examples
  14598. @itemize
  14599. @item
  14600. Make every semi-green pixel in the input transparent with some slight blending:
  14601. @example
  14602. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  14603. @end example
  14604. @end itemize
  14605. @section overlay_opencl
  14606. Overlay one video on top of another.
  14607. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  14608. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  14609. The filter accepts the following options:
  14610. @table @option
  14611. @item x
  14612. Set the x coordinate of the overlaid video on the main video.
  14613. Default value is @code{0}.
  14614. @item y
  14615. Set the x coordinate of the overlaid video on the main video.
  14616. Default value is @code{0}.
  14617. @end table
  14618. @subsection Examples
  14619. @itemize
  14620. @item
  14621. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  14622. @example
  14623. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  14624. @end example
  14625. @item
  14626. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  14627. @example
  14628. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  14629. @end example
  14630. @end itemize
  14631. @section prewitt_opencl
  14632. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  14633. The filter accepts the following option:
  14634. @table @option
  14635. @item planes
  14636. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14637. @item scale
  14638. Set value which will be multiplied with filtered result.
  14639. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  14640. @item delta
  14641. Set value which will be added to filtered result.
  14642. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  14643. @end table
  14644. @subsection Example
  14645. @itemize
  14646. @item
  14647. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  14648. @example
  14649. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  14650. @end example
  14651. @end itemize
  14652. @section roberts_opencl
  14653. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  14654. The filter accepts the following option:
  14655. @table @option
  14656. @item planes
  14657. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14658. @item scale
  14659. Set value which will be multiplied with filtered result.
  14660. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  14661. @item delta
  14662. Set value which will be added to filtered result.
  14663. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  14664. @end table
  14665. @subsection Example
  14666. @itemize
  14667. @item
  14668. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  14669. @example
  14670. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  14671. @end example
  14672. @end itemize
  14673. @section sobel_opencl
  14674. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  14675. The filter accepts the following option:
  14676. @table @option
  14677. @item planes
  14678. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  14679. @item scale
  14680. Set value which will be multiplied with filtered result.
  14681. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  14682. @item delta
  14683. Set value which will be added to filtered result.
  14684. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  14685. @end table
  14686. @subsection Example
  14687. @itemize
  14688. @item
  14689. Apply sobel operator with scale set to 2 and delta set to 10
  14690. @example
  14691. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  14692. @end example
  14693. @end itemize
  14694. @section tonemap_opencl
  14695. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  14696. It accepts the following parameters:
  14697. @table @option
  14698. @item tonemap
  14699. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  14700. @item param
  14701. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  14702. @item desat
  14703. Apply desaturation for highlights that exceed this level of brightness. The
  14704. higher the parameter, the more color information will be preserved. This
  14705. setting helps prevent unnaturally blown-out colors for super-highlights, by
  14706. (smoothly) turning into white instead. This makes images feel more natural,
  14707. at the cost of reducing information about out-of-range colors.
  14708. The default value is 0.5, and the algorithm here is a little different from
  14709. the cpu version tonemap currently. A setting of 0.0 disables this option.
  14710. @item threshold
  14711. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  14712. is used to detect whether the scene has changed or not. If the distance between
  14713. the current frame average brightness and the current running average exceeds
  14714. a threshold value, we would re-calculate scene average and peak brightness.
  14715. The default value is 0.2.
  14716. @item format
  14717. Specify the output pixel format.
  14718. Currently supported formats are:
  14719. @table @var
  14720. @item p010
  14721. @item nv12
  14722. @end table
  14723. @item range, r
  14724. Set the output color range.
  14725. Possible values are:
  14726. @table @var
  14727. @item tv/mpeg
  14728. @item pc/jpeg
  14729. @end table
  14730. Default is same as input.
  14731. @item primaries, p
  14732. Set the output color primaries.
  14733. Possible values are:
  14734. @table @var
  14735. @item bt709
  14736. @item bt2020
  14737. @end table
  14738. Default is same as input.
  14739. @item transfer, t
  14740. Set the output transfer characteristics.
  14741. Possible values are:
  14742. @table @var
  14743. @item bt709
  14744. @item bt2020
  14745. @end table
  14746. Default is bt709.
  14747. @item matrix, m
  14748. Set the output colorspace matrix.
  14749. Possible value are:
  14750. @table @var
  14751. @item bt709
  14752. @item bt2020
  14753. @end table
  14754. Default is same as input.
  14755. @end table
  14756. @subsection Example
  14757. @itemize
  14758. @item
  14759. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  14760. @example
  14761. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  14762. @end example
  14763. @end itemize
  14764. @section unsharp_opencl
  14765. Sharpen or blur the input video.
  14766. It accepts the following parameters:
  14767. @table @option
  14768. @item luma_msize_x, lx
  14769. Set the luma matrix horizontal size.
  14770. Range is @code{[1, 23]} and default value is @code{5}.
  14771. @item luma_msize_y, ly
  14772. Set the luma matrix vertical size.
  14773. Range is @code{[1, 23]} and default value is @code{5}.
  14774. @item luma_amount, la
  14775. Set the luma effect strength.
  14776. Range is @code{[-10, 10]} and default value is @code{1.0}.
  14777. Negative values will blur the input video, while positive values will
  14778. sharpen it, a value of zero will disable the effect.
  14779. @item chroma_msize_x, cx
  14780. Set the chroma matrix horizontal size.
  14781. Range is @code{[1, 23]} and default value is @code{5}.
  14782. @item chroma_msize_y, cy
  14783. Set the chroma matrix vertical size.
  14784. Range is @code{[1, 23]} and default value is @code{5}.
  14785. @item chroma_amount, ca
  14786. Set the chroma effect strength.
  14787. Range is @code{[-10, 10]} and default value is @code{0.0}.
  14788. Negative values will blur the input video, while positive values will
  14789. sharpen it, a value of zero will disable the effect.
  14790. @end table
  14791. All parameters are optional and default to the equivalent of the
  14792. string '5:5:1.0:5:5:0.0'.
  14793. @subsection Examples
  14794. @itemize
  14795. @item
  14796. Apply strong luma sharpen effect:
  14797. @example
  14798. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  14799. @end example
  14800. @item
  14801. Apply a strong blur of both luma and chroma parameters:
  14802. @example
  14803. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  14804. @end example
  14805. @end itemize
  14806. @c man end OPENCL VIDEO FILTERS
  14807. @chapter Video Sources
  14808. @c man begin VIDEO SOURCES
  14809. Below is a description of the currently available video sources.
  14810. @section buffer
  14811. Buffer video frames, and make them available to the filter chain.
  14812. This source is mainly intended for a programmatic use, in particular
  14813. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  14814. It accepts the following parameters:
  14815. @table @option
  14816. @item video_size
  14817. Specify the size (width and height) of the buffered video frames. For the
  14818. syntax of this option, check the
  14819. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14820. @item width
  14821. The input video width.
  14822. @item height
  14823. The input video height.
  14824. @item pix_fmt
  14825. A string representing the pixel format of the buffered video frames.
  14826. It may be a number corresponding to a pixel format, or a pixel format
  14827. name.
  14828. @item time_base
  14829. Specify the timebase assumed by the timestamps of the buffered frames.
  14830. @item frame_rate
  14831. Specify the frame rate expected for the video stream.
  14832. @item pixel_aspect, sar
  14833. The sample (pixel) aspect ratio of the input video.
  14834. @item sws_param
  14835. Specify the optional parameters to be used for the scale filter which
  14836. is automatically inserted when an input change is detected in the
  14837. input size or format.
  14838. @item hw_frames_ctx
  14839. When using a hardware pixel format, this should be a reference to an
  14840. AVHWFramesContext describing input frames.
  14841. @end table
  14842. For example:
  14843. @example
  14844. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  14845. @end example
  14846. will instruct the source to accept video frames with size 320x240 and
  14847. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  14848. square pixels (1:1 sample aspect ratio).
  14849. Since the pixel format with name "yuv410p" corresponds to the number 6
  14850. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  14851. this example corresponds to:
  14852. @example
  14853. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  14854. @end example
  14855. Alternatively, the options can be specified as a flat string, but this
  14856. syntax is deprecated:
  14857. @var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}[:@var{sws_param}]
  14858. @section cellauto
  14859. Create a pattern generated by an elementary cellular automaton.
  14860. The initial state of the cellular automaton can be defined through the
  14861. @option{filename} and @option{pattern} options. If such options are
  14862. not specified an initial state is created randomly.
  14863. At each new frame a new row in the video is filled with the result of
  14864. the cellular automaton next generation. The behavior when the whole
  14865. frame is filled is defined by the @option{scroll} option.
  14866. This source accepts the following options:
  14867. @table @option
  14868. @item filename, f
  14869. Read the initial cellular automaton state, i.e. the starting row, from
  14870. the specified file.
  14871. In the file, each non-whitespace character is considered an alive
  14872. cell, a newline will terminate the row, and further characters in the
  14873. file will be ignored.
  14874. @item pattern, p
  14875. Read the initial cellular automaton state, i.e. the starting row, from
  14876. the specified string.
  14877. Each non-whitespace character in the string is considered an alive
  14878. cell, a newline will terminate the row, and further characters in the
  14879. string will be ignored.
  14880. @item rate, r
  14881. Set the video rate, that is the number of frames generated per second.
  14882. Default is 25.
  14883. @item random_fill_ratio, ratio
  14884. Set the random fill ratio for the initial cellular automaton row. It
  14885. is a floating point number value ranging from 0 to 1, defaults to
  14886. 1/PHI.
  14887. This option is ignored when a file or a pattern is specified.
  14888. @item random_seed, seed
  14889. Set the seed for filling randomly the initial row, must be an integer
  14890. included between 0 and UINT32_MAX. If not specified, or if explicitly
  14891. set to -1, the filter will try to use a good random seed on a best
  14892. effort basis.
  14893. @item rule
  14894. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  14895. Default value is 110.
  14896. @item size, s
  14897. Set the size of the output video. For the syntax of this option, check the
  14898. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14899. If @option{filename} or @option{pattern} is specified, the size is set
  14900. by default to the width of the specified initial state row, and the
  14901. height is set to @var{width} * PHI.
  14902. If @option{size} is set, it must contain the width of the specified
  14903. pattern string, and the specified pattern will be centered in the
  14904. larger row.
  14905. If a filename or a pattern string is not specified, the size value
  14906. defaults to "320x518" (used for a randomly generated initial state).
  14907. @item scroll
  14908. If set to 1, scroll the output upward when all the rows in the output
  14909. have been already filled. If set to 0, the new generated row will be
  14910. written over the top row just after the bottom row is filled.
  14911. Defaults to 1.
  14912. @item start_full, full
  14913. If set to 1, completely fill the output with generated rows before
  14914. outputting the first frame.
  14915. This is the default behavior, for disabling set the value to 0.
  14916. @item stitch
  14917. If set to 1, stitch the left and right row edges together.
  14918. This is the default behavior, for disabling set the value to 0.
  14919. @end table
  14920. @subsection Examples
  14921. @itemize
  14922. @item
  14923. Read the initial state from @file{pattern}, and specify an output of
  14924. size 200x400.
  14925. @example
  14926. cellauto=f=pattern:s=200x400
  14927. @end example
  14928. @item
  14929. Generate a random initial row with a width of 200 cells, with a fill
  14930. ratio of 2/3:
  14931. @example
  14932. cellauto=ratio=2/3:s=200x200
  14933. @end example
  14934. @item
  14935. Create a pattern generated by rule 18 starting by a single alive cell
  14936. centered on an initial row with width 100:
  14937. @example
  14938. cellauto=p=@@:s=100x400:full=0:rule=18
  14939. @end example
  14940. @item
  14941. Specify a more elaborated initial pattern:
  14942. @example
  14943. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  14944. @end example
  14945. @end itemize
  14946. @anchor{coreimagesrc}
  14947. @section coreimagesrc
  14948. Video source generated on GPU using Apple's CoreImage API on OSX.
  14949. This video source is a specialized version of the @ref{coreimage} video filter.
  14950. Use a core image generator at the beginning of the applied filterchain to
  14951. generate the content.
  14952. The coreimagesrc video source accepts the following options:
  14953. @table @option
  14954. @item list_generators
  14955. List all available generators along with all their respective options as well as
  14956. possible minimum and maximum values along with the default values.
  14957. @example
  14958. list_generators=true
  14959. @end example
  14960. @item size, s
  14961. Specify the size of the sourced video. For the syntax of this option, check the
  14962. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14963. The default value is @code{320x240}.
  14964. @item rate, r
  14965. Specify the frame rate of the sourced video, as the number of frames
  14966. generated per second. It has to be a string in the format
  14967. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  14968. number or a valid video frame rate abbreviation. The default value is
  14969. "25".
  14970. @item sar
  14971. Set the sample aspect ratio of the sourced video.
  14972. @item duration, d
  14973. Set the duration of the sourced video. See
  14974. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14975. for the accepted syntax.
  14976. If not specified, or the expressed duration is negative, the video is
  14977. supposed to be generated forever.
  14978. @end table
  14979. Additionally, all options of the @ref{coreimage} video filter are accepted.
  14980. A complete filterchain can be used for further processing of the
  14981. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  14982. and examples for details.
  14983. @subsection Examples
  14984. @itemize
  14985. @item
  14986. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  14987. given as complete and escaped command-line for Apple's standard bash shell:
  14988. @example
  14989. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  14990. @end example
  14991. This example is equivalent to the QRCode example of @ref{coreimage} without the
  14992. need for a nullsrc video source.
  14993. @end itemize
  14994. @section mandelbrot
  14995. Generate a Mandelbrot set fractal, and progressively zoom towards the
  14996. point specified with @var{start_x} and @var{start_y}.
  14997. This source accepts the following options:
  14998. @table @option
  14999. @item end_pts
  15000. Set the terminal pts value. Default value is 400.
  15001. @item end_scale
  15002. Set the terminal scale value.
  15003. Must be a floating point value. Default value is 0.3.
  15004. @item inner
  15005. Set the inner coloring mode, that is the algorithm used to draw the
  15006. Mandelbrot fractal internal region.
  15007. It shall assume one of the following values:
  15008. @table @option
  15009. @item black
  15010. Set black mode.
  15011. @item convergence
  15012. Show time until convergence.
  15013. @item mincol
  15014. Set color based on point closest to the origin of the iterations.
  15015. @item period
  15016. Set period mode.
  15017. @end table
  15018. Default value is @var{mincol}.
  15019. @item bailout
  15020. Set the bailout value. Default value is 10.0.
  15021. @item maxiter
  15022. Set the maximum of iterations performed by the rendering
  15023. algorithm. Default value is 7189.
  15024. @item outer
  15025. Set outer coloring mode.
  15026. It shall assume one of following values:
  15027. @table @option
  15028. @item iteration_count
  15029. Set iteration count mode.
  15030. @item normalized_iteration_count
  15031. set normalized iteration count mode.
  15032. @end table
  15033. Default value is @var{normalized_iteration_count}.
  15034. @item rate, r
  15035. Set frame rate, expressed as number of frames per second. Default
  15036. value is "25".
  15037. @item size, s
  15038. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  15039. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  15040. @item start_scale
  15041. Set the initial scale value. Default value is 3.0.
  15042. @item start_x
  15043. Set the initial x position. Must be a floating point value between
  15044. -100 and 100. Default value is -0.743643887037158704752191506114774.
  15045. @item start_y
  15046. Set the initial y position. Must be a floating point value between
  15047. -100 and 100. Default value is -0.131825904205311970493132056385139.
  15048. @end table
  15049. @section mptestsrc
  15050. Generate various test patterns, as generated by the MPlayer test filter.
  15051. The size of the generated video is fixed, and is 256x256.
  15052. This source is useful in particular for testing encoding features.
  15053. This source accepts the following options:
  15054. @table @option
  15055. @item rate, r
  15056. Specify the frame rate of the sourced video, as the number of frames
  15057. generated per second. It has to be a string in the format
  15058. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15059. number or a valid video frame rate abbreviation. The default value is
  15060. "25".
  15061. @item duration, d
  15062. Set the duration of the sourced video. See
  15063. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15064. for the accepted syntax.
  15065. If not specified, or the expressed duration is negative, the video is
  15066. supposed to be generated forever.
  15067. @item test, t
  15068. Set the number or the name of the test to perform. Supported tests are:
  15069. @table @option
  15070. @item dc_luma
  15071. @item dc_chroma
  15072. @item freq_luma
  15073. @item freq_chroma
  15074. @item amp_luma
  15075. @item amp_chroma
  15076. @item cbp
  15077. @item mv
  15078. @item ring1
  15079. @item ring2
  15080. @item all
  15081. @end table
  15082. Default value is "all", which will cycle through the list of all tests.
  15083. @end table
  15084. Some examples:
  15085. @example
  15086. mptestsrc=t=dc_luma
  15087. @end example
  15088. will generate a "dc_luma" test pattern.
  15089. @section frei0r_src
  15090. Provide a frei0r source.
  15091. To enable compilation of this filter you need to install the frei0r
  15092. header and configure FFmpeg with @code{--enable-frei0r}.
  15093. This source accepts the following parameters:
  15094. @table @option
  15095. @item size
  15096. The size of the video to generate. For the syntax of this option, check the
  15097. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15098. @item framerate
  15099. The framerate of the generated video. It may be a string of the form
  15100. @var{num}/@var{den} or a frame rate abbreviation.
  15101. @item filter_name
  15102. The name to the frei0r source to load. For more information regarding frei0r and
  15103. how to set the parameters, read the @ref{frei0r} section in the video filters
  15104. documentation.
  15105. @item filter_params
  15106. A '|'-separated list of parameters to pass to the frei0r source.
  15107. @end table
  15108. For example, to generate a frei0r partik0l source with size 200x200
  15109. and frame rate 10 which is overlaid on the overlay filter main input:
  15110. @example
  15111. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  15112. @end example
  15113. @section life
  15114. Generate a life pattern.
  15115. This source is based on a generalization of John Conway's life game.
  15116. The sourced input represents a life grid, each pixel represents a cell
  15117. which can be in one of two possible states, alive or dead. Every cell
  15118. interacts with its eight neighbours, which are the cells that are
  15119. horizontally, vertically, or diagonally adjacent.
  15120. At each interaction the grid evolves according to the adopted rule,
  15121. which specifies the number of neighbor alive cells which will make a
  15122. cell stay alive or born. The @option{rule} option allows one to specify
  15123. the rule to adopt.
  15124. This source accepts the following options:
  15125. @table @option
  15126. @item filename, f
  15127. Set the file from which to read the initial grid state. In the file,
  15128. each non-whitespace character is considered an alive cell, and newline
  15129. is used to delimit the end of each row.
  15130. If this option is not specified, the initial grid is generated
  15131. randomly.
  15132. @item rate, r
  15133. Set the video rate, that is the number of frames generated per second.
  15134. Default is 25.
  15135. @item random_fill_ratio, ratio
  15136. Set the random fill ratio for the initial random grid. It is a
  15137. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  15138. It is ignored when a file is specified.
  15139. @item random_seed, seed
  15140. Set the seed for filling the initial random grid, must be an integer
  15141. included between 0 and UINT32_MAX. If not specified, or if explicitly
  15142. set to -1, the filter will try to use a good random seed on a best
  15143. effort basis.
  15144. @item rule
  15145. Set the life rule.
  15146. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  15147. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  15148. @var{NS} specifies the number of alive neighbor cells which make a
  15149. live cell stay alive, and @var{NB} the number of alive neighbor cells
  15150. which make a dead cell to become alive (i.e. to "born").
  15151. "s" and "b" can be used in place of "S" and "B", respectively.
  15152. Alternatively a rule can be specified by an 18-bits integer. The 9
  15153. high order bits are used to encode the next cell state if it is alive
  15154. for each number of neighbor alive cells, the low order bits specify
  15155. the rule for "borning" new cells. Higher order bits encode for an
  15156. higher number of neighbor cells.
  15157. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  15158. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  15159. Default value is "S23/B3", which is the original Conway's game of life
  15160. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  15161. cells, and will born a new cell if there are three alive cells around
  15162. a dead cell.
  15163. @item size, s
  15164. Set the size of the output video. For the syntax of this option, check the
  15165. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15166. If @option{filename} is specified, the size is set by default to the
  15167. same size of the input file. If @option{size} is set, it must contain
  15168. the size specified in the input file, and the initial grid defined in
  15169. that file is centered in the larger resulting area.
  15170. If a filename is not specified, the size value defaults to "320x240"
  15171. (used for a randomly generated initial grid).
  15172. @item stitch
  15173. If set to 1, stitch the left and right grid edges together, and the
  15174. top and bottom edges also. Defaults to 1.
  15175. @item mold
  15176. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  15177. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  15178. value from 0 to 255.
  15179. @item life_color
  15180. Set the color of living (or new born) cells.
  15181. @item death_color
  15182. Set the color of dead cells. If @option{mold} is set, this is the first color
  15183. used to represent a dead cell.
  15184. @item mold_color
  15185. Set mold color, for definitely dead and moldy cells.
  15186. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  15187. ffmpeg-utils manual,ffmpeg-utils}.
  15188. @end table
  15189. @subsection Examples
  15190. @itemize
  15191. @item
  15192. Read a grid from @file{pattern}, and center it on a grid of size
  15193. 300x300 pixels:
  15194. @example
  15195. life=f=pattern:s=300x300
  15196. @end example
  15197. @item
  15198. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  15199. @example
  15200. life=ratio=2/3:s=200x200
  15201. @end example
  15202. @item
  15203. Specify a custom rule for evolving a randomly generated grid:
  15204. @example
  15205. life=rule=S14/B34
  15206. @end example
  15207. @item
  15208. Full example with slow death effect (mold) using @command{ffplay}:
  15209. @example
  15210. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  15211. @end example
  15212. @end itemize
  15213. @anchor{allrgb}
  15214. @anchor{allyuv}
  15215. @anchor{color}
  15216. @anchor{haldclutsrc}
  15217. @anchor{nullsrc}
  15218. @anchor{pal75bars}
  15219. @anchor{pal100bars}
  15220. @anchor{rgbtestsrc}
  15221. @anchor{smptebars}
  15222. @anchor{smptehdbars}
  15223. @anchor{testsrc}
  15224. @anchor{testsrc2}
  15225. @anchor{yuvtestsrc}
  15226. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  15227. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  15228. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  15229. The @code{color} source provides an uniformly colored input.
  15230. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  15231. @ref{haldclut} filter.
  15232. The @code{nullsrc} source returns unprocessed video frames. It is
  15233. mainly useful to be employed in analysis / debugging tools, or as the
  15234. source for filters which ignore the input data.
  15235. The @code{pal75bars} source generates a color bars pattern, based on
  15236. EBU PAL recommendations with 75% color levels.
  15237. The @code{pal100bars} source generates a color bars pattern, based on
  15238. EBU PAL recommendations with 100% color levels.
  15239. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  15240. detecting RGB vs BGR issues. You should see a red, green and blue
  15241. stripe from top to bottom.
  15242. The @code{smptebars} source generates a color bars pattern, based on
  15243. the SMPTE Engineering Guideline EG 1-1990.
  15244. The @code{smptehdbars} source generates a color bars pattern, based on
  15245. the SMPTE RP 219-2002.
  15246. The @code{testsrc} source generates a test video pattern, showing a
  15247. color pattern, a scrolling gradient and a timestamp. This is mainly
  15248. intended for testing purposes.
  15249. The @code{testsrc2} source is similar to testsrc, but supports more
  15250. pixel formats instead of just @code{rgb24}. This allows using it as an
  15251. input for other tests without requiring a format conversion.
  15252. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  15253. see a y, cb and cr stripe from top to bottom.
  15254. The sources accept the following parameters:
  15255. @table @option
  15256. @item level
  15257. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  15258. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  15259. pixels to be used as identity matrix for 3D lookup tables. Each component is
  15260. coded on a @code{1/(N*N)} scale.
  15261. @item color, c
  15262. Specify the color of the source, only available in the @code{color}
  15263. source. For the syntax of this option, check the
  15264. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15265. @item size, s
  15266. Specify the size of the sourced video. For the syntax of this option, check the
  15267. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15268. The default value is @code{320x240}.
  15269. This option is not available with the @code{allrgb}, @code{allyuv}, and
  15270. @code{haldclutsrc} filters.
  15271. @item rate, r
  15272. Specify the frame rate of the sourced video, as the number of frames
  15273. generated per second. It has to be a string in the format
  15274. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  15275. number or a valid video frame rate abbreviation. The default value is
  15276. "25".
  15277. @item duration, d
  15278. Set the duration of the sourced video. See
  15279. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  15280. for the accepted syntax.
  15281. If not specified, or the expressed duration is negative, the video is
  15282. supposed to be generated forever.
  15283. @item sar
  15284. Set the sample aspect ratio of the sourced video.
  15285. @item alpha
  15286. Specify the alpha (opacity) of the background, only available in the
  15287. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  15288. 255 (fully opaque, the default).
  15289. @item decimals, n
  15290. Set the number of decimals to show in the timestamp, only available in the
  15291. @code{testsrc} source.
  15292. The displayed timestamp value will correspond to the original
  15293. timestamp value multiplied by the power of 10 of the specified
  15294. value. Default value is 0.
  15295. @end table
  15296. @subsection Examples
  15297. @itemize
  15298. @item
  15299. Generate a video with a duration of 5.3 seconds, with size
  15300. 176x144 and a frame rate of 10 frames per second:
  15301. @example
  15302. testsrc=duration=5.3:size=qcif:rate=10
  15303. @end example
  15304. @item
  15305. The following graph description will generate a red source
  15306. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  15307. frames per second:
  15308. @example
  15309. color=c=red@@0.2:s=qcif:r=10
  15310. @end example
  15311. @item
  15312. If the input content is to be ignored, @code{nullsrc} can be used. The
  15313. following command generates noise in the luminance plane by employing
  15314. the @code{geq} filter:
  15315. @example
  15316. nullsrc=s=256x256, geq=random(1)*255:128:128
  15317. @end example
  15318. @end itemize
  15319. @subsection Commands
  15320. The @code{color} source supports the following commands:
  15321. @table @option
  15322. @item c, color
  15323. Set the color of the created image. Accepts the same syntax of the
  15324. corresponding @option{color} option.
  15325. @end table
  15326. @section openclsrc
  15327. Generate video using an OpenCL program.
  15328. @table @option
  15329. @item source
  15330. OpenCL program source file.
  15331. @item kernel
  15332. Kernel name in program.
  15333. @item size, s
  15334. Size of frames to generate. This must be set.
  15335. @item format
  15336. Pixel format to use for the generated frames. This must be set.
  15337. @item rate, r
  15338. Number of frames generated every second. Default value is '25'.
  15339. @end table
  15340. For details of how the program loading works, see the @ref{program_opencl}
  15341. filter.
  15342. Example programs:
  15343. @itemize
  15344. @item
  15345. Generate a colour ramp by setting pixel values from the position of the pixel
  15346. in the output image. (Note that this will work with all pixel formats, but
  15347. the generated output will not be the same.)
  15348. @verbatim
  15349. __kernel void ramp(__write_only image2d_t dst,
  15350. unsigned int index)
  15351. {
  15352. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  15353. float4 val;
  15354. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  15355. write_imagef(dst, loc, val);
  15356. }
  15357. @end verbatim
  15358. @item
  15359. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  15360. @verbatim
  15361. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  15362. unsigned int index)
  15363. {
  15364. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  15365. float4 value = 0.0f;
  15366. int x = loc.x + index;
  15367. int y = loc.y + index;
  15368. while (x > 0 || y > 0) {
  15369. if (x % 3 == 1 && y % 3 == 1) {
  15370. value = 1.0f;
  15371. break;
  15372. }
  15373. x /= 3;
  15374. y /= 3;
  15375. }
  15376. write_imagef(dst, loc, value);
  15377. }
  15378. @end verbatim
  15379. @end itemize
  15380. @c man end VIDEO SOURCES
  15381. @chapter Video Sinks
  15382. @c man begin VIDEO SINKS
  15383. Below is a description of the currently available video sinks.
  15384. @section buffersink
  15385. Buffer video frames, and make them available to the end of the filter
  15386. graph.
  15387. This sink is mainly intended for programmatic use, in particular
  15388. through the interface defined in @file{libavfilter/buffersink.h}
  15389. or the options system.
  15390. It accepts a pointer to an AVBufferSinkContext structure, which
  15391. defines the incoming buffers' formats, to be passed as the opaque
  15392. parameter to @code{avfilter_init_filter} for initialization.
  15393. @section nullsink
  15394. Null video sink: do absolutely nothing with the input video. It is
  15395. mainly useful as a template and for use in analysis / debugging
  15396. tools.
  15397. @c man end VIDEO SINKS
  15398. @chapter Multimedia Filters
  15399. @c man begin MULTIMEDIA FILTERS
  15400. Below is a description of the currently available multimedia filters.
  15401. @section abitscope
  15402. Convert input audio to a video output, displaying the audio bit scope.
  15403. The filter accepts the following options:
  15404. @table @option
  15405. @item rate, r
  15406. Set frame rate, expressed as number of frames per second. Default
  15407. value is "25".
  15408. @item size, s
  15409. Specify the video size for the output. For the syntax of this option, check the
  15410. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15411. Default value is @code{1024x256}.
  15412. @item colors
  15413. Specify list of colors separated by space or by '|' which will be used to
  15414. draw channels. Unrecognized or missing colors will be replaced
  15415. by white color.
  15416. @end table
  15417. @section ahistogram
  15418. Convert input audio to a video output, displaying the volume histogram.
  15419. The filter accepts the following options:
  15420. @table @option
  15421. @item dmode
  15422. Specify how histogram is calculated.
  15423. It accepts the following values:
  15424. @table @samp
  15425. @item single
  15426. Use single histogram for all channels.
  15427. @item separate
  15428. Use separate histogram for each channel.
  15429. @end table
  15430. Default is @code{single}.
  15431. @item rate, r
  15432. Set frame rate, expressed as number of frames per second. Default
  15433. value is "25".
  15434. @item size, s
  15435. Specify the video size for the output. For the syntax of this option, check the
  15436. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15437. Default value is @code{hd720}.
  15438. @item scale
  15439. Set display scale.
  15440. It accepts the following values:
  15441. @table @samp
  15442. @item log
  15443. logarithmic
  15444. @item sqrt
  15445. square root
  15446. @item cbrt
  15447. cubic root
  15448. @item lin
  15449. linear
  15450. @item rlog
  15451. reverse logarithmic
  15452. @end table
  15453. Default is @code{log}.
  15454. @item ascale
  15455. Set amplitude scale.
  15456. It accepts the following values:
  15457. @table @samp
  15458. @item log
  15459. logarithmic
  15460. @item lin
  15461. linear
  15462. @end table
  15463. Default is @code{log}.
  15464. @item acount
  15465. Set how much frames to accumulate in histogram.
  15466. Default is 1. Setting this to -1 accumulates all frames.
  15467. @item rheight
  15468. Set histogram ratio of window height.
  15469. @item slide
  15470. Set sonogram sliding.
  15471. It accepts the following values:
  15472. @table @samp
  15473. @item replace
  15474. replace old rows with new ones.
  15475. @item scroll
  15476. scroll from top to bottom.
  15477. @end table
  15478. Default is @code{replace}.
  15479. @end table
  15480. @section aphasemeter
  15481. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  15482. representing mean phase of current audio frame. A video output can also be produced and is
  15483. enabled by default. The audio is passed through as first output.
  15484. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  15485. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  15486. and @code{1} means channels are in phase.
  15487. The filter accepts the following options, all related to its video output:
  15488. @table @option
  15489. @item rate, r
  15490. Set the output frame rate. Default value is @code{25}.
  15491. @item size, s
  15492. Set the video size for the output. For the syntax of this option, check the
  15493. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15494. Default value is @code{800x400}.
  15495. @item rc
  15496. @item gc
  15497. @item bc
  15498. Specify the red, green, blue contrast. Default values are @code{2},
  15499. @code{7} and @code{1}.
  15500. Allowed range is @code{[0, 255]}.
  15501. @item mpc
  15502. Set color which will be used for drawing median phase. If color is
  15503. @code{none} which is default, no median phase value will be drawn.
  15504. @item video
  15505. Enable video output. Default is enabled.
  15506. @end table
  15507. @section avectorscope
  15508. Convert input audio to a video output, representing the audio vector
  15509. scope.
  15510. The filter is used to measure the difference between channels of stereo
  15511. audio stream. A monoaural signal, consisting of identical left and right
  15512. signal, results in straight vertical line. Any stereo separation is visible
  15513. as a deviation from this line, creating a Lissajous figure.
  15514. If the straight (or deviation from it) but horizontal line appears this
  15515. indicates that the left and right channels are out of phase.
  15516. The filter accepts the following options:
  15517. @table @option
  15518. @item mode, m
  15519. Set the vectorscope mode.
  15520. Available values are:
  15521. @table @samp
  15522. @item lissajous
  15523. Lissajous rotated by 45 degrees.
  15524. @item lissajous_xy
  15525. Same as above but not rotated.
  15526. @item polar
  15527. Shape resembling half of circle.
  15528. @end table
  15529. Default value is @samp{lissajous}.
  15530. @item size, s
  15531. Set the video size for the output. For the syntax of this option, check the
  15532. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15533. Default value is @code{400x400}.
  15534. @item rate, r
  15535. Set the output frame rate. Default value is @code{25}.
  15536. @item rc
  15537. @item gc
  15538. @item bc
  15539. @item ac
  15540. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  15541. @code{160}, @code{80} and @code{255}.
  15542. Allowed range is @code{[0, 255]}.
  15543. @item rf
  15544. @item gf
  15545. @item bf
  15546. @item af
  15547. Specify the red, green, blue and alpha fade. Default values are @code{15},
  15548. @code{10}, @code{5} and @code{5}.
  15549. Allowed range is @code{[0, 255]}.
  15550. @item zoom
  15551. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  15552. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  15553. @item draw
  15554. Set the vectorscope drawing mode.
  15555. Available values are:
  15556. @table @samp
  15557. @item dot
  15558. Draw dot for each sample.
  15559. @item line
  15560. Draw line between previous and current sample.
  15561. @end table
  15562. Default value is @samp{dot}.
  15563. @item scale
  15564. Specify amplitude scale of audio samples.
  15565. Available values are:
  15566. @table @samp
  15567. @item lin
  15568. Linear.
  15569. @item sqrt
  15570. Square root.
  15571. @item cbrt
  15572. Cubic root.
  15573. @item log
  15574. Logarithmic.
  15575. @end table
  15576. @item swap
  15577. Swap left channel axis with right channel axis.
  15578. @item mirror
  15579. Mirror axis.
  15580. @table @samp
  15581. @item none
  15582. No mirror.
  15583. @item x
  15584. Mirror only x axis.
  15585. @item y
  15586. Mirror only y axis.
  15587. @item xy
  15588. Mirror both axis.
  15589. @end table
  15590. @end table
  15591. @subsection Examples
  15592. @itemize
  15593. @item
  15594. Complete example using @command{ffplay}:
  15595. @example
  15596. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  15597. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  15598. @end example
  15599. @end itemize
  15600. @section bench, abench
  15601. Benchmark part of a filtergraph.
  15602. The filter accepts the following options:
  15603. @table @option
  15604. @item action
  15605. Start or stop a timer.
  15606. Available values are:
  15607. @table @samp
  15608. @item start
  15609. Get the current time, set it as frame metadata (using the key
  15610. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  15611. @item stop
  15612. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  15613. the input frame metadata to get the time difference. Time difference, average,
  15614. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  15615. @code{min}) are then printed. The timestamps are expressed in seconds.
  15616. @end table
  15617. @end table
  15618. @subsection Examples
  15619. @itemize
  15620. @item
  15621. Benchmark @ref{selectivecolor} filter:
  15622. @example
  15623. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  15624. @end example
  15625. @end itemize
  15626. @section concat
  15627. Concatenate audio and video streams, joining them together one after the
  15628. other.
  15629. The filter works on segments of synchronized video and audio streams. All
  15630. segments must have the same number of streams of each type, and that will
  15631. also be the number of streams at output.
  15632. The filter accepts the following options:
  15633. @table @option
  15634. @item n
  15635. Set the number of segments. Default is 2.
  15636. @item v
  15637. Set the number of output video streams, that is also the number of video
  15638. streams in each segment. Default is 1.
  15639. @item a
  15640. Set the number of output audio streams, that is also the number of audio
  15641. streams in each segment. Default is 0.
  15642. @item unsafe
  15643. Activate unsafe mode: do not fail if segments have a different format.
  15644. @end table
  15645. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  15646. @var{a} audio outputs.
  15647. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  15648. segment, in the same order as the outputs, then the inputs for the second
  15649. segment, etc.
  15650. Related streams do not always have exactly the same duration, for various
  15651. reasons including codec frame size or sloppy authoring. For that reason,
  15652. related synchronized streams (e.g. a video and its audio track) should be
  15653. concatenated at once. The concat filter will use the duration of the longest
  15654. stream in each segment (except the last one), and if necessary pad shorter
  15655. audio streams with silence.
  15656. For this filter to work correctly, all segments must start at timestamp 0.
  15657. All corresponding streams must have the same parameters in all segments; the
  15658. filtering system will automatically select a common pixel format for video
  15659. streams, and a common sample format, sample rate and channel layout for
  15660. audio streams, but other settings, such as resolution, must be converted
  15661. explicitly by the user.
  15662. Different frame rates are acceptable but will result in variable frame rate
  15663. at output; be sure to configure the output file to handle it.
  15664. @subsection Examples
  15665. @itemize
  15666. @item
  15667. Concatenate an opening, an episode and an ending, all in bilingual version
  15668. (video in stream 0, audio in streams 1 and 2):
  15669. @example
  15670. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  15671. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  15672. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  15673. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  15674. @end example
  15675. @item
  15676. Concatenate two parts, handling audio and video separately, using the
  15677. (a)movie sources, and adjusting the resolution:
  15678. @example
  15679. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  15680. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  15681. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  15682. @end example
  15683. Note that a desync will happen at the stitch if the audio and video streams
  15684. do not have exactly the same duration in the first file.
  15685. @end itemize
  15686. @subsection Commands
  15687. This filter supports the following commands:
  15688. @table @option
  15689. @item next
  15690. Close the current segment and step to the next one
  15691. @end table
  15692. @section drawgraph, adrawgraph
  15693. Draw a graph using input video or audio metadata.
  15694. It accepts the following parameters:
  15695. @table @option
  15696. @item m1
  15697. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  15698. @item fg1
  15699. Set 1st foreground color expression.
  15700. @item m2
  15701. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  15702. @item fg2
  15703. Set 2nd foreground color expression.
  15704. @item m3
  15705. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  15706. @item fg3
  15707. Set 3rd foreground color expression.
  15708. @item m4
  15709. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  15710. @item fg4
  15711. Set 4th foreground color expression.
  15712. @item min
  15713. Set minimal value of metadata value.
  15714. @item max
  15715. Set maximal value of metadata value.
  15716. @item bg
  15717. Set graph background color. Default is white.
  15718. @item mode
  15719. Set graph mode.
  15720. Available values for mode is:
  15721. @table @samp
  15722. @item bar
  15723. @item dot
  15724. @item line
  15725. @end table
  15726. Default is @code{line}.
  15727. @item slide
  15728. Set slide mode.
  15729. Available values for slide is:
  15730. @table @samp
  15731. @item frame
  15732. Draw new frame when right border is reached.
  15733. @item replace
  15734. Replace old columns with new ones.
  15735. @item scroll
  15736. Scroll from right to left.
  15737. @item rscroll
  15738. Scroll from left to right.
  15739. @item picture
  15740. Draw single picture.
  15741. @end table
  15742. Default is @code{frame}.
  15743. @item size
  15744. Set size of graph video. For the syntax of this option, check the
  15745. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15746. The default value is @code{900x256}.
  15747. The foreground color expressions can use the following variables:
  15748. @table @option
  15749. @item MIN
  15750. Minimal value of metadata value.
  15751. @item MAX
  15752. Maximal value of metadata value.
  15753. @item VAL
  15754. Current metadata key value.
  15755. @end table
  15756. The color is defined as 0xAABBGGRR.
  15757. @end table
  15758. Example using metadata from @ref{signalstats} filter:
  15759. @example
  15760. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  15761. @end example
  15762. Example using metadata from @ref{ebur128} filter:
  15763. @example
  15764. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  15765. @end example
  15766. @anchor{ebur128}
  15767. @section ebur128
  15768. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  15769. level. By default, it logs a message at a frequency of 10Hz with the
  15770. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  15771. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  15772. The filter can only analyze streams which have a sampling rate of 48000 Hz and whose
  15773. sample format is double-precision floating point. The input stream will be converted to
  15774. this specification, if needed. Users may need to insert aformat and/or aresample filters
  15775. after this filter to obtain the original parameters.
  15776. The filter also has a video output (see the @var{video} option) with a real
  15777. time graph to observe the loudness evolution. The graphic contains the logged
  15778. message mentioned above, so it is not printed anymore when this option is set,
  15779. unless the verbose logging is set. The main graphing area contains the
  15780. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  15781. the momentary loudness (400 milliseconds), but can optionally be configured
  15782. to instead display short-term loudness (see @var{gauge}).
  15783. The green area marks a +/- 1LU target range around the target loudness
  15784. (-23LUFS by default, unless modified through @var{target}).
  15785. More information about the Loudness Recommendation EBU R128 on
  15786. @url{http://tech.ebu.ch/loudness}.
  15787. The filter accepts the following options:
  15788. @table @option
  15789. @item video
  15790. Activate the video output. The audio stream is passed unchanged whether this
  15791. option is set or no. The video stream will be the first output stream if
  15792. activated. Default is @code{0}.
  15793. @item size
  15794. Set the video size. This option is for video only. For the syntax of this
  15795. option, check the
  15796. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15797. Default and minimum resolution is @code{640x480}.
  15798. @item meter
  15799. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  15800. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  15801. other integer value between this range is allowed.
  15802. @item metadata
  15803. Set metadata injection. If set to @code{1}, the audio input will be segmented
  15804. into 100ms output frames, each of them containing various loudness information
  15805. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  15806. Default is @code{0}.
  15807. @item framelog
  15808. Force the frame logging level.
  15809. Available values are:
  15810. @table @samp
  15811. @item info
  15812. information logging level
  15813. @item verbose
  15814. verbose logging level
  15815. @end table
  15816. By default, the logging level is set to @var{info}. If the @option{video} or
  15817. the @option{metadata} options are set, it switches to @var{verbose}.
  15818. @item peak
  15819. Set peak mode(s).
  15820. Available modes can be cumulated (the option is a @code{flag} type). Possible
  15821. values are:
  15822. @table @samp
  15823. @item none
  15824. Disable any peak mode (default).
  15825. @item sample
  15826. Enable sample-peak mode.
  15827. Simple peak mode looking for the higher sample value. It logs a message
  15828. for sample-peak (identified by @code{SPK}).
  15829. @item true
  15830. Enable true-peak mode.
  15831. If enabled, the peak lookup is done on an over-sampled version of the input
  15832. stream for better peak accuracy. It logs a message for true-peak.
  15833. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  15834. This mode requires a build with @code{libswresample}.
  15835. @end table
  15836. @item dualmono
  15837. Treat mono input files as "dual mono". If a mono file is intended for playback
  15838. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  15839. If set to @code{true}, this option will compensate for this effect.
  15840. Multi-channel input files are not affected by this option.
  15841. @item panlaw
  15842. Set a specific pan law to be used for the measurement of dual mono files.
  15843. This parameter is optional, and has a default value of -3.01dB.
  15844. @item target
  15845. Set a specific target level (in LUFS) used as relative zero in the visualization.
  15846. This parameter is optional and has a default value of -23LUFS as specified
  15847. by EBU R128. However, material published online may prefer a level of -16LUFS
  15848. (e.g. for use with podcasts or video platforms).
  15849. @item gauge
  15850. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  15851. @code{shortterm}. By default the momentary value will be used, but in certain
  15852. scenarios it may be more useful to observe the short term value instead (e.g.
  15853. live mixing).
  15854. @item scale
  15855. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  15856. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  15857. video output, not the summary or continuous log output.
  15858. @end table
  15859. @subsection Examples
  15860. @itemize
  15861. @item
  15862. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  15863. @example
  15864. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  15865. @end example
  15866. @item
  15867. Run an analysis with @command{ffmpeg}:
  15868. @example
  15869. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  15870. @end example
  15871. @end itemize
  15872. @section interleave, ainterleave
  15873. Temporally interleave frames from several inputs.
  15874. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  15875. These filters read frames from several inputs and send the oldest
  15876. queued frame to the output.
  15877. Input streams must have well defined, monotonically increasing frame
  15878. timestamp values.
  15879. In order to submit one frame to output, these filters need to enqueue
  15880. at least one frame for each input, so they cannot work in case one
  15881. input is not yet terminated and will not receive incoming frames.
  15882. For example consider the case when one input is a @code{select} filter
  15883. which always drops input frames. The @code{interleave} filter will keep
  15884. reading from that input, but it will never be able to send new frames
  15885. to output until the input sends an end-of-stream signal.
  15886. Also, depending on inputs synchronization, the filters will drop
  15887. frames in case one input receives more frames than the other ones, and
  15888. the queue is already filled.
  15889. These filters accept the following options:
  15890. @table @option
  15891. @item nb_inputs, n
  15892. Set the number of different inputs, it is 2 by default.
  15893. @end table
  15894. @subsection Examples
  15895. @itemize
  15896. @item
  15897. Interleave frames belonging to different streams using @command{ffmpeg}:
  15898. @example
  15899. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  15900. @end example
  15901. @item
  15902. Add flickering blur effect:
  15903. @example
  15904. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  15905. @end example
  15906. @end itemize
  15907. @section metadata, ametadata
  15908. Manipulate frame metadata.
  15909. This filter accepts the following options:
  15910. @table @option
  15911. @item mode
  15912. Set mode of operation of the filter.
  15913. Can be one of the following:
  15914. @table @samp
  15915. @item select
  15916. If both @code{value} and @code{key} is set, select frames
  15917. which have such metadata. If only @code{key} is set, select
  15918. every frame that has such key in metadata.
  15919. @item add
  15920. Add new metadata @code{key} and @code{value}. If key is already available
  15921. do nothing.
  15922. @item modify
  15923. Modify value of already present key.
  15924. @item delete
  15925. If @code{value} is set, delete only keys that have such value.
  15926. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  15927. the frame.
  15928. @item print
  15929. Print key and its value if metadata was found. If @code{key} is not set print all
  15930. metadata values available in frame.
  15931. @end table
  15932. @item key
  15933. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  15934. @item value
  15935. Set metadata value which will be used. This option is mandatory for
  15936. @code{modify} and @code{add} mode.
  15937. @item function
  15938. Which function to use when comparing metadata value and @code{value}.
  15939. Can be one of following:
  15940. @table @samp
  15941. @item same_str
  15942. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  15943. @item starts_with
  15944. Values are interpreted as strings, returns true if metadata value starts with
  15945. the @code{value} option string.
  15946. @item less
  15947. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  15948. @item equal
  15949. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  15950. @item greater
  15951. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  15952. @item expr
  15953. Values are interpreted as floats, returns true if expression from option @code{expr}
  15954. evaluates to true.
  15955. @end table
  15956. @item expr
  15957. Set expression which is used when @code{function} is set to @code{expr}.
  15958. The expression is evaluated through the eval API and can contain the following
  15959. constants:
  15960. @table @option
  15961. @item VALUE1
  15962. Float representation of @code{value} from metadata key.
  15963. @item VALUE2
  15964. Float representation of @code{value} as supplied by user in @code{value} option.
  15965. @end table
  15966. @item file
  15967. If specified in @code{print} mode, output is written to the named file. Instead of
  15968. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  15969. for standard output. If @code{file} option is not set, output is written to the log
  15970. with AV_LOG_INFO loglevel.
  15971. @end table
  15972. @subsection Examples
  15973. @itemize
  15974. @item
  15975. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  15976. between 0 and 1.
  15977. @example
  15978. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  15979. @end example
  15980. @item
  15981. Print silencedetect output to file @file{metadata.txt}.
  15982. @example
  15983. silencedetect,ametadata=mode=print:file=metadata.txt
  15984. @end example
  15985. @item
  15986. Direct all metadata to a pipe with file descriptor 4.
  15987. @example
  15988. metadata=mode=print:file='pipe\:4'
  15989. @end example
  15990. @end itemize
  15991. @section perms, aperms
  15992. Set read/write permissions for the output frames.
  15993. These filters are mainly aimed at developers to test direct path in the
  15994. following filter in the filtergraph.
  15995. The filters accept the following options:
  15996. @table @option
  15997. @item mode
  15998. Select the permissions mode.
  15999. It accepts the following values:
  16000. @table @samp
  16001. @item none
  16002. Do nothing. This is the default.
  16003. @item ro
  16004. Set all the output frames read-only.
  16005. @item rw
  16006. Set all the output frames directly writable.
  16007. @item toggle
  16008. Make the frame read-only if writable, and writable if read-only.
  16009. @item random
  16010. Set each output frame read-only or writable randomly.
  16011. @end table
  16012. @item seed
  16013. Set the seed for the @var{random} mode, must be an integer included between
  16014. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  16015. @code{-1}, the filter will try to use a good random seed on a best effort
  16016. basis.
  16017. @end table
  16018. Note: in case of auto-inserted filter between the permission filter and the
  16019. following one, the permission might not be received as expected in that
  16020. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  16021. perms/aperms filter can avoid this problem.
  16022. @section realtime, arealtime
  16023. Slow down filtering to match real time approximately.
  16024. These filters will pause the filtering for a variable amount of time to
  16025. match the output rate with the input timestamps.
  16026. They are similar to the @option{re} option to @code{ffmpeg}.
  16027. They accept the following options:
  16028. @table @option
  16029. @item limit
  16030. Time limit for the pauses. Any pause longer than that will be considered
  16031. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  16032. @end table
  16033. @anchor{select}
  16034. @section select, aselect
  16035. Select frames to pass in output.
  16036. This filter accepts the following options:
  16037. @table @option
  16038. @item expr, e
  16039. Set expression, which is evaluated for each input frame.
  16040. If the expression is evaluated to zero, the frame is discarded.
  16041. If the evaluation result is negative or NaN, the frame is sent to the
  16042. first output; otherwise it is sent to the output with index
  16043. @code{ceil(val)-1}, assuming that the input index starts from 0.
  16044. For example a value of @code{1.2} corresponds to the output with index
  16045. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  16046. @item outputs, n
  16047. Set the number of outputs. The output to which to send the selected
  16048. frame is based on the result of the evaluation. Default value is 1.
  16049. @end table
  16050. The expression can contain the following constants:
  16051. @table @option
  16052. @item n
  16053. The (sequential) number of the filtered frame, starting from 0.
  16054. @item selected_n
  16055. The (sequential) number of the selected frame, starting from 0.
  16056. @item prev_selected_n
  16057. The sequential number of the last selected frame. It's NAN if undefined.
  16058. @item TB
  16059. The timebase of the input timestamps.
  16060. @item pts
  16061. The PTS (Presentation TimeStamp) of the filtered video frame,
  16062. expressed in @var{TB} units. It's NAN if undefined.
  16063. @item t
  16064. The PTS of the filtered video frame,
  16065. expressed in seconds. It's NAN if undefined.
  16066. @item prev_pts
  16067. The PTS of the previously filtered video frame. It's NAN if undefined.
  16068. @item prev_selected_pts
  16069. The PTS of the last previously filtered video frame. It's NAN if undefined.
  16070. @item prev_selected_t
  16071. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  16072. @item start_pts
  16073. The PTS of the first video frame in the video. It's NAN if undefined.
  16074. @item start_t
  16075. The time of the first video frame in the video. It's NAN if undefined.
  16076. @item pict_type @emph{(video only)}
  16077. The type of the filtered frame. It can assume one of the following
  16078. values:
  16079. @table @option
  16080. @item I
  16081. @item P
  16082. @item B
  16083. @item S
  16084. @item SI
  16085. @item SP
  16086. @item BI
  16087. @end table
  16088. @item interlace_type @emph{(video only)}
  16089. The frame interlace type. It can assume one of the following values:
  16090. @table @option
  16091. @item PROGRESSIVE
  16092. The frame is progressive (not interlaced).
  16093. @item TOPFIRST
  16094. The frame is top-field-first.
  16095. @item BOTTOMFIRST
  16096. The frame is bottom-field-first.
  16097. @end table
  16098. @item consumed_sample_n @emph{(audio only)}
  16099. the number of selected samples before the current frame
  16100. @item samples_n @emph{(audio only)}
  16101. the number of samples in the current frame
  16102. @item sample_rate @emph{(audio only)}
  16103. the input sample rate
  16104. @item key
  16105. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  16106. @item pos
  16107. the position in the file of the filtered frame, -1 if the information
  16108. is not available (e.g. for synthetic video)
  16109. @item scene @emph{(video only)}
  16110. value between 0 and 1 to indicate a new scene; a low value reflects a low
  16111. probability for the current frame to introduce a new scene, while a higher
  16112. value means the current frame is more likely to be one (see the example below)
  16113. @item concatdec_select
  16114. The concat demuxer can select only part of a concat input file by setting an
  16115. inpoint and an outpoint, but the output packets may not be entirely contained
  16116. in the selected interval. By using this variable, it is possible to skip frames
  16117. generated by the concat demuxer which are not exactly contained in the selected
  16118. interval.
  16119. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  16120. and the @var{lavf.concat.duration} packet metadata values which are also
  16121. present in the decoded frames.
  16122. The @var{concatdec_select} variable is -1 if the frame pts is at least
  16123. start_time and either the duration metadata is missing or the frame pts is less
  16124. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  16125. missing.
  16126. That basically means that an input frame is selected if its pts is within the
  16127. interval set by the concat demuxer.
  16128. @end table
  16129. The default value of the select expression is "1".
  16130. @subsection Examples
  16131. @itemize
  16132. @item
  16133. Select all frames in input:
  16134. @example
  16135. select
  16136. @end example
  16137. The example above is the same as:
  16138. @example
  16139. select=1
  16140. @end example
  16141. @item
  16142. Skip all frames:
  16143. @example
  16144. select=0
  16145. @end example
  16146. @item
  16147. Select only I-frames:
  16148. @example
  16149. select='eq(pict_type\,I)'
  16150. @end example
  16151. @item
  16152. Select one frame every 100:
  16153. @example
  16154. select='not(mod(n\,100))'
  16155. @end example
  16156. @item
  16157. Select only frames contained in the 10-20 time interval:
  16158. @example
  16159. select=between(t\,10\,20)
  16160. @end example
  16161. @item
  16162. Select only I-frames contained in the 10-20 time interval:
  16163. @example
  16164. select=between(t\,10\,20)*eq(pict_type\,I)
  16165. @end example
  16166. @item
  16167. Select frames with a minimum distance of 10 seconds:
  16168. @example
  16169. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  16170. @end example
  16171. @item
  16172. Use aselect to select only audio frames with samples number > 100:
  16173. @example
  16174. aselect='gt(samples_n\,100)'
  16175. @end example
  16176. @item
  16177. Create a mosaic of the first scenes:
  16178. @example
  16179. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  16180. @end example
  16181. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  16182. choice.
  16183. @item
  16184. Send even and odd frames to separate outputs, and compose them:
  16185. @example
  16186. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  16187. @end example
  16188. @item
  16189. Select useful frames from an ffconcat file which is using inpoints and
  16190. outpoints but where the source files are not intra frame only.
  16191. @example
  16192. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  16193. @end example
  16194. @end itemize
  16195. @section sendcmd, asendcmd
  16196. Send commands to filters in the filtergraph.
  16197. These filters read commands to be sent to other filters in the
  16198. filtergraph.
  16199. @code{sendcmd} must be inserted between two video filters,
  16200. @code{asendcmd} must be inserted between two audio filters, but apart
  16201. from that they act the same way.
  16202. The specification of commands can be provided in the filter arguments
  16203. with the @var{commands} option, or in a file specified by the
  16204. @var{filename} option.
  16205. These filters accept the following options:
  16206. @table @option
  16207. @item commands, c
  16208. Set the commands to be read and sent to the other filters.
  16209. @item filename, f
  16210. Set the filename of the commands to be read and sent to the other
  16211. filters.
  16212. @end table
  16213. @subsection Commands syntax
  16214. A commands description consists of a sequence of interval
  16215. specifications, comprising a list of commands to be executed when a
  16216. particular event related to that interval occurs. The occurring event
  16217. is typically the current frame time entering or leaving a given time
  16218. interval.
  16219. An interval is specified by the following syntax:
  16220. @example
  16221. @var{START}[-@var{END}] @var{COMMANDS};
  16222. @end example
  16223. The time interval is specified by the @var{START} and @var{END} times.
  16224. @var{END} is optional and defaults to the maximum time.
  16225. The current frame time is considered within the specified interval if
  16226. it is included in the interval [@var{START}, @var{END}), that is when
  16227. the time is greater or equal to @var{START} and is lesser than
  16228. @var{END}.
  16229. @var{COMMANDS} consists of a sequence of one or more command
  16230. specifications, separated by ",", relating to that interval. The
  16231. syntax of a command specification is given by:
  16232. @example
  16233. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  16234. @end example
  16235. @var{FLAGS} is optional and specifies the type of events relating to
  16236. the time interval which enable sending the specified command, and must
  16237. be a non-null sequence of identifier flags separated by "+" or "|" and
  16238. enclosed between "[" and "]".
  16239. The following flags are recognized:
  16240. @table @option
  16241. @item enter
  16242. The command is sent when the current frame timestamp enters the
  16243. specified interval. In other words, the command is sent when the
  16244. previous frame timestamp was not in the given interval, and the
  16245. current is.
  16246. @item leave
  16247. The command is sent when the current frame timestamp leaves the
  16248. specified interval. In other words, the command is sent when the
  16249. previous frame timestamp was in the given interval, and the
  16250. current is not.
  16251. @end table
  16252. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  16253. assumed.
  16254. @var{TARGET} specifies the target of the command, usually the name of
  16255. the filter class or a specific filter instance name.
  16256. @var{COMMAND} specifies the name of the command for the target filter.
  16257. @var{ARG} is optional and specifies the optional list of argument for
  16258. the given @var{COMMAND}.
  16259. Between one interval specification and another, whitespaces, or
  16260. sequences of characters starting with @code{#} until the end of line,
  16261. are ignored and can be used to annotate comments.
  16262. A simplified BNF description of the commands specification syntax
  16263. follows:
  16264. @example
  16265. @var{COMMAND_FLAG} ::= "enter" | "leave"
  16266. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  16267. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  16268. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  16269. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  16270. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  16271. @end example
  16272. @subsection Examples
  16273. @itemize
  16274. @item
  16275. Specify audio tempo change at second 4:
  16276. @example
  16277. asendcmd=c='4.0 atempo tempo 1.5',atempo
  16278. @end example
  16279. @item
  16280. Target a specific filter instance:
  16281. @example
  16282. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  16283. @end example
  16284. @item
  16285. Specify a list of drawtext and hue commands in a file.
  16286. @example
  16287. # show text in the interval 5-10
  16288. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  16289. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  16290. # desaturate the image in the interval 15-20
  16291. 15.0-20.0 [enter] hue s 0,
  16292. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  16293. [leave] hue s 1,
  16294. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  16295. # apply an exponential saturation fade-out effect, starting from time 25
  16296. 25 [enter] hue s exp(25-t)
  16297. @end example
  16298. A filtergraph allowing to read and process the above command list
  16299. stored in a file @file{test.cmd}, can be specified with:
  16300. @example
  16301. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  16302. @end example
  16303. @end itemize
  16304. @anchor{setpts}
  16305. @section setpts, asetpts
  16306. Change the PTS (presentation timestamp) of the input frames.
  16307. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  16308. This filter accepts the following options:
  16309. @table @option
  16310. @item expr
  16311. The expression which is evaluated for each frame to construct its timestamp.
  16312. @end table
  16313. The expression is evaluated through the eval API and can contain the following
  16314. constants:
  16315. @table @option
  16316. @item FRAME_RATE, FR
  16317. frame rate, only defined for constant frame-rate video
  16318. @item PTS
  16319. The presentation timestamp in input
  16320. @item N
  16321. The count of the input frame for video or the number of consumed samples,
  16322. not including the current frame for audio, starting from 0.
  16323. @item NB_CONSUMED_SAMPLES
  16324. The number of consumed samples, not including the current frame (only
  16325. audio)
  16326. @item NB_SAMPLES, S
  16327. The number of samples in the current frame (only audio)
  16328. @item SAMPLE_RATE, SR
  16329. The audio sample rate.
  16330. @item STARTPTS
  16331. The PTS of the first frame.
  16332. @item STARTT
  16333. the time in seconds of the first frame
  16334. @item INTERLACED
  16335. State whether the current frame is interlaced.
  16336. @item T
  16337. the time in seconds of the current frame
  16338. @item POS
  16339. original position in the file of the frame, or undefined if undefined
  16340. for the current frame
  16341. @item PREV_INPTS
  16342. The previous input PTS.
  16343. @item PREV_INT
  16344. previous input time in seconds
  16345. @item PREV_OUTPTS
  16346. The previous output PTS.
  16347. @item PREV_OUTT
  16348. previous output time in seconds
  16349. @item RTCTIME
  16350. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  16351. instead.
  16352. @item RTCSTART
  16353. The wallclock (RTC) time at the start of the movie in microseconds.
  16354. @item TB
  16355. The timebase of the input timestamps.
  16356. @end table
  16357. @subsection Examples
  16358. @itemize
  16359. @item
  16360. Start counting PTS from zero
  16361. @example
  16362. setpts=PTS-STARTPTS
  16363. @end example
  16364. @item
  16365. Apply fast motion effect:
  16366. @example
  16367. setpts=0.5*PTS
  16368. @end example
  16369. @item
  16370. Apply slow motion effect:
  16371. @example
  16372. setpts=2.0*PTS
  16373. @end example
  16374. @item
  16375. Set fixed rate of 25 frames per second:
  16376. @example
  16377. setpts=N/(25*TB)
  16378. @end example
  16379. @item
  16380. Set fixed rate 25 fps with some jitter:
  16381. @example
  16382. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  16383. @end example
  16384. @item
  16385. Apply an offset of 10 seconds to the input PTS:
  16386. @example
  16387. setpts=PTS+10/TB
  16388. @end example
  16389. @item
  16390. Generate timestamps from a "live source" and rebase onto the current timebase:
  16391. @example
  16392. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  16393. @end example
  16394. @item
  16395. Generate timestamps by counting samples:
  16396. @example
  16397. asetpts=N/SR/TB
  16398. @end example
  16399. @end itemize
  16400. @section setrange
  16401. Force color range for the output video frame.
  16402. The @code{setrange} filter marks the color range property for the
  16403. output frames. It does not change the input frame, but only sets the
  16404. corresponding property, which affects how the frame is treated by
  16405. following filters.
  16406. The filter accepts the following options:
  16407. @table @option
  16408. @item range
  16409. Available values are:
  16410. @table @samp
  16411. @item auto
  16412. Keep the same color range property.
  16413. @item unspecified, unknown
  16414. Set the color range as unspecified.
  16415. @item limited, tv, mpeg
  16416. Set the color range as limited.
  16417. @item full, pc, jpeg
  16418. Set the color range as full.
  16419. @end table
  16420. @end table
  16421. @section settb, asettb
  16422. Set the timebase to use for the output frames timestamps.
  16423. It is mainly useful for testing timebase configuration.
  16424. It accepts the following parameters:
  16425. @table @option
  16426. @item expr, tb
  16427. The expression which is evaluated into the output timebase.
  16428. @end table
  16429. The value for @option{tb} is an arithmetic expression representing a
  16430. rational. The expression can contain the constants "AVTB" (the default
  16431. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  16432. audio only). Default value is "intb".
  16433. @subsection Examples
  16434. @itemize
  16435. @item
  16436. Set the timebase to 1/25:
  16437. @example
  16438. settb=expr=1/25
  16439. @end example
  16440. @item
  16441. Set the timebase to 1/10:
  16442. @example
  16443. settb=expr=0.1
  16444. @end example
  16445. @item
  16446. Set the timebase to 1001/1000:
  16447. @example
  16448. settb=1+0.001
  16449. @end example
  16450. @item
  16451. Set the timebase to 2*intb:
  16452. @example
  16453. settb=2*intb
  16454. @end example
  16455. @item
  16456. Set the default timebase value:
  16457. @example
  16458. settb=AVTB
  16459. @end example
  16460. @end itemize
  16461. @section showcqt
  16462. Convert input audio to a video output representing frequency spectrum
  16463. logarithmically using Brown-Puckette constant Q transform algorithm with
  16464. direct frequency domain coefficient calculation (but the transform itself
  16465. is not really constant Q, instead the Q factor is actually variable/clamped),
  16466. with musical tone scale, from E0 to D#10.
  16467. The filter accepts the following options:
  16468. @table @option
  16469. @item size, s
  16470. Specify the video size for the output. It must be even. For the syntax of this option,
  16471. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16472. Default value is @code{1920x1080}.
  16473. @item fps, rate, r
  16474. Set the output frame rate. Default value is @code{25}.
  16475. @item bar_h
  16476. Set the bargraph height. It must be even. Default value is @code{-1} which
  16477. computes the bargraph height automatically.
  16478. @item axis_h
  16479. Set the axis height. It must be even. Default value is @code{-1} which computes
  16480. the axis height automatically.
  16481. @item sono_h
  16482. Set the sonogram height. It must be even. Default value is @code{-1} which
  16483. computes the sonogram height automatically.
  16484. @item fullhd
  16485. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  16486. instead. Default value is @code{1}.
  16487. @item sono_v, volume
  16488. Specify the sonogram volume expression. It can contain variables:
  16489. @table @option
  16490. @item bar_v
  16491. the @var{bar_v} evaluated expression
  16492. @item frequency, freq, f
  16493. the frequency where it is evaluated
  16494. @item timeclamp, tc
  16495. the value of @var{timeclamp} option
  16496. @end table
  16497. and functions:
  16498. @table @option
  16499. @item a_weighting(f)
  16500. A-weighting of equal loudness
  16501. @item b_weighting(f)
  16502. B-weighting of equal loudness
  16503. @item c_weighting(f)
  16504. C-weighting of equal loudness.
  16505. @end table
  16506. Default value is @code{16}.
  16507. @item bar_v, volume2
  16508. Specify the bargraph volume expression. It can contain variables:
  16509. @table @option
  16510. @item sono_v
  16511. the @var{sono_v} evaluated expression
  16512. @item frequency, freq, f
  16513. the frequency where it is evaluated
  16514. @item timeclamp, tc
  16515. the value of @var{timeclamp} option
  16516. @end table
  16517. and functions:
  16518. @table @option
  16519. @item a_weighting(f)
  16520. A-weighting of equal loudness
  16521. @item b_weighting(f)
  16522. B-weighting of equal loudness
  16523. @item c_weighting(f)
  16524. C-weighting of equal loudness.
  16525. @end table
  16526. Default value is @code{sono_v}.
  16527. @item sono_g, gamma
  16528. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  16529. higher gamma makes the spectrum having more range. Default value is @code{3}.
  16530. Acceptable range is @code{[1, 7]}.
  16531. @item bar_g, gamma2
  16532. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  16533. @code{[1, 7]}.
  16534. @item bar_t
  16535. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  16536. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  16537. @item timeclamp, tc
  16538. Specify the transform timeclamp. At low frequency, there is trade-off between
  16539. accuracy in time domain and frequency domain. If timeclamp is lower,
  16540. event in time domain is represented more accurately (such as fast bass drum),
  16541. otherwise event in frequency domain is represented more accurately
  16542. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  16543. @item attack
  16544. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  16545. limits future samples by applying asymmetric windowing in time domain, useful
  16546. when low latency is required. Accepted range is @code{[0, 1]}.
  16547. @item basefreq
  16548. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  16549. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  16550. @item endfreq
  16551. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  16552. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  16553. @item coeffclamp
  16554. This option is deprecated and ignored.
  16555. @item tlength
  16556. Specify the transform length in time domain. Use this option to control accuracy
  16557. trade-off between time domain and frequency domain at every frequency sample.
  16558. It can contain variables:
  16559. @table @option
  16560. @item frequency, freq, f
  16561. the frequency where it is evaluated
  16562. @item timeclamp, tc
  16563. the value of @var{timeclamp} option.
  16564. @end table
  16565. Default value is @code{384*tc/(384+tc*f)}.
  16566. @item count
  16567. Specify the transform count for every video frame. Default value is @code{6}.
  16568. Acceptable range is @code{[1, 30]}.
  16569. @item fcount
  16570. Specify the transform count for every single pixel. Default value is @code{0},
  16571. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  16572. @item fontfile
  16573. Specify font file for use with freetype to draw the axis. If not specified,
  16574. use embedded font. Note that drawing with font file or embedded font is not
  16575. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  16576. option instead.
  16577. @item font
  16578. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  16579. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  16580. @item fontcolor
  16581. Specify font color expression. This is arithmetic expression that should return
  16582. integer value 0xRRGGBB. It can contain variables:
  16583. @table @option
  16584. @item frequency, freq, f
  16585. the frequency where it is evaluated
  16586. @item timeclamp, tc
  16587. the value of @var{timeclamp} option
  16588. @end table
  16589. and functions:
  16590. @table @option
  16591. @item midi(f)
  16592. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  16593. @item r(x), g(x), b(x)
  16594. red, green, and blue value of intensity x.
  16595. @end table
  16596. Default value is @code{st(0, (midi(f)-59.5)/12);
  16597. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  16598. r(1-ld(1)) + b(ld(1))}.
  16599. @item axisfile
  16600. Specify image file to draw the axis. This option override @var{fontfile} and
  16601. @var{fontcolor} option.
  16602. @item axis, text
  16603. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  16604. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  16605. Default value is @code{1}.
  16606. @item csp
  16607. Set colorspace. The accepted values are:
  16608. @table @samp
  16609. @item unspecified
  16610. Unspecified (default)
  16611. @item bt709
  16612. BT.709
  16613. @item fcc
  16614. FCC
  16615. @item bt470bg
  16616. BT.470BG or BT.601-6 625
  16617. @item smpte170m
  16618. SMPTE-170M or BT.601-6 525
  16619. @item smpte240m
  16620. SMPTE-240M
  16621. @item bt2020ncl
  16622. BT.2020 with non-constant luminance
  16623. @end table
  16624. @item cscheme
  16625. Set spectrogram color scheme. This is list of floating point values with format
  16626. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  16627. The default is @code{1|0.5|0|0|0.5|1}.
  16628. @end table
  16629. @subsection Examples
  16630. @itemize
  16631. @item
  16632. Playing audio while showing the spectrum:
  16633. @example
  16634. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  16635. @end example
  16636. @item
  16637. Same as above, but with frame rate 30 fps:
  16638. @example
  16639. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  16640. @end example
  16641. @item
  16642. Playing at 1280x720:
  16643. @example
  16644. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  16645. @end example
  16646. @item
  16647. Disable sonogram display:
  16648. @example
  16649. sono_h=0
  16650. @end example
  16651. @item
  16652. A1 and its harmonics: A1, A2, (near)E3, A3:
  16653. @example
  16654. 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),
  16655. asplit[a][out1]; [a] showcqt [out0]'
  16656. @end example
  16657. @item
  16658. Same as above, but with more accuracy in frequency domain:
  16659. @example
  16660. 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),
  16661. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  16662. @end example
  16663. @item
  16664. Custom volume:
  16665. @example
  16666. bar_v=10:sono_v=bar_v*a_weighting(f)
  16667. @end example
  16668. @item
  16669. Custom gamma, now spectrum is linear to the amplitude.
  16670. @example
  16671. bar_g=2:sono_g=2
  16672. @end example
  16673. @item
  16674. Custom tlength equation:
  16675. @example
  16676. 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)))'
  16677. @end example
  16678. @item
  16679. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  16680. @example
  16681. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  16682. @end example
  16683. @item
  16684. Custom font using fontconfig:
  16685. @example
  16686. font='Courier New,Monospace,mono|bold'
  16687. @end example
  16688. @item
  16689. Custom frequency range with custom axis using image file:
  16690. @example
  16691. axisfile=myaxis.png:basefreq=40:endfreq=10000
  16692. @end example
  16693. @end itemize
  16694. @section showfreqs
  16695. Convert input audio to video output representing the audio power spectrum.
  16696. Audio amplitude is on Y-axis while frequency is on X-axis.
  16697. The filter accepts the following options:
  16698. @table @option
  16699. @item size, s
  16700. Specify size of video. For the syntax of this option, check the
  16701. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16702. Default is @code{1024x512}.
  16703. @item mode
  16704. Set display mode.
  16705. This set how each frequency bin will be represented.
  16706. It accepts the following values:
  16707. @table @samp
  16708. @item line
  16709. @item bar
  16710. @item dot
  16711. @end table
  16712. Default is @code{bar}.
  16713. @item ascale
  16714. Set amplitude scale.
  16715. It accepts the following values:
  16716. @table @samp
  16717. @item lin
  16718. Linear scale.
  16719. @item sqrt
  16720. Square root scale.
  16721. @item cbrt
  16722. Cubic root scale.
  16723. @item log
  16724. Logarithmic scale.
  16725. @end table
  16726. Default is @code{log}.
  16727. @item fscale
  16728. Set frequency scale.
  16729. It accepts the following values:
  16730. @table @samp
  16731. @item lin
  16732. Linear scale.
  16733. @item log
  16734. Logarithmic scale.
  16735. @item rlog
  16736. Reverse logarithmic scale.
  16737. @end table
  16738. Default is @code{lin}.
  16739. @item win_size
  16740. Set window size.
  16741. It accepts the following values:
  16742. @table @samp
  16743. @item w16
  16744. @item w32
  16745. @item w64
  16746. @item w128
  16747. @item w256
  16748. @item w512
  16749. @item w1024
  16750. @item w2048
  16751. @item w4096
  16752. @item w8192
  16753. @item w16384
  16754. @item w32768
  16755. @item w65536
  16756. @end table
  16757. Default is @code{w2048}
  16758. @item win_func
  16759. Set windowing function.
  16760. It accepts the following values:
  16761. @table @samp
  16762. @item rect
  16763. @item bartlett
  16764. @item hanning
  16765. @item hamming
  16766. @item blackman
  16767. @item welch
  16768. @item flattop
  16769. @item bharris
  16770. @item bnuttall
  16771. @item bhann
  16772. @item sine
  16773. @item nuttall
  16774. @item lanczos
  16775. @item gauss
  16776. @item tukey
  16777. @item dolph
  16778. @item cauchy
  16779. @item parzen
  16780. @item poisson
  16781. @item bohman
  16782. @end table
  16783. Default is @code{hanning}.
  16784. @item overlap
  16785. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  16786. which means optimal overlap for selected window function will be picked.
  16787. @item averaging
  16788. Set time averaging. Setting this to 0 will display current maximal peaks.
  16789. Default is @code{1}, which means time averaging is disabled.
  16790. @item colors
  16791. Specify list of colors separated by space or by '|' which will be used to
  16792. draw channel frequencies. Unrecognized or missing colors will be replaced
  16793. by white color.
  16794. @item cmode
  16795. Set channel display mode.
  16796. It accepts the following values:
  16797. @table @samp
  16798. @item combined
  16799. @item separate
  16800. @end table
  16801. Default is @code{combined}.
  16802. @item minamp
  16803. Set minimum amplitude used in @code{log} amplitude scaler.
  16804. @end table
  16805. @anchor{showspectrum}
  16806. @section showspectrum
  16807. Convert input audio to a video output, representing the audio frequency
  16808. spectrum.
  16809. The filter accepts the following options:
  16810. @table @option
  16811. @item size, s
  16812. Specify the video size for the output. For the syntax of this option, check the
  16813. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16814. Default value is @code{640x512}.
  16815. @item slide
  16816. Specify how the spectrum should slide along the window.
  16817. It accepts the following values:
  16818. @table @samp
  16819. @item replace
  16820. the samples start again on the left when they reach the right
  16821. @item scroll
  16822. the samples scroll from right to left
  16823. @item fullframe
  16824. frames are only produced when the samples reach the right
  16825. @item rscroll
  16826. the samples scroll from left to right
  16827. @end table
  16828. Default value is @code{replace}.
  16829. @item mode
  16830. Specify display mode.
  16831. It accepts the following values:
  16832. @table @samp
  16833. @item combined
  16834. all channels are displayed in the same row
  16835. @item separate
  16836. all channels are displayed in separate rows
  16837. @end table
  16838. Default value is @samp{combined}.
  16839. @item color
  16840. Specify display color mode.
  16841. It accepts the following values:
  16842. @table @samp
  16843. @item channel
  16844. each channel is displayed in a separate color
  16845. @item intensity
  16846. each channel is displayed using the same color scheme
  16847. @item rainbow
  16848. each channel is displayed using the rainbow color scheme
  16849. @item moreland
  16850. each channel is displayed using the moreland color scheme
  16851. @item nebulae
  16852. each channel is displayed using the nebulae color scheme
  16853. @item fire
  16854. each channel is displayed using the fire color scheme
  16855. @item fiery
  16856. each channel is displayed using the fiery color scheme
  16857. @item fruit
  16858. each channel is displayed using the fruit color scheme
  16859. @item cool
  16860. each channel is displayed using the cool color scheme
  16861. @item magma
  16862. each channel is displayed using the magma color scheme
  16863. @item green
  16864. each channel is displayed using the green color scheme
  16865. @item viridis
  16866. each channel is displayed using the viridis color scheme
  16867. @item plasma
  16868. each channel is displayed using the plasma color scheme
  16869. @item cividis
  16870. each channel is displayed using the cividis color scheme
  16871. @item terrain
  16872. each channel is displayed using the terrain color scheme
  16873. @end table
  16874. Default value is @samp{channel}.
  16875. @item scale
  16876. Specify scale used for calculating intensity color values.
  16877. It accepts the following values:
  16878. @table @samp
  16879. @item lin
  16880. linear
  16881. @item sqrt
  16882. square root, default
  16883. @item cbrt
  16884. cubic root
  16885. @item log
  16886. logarithmic
  16887. @item 4thrt
  16888. 4th root
  16889. @item 5thrt
  16890. 5th root
  16891. @end table
  16892. Default value is @samp{sqrt}.
  16893. @item saturation
  16894. Set saturation modifier for displayed colors. Negative values provide
  16895. alternative color scheme. @code{0} is no saturation at all.
  16896. Saturation must be in [-10.0, 10.0] range.
  16897. Default value is @code{1}.
  16898. @item win_func
  16899. Set window function.
  16900. It accepts the following values:
  16901. @table @samp
  16902. @item rect
  16903. @item bartlett
  16904. @item hann
  16905. @item hanning
  16906. @item hamming
  16907. @item blackman
  16908. @item welch
  16909. @item flattop
  16910. @item bharris
  16911. @item bnuttall
  16912. @item bhann
  16913. @item sine
  16914. @item nuttall
  16915. @item lanczos
  16916. @item gauss
  16917. @item tukey
  16918. @item dolph
  16919. @item cauchy
  16920. @item parzen
  16921. @item poisson
  16922. @item bohman
  16923. @end table
  16924. Default value is @code{hann}.
  16925. @item orientation
  16926. Set orientation of time vs frequency axis. Can be @code{vertical} or
  16927. @code{horizontal}. Default is @code{vertical}.
  16928. @item overlap
  16929. Set ratio of overlap window. Default value is @code{0}.
  16930. When value is @code{1} overlap is set to recommended size for specific
  16931. window function currently used.
  16932. @item gain
  16933. Set scale gain for calculating intensity color values.
  16934. Default value is @code{1}.
  16935. @item data
  16936. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  16937. @item rotation
  16938. Set color rotation, must be in [-1.0, 1.0] range.
  16939. Default value is @code{0}.
  16940. @item start
  16941. Set start frequency from which to display spectrogram. Default is @code{0}.
  16942. @item stop
  16943. Set stop frequency to which to display spectrogram. Default is @code{0}.
  16944. @item fps
  16945. Set upper frame rate limit. Default is @code{auto}, unlimited.
  16946. @item legend
  16947. Draw time and frequency axes and legends. Default is disabled.
  16948. @end table
  16949. The usage is very similar to the showwaves filter; see the examples in that
  16950. section.
  16951. @subsection Examples
  16952. @itemize
  16953. @item
  16954. Large window with logarithmic color scaling:
  16955. @example
  16956. showspectrum=s=1280x480:scale=log
  16957. @end example
  16958. @item
  16959. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  16960. @example
  16961. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  16962. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  16963. @end example
  16964. @end itemize
  16965. @section showspectrumpic
  16966. Convert input audio to a single video frame, representing the audio frequency
  16967. spectrum.
  16968. The filter accepts the following options:
  16969. @table @option
  16970. @item size, s
  16971. Specify the video size for the output. For the syntax of this option, check the
  16972. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16973. Default value is @code{4096x2048}.
  16974. @item mode
  16975. Specify display mode.
  16976. It accepts the following values:
  16977. @table @samp
  16978. @item combined
  16979. all channels are displayed in the same row
  16980. @item separate
  16981. all channels are displayed in separate rows
  16982. @end table
  16983. Default value is @samp{combined}.
  16984. @item color
  16985. Specify display color mode.
  16986. It accepts the following values:
  16987. @table @samp
  16988. @item channel
  16989. each channel is displayed in a separate color
  16990. @item intensity
  16991. each channel is displayed using the same color scheme
  16992. @item rainbow
  16993. each channel is displayed using the rainbow color scheme
  16994. @item moreland
  16995. each channel is displayed using the moreland color scheme
  16996. @item nebulae
  16997. each channel is displayed using the nebulae color scheme
  16998. @item fire
  16999. each channel is displayed using the fire color scheme
  17000. @item fiery
  17001. each channel is displayed using the fiery color scheme
  17002. @item fruit
  17003. each channel is displayed using the fruit color scheme
  17004. @item cool
  17005. each channel is displayed using the cool color scheme
  17006. @item magma
  17007. each channel is displayed using the magma color scheme
  17008. @item green
  17009. each channel is displayed using the green color scheme
  17010. @item viridis
  17011. each channel is displayed using the viridis color scheme
  17012. @item plasma
  17013. each channel is displayed using the plasma color scheme
  17014. @item cividis
  17015. each channel is displayed using the cividis color scheme
  17016. @item terrain
  17017. each channel is displayed using the terrain color scheme
  17018. @end table
  17019. Default value is @samp{intensity}.
  17020. @item scale
  17021. Specify scale used for calculating intensity color values.
  17022. It accepts the following values:
  17023. @table @samp
  17024. @item lin
  17025. linear
  17026. @item sqrt
  17027. square root, default
  17028. @item cbrt
  17029. cubic root
  17030. @item log
  17031. logarithmic
  17032. @item 4thrt
  17033. 4th root
  17034. @item 5thrt
  17035. 5th root
  17036. @end table
  17037. Default value is @samp{log}.
  17038. @item saturation
  17039. Set saturation modifier for displayed colors. Negative values provide
  17040. alternative color scheme. @code{0} is no saturation at all.
  17041. Saturation must be in [-10.0, 10.0] range.
  17042. Default value is @code{1}.
  17043. @item win_func
  17044. Set window function.
  17045. It accepts the following values:
  17046. @table @samp
  17047. @item rect
  17048. @item bartlett
  17049. @item hann
  17050. @item hanning
  17051. @item hamming
  17052. @item blackman
  17053. @item welch
  17054. @item flattop
  17055. @item bharris
  17056. @item bnuttall
  17057. @item bhann
  17058. @item sine
  17059. @item nuttall
  17060. @item lanczos
  17061. @item gauss
  17062. @item tukey
  17063. @item dolph
  17064. @item cauchy
  17065. @item parzen
  17066. @item poisson
  17067. @item bohman
  17068. @end table
  17069. Default value is @code{hann}.
  17070. @item orientation
  17071. Set orientation of time vs frequency axis. Can be @code{vertical} or
  17072. @code{horizontal}. Default is @code{vertical}.
  17073. @item gain
  17074. Set scale gain for calculating intensity color values.
  17075. Default value is @code{1}.
  17076. @item legend
  17077. Draw time and frequency axes and legends. Default is enabled.
  17078. @item rotation
  17079. Set color rotation, must be in [-1.0, 1.0] range.
  17080. Default value is @code{0}.
  17081. @item start
  17082. Set start frequency from which to display spectrogram. Default is @code{0}.
  17083. @item stop
  17084. Set stop frequency to which to display spectrogram. Default is @code{0}.
  17085. @end table
  17086. @subsection Examples
  17087. @itemize
  17088. @item
  17089. Extract an audio spectrogram of a whole audio track
  17090. in a 1024x1024 picture using @command{ffmpeg}:
  17091. @example
  17092. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  17093. @end example
  17094. @end itemize
  17095. @section showvolume
  17096. Convert input audio volume to a video output.
  17097. The filter accepts the following options:
  17098. @table @option
  17099. @item rate, r
  17100. Set video rate.
  17101. @item b
  17102. Set border width, allowed range is [0, 5]. Default is 1.
  17103. @item w
  17104. Set channel width, allowed range is [80, 8192]. Default is 400.
  17105. @item h
  17106. Set channel height, allowed range is [1, 900]. Default is 20.
  17107. @item f
  17108. Set fade, allowed range is [0, 1]. Default is 0.95.
  17109. @item c
  17110. Set volume color expression.
  17111. The expression can use the following variables:
  17112. @table @option
  17113. @item VOLUME
  17114. Current max volume of channel in dB.
  17115. @item PEAK
  17116. Current peak.
  17117. @item CHANNEL
  17118. Current channel number, starting from 0.
  17119. @end table
  17120. @item t
  17121. If set, displays channel names. Default is enabled.
  17122. @item v
  17123. If set, displays volume values. Default is enabled.
  17124. @item o
  17125. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  17126. default is @code{h}.
  17127. @item s
  17128. Set step size, allowed range is [0, 5]. Default is 0, which means
  17129. step is disabled.
  17130. @item p
  17131. Set background opacity, allowed range is [0, 1]. Default is 0.
  17132. @item m
  17133. Set metering mode, can be peak: @code{p} or rms: @code{r},
  17134. default is @code{p}.
  17135. @item ds
  17136. Set display scale, can be linear: @code{lin} or log: @code{log},
  17137. default is @code{lin}.
  17138. @item dm
  17139. In second.
  17140. If set to > 0., display a line for the max level
  17141. in the previous seconds.
  17142. default is disabled: @code{0.}
  17143. @item dmc
  17144. The color of the max line. Use when @code{dm} option is set to > 0.
  17145. default is: @code{orange}
  17146. @end table
  17147. @section showwaves
  17148. Convert input audio to a video output, representing the samples waves.
  17149. The filter accepts the following options:
  17150. @table @option
  17151. @item size, s
  17152. Specify the video size for the output. For the syntax of this option, check the
  17153. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17154. Default value is @code{600x240}.
  17155. @item mode
  17156. Set display mode.
  17157. Available values are:
  17158. @table @samp
  17159. @item point
  17160. Draw a point for each sample.
  17161. @item line
  17162. Draw a vertical line for each sample.
  17163. @item p2p
  17164. Draw a point for each sample and a line between them.
  17165. @item cline
  17166. Draw a centered vertical line for each sample.
  17167. @end table
  17168. Default value is @code{point}.
  17169. @item n
  17170. Set the number of samples which are printed on the same column. A
  17171. larger value will decrease the frame rate. Must be a positive
  17172. integer. This option can be set only if the value for @var{rate}
  17173. is not explicitly specified.
  17174. @item rate, r
  17175. Set the (approximate) output frame rate. This is done by setting the
  17176. option @var{n}. Default value is "25".
  17177. @item split_channels
  17178. Set if channels should be drawn separately or overlap. Default value is 0.
  17179. @item colors
  17180. Set colors separated by '|' which are going to be used for drawing of each channel.
  17181. @item scale
  17182. Set amplitude scale.
  17183. Available values are:
  17184. @table @samp
  17185. @item lin
  17186. Linear.
  17187. @item log
  17188. Logarithmic.
  17189. @item sqrt
  17190. Square root.
  17191. @item cbrt
  17192. Cubic root.
  17193. @end table
  17194. Default is linear.
  17195. @item draw
  17196. Set the draw mode. This is mostly useful to set for high @var{n}.
  17197. Available values are:
  17198. @table @samp
  17199. @item scale
  17200. Scale pixel values for each drawn sample.
  17201. @item full
  17202. Draw every sample directly.
  17203. @end table
  17204. Default value is @code{scale}.
  17205. @end table
  17206. @subsection Examples
  17207. @itemize
  17208. @item
  17209. Output the input file audio and the corresponding video representation
  17210. at the same time:
  17211. @example
  17212. amovie=a.mp3,asplit[out0],showwaves[out1]
  17213. @end example
  17214. @item
  17215. Create a synthetic signal and show it with showwaves, forcing a
  17216. frame rate of 30 frames per second:
  17217. @example
  17218. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  17219. @end example
  17220. @end itemize
  17221. @section showwavespic
  17222. Convert input audio to a single video frame, representing the samples waves.
  17223. The filter accepts the following options:
  17224. @table @option
  17225. @item size, s
  17226. Specify the video size for the output. For the syntax of this option, check the
  17227. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17228. Default value is @code{600x240}.
  17229. @item split_channels
  17230. Set if channels should be drawn separately or overlap. Default value is 0.
  17231. @item colors
  17232. Set colors separated by '|' which are going to be used for drawing of each channel.
  17233. @item scale
  17234. Set amplitude scale.
  17235. Available values are:
  17236. @table @samp
  17237. @item lin
  17238. Linear.
  17239. @item log
  17240. Logarithmic.
  17241. @item sqrt
  17242. Square root.
  17243. @item cbrt
  17244. Cubic root.
  17245. @end table
  17246. Default is linear.
  17247. @end table
  17248. @subsection Examples
  17249. @itemize
  17250. @item
  17251. Extract a channel split representation of the wave form of a whole audio track
  17252. in a 1024x800 picture using @command{ffmpeg}:
  17253. @example
  17254. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  17255. @end example
  17256. @end itemize
  17257. @section sidedata, asidedata
  17258. Delete frame side data, or select frames based on it.
  17259. This filter accepts the following options:
  17260. @table @option
  17261. @item mode
  17262. Set mode of operation of the filter.
  17263. Can be one of the following:
  17264. @table @samp
  17265. @item select
  17266. Select every frame with side data of @code{type}.
  17267. @item delete
  17268. Delete side data of @code{type}. If @code{type} is not set, delete all side
  17269. data in the frame.
  17270. @end table
  17271. @item type
  17272. Set side data type used with all modes. Must be set for @code{select} mode. For
  17273. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  17274. in @file{libavutil/frame.h}. For example, to choose
  17275. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  17276. @end table
  17277. @section spectrumsynth
  17278. Sythesize audio from 2 input video spectrums, first input stream represents
  17279. magnitude across time and second represents phase across time.
  17280. The filter will transform from frequency domain as displayed in videos back
  17281. to time domain as presented in audio output.
  17282. This filter is primarily created for reversing processed @ref{showspectrum}
  17283. filter outputs, but can synthesize sound from other spectrograms too.
  17284. But in such case results are going to be poor if the phase data is not
  17285. available, because in such cases phase data need to be recreated, usually
  17286. it's just recreated from random noise.
  17287. For best results use gray only output (@code{channel} color mode in
  17288. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  17289. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  17290. @code{data} option. Inputs videos should generally use @code{fullframe}
  17291. slide mode as that saves resources needed for decoding video.
  17292. The filter accepts the following options:
  17293. @table @option
  17294. @item sample_rate
  17295. Specify sample rate of output audio, the sample rate of audio from which
  17296. spectrum was generated may differ.
  17297. @item channels
  17298. Set number of channels represented in input video spectrums.
  17299. @item scale
  17300. Set scale which was used when generating magnitude input spectrum.
  17301. Can be @code{lin} or @code{log}. Default is @code{log}.
  17302. @item slide
  17303. Set slide which was used when generating inputs spectrums.
  17304. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  17305. Default is @code{fullframe}.
  17306. @item win_func
  17307. Set window function used for resynthesis.
  17308. @item overlap
  17309. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  17310. which means optimal overlap for selected window function will be picked.
  17311. @item orientation
  17312. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  17313. Default is @code{vertical}.
  17314. @end table
  17315. @subsection Examples
  17316. @itemize
  17317. @item
  17318. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  17319. then resynthesize videos back to audio with spectrumsynth:
  17320. @example
  17321. 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
  17322. 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
  17323. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  17324. @end example
  17325. @end itemize
  17326. @section split, asplit
  17327. Split input into several identical outputs.
  17328. @code{asplit} works with audio input, @code{split} with video.
  17329. The filter accepts a single parameter which specifies the number of outputs. If
  17330. unspecified, it defaults to 2.
  17331. @subsection Examples
  17332. @itemize
  17333. @item
  17334. Create two separate outputs from the same input:
  17335. @example
  17336. [in] split [out0][out1]
  17337. @end example
  17338. @item
  17339. To create 3 or more outputs, you need to specify the number of
  17340. outputs, like in:
  17341. @example
  17342. [in] asplit=3 [out0][out1][out2]
  17343. @end example
  17344. @item
  17345. Create two separate outputs from the same input, one cropped and
  17346. one padded:
  17347. @example
  17348. [in] split [splitout1][splitout2];
  17349. [splitout1] crop=100:100:0:0 [cropout];
  17350. [splitout2] pad=200:200:100:100 [padout];
  17351. @end example
  17352. @item
  17353. Create 5 copies of the input audio with @command{ffmpeg}:
  17354. @example
  17355. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  17356. @end example
  17357. @end itemize
  17358. @section zmq, azmq
  17359. Receive commands sent through a libzmq client, and forward them to
  17360. filters in the filtergraph.
  17361. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  17362. must be inserted between two video filters, @code{azmq} between two
  17363. audio filters. Both are capable to send messages to any filter type.
  17364. To enable these filters you need to install the libzmq library and
  17365. headers and configure FFmpeg with @code{--enable-libzmq}.
  17366. For more information about libzmq see:
  17367. @url{http://www.zeromq.org/}
  17368. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  17369. receives messages sent through a network interface defined by the
  17370. @option{bind_address} (or the abbreviation "@option{b}") option.
  17371. Default value of this option is @file{tcp://localhost:5555}. You may
  17372. want to alter this value to your needs, but do not forget to escape any
  17373. ':' signs (see @ref{filtergraph escaping}).
  17374. The received message must be in the form:
  17375. @example
  17376. @var{TARGET} @var{COMMAND} [@var{ARG}]
  17377. @end example
  17378. @var{TARGET} specifies the target of the command, usually the name of
  17379. the filter class or a specific filter instance name. The default
  17380. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  17381. but you can override this by using the @samp{filter_name@@id} syntax
  17382. (see @ref{Filtergraph syntax}).
  17383. @var{COMMAND} specifies the name of the command for the target filter.
  17384. @var{ARG} is optional and specifies the optional argument list for the
  17385. given @var{COMMAND}.
  17386. Upon reception, the message is processed and the corresponding command
  17387. is injected into the filtergraph. Depending on the result, the filter
  17388. will send a reply to the client, adopting the format:
  17389. @example
  17390. @var{ERROR_CODE} @var{ERROR_REASON}
  17391. @var{MESSAGE}
  17392. @end example
  17393. @var{MESSAGE} is optional.
  17394. @subsection Examples
  17395. Look at @file{tools/zmqsend} for an example of a zmq client which can
  17396. be used to send commands processed by these filters.
  17397. Consider the following filtergraph generated by @command{ffplay}.
  17398. In this example the last overlay filter has an instance name. All other
  17399. filters will have default instance names.
  17400. @example
  17401. ffplay -dumpgraph 1 -f lavfi "
  17402. color=s=100x100:c=red [l];
  17403. color=s=100x100:c=blue [r];
  17404. nullsrc=s=200x100, zmq [bg];
  17405. [bg][l] overlay [bg+l];
  17406. [bg+l][r] overlay@@my=x=100 "
  17407. @end example
  17408. To change the color of the left side of the video, the following
  17409. command can be used:
  17410. @example
  17411. echo Parsed_color_0 c yellow | tools/zmqsend
  17412. @end example
  17413. To change the right side:
  17414. @example
  17415. echo Parsed_color_1 c pink | tools/zmqsend
  17416. @end example
  17417. To change the position of the right side:
  17418. @example
  17419. echo overlay@@my x 150 | tools/zmqsend
  17420. @end example
  17421. @c man end MULTIMEDIA FILTERS
  17422. @chapter Multimedia Sources
  17423. @c man begin MULTIMEDIA SOURCES
  17424. Below is a description of the currently available multimedia sources.
  17425. @section amovie
  17426. This is the same as @ref{movie} source, except it selects an audio
  17427. stream by default.
  17428. @anchor{movie}
  17429. @section movie
  17430. Read audio and/or video stream(s) from a movie container.
  17431. It accepts the following parameters:
  17432. @table @option
  17433. @item filename
  17434. The name of the resource to read (not necessarily a file; it can also be a
  17435. device or a stream accessed through some protocol).
  17436. @item format_name, f
  17437. Specifies the format assumed for the movie to read, and can be either
  17438. the name of a container or an input device. If not specified, the
  17439. format is guessed from @var{movie_name} or by probing.
  17440. @item seek_point, sp
  17441. Specifies the seek point in seconds. The frames will be output
  17442. starting from this seek point. The parameter is evaluated with
  17443. @code{av_strtod}, so the numerical value may be suffixed by an IS
  17444. postfix. The default value is "0".
  17445. @item streams, s
  17446. Specifies the streams to read. Several streams can be specified,
  17447. separated by "+". The source will then have as many outputs, in the
  17448. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  17449. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  17450. respectively the default (best suited) video and audio stream. Default
  17451. is "dv", or "da" if the filter is called as "amovie".
  17452. @item stream_index, si
  17453. Specifies the index of the video stream to read. If the value is -1,
  17454. the most suitable video stream will be automatically selected. The default
  17455. value is "-1". Deprecated. If the filter is called "amovie", it will select
  17456. audio instead of video.
  17457. @item loop
  17458. Specifies how many times to read the stream in sequence.
  17459. If the value is 0, the stream will be looped infinitely.
  17460. Default value is "1".
  17461. Note that when the movie is looped the source timestamps are not
  17462. changed, so it will generate non monotonically increasing timestamps.
  17463. @item discontinuity
  17464. Specifies the time difference between frames above which the point is
  17465. considered a timestamp discontinuity which is removed by adjusting the later
  17466. timestamps.
  17467. @end table
  17468. It allows overlaying a second video on top of the main input of
  17469. a filtergraph, as shown in this graph:
  17470. @example
  17471. input -----------> deltapts0 --> overlay --> output
  17472. ^
  17473. |
  17474. movie --> scale--> deltapts1 -------+
  17475. @end example
  17476. @subsection Examples
  17477. @itemize
  17478. @item
  17479. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  17480. on top of the input labelled "in":
  17481. @example
  17482. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  17483. [in] setpts=PTS-STARTPTS [main];
  17484. [main][over] overlay=16:16 [out]
  17485. @end example
  17486. @item
  17487. Read from a video4linux2 device, and overlay it on top of the input
  17488. labelled "in":
  17489. @example
  17490. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  17491. [in] setpts=PTS-STARTPTS [main];
  17492. [main][over] overlay=16:16 [out]
  17493. @end example
  17494. @item
  17495. Read the first video stream and the audio stream with id 0x81 from
  17496. dvd.vob; the video is connected to the pad named "video" and the audio is
  17497. connected to the pad named "audio":
  17498. @example
  17499. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  17500. @end example
  17501. @end itemize
  17502. @subsection Commands
  17503. Both movie and amovie support the following commands:
  17504. @table @option
  17505. @item seek
  17506. Perform seek using "av_seek_frame".
  17507. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  17508. @itemize
  17509. @item
  17510. @var{stream_index}: If stream_index is -1, a default
  17511. stream is selected, and @var{timestamp} is automatically converted
  17512. from AV_TIME_BASE units to the stream specific time_base.
  17513. @item
  17514. @var{timestamp}: Timestamp in AVStream.time_base units
  17515. or, if no stream is specified, in AV_TIME_BASE units.
  17516. @item
  17517. @var{flags}: Flags which select direction and seeking mode.
  17518. @end itemize
  17519. @item get_duration
  17520. Get movie duration in AV_TIME_BASE units.
  17521. @end table
  17522. @c man end MULTIMEDIA SOURCES