filters.texi 544 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525
  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 threshold
  315. If a signal of stream rises above this level it will affect the gain
  316. reduction.
  317. By default it is 0.125. Range is between 0.00097563 and 1.
  318. @item ratio
  319. Set a ratio by which the signal is reduced. 1:2 means that if the level
  320. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  321. Default is 2. Range is between 1 and 20.
  322. @item attack
  323. Amount of milliseconds the signal has to rise above the threshold before gain
  324. reduction starts. Default is 20. Range is between 0.01 and 2000.
  325. @item release
  326. Amount of milliseconds the signal has to fall below the threshold before
  327. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  328. @item makeup
  329. Set the amount by how much signal will be amplified after processing.
  330. Default is 1. Range is from 1 to 64.
  331. @item knee
  332. Curve the sharp knee around the threshold to enter gain reduction more softly.
  333. Default is 2.82843. Range is between 1 and 8.
  334. @item link
  335. Choose if the @code{average} level between all channels of input stream
  336. or the louder(@code{maximum}) channel of input stream affects the
  337. reduction. Default is @code{average}.
  338. @item detection
  339. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  340. of @code{rms}. Default is @code{rms} which is mostly smoother.
  341. @item mix
  342. How much to use compressed signal in output. Default is 1.
  343. Range is between 0 and 1.
  344. @end table
  345. @section acontrast
  346. Simple audio dynamic range commpression/expansion filter.
  347. The filter accepts the following options:
  348. @table @option
  349. @item contrast
  350. Set contrast. Default is 33. Allowed range is between 0 and 100.
  351. @end table
  352. @section acopy
  353. Copy the input audio source unchanged to the output. This is mainly useful for
  354. testing purposes.
  355. @section acrossfade
  356. Apply cross fade from one input audio stream to another input audio stream.
  357. The cross fade is applied for specified duration near the end of first stream.
  358. The filter accepts the following options:
  359. @table @option
  360. @item nb_samples, ns
  361. Specify the number of samples for which the cross fade effect has to last.
  362. At the end of the cross fade effect the first input audio will be completely
  363. silent. Default is 44100.
  364. @item duration, d
  365. Specify the duration of the cross fade effect. See
  366. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  367. for the accepted syntax.
  368. By default the duration is determined by @var{nb_samples}.
  369. If set this option is used instead of @var{nb_samples}.
  370. @item overlap, o
  371. Should first stream end overlap with second stream start. Default is enabled.
  372. @item curve1
  373. Set curve for cross fade transition for first stream.
  374. @item curve2
  375. Set curve for cross fade transition for second stream.
  376. For description of available curve types see @ref{afade} filter description.
  377. @end table
  378. @subsection Examples
  379. @itemize
  380. @item
  381. Cross fade from one input to another:
  382. @example
  383. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  384. @end example
  385. @item
  386. Cross fade from one input to another but without overlapping:
  387. @example
  388. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  389. @end example
  390. @end itemize
  391. @section acrusher
  392. Reduce audio bit resolution.
  393. This filter is bit crusher with enhanced functionality. A bit crusher
  394. is used to audibly reduce number of bits an audio signal is sampled
  395. with. This doesn't change the bit depth at all, it just produces the
  396. effect. Material reduced in bit depth sounds more harsh and "digital".
  397. This filter is able to even round to continuous values instead of discrete
  398. bit depths.
  399. Additionally it has a D/C offset which results in different crushing of
  400. the lower and the upper half of the signal.
  401. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  402. Another feature of this filter is the logarithmic mode.
  403. This setting switches from linear distances between bits to logarithmic ones.
  404. The result is a much more "natural" sounding crusher which doesn't gate low
  405. signals for example. The human ear has a logarithmic perception,
  406. so this kind of crushing is much more pleasant.
  407. Logarithmic crushing is also able to get anti-aliased.
  408. The filter accepts the following options:
  409. @table @option
  410. @item level_in
  411. Set level in.
  412. @item level_out
  413. Set level out.
  414. @item bits
  415. Set bit reduction.
  416. @item mix
  417. Set mixing amount.
  418. @item mode
  419. Can be linear: @code{lin} or logarithmic: @code{log}.
  420. @item dc
  421. Set DC.
  422. @item aa
  423. Set anti-aliasing.
  424. @item samples
  425. Set sample reduction.
  426. @item lfo
  427. Enable LFO. By default disabled.
  428. @item lforange
  429. Set LFO range.
  430. @item lforate
  431. Set LFO rate.
  432. @end table
  433. @section adelay
  434. Delay one or more audio channels.
  435. Samples in delayed channel are filled with silence.
  436. The filter accepts the following option:
  437. @table @option
  438. @item delays
  439. Set list of delays in milliseconds for each channel separated by '|'.
  440. Unused delays will be silently ignored. If number of given delays is
  441. smaller than number of channels all remaining channels will not be delayed.
  442. If you want to delay exact number of samples, append 'S' to number.
  443. @end table
  444. @subsection Examples
  445. @itemize
  446. @item
  447. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  448. the second channel (and any other channels that may be present) unchanged.
  449. @example
  450. adelay=1500|0|500
  451. @end example
  452. @item
  453. Delay second channel by 500 samples, the third channel by 700 samples and leave
  454. the first channel (and any other channels that may be present) unchanged.
  455. @example
  456. adelay=0|500S|700S
  457. @end example
  458. @end itemize
  459. @section aecho
  460. Apply echoing to the input audio.
  461. Echoes are reflected sound and can occur naturally amongst mountains
  462. (and sometimes large buildings) when talking or shouting; digital echo
  463. effects emulate this behaviour and are often used to help fill out the
  464. sound of a single instrument or vocal. The time difference between the
  465. original signal and the reflection is the @code{delay}, and the
  466. loudness of the reflected signal is the @code{decay}.
  467. Multiple echoes can have different delays and decays.
  468. A description of the accepted parameters follows.
  469. @table @option
  470. @item in_gain
  471. Set input gain of reflected signal. Default is @code{0.6}.
  472. @item out_gain
  473. Set output gain of reflected signal. Default is @code{0.3}.
  474. @item delays
  475. Set list of time intervals in milliseconds between original signal and reflections
  476. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  477. Default is @code{1000}.
  478. @item decays
  479. Set list of loudness of reflected signals separated by '|'.
  480. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  481. Default is @code{0.5}.
  482. @end table
  483. @subsection Examples
  484. @itemize
  485. @item
  486. Make it sound as if there are twice as many instruments as are actually playing:
  487. @example
  488. aecho=0.8:0.88:60:0.4
  489. @end example
  490. @item
  491. If delay is very short, then it sound like a (metallic) robot playing music:
  492. @example
  493. aecho=0.8:0.88:6:0.4
  494. @end example
  495. @item
  496. A longer delay will sound like an open air concert in the mountains:
  497. @example
  498. aecho=0.8:0.9:1000:0.3
  499. @end example
  500. @item
  501. Same as above but with one more mountain:
  502. @example
  503. aecho=0.8:0.9:1000|1800:0.3|0.25
  504. @end example
  505. @end itemize
  506. @section aemphasis
  507. Audio emphasis filter creates or restores material directly taken from LPs or
  508. emphased CDs with different filter curves. E.g. to store music on vinyl the
  509. signal has to be altered by a filter first to even out the disadvantages of
  510. this recording medium.
  511. Once the material is played back the inverse filter has to be applied to
  512. restore the distortion of the frequency response.
  513. The filter accepts the following options:
  514. @table @option
  515. @item level_in
  516. Set input gain.
  517. @item level_out
  518. Set output gain.
  519. @item mode
  520. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  521. use @code{production} mode. Default is @code{reproduction} mode.
  522. @item type
  523. Set filter type. Selects medium. Can be one of the following:
  524. @table @option
  525. @item col
  526. select Columbia.
  527. @item emi
  528. select EMI.
  529. @item bsi
  530. select BSI (78RPM).
  531. @item riaa
  532. select RIAA.
  533. @item cd
  534. select Compact Disc (CD).
  535. @item 50fm
  536. select 50µs (FM).
  537. @item 75fm
  538. select 75µs (FM).
  539. @item 50kf
  540. select 50µs (FM-KF).
  541. @item 75kf
  542. select 75µs (FM-KF).
  543. @end table
  544. @end table
  545. @section aeval
  546. Modify an audio signal according to the specified expressions.
  547. This filter accepts one or more expressions (one for each channel),
  548. which are evaluated and used to modify a corresponding audio signal.
  549. It accepts the following parameters:
  550. @table @option
  551. @item exprs
  552. Set the '|'-separated expressions list for each separate channel. If
  553. the number of input channels is greater than the number of
  554. expressions, the last specified expression is used for the remaining
  555. output channels.
  556. @item channel_layout, c
  557. Set output channel layout. If not specified, the channel layout is
  558. specified by the number of expressions. If set to @samp{same}, it will
  559. use by default the same input channel layout.
  560. @end table
  561. Each expression in @var{exprs} can contain the following constants and functions:
  562. @table @option
  563. @item ch
  564. channel number of the current expression
  565. @item n
  566. number of the evaluated sample, starting from 0
  567. @item s
  568. sample rate
  569. @item t
  570. time of the evaluated sample expressed in seconds
  571. @item nb_in_channels
  572. @item nb_out_channels
  573. input and output number of channels
  574. @item val(CH)
  575. the value of input channel with number @var{CH}
  576. @end table
  577. Note: this filter is slow. For faster processing you should use a
  578. dedicated filter.
  579. @subsection Examples
  580. @itemize
  581. @item
  582. Half volume:
  583. @example
  584. aeval=val(ch)/2:c=same
  585. @end example
  586. @item
  587. Invert phase of the second channel:
  588. @example
  589. aeval=val(0)|-val(1)
  590. @end example
  591. @end itemize
  592. @anchor{afade}
  593. @section afade
  594. Apply fade-in/out effect to input audio.
  595. A description of the accepted parameters follows.
  596. @table @option
  597. @item type, t
  598. Specify the effect type, can be either @code{in} for fade-in, or
  599. @code{out} for a fade-out effect. Default is @code{in}.
  600. @item start_sample, ss
  601. Specify the number of the start sample for starting to apply the fade
  602. effect. Default is 0.
  603. @item nb_samples, ns
  604. Specify the number of samples for which the fade effect has to last. At
  605. the end of the fade-in effect the output audio will have the same
  606. volume as the input audio, at the end of the fade-out transition
  607. the output audio will be silence. Default is 44100.
  608. @item start_time, st
  609. Specify the start time of the fade effect. Default is 0.
  610. The value must be specified as a time duration; see
  611. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  612. for the accepted syntax.
  613. If set this option is used instead of @var{start_sample}.
  614. @item duration, d
  615. Specify the duration of the fade effect. See
  616. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  617. for the accepted syntax.
  618. At the end of the fade-in effect the output audio will have the same
  619. volume as the input audio, at the end of the fade-out transition
  620. the output audio will be silence.
  621. By default the duration is determined by @var{nb_samples}.
  622. If set this option is used instead of @var{nb_samples}.
  623. @item curve
  624. Set curve for fade transition.
  625. It accepts the following values:
  626. @table @option
  627. @item tri
  628. select triangular, linear slope (default)
  629. @item qsin
  630. select quarter of sine wave
  631. @item hsin
  632. select half of sine wave
  633. @item esin
  634. select exponential sine wave
  635. @item log
  636. select logarithmic
  637. @item ipar
  638. select inverted parabola
  639. @item qua
  640. select quadratic
  641. @item cub
  642. select cubic
  643. @item squ
  644. select square root
  645. @item cbr
  646. select cubic root
  647. @item par
  648. select parabola
  649. @item exp
  650. select exponential
  651. @item iqsin
  652. select inverted quarter of sine wave
  653. @item ihsin
  654. select inverted half of sine wave
  655. @item dese
  656. select double-exponential seat
  657. @item desi
  658. select double-exponential sigmoid
  659. @end table
  660. @end table
  661. @subsection Examples
  662. @itemize
  663. @item
  664. Fade in first 15 seconds of audio:
  665. @example
  666. afade=t=in:ss=0:d=15
  667. @end example
  668. @item
  669. Fade out last 25 seconds of a 900 seconds audio:
  670. @example
  671. afade=t=out:st=875:d=25
  672. @end example
  673. @end itemize
  674. @section afftfilt
  675. Apply arbitrary expressions to samples in frequency domain.
  676. @table @option
  677. @item real
  678. Set frequency domain real expression for each separate channel separated
  679. by '|'. Default is "1".
  680. If the number of input channels is greater than the number of
  681. expressions, the last specified expression is used for the remaining
  682. output channels.
  683. @item imag
  684. Set frequency domain imaginary expression for each separate channel
  685. separated by '|'. If not set, @var{real} option is used.
  686. Each expression in @var{real} and @var{imag} can contain the following
  687. constants:
  688. @table @option
  689. @item sr
  690. sample rate
  691. @item b
  692. current frequency bin number
  693. @item nb
  694. number of available bins
  695. @item ch
  696. channel number of the current expression
  697. @item chs
  698. number of channels
  699. @item pts
  700. current frame pts
  701. @end table
  702. @item win_size
  703. Set window size.
  704. It accepts the following values:
  705. @table @samp
  706. @item w16
  707. @item w32
  708. @item w64
  709. @item w128
  710. @item w256
  711. @item w512
  712. @item w1024
  713. @item w2048
  714. @item w4096
  715. @item w8192
  716. @item w16384
  717. @item w32768
  718. @item w65536
  719. @end table
  720. Default is @code{w4096}
  721. @item win_func
  722. Set window function. Default is @code{hann}.
  723. @item overlap
  724. Set window overlap. If set to 1, the recommended overlap for selected
  725. window function will be picked. Default is @code{0.75}.
  726. @end table
  727. @subsection Examples
  728. @itemize
  729. @item
  730. Leave almost only low frequencies in audio:
  731. @example
  732. afftfilt="1-clip((b/nb)*b,0,1)"
  733. @end example
  734. @end itemize
  735. @anchor{afir}
  736. @section afir
  737. Apply an arbitrary Frequency Impulse Response filter.
  738. This filter is designed for applying long FIR filters,
  739. up to 30 seconds long.
  740. It can be used as component for digital crossover filters,
  741. room equalization, cross talk cancellation, wavefield synthesis,
  742. auralization, ambiophonics and ambisonics.
  743. This filter uses second stream as FIR coefficients.
  744. If second stream holds single channel, it will be used
  745. for all input channels in first stream, otherwise
  746. number of channels in second stream must be same as
  747. number of channels in first stream.
  748. It accepts the following parameters:
  749. @table @option
  750. @item dry
  751. Set dry gain. This sets input gain.
  752. @item wet
  753. Set wet gain. This sets final output gain.
  754. @item length
  755. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  756. @item again
  757. Enable applying gain measured from power of IR.
  758. @end table
  759. @subsection Examples
  760. @itemize
  761. @item
  762. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  763. @example
  764. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  765. @end example
  766. @end itemize
  767. @anchor{aformat}
  768. @section aformat
  769. Set output format constraints for the input audio. The framework will
  770. negotiate the most appropriate format to minimize conversions.
  771. It accepts the following parameters:
  772. @table @option
  773. @item sample_fmts
  774. A '|'-separated list of requested sample formats.
  775. @item sample_rates
  776. A '|'-separated list of requested sample rates.
  777. @item channel_layouts
  778. A '|'-separated list of requested channel layouts.
  779. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  780. for the required syntax.
  781. @end table
  782. If a parameter is omitted, all values are allowed.
  783. Force the output to either unsigned 8-bit or signed 16-bit stereo
  784. @example
  785. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  786. @end example
  787. @section agate
  788. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  789. processing reduces disturbing noise between useful signals.
  790. Gating is done by detecting the volume below a chosen level @var{threshold}
  791. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  792. floor is set via @var{range}. Because an exact manipulation of the signal
  793. would cause distortion of the waveform the reduction can be levelled over
  794. time. This is done by setting @var{attack} and @var{release}.
  795. @var{attack} determines how long the signal has to fall below the threshold
  796. before any reduction will occur and @var{release} sets the time the signal
  797. has to rise above the threshold to reduce the reduction again.
  798. Shorter signals than the chosen attack time will be left untouched.
  799. @table @option
  800. @item level_in
  801. Set input level before filtering.
  802. Default is 1. Allowed range is from 0.015625 to 64.
  803. @item range
  804. Set the level of gain reduction when the signal is below the threshold.
  805. Default is 0.06125. Allowed range is from 0 to 1.
  806. @item threshold
  807. If a signal rises above this level the gain reduction is released.
  808. Default is 0.125. Allowed range is from 0 to 1.
  809. @item ratio
  810. Set a ratio by which the signal is reduced.
  811. Default is 2. Allowed range is from 1 to 9000.
  812. @item attack
  813. Amount of milliseconds the signal has to rise above the threshold before gain
  814. reduction stops.
  815. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  816. @item release
  817. Amount of milliseconds the signal has to fall below the threshold before the
  818. reduction is increased again. Default is 250 milliseconds.
  819. Allowed range is from 0.01 to 9000.
  820. @item makeup
  821. Set amount of amplification of signal after processing.
  822. Default is 1. Allowed range is from 1 to 64.
  823. @item knee
  824. Curve the sharp knee around the threshold to enter gain reduction more softly.
  825. Default is 2.828427125. Allowed range is from 1 to 8.
  826. @item detection
  827. Choose if exact signal should be taken for detection or an RMS like one.
  828. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  829. @item link
  830. Choose if the average level between all channels or the louder channel affects
  831. the reduction.
  832. Default is @code{average}. Can be @code{average} or @code{maximum}.
  833. @end table
  834. @section aiir
  835. Apply an arbitrary Infinite Impulse Response filter.
  836. It accepts the following parameters:
  837. @table @option
  838. @item z
  839. Set numerator/zeros coefficients.
  840. @item p
  841. Set denominator/poles coefficients.
  842. @item k
  843. Set channels gains.
  844. @item dry_gain
  845. Set input gain.
  846. @item wet_gain
  847. Set output gain.
  848. @item f
  849. Set coefficients format.
  850. @table @samp
  851. @item tf
  852. transfer function
  853. @item zp
  854. Z-plane zeros/poles, cartesian (default)
  855. @item pr
  856. Z-plane zeros/poles, polar radians
  857. @item pd
  858. Z-plane zeros/poles, polar degrees
  859. @end table
  860. @item r
  861. Set kind of processing.
  862. Can be @code{d} - direct or @code{s} - serial cascading. Defauls is @code{s}.
  863. @item e
  864. Set filtering precision.
  865. @table @samp
  866. @item dbl
  867. double-precision floating-point (default)
  868. @item flt
  869. single-precision floating-point
  870. @item i32
  871. 32-bit integers
  872. @item i16
  873. 16-bit integers
  874. @end table
  875. @end table
  876. Coefficients in @code{tf} format are separated by spaces and are in ascending
  877. order.
  878. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  879. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  880. imaginary unit.
  881. Different coefficients and gains can be provided for every channel, in such case
  882. use '|' to separate coefficients or gains. Last provided coefficients will be
  883. used for all remaining channels.
  884. @subsection Examples
  885. @itemize
  886. @item
  887. Apply 2 pole elliptic notch at arround 5000Hz for 48000 Hz sample rate:
  888. @example
  889. 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
  890. @end example
  891. @item
  892. Same as above but in @code{zp} format:
  893. @example
  894. 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
  895. @end example
  896. @end itemize
  897. @section alimiter
  898. The limiter prevents an input signal from rising over a desired threshold.
  899. This limiter uses lookahead technology to prevent your signal from distorting.
  900. It means that there is a small delay after the signal is processed. Keep in mind
  901. that the delay it produces is the attack time you set.
  902. The filter accepts the following options:
  903. @table @option
  904. @item level_in
  905. Set input gain. Default is 1.
  906. @item level_out
  907. Set output gain. Default is 1.
  908. @item limit
  909. Don't let signals above this level pass the limiter. Default is 1.
  910. @item attack
  911. The limiter will reach its attenuation level in this amount of time in
  912. milliseconds. Default is 5 milliseconds.
  913. @item release
  914. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  915. Default is 50 milliseconds.
  916. @item asc
  917. When gain reduction is always needed ASC takes care of releasing to an
  918. average reduction level rather than reaching a reduction of 0 in the release
  919. time.
  920. @item asc_level
  921. Select how much the release time is affected by ASC, 0 means nearly no changes
  922. in release time while 1 produces higher release times.
  923. @item level
  924. Auto level output signal. Default is enabled.
  925. This normalizes audio back to 0dB if enabled.
  926. @end table
  927. Depending on picked setting it is recommended to upsample input 2x or 4x times
  928. with @ref{aresample} before applying this filter.
  929. @section allpass
  930. Apply a two-pole all-pass filter with central frequency (in Hz)
  931. @var{frequency}, and filter-width @var{width}.
  932. An all-pass filter changes the audio's frequency to phase relationship
  933. without changing its frequency to amplitude relationship.
  934. The filter accepts the following options:
  935. @table @option
  936. @item frequency, f
  937. Set frequency in Hz.
  938. @item width_type, t
  939. Set method to specify band-width of filter.
  940. @table @option
  941. @item h
  942. Hz
  943. @item q
  944. Q-Factor
  945. @item o
  946. octave
  947. @item s
  948. slope
  949. @item k
  950. kHz
  951. @end table
  952. @item width, w
  953. Specify the band-width of a filter in width_type units.
  954. @item channels, c
  955. Specify which channels to filter, by default all available are filtered.
  956. @end table
  957. @subsection Commands
  958. This filter supports the following commands:
  959. @table @option
  960. @item frequency, f
  961. Change allpass frequency.
  962. Syntax for the command is : "@var{frequency}"
  963. @item width_type, t
  964. Change allpass width_type.
  965. Syntax for the command is : "@var{width_type}"
  966. @item width, w
  967. Change allpass width.
  968. Syntax for the command is : "@var{width}"
  969. @end table
  970. @section aloop
  971. Loop audio samples.
  972. The filter accepts the following options:
  973. @table @option
  974. @item loop
  975. Set the number of loops. Setting this value to -1 will result in infinite loops.
  976. Default is 0.
  977. @item size
  978. Set maximal number of samples. Default is 0.
  979. @item start
  980. Set first sample of loop. Default is 0.
  981. @end table
  982. @anchor{amerge}
  983. @section amerge
  984. Merge two or more audio streams into a single multi-channel stream.
  985. The filter accepts the following options:
  986. @table @option
  987. @item inputs
  988. Set the number of inputs. Default is 2.
  989. @end table
  990. If the channel layouts of the inputs are disjoint, and therefore compatible,
  991. the channel layout of the output will be set accordingly and the channels
  992. will be reordered as necessary. If the channel layouts of the inputs are not
  993. disjoint, the output will have all the channels of the first input then all
  994. the channels of the second input, in that order, and the channel layout of
  995. the output will be the default value corresponding to the total number of
  996. channels.
  997. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  998. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  999. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1000. first input, b1 is the first channel of the second input).
  1001. On the other hand, if both input are in stereo, the output channels will be
  1002. in the default order: a1, a2, b1, b2, and the channel layout will be
  1003. arbitrarily set to 4.0, which may or may not be the expected value.
  1004. All inputs must have the same sample rate, and format.
  1005. If inputs do not have the same duration, the output will stop with the
  1006. shortest.
  1007. @subsection Examples
  1008. @itemize
  1009. @item
  1010. Merge two mono files into a stereo stream:
  1011. @example
  1012. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1013. @end example
  1014. @item
  1015. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1016. @example
  1017. 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
  1018. @end example
  1019. @end itemize
  1020. @section amix
  1021. Mixes multiple audio inputs into a single output.
  1022. Note that this filter only supports float samples (the @var{amerge}
  1023. and @var{pan} audio filters support many formats). If the @var{amix}
  1024. input has integer samples then @ref{aresample} will be automatically
  1025. inserted to perform the conversion to float samples.
  1026. For example
  1027. @example
  1028. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1029. @end example
  1030. will mix 3 input audio streams to a single output with the same duration as the
  1031. first input and a dropout transition time of 3 seconds.
  1032. It accepts the following parameters:
  1033. @table @option
  1034. @item inputs
  1035. The number of inputs. If unspecified, it defaults to 2.
  1036. @item duration
  1037. How to determine the end-of-stream.
  1038. @table @option
  1039. @item longest
  1040. The duration of the longest input. (default)
  1041. @item shortest
  1042. The duration of the shortest input.
  1043. @item first
  1044. The duration of the first input.
  1045. @end table
  1046. @item dropout_transition
  1047. The transition time, in seconds, for volume renormalization when an input
  1048. stream ends. The default value is 2 seconds.
  1049. @item weights
  1050. Specify weight of each input audio stream as sequence.
  1051. Each weight is separated by space. By default all inputs have same weight.
  1052. @end table
  1053. @section anequalizer
  1054. High-order parametric multiband equalizer for each channel.
  1055. It accepts the following parameters:
  1056. @table @option
  1057. @item params
  1058. This option string is in format:
  1059. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1060. Each equalizer band is separated by '|'.
  1061. @table @option
  1062. @item chn
  1063. Set channel number to which equalization will be applied.
  1064. If input doesn't have that channel the entry is ignored.
  1065. @item f
  1066. Set central frequency for band.
  1067. If input doesn't have that frequency the entry is ignored.
  1068. @item w
  1069. Set band width in hertz.
  1070. @item g
  1071. Set band gain in dB.
  1072. @item t
  1073. Set filter type for band, optional, can be:
  1074. @table @samp
  1075. @item 0
  1076. Butterworth, this is default.
  1077. @item 1
  1078. Chebyshev type 1.
  1079. @item 2
  1080. Chebyshev type 2.
  1081. @end table
  1082. @end table
  1083. @item curves
  1084. With this option activated frequency response of anequalizer is displayed
  1085. in video stream.
  1086. @item size
  1087. Set video stream size. Only useful if curves option is activated.
  1088. @item mgain
  1089. Set max gain that will be displayed. Only useful if curves option is activated.
  1090. Setting this to a reasonable value makes it possible to display gain which is derived from
  1091. neighbour bands which are too close to each other and thus produce higher gain
  1092. when both are activated.
  1093. @item fscale
  1094. Set frequency scale used to draw frequency response in video output.
  1095. Can be linear or logarithmic. Default is logarithmic.
  1096. @item colors
  1097. Set color for each channel curve which is going to be displayed in video stream.
  1098. This is list of color names separated by space or by '|'.
  1099. Unrecognised or missing colors will be replaced by white color.
  1100. @end table
  1101. @subsection Examples
  1102. @itemize
  1103. @item
  1104. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1105. for first 2 channels using Chebyshev type 1 filter:
  1106. @example
  1107. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1108. @end example
  1109. @end itemize
  1110. @subsection Commands
  1111. This filter supports the following commands:
  1112. @table @option
  1113. @item change
  1114. Alter existing filter parameters.
  1115. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1116. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1117. error is returned.
  1118. @var{freq} set new frequency parameter.
  1119. @var{width} set new width parameter in herz.
  1120. @var{gain} set new gain parameter in dB.
  1121. Full filter invocation with asendcmd may look like this:
  1122. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1123. @end table
  1124. @section anull
  1125. Pass the audio source unchanged to the output.
  1126. @section apad
  1127. Pad the end of an audio stream with silence.
  1128. This can be used together with @command{ffmpeg} @option{-shortest} to
  1129. extend audio streams to the same length as the video stream.
  1130. A description of the accepted options follows.
  1131. @table @option
  1132. @item packet_size
  1133. Set silence packet size. Default value is 4096.
  1134. @item pad_len
  1135. Set the number of samples of silence to add to the end. After the
  1136. value is reached, the stream is terminated. This option is mutually
  1137. exclusive with @option{whole_len}.
  1138. @item whole_len
  1139. Set the minimum total number of samples in the output audio stream. If
  1140. the value is longer than the input audio length, silence is added to
  1141. the end, until the value is reached. This option is mutually exclusive
  1142. with @option{pad_len}.
  1143. @end table
  1144. If neither the @option{pad_len} nor the @option{whole_len} option is
  1145. set, the filter will add silence to the end of the input stream
  1146. indefinitely.
  1147. @subsection Examples
  1148. @itemize
  1149. @item
  1150. Add 1024 samples of silence to the end of the input:
  1151. @example
  1152. apad=pad_len=1024
  1153. @end example
  1154. @item
  1155. Make sure the audio output will contain at least 10000 samples, pad
  1156. the input with silence if required:
  1157. @example
  1158. apad=whole_len=10000
  1159. @end example
  1160. @item
  1161. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1162. video stream will always result the shortest and will be converted
  1163. until the end in the output file when using the @option{shortest}
  1164. option:
  1165. @example
  1166. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1167. @end example
  1168. @end itemize
  1169. @section aphaser
  1170. Add a phasing effect to the input audio.
  1171. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1172. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1173. A description of the accepted parameters follows.
  1174. @table @option
  1175. @item in_gain
  1176. Set input gain. Default is 0.4.
  1177. @item out_gain
  1178. Set output gain. Default is 0.74
  1179. @item delay
  1180. Set delay in milliseconds. Default is 3.0.
  1181. @item decay
  1182. Set decay. Default is 0.4.
  1183. @item speed
  1184. Set modulation speed in Hz. Default is 0.5.
  1185. @item type
  1186. Set modulation type. Default is triangular.
  1187. It accepts the following values:
  1188. @table @samp
  1189. @item triangular, t
  1190. @item sinusoidal, s
  1191. @end table
  1192. @end table
  1193. @section apulsator
  1194. Audio pulsator is something between an autopanner and a tremolo.
  1195. But it can produce funny stereo effects as well. Pulsator changes the volume
  1196. of the left and right channel based on a LFO (low frequency oscillator) with
  1197. different waveforms and shifted phases.
  1198. This filter have the ability to define an offset between left and right
  1199. channel. An offset of 0 means that both LFO shapes match each other.
  1200. The left and right channel are altered equally - a conventional tremolo.
  1201. An offset of 50% means that the shape of the right channel is exactly shifted
  1202. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1203. an autopanner. At 1 both curves match again. Every setting in between moves the
  1204. phase shift gapless between all stages and produces some "bypassing" sounds with
  1205. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1206. the 0.5) the faster the signal passes from the left to the right speaker.
  1207. The filter accepts the following options:
  1208. @table @option
  1209. @item level_in
  1210. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1211. @item level_out
  1212. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1213. @item mode
  1214. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1215. sawup or sawdown. Default is sine.
  1216. @item amount
  1217. Set modulation. Define how much of original signal is affected by the LFO.
  1218. @item offset_l
  1219. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1220. @item offset_r
  1221. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1222. @item width
  1223. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1224. @item timing
  1225. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1226. @item bpm
  1227. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1228. is set to bpm.
  1229. @item ms
  1230. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1231. is set to ms.
  1232. @item hz
  1233. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1234. if timing is set to hz.
  1235. @end table
  1236. @anchor{aresample}
  1237. @section aresample
  1238. Resample the input audio to the specified parameters, using the
  1239. libswresample library. If none are specified then the filter will
  1240. automatically convert between its input and output.
  1241. This filter is also able to stretch/squeeze the audio data to make it match
  1242. the timestamps or to inject silence / cut out audio to make it match the
  1243. timestamps, do a combination of both or do neither.
  1244. The filter accepts the syntax
  1245. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1246. expresses a sample rate and @var{resampler_options} is a list of
  1247. @var{key}=@var{value} pairs, separated by ":". See the
  1248. @ref{Resampler Options,,"Resampler Options" section in the
  1249. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1250. for the complete list of supported options.
  1251. @subsection Examples
  1252. @itemize
  1253. @item
  1254. Resample the input audio to 44100Hz:
  1255. @example
  1256. aresample=44100
  1257. @end example
  1258. @item
  1259. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1260. samples per second compensation:
  1261. @example
  1262. aresample=async=1000
  1263. @end example
  1264. @end itemize
  1265. @section areverse
  1266. Reverse an audio clip.
  1267. Warning: This filter requires memory to buffer the entire clip, so trimming
  1268. is suggested.
  1269. @subsection Examples
  1270. @itemize
  1271. @item
  1272. Take the first 5 seconds of a clip, and reverse it.
  1273. @example
  1274. atrim=end=5,areverse
  1275. @end example
  1276. @end itemize
  1277. @section asetnsamples
  1278. Set the number of samples per each output audio frame.
  1279. The last output packet may contain a different number of samples, as
  1280. the filter will flush all the remaining samples when the input audio
  1281. signals its end.
  1282. The filter accepts the following options:
  1283. @table @option
  1284. @item nb_out_samples, n
  1285. Set the number of frames per each output audio frame. The number is
  1286. intended as the number of samples @emph{per each channel}.
  1287. Default value is 1024.
  1288. @item pad, p
  1289. If set to 1, the filter will pad the last audio frame with zeroes, so
  1290. that the last frame will contain the same number of samples as the
  1291. previous ones. Default value is 1.
  1292. @end table
  1293. For example, to set the number of per-frame samples to 1234 and
  1294. disable padding for the last frame, use:
  1295. @example
  1296. asetnsamples=n=1234:p=0
  1297. @end example
  1298. @section asetrate
  1299. Set the sample rate without altering the PCM data.
  1300. This will result in a change of speed and pitch.
  1301. The filter accepts the following options:
  1302. @table @option
  1303. @item sample_rate, r
  1304. Set the output sample rate. Default is 44100 Hz.
  1305. @end table
  1306. @section ashowinfo
  1307. Show a line containing various information for each input audio frame.
  1308. The input audio is not modified.
  1309. The shown line contains a sequence of key/value pairs of the form
  1310. @var{key}:@var{value}.
  1311. The following values are shown in the output:
  1312. @table @option
  1313. @item n
  1314. The (sequential) number of the input frame, starting from 0.
  1315. @item pts
  1316. The presentation timestamp of the input frame, in time base units; the time base
  1317. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1318. @item pts_time
  1319. The presentation timestamp of the input frame in seconds.
  1320. @item pos
  1321. position of the frame in the input stream, -1 if this information in
  1322. unavailable and/or meaningless (for example in case of synthetic audio)
  1323. @item fmt
  1324. The sample format.
  1325. @item chlayout
  1326. The channel layout.
  1327. @item rate
  1328. The sample rate for the audio frame.
  1329. @item nb_samples
  1330. The number of samples (per channel) in the frame.
  1331. @item checksum
  1332. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1333. audio, the data is treated as if all the planes were concatenated.
  1334. @item plane_checksums
  1335. A list of Adler-32 checksums for each data plane.
  1336. @end table
  1337. @anchor{astats}
  1338. @section astats
  1339. Display time domain statistical information about the audio channels.
  1340. Statistics are calculated and displayed for each audio channel and,
  1341. where applicable, an overall figure is also given.
  1342. It accepts the following option:
  1343. @table @option
  1344. @item length
  1345. Short window length in seconds, used for peak and trough RMS measurement.
  1346. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1347. @item metadata
  1348. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1349. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1350. disabled.
  1351. Available keys for each channel are:
  1352. DC_offset
  1353. Min_level
  1354. Max_level
  1355. Min_difference
  1356. Max_difference
  1357. Mean_difference
  1358. RMS_difference
  1359. Peak_level
  1360. RMS_peak
  1361. RMS_trough
  1362. Crest_factor
  1363. Flat_factor
  1364. Peak_count
  1365. Bit_depth
  1366. Dynamic_range
  1367. and for Overall:
  1368. DC_offset
  1369. Min_level
  1370. Max_level
  1371. Min_difference
  1372. Max_difference
  1373. Mean_difference
  1374. RMS_difference
  1375. Peak_level
  1376. RMS_level
  1377. RMS_peak
  1378. RMS_trough
  1379. Flat_factor
  1380. Peak_count
  1381. Bit_depth
  1382. Number_of_samples
  1383. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1384. this @code{lavfi.astats.Overall.Peak_count}.
  1385. For description what each key means read below.
  1386. @item reset
  1387. Set number of frame after which stats are going to be recalculated.
  1388. Default is disabled.
  1389. @end table
  1390. A description of each shown parameter follows:
  1391. @table @option
  1392. @item DC offset
  1393. Mean amplitude displacement from zero.
  1394. @item Min level
  1395. Minimal sample level.
  1396. @item Max level
  1397. Maximal sample level.
  1398. @item Min difference
  1399. Minimal difference between two consecutive samples.
  1400. @item Max difference
  1401. Maximal difference between two consecutive samples.
  1402. @item Mean difference
  1403. Mean difference between two consecutive samples.
  1404. The average of each difference between two consecutive samples.
  1405. @item RMS difference
  1406. Root Mean Square difference between two consecutive samples.
  1407. @item Peak level dB
  1408. @item RMS level dB
  1409. Standard peak and RMS level measured in dBFS.
  1410. @item RMS peak dB
  1411. @item RMS trough dB
  1412. Peak and trough values for RMS level measured over a short window.
  1413. @item Crest factor
  1414. Standard ratio of peak to RMS level (note: not in dB).
  1415. @item Flat factor
  1416. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1417. (i.e. either @var{Min level} or @var{Max level}).
  1418. @item Peak count
  1419. Number of occasions (not the number of samples) that the signal attained either
  1420. @var{Min level} or @var{Max level}.
  1421. @item Bit depth
  1422. Overall bit depth of audio. Number of bits used for each sample.
  1423. @item Dynamic range
  1424. Measured dynamic range of audio in dB.
  1425. @end table
  1426. @section atempo
  1427. Adjust audio tempo.
  1428. The filter accepts exactly one parameter, the audio tempo. If not
  1429. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1430. be in the [0.5, 2.0] range.
  1431. @subsection Examples
  1432. @itemize
  1433. @item
  1434. Slow down audio to 80% tempo:
  1435. @example
  1436. atempo=0.8
  1437. @end example
  1438. @item
  1439. To speed up audio to 125% tempo:
  1440. @example
  1441. atempo=1.25
  1442. @end example
  1443. @end itemize
  1444. @section atrim
  1445. Trim the input so that the output contains one continuous subpart of the input.
  1446. It accepts the following parameters:
  1447. @table @option
  1448. @item start
  1449. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1450. sample with the timestamp @var{start} will be the first sample in the output.
  1451. @item end
  1452. Specify time of the first audio sample that will be dropped, i.e. the
  1453. audio sample immediately preceding the one with the timestamp @var{end} will be
  1454. the last sample in the output.
  1455. @item start_pts
  1456. Same as @var{start}, except this option sets the start timestamp in samples
  1457. instead of seconds.
  1458. @item end_pts
  1459. Same as @var{end}, except this option sets the end timestamp in samples instead
  1460. of seconds.
  1461. @item duration
  1462. The maximum duration of the output in seconds.
  1463. @item start_sample
  1464. The number of the first sample that should be output.
  1465. @item end_sample
  1466. The number of the first sample that should be dropped.
  1467. @end table
  1468. @option{start}, @option{end}, and @option{duration} are expressed as time
  1469. duration specifications; see
  1470. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1471. Note that the first two sets of the start/end options and the @option{duration}
  1472. option look at the frame timestamp, while the _sample options simply count the
  1473. samples that pass through the filter. So start/end_pts and start/end_sample will
  1474. give different results when the timestamps are wrong, inexact or do not start at
  1475. zero. Also note that this filter does not modify the timestamps. If you wish
  1476. to have the output timestamps start at zero, insert the asetpts filter after the
  1477. atrim filter.
  1478. If multiple start or end options are set, this filter tries to be greedy and
  1479. keep all samples that match at least one of the specified constraints. To keep
  1480. only the part that matches all the constraints at once, chain multiple atrim
  1481. filters.
  1482. The defaults are such that all the input is kept. So it is possible to set e.g.
  1483. just the end values to keep everything before the specified time.
  1484. Examples:
  1485. @itemize
  1486. @item
  1487. Drop everything except the second minute of input:
  1488. @example
  1489. ffmpeg -i INPUT -af atrim=60:120
  1490. @end example
  1491. @item
  1492. Keep only the first 1000 samples:
  1493. @example
  1494. ffmpeg -i INPUT -af atrim=end_sample=1000
  1495. @end example
  1496. @end itemize
  1497. @section bandpass
  1498. Apply a two-pole Butterworth band-pass filter with central
  1499. frequency @var{frequency}, and (3dB-point) band-width width.
  1500. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1501. instead of the default: constant 0dB peak gain.
  1502. The filter roll off at 6dB per octave (20dB per decade).
  1503. The filter accepts the following options:
  1504. @table @option
  1505. @item frequency, f
  1506. Set the filter's central frequency. Default is @code{3000}.
  1507. @item csg
  1508. Constant skirt gain if set to 1. Defaults to 0.
  1509. @item width_type, t
  1510. Set method to specify band-width of filter.
  1511. @table @option
  1512. @item h
  1513. Hz
  1514. @item q
  1515. Q-Factor
  1516. @item o
  1517. octave
  1518. @item s
  1519. slope
  1520. @item k
  1521. kHz
  1522. @end table
  1523. @item width, w
  1524. Specify the band-width of a filter in width_type units.
  1525. @item channels, c
  1526. Specify which channels to filter, by default all available are filtered.
  1527. @end table
  1528. @subsection Commands
  1529. This filter supports the following commands:
  1530. @table @option
  1531. @item frequency, f
  1532. Change bandpass frequency.
  1533. Syntax for the command is : "@var{frequency}"
  1534. @item width_type, t
  1535. Change bandpass width_type.
  1536. Syntax for the command is : "@var{width_type}"
  1537. @item width, w
  1538. Change bandpass width.
  1539. Syntax for the command is : "@var{width}"
  1540. @end table
  1541. @section bandreject
  1542. Apply a two-pole Butterworth band-reject filter with central
  1543. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1544. The filter roll off at 6dB per octave (20dB per decade).
  1545. The filter accepts the following options:
  1546. @table @option
  1547. @item frequency, f
  1548. Set the filter's central frequency. Default is @code{3000}.
  1549. @item width_type, t
  1550. Set method to specify band-width of filter.
  1551. @table @option
  1552. @item h
  1553. Hz
  1554. @item q
  1555. Q-Factor
  1556. @item o
  1557. octave
  1558. @item s
  1559. slope
  1560. @item k
  1561. kHz
  1562. @end table
  1563. @item width, w
  1564. Specify the band-width of a filter in width_type units.
  1565. @item channels, c
  1566. Specify which channels to filter, by default all available are filtered.
  1567. @end table
  1568. @subsection Commands
  1569. This filter supports the following commands:
  1570. @table @option
  1571. @item frequency, f
  1572. Change bandreject frequency.
  1573. Syntax for the command is : "@var{frequency}"
  1574. @item width_type, t
  1575. Change bandreject width_type.
  1576. Syntax for the command is : "@var{width_type}"
  1577. @item width, w
  1578. Change bandreject width.
  1579. Syntax for the command is : "@var{width}"
  1580. @end table
  1581. @section bass
  1582. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1583. shelving filter with a response similar to that of a standard
  1584. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1585. The filter accepts the following options:
  1586. @table @option
  1587. @item gain, g
  1588. Give the gain at 0 Hz. Its useful range is about -20
  1589. (for a large cut) to +20 (for a large boost).
  1590. Beware of clipping when using a positive gain.
  1591. @item frequency, f
  1592. Set the filter's central frequency and so can be used
  1593. to extend or reduce the frequency range to be boosted or cut.
  1594. The default value is @code{100} Hz.
  1595. @item width_type, t
  1596. Set method to specify band-width of filter.
  1597. @table @option
  1598. @item h
  1599. Hz
  1600. @item q
  1601. Q-Factor
  1602. @item o
  1603. octave
  1604. @item s
  1605. slope
  1606. @item k
  1607. kHz
  1608. @end table
  1609. @item width, w
  1610. Determine how steep is the filter's shelf transition.
  1611. @item channels, c
  1612. Specify which channels to filter, by default all available are filtered.
  1613. @end table
  1614. @subsection Commands
  1615. This filter supports the following commands:
  1616. @table @option
  1617. @item frequency, f
  1618. Change bass frequency.
  1619. Syntax for the command is : "@var{frequency}"
  1620. @item width_type, t
  1621. Change bass width_type.
  1622. Syntax for the command is : "@var{width_type}"
  1623. @item width, w
  1624. Change bass width.
  1625. Syntax for the command is : "@var{width}"
  1626. @item gain, g
  1627. Change bass gain.
  1628. Syntax for the command is : "@var{gain}"
  1629. @end table
  1630. @section biquad
  1631. Apply a biquad IIR filter with the given coefficients.
  1632. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1633. are the numerator and denominator coefficients respectively.
  1634. and @var{channels}, @var{c} specify which channels to filter, by default all
  1635. available are filtered.
  1636. @subsection Commands
  1637. This filter supports the following commands:
  1638. @table @option
  1639. @item a0
  1640. @item a1
  1641. @item a2
  1642. @item b0
  1643. @item b1
  1644. @item b2
  1645. Change biquad parameter.
  1646. Syntax for the command is : "@var{value}"
  1647. @end table
  1648. @section bs2b
  1649. Bauer stereo to binaural transformation, which improves headphone listening of
  1650. stereo audio records.
  1651. To enable compilation of this filter you need to configure FFmpeg with
  1652. @code{--enable-libbs2b}.
  1653. It accepts the following parameters:
  1654. @table @option
  1655. @item profile
  1656. Pre-defined crossfeed level.
  1657. @table @option
  1658. @item default
  1659. Default level (fcut=700, feed=50).
  1660. @item cmoy
  1661. Chu Moy circuit (fcut=700, feed=60).
  1662. @item jmeier
  1663. Jan Meier circuit (fcut=650, feed=95).
  1664. @end table
  1665. @item fcut
  1666. Cut frequency (in Hz).
  1667. @item feed
  1668. Feed level (in Hz).
  1669. @end table
  1670. @section channelmap
  1671. Remap input channels to new locations.
  1672. It accepts the following parameters:
  1673. @table @option
  1674. @item map
  1675. Map channels from input to output. The argument is a '|'-separated list of
  1676. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1677. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1678. channel (e.g. FL for front left) or its index in the input channel layout.
  1679. @var{out_channel} is the name of the output channel or its index in the output
  1680. channel layout. If @var{out_channel} is not given then it is implicitly an
  1681. index, starting with zero and increasing by one for each mapping.
  1682. @item channel_layout
  1683. The channel layout of the output stream.
  1684. @end table
  1685. If no mapping is present, the filter will implicitly map input channels to
  1686. output channels, preserving indices.
  1687. @subsection Examples
  1688. @itemize
  1689. @item
  1690. For example, assuming a 5.1+downmix input MOV file,
  1691. @example
  1692. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1693. @end example
  1694. will create an output WAV file tagged as stereo from the downmix channels of
  1695. the input.
  1696. @item
  1697. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1698. @example
  1699. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1700. @end example
  1701. @end itemize
  1702. @section channelsplit
  1703. Split each channel from an input audio stream into a separate output stream.
  1704. It accepts the following parameters:
  1705. @table @option
  1706. @item channel_layout
  1707. The channel layout of the input stream. The default is "stereo".
  1708. @item channels
  1709. A channel layout describing the channels to be extracted as separate output streams
  1710. or "all" to extract each input channel as a separate stream. The default is "all".
  1711. Choosing channels not present in channel layout in the input will result in an error.
  1712. @end table
  1713. @subsection Examples
  1714. @itemize
  1715. @item
  1716. For example, assuming a stereo input MP3 file,
  1717. @example
  1718. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1719. @end example
  1720. will create an output Matroska file with two audio streams, one containing only
  1721. the left channel and the other the right channel.
  1722. @item
  1723. Split a 5.1 WAV file into per-channel files:
  1724. @example
  1725. ffmpeg -i in.wav -filter_complex
  1726. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1727. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1728. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1729. side_right.wav
  1730. @end example
  1731. @item
  1732. Extract only LFE from a 5.1 WAV file:
  1733. @example
  1734. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  1735. -map '[LFE]' lfe.wav
  1736. @end example
  1737. @end itemize
  1738. @section chorus
  1739. Add a chorus effect to the audio.
  1740. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1741. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1742. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1743. The modulation depth defines the range the modulated delay is played before or after
  1744. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1745. sound tuned around the original one, like in a chorus where some vocals are slightly
  1746. off key.
  1747. It accepts the following parameters:
  1748. @table @option
  1749. @item in_gain
  1750. Set input gain. Default is 0.4.
  1751. @item out_gain
  1752. Set output gain. Default is 0.4.
  1753. @item delays
  1754. Set delays. A typical delay is around 40ms to 60ms.
  1755. @item decays
  1756. Set decays.
  1757. @item speeds
  1758. Set speeds.
  1759. @item depths
  1760. Set depths.
  1761. @end table
  1762. @subsection Examples
  1763. @itemize
  1764. @item
  1765. A single delay:
  1766. @example
  1767. chorus=0.7:0.9:55:0.4:0.25:2
  1768. @end example
  1769. @item
  1770. Two delays:
  1771. @example
  1772. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1773. @end example
  1774. @item
  1775. Fuller sounding chorus with three delays:
  1776. @example
  1777. 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
  1778. @end example
  1779. @end itemize
  1780. @section compand
  1781. Compress or expand the audio's dynamic range.
  1782. It accepts the following parameters:
  1783. @table @option
  1784. @item attacks
  1785. @item decays
  1786. A list of times in seconds for each channel over which the instantaneous level
  1787. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1788. increase of volume and @var{decays} refers to decrease of volume. For most
  1789. situations, the attack time (response to the audio getting louder) should be
  1790. shorter than the decay time, because the human ear is more sensitive to sudden
  1791. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1792. a typical value for decay is 0.8 seconds.
  1793. If specified number of attacks & decays is lower than number of channels, the last
  1794. set attack/decay will be used for all remaining channels.
  1795. @item points
  1796. A list of points for the transfer function, specified in dB relative to the
  1797. maximum possible signal amplitude. Each key points list must be defined using
  1798. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1799. @code{x0/y0 x1/y1 x2/y2 ....}
  1800. The input values must be in strictly increasing order but the transfer function
  1801. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1802. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1803. function are @code{-70/-70|-60/-20|1/0}.
  1804. @item soft-knee
  1805. Set the curve radius in dB for all joints. It defaults to 0.01.
  1806. @item gain
  1807. Set the additional gain in dB to be applied at all points on the transfer
  1808. function. This allows for easy adjustment of the overall gain.
  1809. It defaults to 0.
  1810. @item volume
  1811. Set an initial volume, in dB, to be assumed for each channel when filtering
  1812. starts. This permits the user to supply a nominal level initially, so that, for
  1813. example, a very large gain is not applied to initial signal levels before the
  1814. companding has begun to operate. A typical value for audio which is initially
  1815. quiet is -90 dB. It defaults to 0.
  1816. @item delay
  1817. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1818. delayed before being fed to the volume adjuster. Specifying a delay
  1819. approximately equal to the attack/decay times allows the filter to effectively
  1820. operate in predictive rather than reactive mode. It defaults to 0.
  1821. @end table
  1822. @subsection Examples
  1823. @itemize
  1824. @item
  1825. Make music with both quiet and loud passages suitable for listening to in a
  1826. noisy environment:
  1827. @example
  1828. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1829. @end example
  1830. Another example for audio with whisper and explosion parts:
  1831. @example
  1832. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1833. @end example
  1834. @item
  1835. A noise gate for when the noise is at a lower level than the signal:
  1836. @example
  1837. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1838. @end example
  1839. @item
  1840. Here is another noise gate, this time for when the noise is at a higher level
  1841. than the signal (making it, in some ways, similar to squelch):
  1842. @example
  1843. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1844. @end example
  1845. @item
  1846. 2:1 compression starting at -6dB:
  1847. @example
  1848. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1849. @end example
  1850. @item
  1851. 2:1 compression starting at -9dB:
  1852. @example
  1853. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1854. @end example
  1855. @item
  1856. 2:1 compression starting at -12dB:
  1857. @example
  1858. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1859. @end example
  1860. @item
  1861. 2:1 compression starting at -18dB:
  1862. @example
  1863. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1864. @end example
  1865. @item
  1866. 3:1 compression starting at -15dB:
  1867. @example
  1868. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1869. @end example
  1870. @item
  1871. Compressor/Gate:
  1872. @example
  1873. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1874. @end example
  1875. @item
  1876. Expander:
  1877. @example
  1878. 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
  1879. @end example
  1880. @item
  1881. Hard limiter at -6dB:
  1882. @example
  1883. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1884. @end example
  1885. @item
  1886. Hard limiter at -12dB:
  1887. @example
  1888. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1889. @end example
  1890. @item
  1891. Hard noise gate at -35 dB:
  1892. @example
  1893. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1894. @end example
  1895. @item
  1896. Soft limiter:
  1897. @example
  1898. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  1899. @end example
  1900. @end itemize
  1901. @section compensationdelay
  1902. Compensation Delay Line is a metric based delay to compensate differing
  1903. positions of microphones or speakers.
  1904. For example, you have recorded guitar with two microphones placed in
  1905. different location. Because the front of sound wave has fixed speed in
  1906. normal conditions, the phasing of microphones can vary and depends on
  1907. their location and interposition. The best sound mix can be achieved when
  1908. these microphones are in phase (synchronized). Note that distance of
  1909. ~30 cm between microphones makes one microphone to capture signal in
  1910. antiphase to another microphone. That makes the final mix sounding moody.
  1911. This filter helps to solve phasing problems by adding different delays
  1912. to each microphone track and make them synchronized.
  1913. The best result can be reached when you take one track as base and
  1914. synchronize other tracks one by one with it.
  1915. Remember that synchronization/delay tolerance depends on sample rate, too.
  1916. Higher sample rates will give more tolerance.
  1917. It accepts the following parameters:
  1918. @table @option
  1919. @item mm
  1920. Set millimeters distance. This is compensation distance for fine tuning.
  1921. Default is 0.
  1922. @item cm
  1923. Set cm distance. This is compensation distance for tightening distance setup.
  1924. Default is 0.
  1925. @item m
  1926. Set meters distance. This is compensation distance for hard distance setup.
  1927. Default is 0.
  1928. @item dry
  1929. Set dry amount. Amount of unprocessed (dry) signal.
  1930. Default is 0.
  1931. @item wet
  1932. Set wet amount. Amount of processed (wet) signal.
  1933. Default is 1.
  1934. @item temp
  1935. Set temperature degree in Celsius. This is the temperature of the environment.
  1936. Default is 20.
  1937. @end table
  1938. @section crossfeed
  1939. Apply headphone crossfeed filter.
  1940. Crossfeed is the process of blending the left and right channels of stereo
  1941. audio recording.
  1942. It is mainly used to reduce extreme stereo separation of low frequencies.
  1943. The intent is to produce more speaker like sound to the listener.
  1944. The filter accepts the following options:
  1945. @table @option
  1946. @item strength
  1947. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  1948. This sets gain of low shelf filter for side part of stereo image.
  1949. Default is -6dB. Max allowed is -30db when strength is set to 1.
  1950. @item range
  1951. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  1952. This sets cut off frequency of low shelf filter. Default is cut off near
  1953. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  1954. @item level_in
  1955. Set input gain. Default is 0.9.
  1956. @item level_out
  1957. Set output gain. Default is 1.
  1958. @end table
  1959. @section crystalizer
  1960. Simple algorithm to expand audio dynamic range.
  1961. The filter accepts the following options:
  1962. @table @option
  1963. @item i
  1964. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  1965. (unchanged sound) to 10.0 (maximum effect).
  1966. @item c
  1967. Enable clipping. By default is enabled.
  1968. @end table
  1969. @section dcshift
  1970. Apply a DC shift to the audio.
  1971. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1972. in the recording chain) from the audio. The effect of a DC offset is reduced
  1973. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1974. a signal has a DC offset.
  1975. @table @option
  1976. @item shift
  1977. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1978. the audio.
  1979. @item limitergain
  1980. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1981. used to prevent clipping.
  1982. @end table
  1983. @section drmeter
  1984. Measure audio dynamic range.
  1985. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  1986. is found in transition material. And anything less that 8 have very poor dynamics
  1987. and is very compressed.
  1988. The filter accepts the following options:
  1989. @table @option
  1990. @item length
  1991. Set window length in seconds used to split audio into segments of equal length.
  1992. Default is 3 seconds.
  1993. @end table
  1994. @section dynaudnorm
  1995. Dynamic Audio Normalizer.
  1996. This filter applies a certain amount of gain to the input audio in order
  1997. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  1998. contrast to more "simple" normalization algorithms, the Dynamic Audio
  1999. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2000. This allows for applying extra gain to the "quiet" sections of the audio
  2001. while avoiding distortions or clipping the "loud" sections. In other words:
  2002. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2003. sections, in the sense that the volume of each section is brought to the
  2004. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2005. this goal *without* applying "dynamic range compressing". It will retain 100%
  2006. of the dynamic range *within* each section of the audio file.
  2007. @table @option
  2008. @item f
  2009. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2010. Default is 500 milliseconds.
  2011. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2012. referred to as frames. This is required, because a peak magnitude has no
  2013. meaning for just a single sample value. Instead, we need to determine the
  2014. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2015. normalizer would simply use the peak magnitude of the complete file, the
  2016. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2017. frame. The length of a frame is specified in milliseconds. By default, the
  2018. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2019. been found to give good results with most files.
  2020. Note that the exact frame length, in number of samples, will be determined
  2021. automatically, based on the sampling rate of the individual input audio file.
  2022. @item g
  2023. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2024. number. Default is 31.
  2025. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2026. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2027. is specified in frames, centered around the current frame. For the sake of
  2028. simplicity, this must be an odd number. Consequently, the default value of 31
  2029. takes into account the current frame, as well as the 15 preceding frames and
  2030. the 15 subsequent frames. Using a larger window results in a stronger
  2031. smoothing effect and thus in less gain variation, i.e. slower gain
  2032. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2033. effect and thus in more gain variation, i.e. faster gain adaptation.
  2034. In other words, the more you increase this value, the more the Dynamic Audio
  2035. Normalizer will behave like a "traditional" normalization filter. On the
  2036. contrary, the more you decrease this value, the more the Dynamic Audio
  2037. Normalizer will behave like a dynamic range compressor.
  2038. @item p
  2039. Set the target peak value. This specifies the highest permissible magnitude
  2040. level for the normalized audio input. This filter will try to approach the
  2041. target peak magnitude as closely as possible, but at the same time it also
  2042. makes sure that the normalized signal will never exceed the peak magnitude.
  2043. A frame's maximum local gain factor is imposed directly by the target peak
  2044. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2045. It is not recommended to go above this value.
  2046. @item m
  2047. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2048. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2049. factor for each input frame, i.e. the maximum gain factor that does not
  2050. result in clipping or distortion. The maximum gain factor is determined by
  2051. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2052. additionally bounds the frame's maximum gain factor by a predetermined
  2053. (global) maximum gain factor. This is done in order to avoid excessive gain
  2054. factors in "silent" or almost silent frames. By default, the maximum gain
  2055. factor is 10.0, For most inputs the default value should be sufficient and
  2056. it usually is not recommended to increase this value. Though, for input
  2057. with an extremely low overall volume level, it may be necessary to allow even
  2058. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2059. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2060. Instead, a "sigmoid" threshold function will be applied. This way, the
  2061. gain factors will smoothly approach the threshold value, but never exceed that
  2062. value.
  2063. @item r
  2064. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2065. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2066. This means that the maximum local gain factor for each frame is defined
  2067. (only) by the frame's highest magnitude sample. This way, the samples can
  2068. be amplified as much as possible without exceeding the maximum signal
  2069. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2070. Normalizer can also take into account the frame's root mean square,
  2071. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2072. determine the power of a time-varying signal. It is therefore considered
  2073. that the RMS is a better approximation of the "perceived loudness" than
  2074. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2075. frames to a constant RMS value, a uniform "perceived loudness" can be
  2076. established. If a target RMS value has been specified, a frame's local gain
  2077. factor is defined as the factor that would result in exactly that RMS value.
  2078. Note, however, that the maximum local gain factor is still restricted by the
  2079. frame's highest magnitude sample, in order to prevent clipping.
  2080. @item n
  2081. Enable channels coupling. By default is enabled.
  2082. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2083. amount. This means the same gain factor will be applied to all channels, i.e.
  2084. the maximum possible gain factor is determined by the "loudest" channel.
  2085. However, in some recordings, it may happen that the volume of the different
  2086. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2087. In this case, this option can be used to disable the channel coupling. This way,
  2088. the gain factor will be determined independently for each channel, depending
  2089. only on the individual channel's highest magnitude sample. This allows for
  2090. harmonizing the volume of the different channels.
  2091. @item c
  2092. Enable DC bias correction. By default is disabled.
  2093. An audio signal (in the time domain) is a sequence of sample values.
  2094. In the Dynamic Audio Normalizer these sample values are represented in the
  2095. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2096. audio signal, or "waveform", should be centered around the zero point.
  2097. That means if we calculate the mean value of all samples in a file, or in a
  2098. single frame, then the result should be 0.0 or at least very close to that
  2099. value. If, however, there is a significant deviation of the mean value from
  2100. 0.0, in either positive or negative direction, this is referred to as a
  2101. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2102. Audio Normalizer provides optional DC bias correction.
  2103. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2104. the mean value, or "DC correction" offset, of each input frame and subtract
  2105. that value from all of the frame's sample values which ensures those samples
  2106. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2107. boundaries, the DC correction offset values will be interpolated smoothly
  2108. between neighbouring frames.
  2109. @item b
  2110. Enable alternative boundary mode. By default is disabled.
  2111. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2112. around each frame. This includes the preceding frames as well as the
  2113. subsequent frames. However, for the "boundary" frames, located at the very
  2114. beginning and at the very end of the audio file, not all neighbouring
  2115. frames are available. In particular, for the first few frames in the audio
  2116. file, the preceding frames are not known. And, similarly, for the last few
  2117. frames in the audio file, the subsequent frames are not known. Thus, the
  2118. question arises which gain factors should be assumed for the missing frames
  2119. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2120. to deal with this situation. The default boundary mode assumes a gain factor
  2121. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2122. "fade out" at the beginning and at the end of the input, respectively.
  2123. @item s
  2124. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2125. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2126. compression. This means that signal peaks will not be pruned and thus the
  2127. full dynamic range will be retained within each local neighbourhood. However,
  2128. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2129. normalization algorithm with a more "traditional" compression.
  2130. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2131. (thresholding) function. If (and only if) the compression feature is enabled,
  2132. all input frames will be processed by a soft knee thresholding function prior
  2133. to the actual normalization process. Put simply, the thresholding function is
  2134. going to prune all samples whose magnitude exceeds a certain threshold value.
  2135. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2136. value. Instead, the threshold value will be adjusted for each individual
  2137. frame.
  2138. In general, smaller parameters result in stronger compression, and vice versa.
  2139. Values below 3.0 are not recommended, because audible distortion may appear.
  2140. @end table
  2141. @section earwax
  2142. Make audio easier to listen to on headphones.
  2143. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2144. so that when listened to on headphones the stereo image is moved from
  2145. inside your head (standard for headphones) to outside and in front of
  2146. the listener (standard for speakers).
  2147. Ported from SoX.
  2148. @section equalizer
  2149. Apply a two-pole peaking equalisation (EQ) filter. With this
  2150. filter, the signal-level at and around a selected frequency can
  2151. be increased or decreased, whilst (unlike bandpass and bandreject
  2152. filters) that at all other frequencies is unchanged.
  2153. In order to produce complex equalisation curves, this filter can
  2154. be given several times, each with a different central frequency.
  2155. The filter accepts the following options:
  2156. @table @option
  2157. @item frequency, f
  2158. Set the filter's central frequency in Hz.
  2159. @item width_type, t
  2160. Set method to specify band-width of filter.
  2161. @table @option
  2162. @item h
  2163. Hz
  2164. @item q
  2165. Q-Factor
  2166. @item o
  2167. octave
  2168. @item s
  2169. slope
  2170. @item k
  2171. kHz
  2172. @end table
  2173. @item width, w
  2174. Specify the band-width of a filter in width_type units.
  2175. @item gain, g
  2176. Set the required gain or attenuation in dB.
  2177. Beware of clipping when using a positive gain.
  2178. @item channels, c
  2179. Specify which channels to filter, by default all available are filtered.
  2180. @end table
  2181. @subsection Examples
  2182. @itemize
  2183. @item
  2184. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2185. @example
  2186. equalizer=f=1000:t=h:width=200:g=-10
  2187. @end example
  2188. @item
  2189. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2190. @example
  2191. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2192. @end example
  2193. @end itemize
  2194. @subsection Commands
  2195. This filter supports the following commands:
  2196. @table @option
  2197. @item frequency, f
  2198. Change equalizer frequency.
  2199. Syntax for the command is : "@var{frequency}"
  2200. @item width_type, t
  2201. Change equalizer width_type.
  2202. Syntax for the command is : "@var{width_type}"
  2203. @item width, w
  2204. Change equalizer width.
  2205. Syntax for the command is : "@var{width}"
  2206. @item gain, g
  2207. Change equalizer gain.
  2208. Syntax for the command is : "@var{gain}"
  2209. @end table
  2210. @section extrastereo
  2211. Linearly increases the difference between left and right channels which
  2212. adds some sort of "live" effect to playback.
  2213. The filter accepts the following options:
  2214. @table @option
  2215. @item m
  2216. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2217. (average of both channels), with 1.0 sound will be unchanged, with
  2218. -1.0 left and right channels will be swapped.
  2219. @item c
  2220. Enable clipping. By default is enabled.
  2221. @end table
  2222. @section firequalizer
  2223. Apply FIR Equalization using arbitrary frequency response.
  2224. The filter accepts the following option:
  2225. @table @option
  2226. @item gain
  2227. Set gain curve equation (in dB). The expression can contain variables:
  2228. @table @option
  2229. @item f
  2230. the evaluated frequency
  2231. @item sr
  2232. sample rate
  2233. @item ch
  2234. channel number, set to 0 when multichannels evaluation is disabled
  2235. @item chid
  2236. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2237. multichannels evaluation is disabled
  2238. @item chs
  2239. number of channels
  2240. @item chlayout
  2241. channel_layout, see libavutil/channel_layout.h
  2242. @end table
  2243. and functions:
  2244. @table @option
  2245. @item gain_interpolate(f)
  2246. interpolate gain on frequency f based on gain_entry
  2247. @item cubic_interpolate(f)
  2248. same as gain_interpolate, but smoother
  2249. @end table
  2250. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2251. @item gain_entry
  2252. Set gain entry for gain_interpolate function. The expression can
  2253. contain functions:
  2254. @table @option
  2255. @item entry(f, g)
  2256. store gain entry at frequency f with value g
  2257. @end table
  2258. This option is also available as command.
  2259. @item delay
  2260. Set filter delay in seconds. Higher value means more accurate.
  2261. Default is @code{0.01}.
  2262. @item accuracy
  2263. Set filter accuracy in Hz. Lower value means more accurate.
  2264. Default is @code{5}.
  2265. @item wfunc
  2266. Set window function. Acceptable values are:
  2267. @table @option
  2268. @item rectangular
  2269. rectangular window, useful when gain curve is already smooth
  2270. @item hann
  2271. hann window (default)
  2272. @item hamming
  2273. hamming window
  2274. @item blackman
  2275. blackman window
  2276. @item nuttall3
  2277. 3-terms continuous 1st derivative nuttall window
  2278. @item mnuttall3
  2279. minimum 3-terms discontinuous nuttall window
  2280. @item nuttall
  2281. 4-terms continuous 1st derivative nuttall window
  2282. @item bnuttall
  2283. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2284. @item bharris
  2285. blackman-harris window
  2286. @item tukey
  2287. tukey window
  2288. @end table
  2289. @item fixed
  2290. If enabled, use fixed number of audio samples. This improves speed when
  2291. filtering with large delay. Default is disabled.
  2292. @item multi
  2293. Enable multichannels evaluation on gain. Default is disabled.
  2294. @item zero_phase
  2295. Enable zero phase mode by subtracting timestamp to compensate delay.
  2296. Default is disabled.
  2297. @item scale
  2298. Set scale used by gain. Acceptable values are:
  2299. @table @option
  2300. @item linlin
  2301. linear frequency, linear gain
  2302. @item linlog
  2303. linear frequency, logarithmic (in dB) gain (default)
  2304. @item loglin
  2305. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2306. @item loglog
  2307. logarithmic frequency, logarithmic gain
  2308. @end table
  2309. @item dumpfile
  2310. Set file for dumping, suitable for gnuplot.
  2311. @item dumpscale
  2312. Set scale for dumpfile. Acceptable values are same with scale option.
  2313. Default is linlog.
  2314. @item fft2
  2315. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2316. Default is disabled.
  2317. @item min_phase
  2318. Enable minimum phase impulse response. Default is disabled.
  2319. @end table
  2320. @subsection Examples
  2321. @itemize
  2322. @item
  2323. lowpass at 1000 Hz:
  2324. @example
  2325. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2326. @end example
  2327. @item
  2328. lowpass at 1000 Hz with gain_entry:
  2329. @example
  2330. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2331. @end example
  2332. @item
  2333. custom equalization:
  2334. @example
  2335. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2336. @end example
  2337. @item
  2338. higher delay with zero phase to compensate delay:
  2339. @example
  2340. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2341. @end example
  2342. @item
  2343. lowpass on left channel, highpass on right channel:
  2344. @example
  2345. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2346. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2347. @end example
  2348. @end itemize
  2349. @section flanger
  2350. Apply a flanging effect to the audio.
  2351. The filter accepts the following options:
  2352. @table @option
  2353. @item delay
  2354. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2355. @item depth
  2356. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2357. @item regen
  2358. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2359. Default value is 0.
  2360. @item width
  2361. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2362. Default value is 71.
  2363. @item speed
  2364. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2365. @item shape
  2366. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2367. Default value is @var{sinusoidal}.
  2368. @item phase
  2369. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2370. Default value is 25.
  2371. @item interp
  2372. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2373. Default is @var{linear}.
  2374. @end table
  2375. @section haas
  2376. Apply Haas effect to audio.
  2377. Note that this makes most sense to apply on mono signals.
  2378. With this filter applied to mono signals it give some directionality and
  2379. stretches its stereo image.
  2380. The filter accepts the following options:
  2381. @table @option
  2382. @item level_in
  2383. Set input level. By default is @var{1}, or 0dB
  2384. @item level_out
  2385. Set output level. By default is @var{1}, or 0dB.
  2386. @item side_gain
  2387. Set gain applied to side part of signal. By default is @var{1}.
  2388. @item middle_source
  2389. Set kind of middle source. Can be one of the following:
  2390. @table @samp
  2391. @item left
  2392. Pick left channel.
  2393. @item right
  2394. Pick right channel.
  2395. @item mid
  2396. Pick middle part signal of stereo image.
  2397. @item side
  2398. Pick side part signal of stereo image.
  2399. @end table
  2400. @item middle_phase
  2401. Change middle phase. By default is disabled.
  2402. @item left_delay
  2403. Set left channel delay. By default is @var{2.05} milliseconds.
  2404. @item left_balance
  2405. Set left channel balance. By default is @var{-1}.
  2406. @item left_gain
  2407. Set left channel gain. By default is @var{1}.
  2408. @item left_phase
  2409. Change left phase. By default is disabled.
  2410. @item right_delay
  2411. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2412. @item right_balance
  2413. Set right channel balance. By default is @var{1}.
  2414. @item right_gain
  2415. Set right channel gain. By default is @var{1}.
  2416. @item right_phase
  2417. Change right phase. By default is enabled.
  2418. @end table
  2419. @section hdcd
  2420. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2421. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2422. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2423. of HDCD, and detects the Transient Filter flag.
  2424. @example
  2425. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2426. @end example
  2427. When using the filter with wav, note the default encoding for wav is 16-bit,
  2428. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2429. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2430. @example
  2431. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2432. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2433. @end example
  2434. The filter accepts the following options:
  2435. @table @option
  2436. @item disable_autoconvert
  2437. Disable any automatic format conversion or resampling in the filter graph.
  2438. @item process_stereo
  2439. Process the stereo channels together. If target_gain does not match between
  2440. channels, consider it invalid and use the last valid target_gain.
  2441. @item cdt_ms
  2442. Set the code detect timer period in ms.
  2443. @item force_pe
  2444. Always extend peaks above -3dBFS even if PE isn't signaled.
  2445. @item analyze_mode
  2446. Replace audio with a solid tone and adjust the amplitude to signal some
  2447. specific aspect of the decoding process. The output file can be loaded in
  2448. an audio editor alongside the original to aid analysis.
  2449. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2450. Modes are:
  2451. @table @samp
  2452. @item 0, off
  2453. Disabled
  2454. @item 1, lle
  2455. Gain adjustment level at each sample
  2456. @item 2, pe
  2457. Samples where peak extend occurs
  2458. @item 3, cdt
  2459. Samples where the code detect timer is active
  2460. @item 4, tgm
  2461. Samples where the target gain does not match between channels
  2462. @end table
  2463. @end table
  2464. @section headphone
  2465. Apply head-related transfer functions (HRTFs) to create virtual
  2466. loudspeakers around the user for binaural listening via headphones.
  2467. The HRIRs are provided via additional streams, for each channel
  2468. one stereo input stream is needed.
  2469. The filter accepts the following options:
  2470. @table @option
  2471. @item map
  2472. Set mapping of input streams for convolution.
  2473. The argument is a '|'-separated list of channel names in order as they
  2474. are given as additional stream inputs for filter.
  2475. This also specify number of input streams. Number of input streams
  2476. must be not less than number of channels in first stream plus one.
  2477. @item gain
  2478. Set gain applied to audio. Value is in dB. Default is 0.
  2479. @item type
  2480. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2481. processing audio in time domain which is slow.
  2482. @var{freq} is processing audio in frequency domain which is fast.
  2483. Default is @var{freq}.
  2484. @item lfe
  2485. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2486. @item size
  2487. Set size of frame in number of samples which will be processed at once.
  2488. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  2489. @item hrir
  2490. Set format of hrir stream.
  2491. Default value is @var{stereo}. Alternative value is @var{multich}.
  2492. If value is set to @var{stereo}, number of additional streams should
  2493. be greater or equal to number of input channels in first input stream.
  2494. Also each additional stream should have stereo number of channels.
  2495. If value is set to @var{multich}, number of additional streams should
  2496. be exactly one. Also number of input channels of additional stream
  2497. should be equal or greater than twice number of channels of first input
  2498. stream.
  2499. @end table
  2500. @subsection Examples
  2501. @itemize
  2502. @item
  2503. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2504. each amovie filter use stereo file with IR coefficients as input.
  2505. The files give coefficients for each position of virtual loudspeaker:
  2506. @example
  2507. ffmpeg -i input.wav -lavfi-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],[a:0][fl][fr][fc][lfe][bl][br][sl][sr]headphone=FL|FR|FC|LFE|BL|BR|SL|SR"
  2508. output.wav
  2509. @end example
  2510. @item
  2511. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2512. but now in @var{multich} @var{hrir} format.
  2513. @example
  2514. ffmpeg -i input.wav -lavfi-complex "amovie=minp.wav[hrirs],[a:0][hrirs]headphone=map=FL|FR|FC|LFE|BL|BR|SL|SR:hrir=multich"
  2515. output.wav
  2516. @end example
  2517. @end itemize
  2518. @section highpass
  2519. Apply a high-pass filter with 3dB point frequency.
  2520. The filter can be either single-pole, or double-pole (the default).
  2521. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2522. The filter accepts the following options:
  2523. @table @option
  2524. @item frequency, f
  2525. Set frequency in Hz. Default is 3000.
  2526. @item poles, p
  2527. Set number of poles. Default is 2.
  2528. @item width_type, t
  2529. Set method to specify band-width of filter.
  2530. @table @option
  2531. @item h
  2532. Hz
  2533. @item q
  2534. Q-Factor
  2535. @item o
  2536. octave
  2537. @item s
  2538. slope
  2539. @item k
  2540. kHz
  2541. @end table
  2542. @item width, w
  2543. Specify the band-width of a filter in width_type units.
  2544. Applies only to double-pole filter.
  2545. The default is 0.707q and gives a Butterworth response.
  2546. @item channels, c
  2547. Specify which channels to filter, by default all available are filtered.
  2548. @end table
  2549. @subsection Commands
  2550. This filter supports the following commands:
  2551. @table @option
  2552. @item frequency, f
  2553. Change highpass frequency.
  2554. Syntax for the command is : "@var{frequency}"
  2555. @item width_type, t
  2556. Change highpass width_type.
  2557. Syntax for the command is : "@var{width_type}"
  2558. @item width, w
  2559. Change highpass width.
  2560. Syntax for the command is : "@var{width}"
  2561. @end table
  2562. @section join
  2563. Join multiple input streams into one multi-channel stream.
  2564. It accepts the following parameters:
  2565. @table @option
  2566. @item inputs
  2567. The number of input streams. It defaults to 2.
  2568. @item channel_layout
  2569. The desired output channel layout. It defaults to stereo.
  2570. @item map
  2571. Map channels from inputs to output. The argument is a '|'-separated list of
  2572. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2573. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2574. can be either the name of the input channel (e.g. FL for front left) or its
  2575. index in the specified input stream. @var{out_channel} is the name of the output
  2576. channel.
  2577. @end table
  2578. The filter will attempt to guess the mappings when they are not specified
  2579. explicitly. It does so by first trying to find an unused matching input channel
  2580. and if that fails it picks the first unused input channel.
  2581. Join 3 inputs (with properly set channel layouts):
  2582. @example
  2583. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2584. @end example
  2585. Build a 5.1 output from 6 single-channel streams:
  2586. @example
  2587. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2588. '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'
  2589. out
  2590. @end example
  2591. @section ladspa
  2592. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2593. To enable compilation of this filter you need to configure FFmpeg with
  2594. @code{--enable-ladspa}.
  2595. @table @option
  2596. @item file, f
  2597. Specifies the name of LADSPA plugin library to load. If the environment
  2598. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2599. each one of the directories specified by the colon separated list in
  2600. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2601. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2602. @file{/usr/lib/ladspa/}.
  2603. @item plugin, p
  2604. Specifies the plugin within the library. Some libraries contain only
  2605. one plugin, but others contain many of them. If this is not set filter
  2606. will list all available plugins within the specified library.
  2607. @item controls, c
  2608. Set the '|' separated list of controls which are zero or more floating point
  2609. values that determine the behavior of the loaded plugin (for example delay,
  2610. threshold or gain).
  2611. Controls need to be defined using the following syntax:
  2612. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2613. @var{valuei} is the value set on the @var{i}-th control.
  2614. Alternatively they can be also defined using the following syntax:
  2615. @var{value0}|@var{value1}|@var{value2}|..., where
  2616. @var{valuei} is the value set on the @var{i}-th control.
  2617. If @option{controls} is set to @code{help}, all available controls and
  2618. their valid ranges are printed.
  2619. @item sample_rate, s
  2620. Specify the sample rate, default to 44100. Only used if plugin have
  2621. zero inputs.
  2622. @item nb_samples, n
  2623. Set the number of samples per channel per each output frame, default
  2624. is 1024. Only used if plugin have zero inputs.
  2625. @item duration, d
  2626. Set the minimum duration of the sourced audio. See
  2627. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2628. for the accepted syntax.
  2629. Note that the resulting duration may be greater than the specified duration,
  2630. as the generated audio is always cut at the end of a complete frame.
  2631. If not specified, or the expressed duration is negative, the audio is
  2632. supposed to be generated forever.
  2633. Only used if plugin have zero inputs.
  2634. @end table
  2635. @subsection Examples
  2636. @itemize
  2637. @item
  2638. List all available plugins within amp (LADSPA example plugin) library:
  2639. @example
  2640. ladspa=file=amp
  2641. @end example
  2642. @item
  2643. List all available controls and their valid ranges for @code{vcf_notch}
  2644. plugin from @code{VCF} library:
  2645. @example
  2646. ladspa=f=vcf:p=vcf_notch:c=help
  2647. @end example
  2648. @item
  2649. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2650. plugin library:
  2651. @example
  2652. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2653. @end example
  2654. @item
  2655. Add reverberation to the audio using TAP-plugins
  2656. (Tom's Audio Processing plugins):
  2657. @example
  2658. ladspa=file=tap_reverb:tap_reverb
  2659. @end example
  2660. @item
  2661. Generate white noise, with 0.2 amplitude:
  2662. @example
  2663. ladspa=file=cmt:noise_source_white:c=c0=.2
  2664. @end example
  2665. @item
  2666. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2667. @code{C* Audio Plugin Suite} (CAPS) library:
  2668. @example
  2669. ladspa=file=caps:Click:c=c1=20'
  2670. @end example
  2671. @item
  2672. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2673. @example
  2674. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2675. @end example
  2676. @item
  2677. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2678. @code{SWH Plugins} collection:
  2679. @example
  2680. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2681. @end example
  2682. @item
  2683. Attenuate low frequencies using Multiband EQ from Steve Harris
  2684. @code{SWH Plugins} collection:
  2685. @example
  2686. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2687. @end example
  2688. @item
  2689. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  2690. (CAPS) library:
  2691. @example
  2692. ladspa=caps:Narrower
  2693. @end example
  2694. @item
  2695. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  2696. @example
  2697. ladspa=caps:White:.2
  2698. @end example
  2699. @item
  2700. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  2701. @example
  2702. ladspa=caps:Fractal:c=c1=1
  2703. @end example
  2704. @item
  2705. Dynamic volume normalization using @code{VLevel} plugin:
  2706. @example
  2707. ladspa=vlevel-ladspa:vlevel_mono
  2708. @end example
  2709. @end itemize
  2710. @subsection Commands
  2711. This filter supports the following commands:
  2712. @table @option
  2713. @item cN
  2714. Modify the @var{N}-th control value.
  2715. If the specified value is not valid, it is ignored and prior one is kept.
  2716. @end table
  2717. @section loudnorm
  2718. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2719. Support for both single pass (livestreams, files) and double pass (files) modes.
  2720. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  2721. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  2722. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  2723. The filter accepts the following options:
  2724. @table @option
  2725. @item I, i
  2726. Set integrated loudness target.
  2727. Range is -70.0 - -5.0. Default value is -24.0.
  2728. @item LRA, lra
  2729. Set loudness range target.
  2730. Range is 1.0 - 20.0. Default value is 7.0.
  2731. @item TP, tp
  2732. Set maximum true peak.
  2733. Range is -9.0 - +0.0. Default value is -2.0.
  2734. @item measured_I, measured_i
  2735. Measured IL of input file.
  2736. Range is -99.0 - +0.0.
  2737. @item measured_LRA, measured_lra
  2738. Measured LRA of input file.
  2739. Range is 0.0 - 99.0.
  2740. @item measured_TP, measured_tp
  2741. Measured true peak of input file.
  2742. Range is -99.0 - +99.0.
  2743. @item measured_thresh
  2744. Measured threshold of input file.
  2745. Range is -99.0 - +0.0.
  2746. @item offset
  2747. Set offset gain. Gain is applied before the true-peak limiter.
  2748. Range is -99.0 - +99.0. Default is +0.0.
  2749. @item linear
  2750. Normalize linearly if possible.
  2751. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2752. to be specified in order to use this mode.
  2753. Options are true or false. Default is true.
  2754. @item dual_mono
  2755. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2756. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2757. If set to @code{true}, this option will compensate for this effect.
  2758. Multi-channel input files are not affected by this option.
  2759. Options are true or false. Default is false.
  2760. @item print_format
  2761. Set print format for stats. Options are summary, json, or none.
  2762. Default value is none.
  2763. @end table
  2764. @section lowpass
  2765. Apply a low-pass filter with 3dB point frequency.
  2766. The filter can be either single-pole or double-pole (the default).
  2767. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2768. The filter accepts the following options:
  2769. @table @option
  2770. @item frequency, f
  2771. Set frequency in Hz. Default is 500.
  2772. @item poles, p
  2773. Set number of poles. Default is 2.
  2774. @item width_type, t
  2775. Set method to specify band-width of filter.
  2776. @table @option
  2777. @item h
  2778. Hz
  2779. @item q
  2780. Q-Factor
  2781. @item o
  2782. octave
  2783. @item s
  2784. slope
  2785. @item k
  2786. kHz
  2787. @end table
  2788. @item width, w
  2789. Specify the band-width of a filter in width_type units.
  2790. Applies only to double-pole filter.
  2791. The default is 0.707q and gives a Butterworth response.
  2792. @item channels, c
  2793. Specify which channels to filter, by default all available are filtered.
  2794. @end table
  2795. @subsection Examples
  2796. @itemize
  2797. @item
  2798. Lowpass only LFE channel, it LFE is not present it does nothing:
  2799. @example
  2800. lowpass=c=LFE
  2801. @end example
  2802. @end itemize
  2803. @subsection Commands
  2804. This filter supports the following commands:
  2805. @table @option
  2806. @item frequency, f
  2807. Change lowpass frequency.
  2808. Syntax for the command is : "@var{frequency}"
  2809. @item width_type, t
  2810. Change lowpass width_type.
  2811. Syntax for the command is : "@var{width_type}"
  2812. @item width, w
  2813. Change lowpass width.
  2814. Syntax for the command is : "@var{width}"
  2815. @end table
  2816. @section lv2
  2817. Load a LV2 (LADSPA Version 2) plugin.
  2818. To enable compilation of this filter you need to configure FFmpeg with
  2819. @code{--enable-lv2}.
  2820. @table @option
  2821. @item plugin, p
  2822. Specifies the plugin URI. You may need to escape ':'.
  2823. @item controls, c
  2824. Set the '|' separated list of controls which are zero or more floating point
  2825. values that determine the behavior of the loaded plugin (for example delay,
  2826. threshold or gain).
  2827. If @option{controls} is set to @code{help}, all available controls and
  2828. their valid ranges are printed.
  2829. @item sample_rate, s
  2830. Specify the sample rate, default to 44100. Only used if plugin have
  2831. zero inputs.
  2832. @item nb_samples, n
  2833. Set the number of samples per channel per each output frame, default
  2834. is 1024. Only used if plugin have zero inputs.
  2835. @item duration, d
  2836. Set the minimum duration of the sourced audio. See
  2837. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2838. for the accepted syntax.
  2839. Note that the resulting duration may be greater than the specified duration,
  2840. as the generated audio is always cut at the end of a complete frame.
  2841. If not specified, or the expressed duration is negative, the audio is
  2842. supposed to be generated forever.
  2843. Only used if plugin have zero inputs.
  2844. @end table
  2845. @subsection Examples
  2846. @itemize
  2847. @item
  2848. Apply bass enhancer plugin from Calf:
  2849. @example
  2850. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  2851. @end example
  2852. @item
  2853. Apply vinyl plugin from Calf:
  2854. @example
  2855. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  2856. @end example
  2857. @item
  2858. Apply bit crusher plugin from ArtyFX:
  2859. @example
  2860. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  2861. @end example
  2862. @end itemize
  2863. @section mcompand
  2864. Multiband Compress or expand the audio's dynamic range.
  2865. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  2866. This is akin to the crossover of a loudspeaker, and results in flat frequency
  2867. response when absent compander action.
  2868. It accepts the following parameters:
  2869. @table @option
  2870. @item args
  2871. This option syntax is:
  2872. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  2873. For explanation of each item refer to compand filter documentation.
  2874. @end table
  2875. @anchor{pan}
  2876. @section pan
  2877. Mix channels with specific gain levels. The filter accepts the output
  2878. channel layout followed by a set of channels definitions.
  2879. This filter is also designed to efficiently remap the channels of an audio
  2880. stream.
  2881. The filter accepts parameters of the form:
  2882. "@var{l}|@var{outdef}|@var{outdef}|..."
  2883. @table @option
  2884. @item l
  2885. output channel layout or number of channels
  2886. @item outdef
  2887. output channel specification, of the form:
  2888. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  2889. @item out_name
  2890. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2891. number (c0, c1, etc.)
  2892. @item gain
  2893. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2894. @item in_name
  2895. input channel to use, see out_name for details; it is not possible to mix
  2896. named and numbered input channels
  2897. @end table
  2898. If the `=' in a channel specification is replaced by `<', then the gains for
  2899. that specification will be renormalized so that the total is 1, thus
  2900. avoiding clipping noise.
  2901. @subsection Mixing examples
  2902. For example, if you want to down-mix from stereo to mono, but with a bigger
  2903. factor for the left channel:
  2904. @example
  2905. pan=1c|c0=0.9*c0+0.1*c1
  2906. @end example
  2907. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2908. 7-channels surround:
  2909. @example
  2910. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2911. @end example
  2912. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2913. that should be preferred (see "-ac" option) unless you have very specific
  2914. needs.
  2915. @subsection Remapping examples
  2916. The channel remapping will be effective if, and only if:
  2917. @itemize
  2918. @item gain coefficients are zeroes or ones,
  2919. @item only one input per channel output,
  2920. @end itemize
  2921. If all these conditions are satisfied, the filter will notify the user ("Pure
  2922. channel mapping detected"), and use an optimized and lossless method to do the
  2923. remapping.
  2924. For example, if you have a 5.1 source and want a stereo audio stream by
  2925. dropping the extra channels:
  2926. @example
  2927. pan="stereo| c0=FL | c1=FR"
  2928. @end example
  2929. Given the same source, you can also switch front left and front right channels
  2930. and keep the input channel layout:
  2931. @example
  2932. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2933. @end example
  2934. If the input is a stereo audio stream, you can mute the front left channel (and
  2935. still keep the stereo channel layout) with:
  2936. @example
  2937. pan="stereo|c1=c1"
  2938. @end example
  2939. Still with a stereo audio stream input, you can copy the right channel in both
  2940. front left and right:
  2941. @example
  2942. pan="stereo| c0=FR | c1=FR"
  2943. @end example
  2944. @section replaygain
  2945. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2946. outputs it unchanged.
  2947. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2948. @section resample
  2949. Convert the audio sample format, sample rate and channel layout. It is
  2950. not meant to be used directly.
  2951. @section rubberband
  2952. Apply time-stretching and pitch-shifting with librubberband.
  2953. The filter accepts the following options:
  2954. @table @option
  2955. @item tempo
  2956. Set tempo scale factor.
  2957. @item pitch
  2958. Set pitch scale factor.
  2959. @item transients
  2960. Set transients detector.
  2961. Possible values are:
  2962. @table @var
  2963. @item crisp
  2964. @item mixed
  2965. @item smooth
  2966. @end table
  2967. @item detector
  2968. Set detector.
  2969. Possible values are:
  2970. @table @var
  2971. @item compound
  2972. @item percussive
  2973. @item soft
  2974. @end table
  2975. @item phase
  2976. Set phase.
  2977. Possible values are:
  2978. @table @var
  2979. @item laminar
  2980. @item independent
  2981. @end table
  2982. @item window
  2983. Set processing window size.
  2984. Possible values are:
  2985. @table @var
  2986. @item standard
  2987. @item short
  2988. @item long
  2989. @end table
  2990. @item smoothing
  2991. Set smoothing.
  2992. Possible values are:
  2993. @table @var
  2994. @item off
  2995. @item on
  2996. @end table
  2997. @item formant
  2998. Enable formant preservation when shift pitching.
  2999. Possible values are:
  3000. @table @var
  3001. @item shifted
  3002. @item preserved
  3003. @end table
  3004. @item pitchq
  3005. Set pitch quality.
  3006. Possible values are:
  3007. @table @var
  3008. @item quality
  3009. @item speed
  3010. @item consistency
  3011. @end table
  3012. @item channels
  3013. Set channels.
  3014. Possible values are:
  3015. @table @var
  3016. @item apart
  3017. @item together
  3018. @end table
  3019. @end table
  3020. @section sidechaincompress
  3021. This filter acts like normal compressor but has the ability to compress
  3022. detected signal using second input signal.
  3023. It needs two input streams and returns one output stream.
  3024. First input stream will be processed depending on second stream signal.
  3025. The filtered signal then can be filtered with other filters in later stages of
  3026. processing. See @ref{pan} and @ref{amerge} filter.
  3027. The filter accepts the following options:
  3028. @table @option
  3029. @item level_in
  3030. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3031. @item threshold
  3032. If a signal of second stream raises above this level it will affect the gain
  3033. reduction of first stream.
  3034. By default is 0.125. Range is between 0.00097563 and 1.
  3035. @item ratio
  3036. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3037. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3038. Default is 2. Range is between 1 and 20.
  3039. @item attack
  3040. Amount of milliseconds the signal has to rise above the threshold before gain
  3041. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3042. @item release
  3043. Amount of milliseconds the signal has to fall below the threshold before
  3044. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3045. @item makeup
  3046. Set the amount by how much signal will be amplified after processing.
  3047. Default is 1. Range is from 1 to 64.
  3048. @item knee
  3049. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3050. Default is 2.82843. Range is between 1 and 8.
  3051. @item link
  3052. Choose if the @code{average} level between all channels of side-chain stream
  3053. or the louder(@code{maximum}) channel of side-chain stream affects the
  3054. reduction. Default is @code{average}.
  3055. @item detection
  3056. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3057. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3058. @item level_sc
  3059. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3060. @item mix
  3061. How much to use compressed signal in output. Default is 1.
  3062. Range is between 0 and 1.
  3063. @end table
  3064. @subsection Examples
  3065. @itemize
  3066. @item
  3067. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3068. depending on the signal of 2nd input and later compressed signal to be
  3069. merged with 2nd input:
  3070. @example
  3071. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3072. @end example
  3073. @end itemize
  3074. @section sidechaingate
  3075. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3076. filter the detected signal before sending it to the gain reduction stage.
  3077. Normally a gate uses the full range signal to detect a level above the
  3078. threshold.
  3079. For example: If you cut all lower frequencies from your sidechain signal
  3080. the gate will decrease the volume of your track only if not enough highs
  3081. appear. With this technique you are able to reduce the resonation of a
  3082. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3083. guitar.
  3084. It needs two input streams and returns one output stream.
  3085. First input stream will be processed depending on second stream signal.
  3086. The filter accepts the following options:
  3087. @table @option
  3088. @item level_in
  3089. Set input level before filtering.
  3090. Default is 1. Allowed range is from 0.015625 to 64.
  3091. @item range
  3092. Set the level of gain reduction when the signal is below the threshold.
  3093. Default is 0.06125. Allowed range is from 0 to 1.
  3094. @item threshold
  3095. If a signal rises above this level the gain reduction is released.
  3096. Default is 0.125. Allowed range is from 0 to 1.
  3097. @item ratio
  3098. Set a ratio about which the signal is reduced.
  3099. Default is 2. Allowed range is from 1 to 9000.
  3100. @item attack
  3101. Amount of milliseconds the signal has to rise above the threshold before gain
  3102. reduction stops.
  3103. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3104. @item release
  3105. Amount of milliseconds the signal has to fall below the threshold before the
  3106. reduction is increased again. Default is 250 milliseconds.
  3107. Allowed range is from 0.01 to 9000.
  3108. @item makeup
  3109. Set amount of amplification of signal after processing.
  3110. Default is 1. Allowed range is from 1 to 64.
  3111. @item knee
  3112. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3113. Default is 2.828427125. Allowed range is from 1 to 8.
  3114. @item detection
  3115. Choose if exact signal should be taken for detection or an RMS like one.
  3116. Default is rms. Can be peak or rms.
  3117. @item link
  3118. Choose if the average level between all channels or the louder channel affects
  3119. the reduction.
  3120. Default is average. Can be average or maximum.
  3121. @item level_sc
  3122. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3123. @end table
  3124. @section silencedetect
  3125. Detect silence in an audio stream.
  3126. This filter logs a message when it detects that the input audio volume is less
  3127. or equal to a noise tolerance value for a duration greater or equal to the
  3128. minimum detected noise duration.
  3129. The printed times and duration are expressed in seconds.
  3130. The filter accepts the following options:
  3131. @table @option
  3132. @item duration, d
  3133. Set silence duration until notification (default is 2 seconds).
  3134. @item noise, n
  3135. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3136. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3137. @end table
  3138. @subsection Examples
  3139. @itemize
  3140. @item
  3141. Detect 5 seconds of silence with -50dB noise tolerance:
  3142. @example
  3143. silencedetect=n=-50dB:d=5
  3144. @end example
  3145. @item
  3146. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3147. tolerance in @file{silence.mp3}:
  3148. @example
  3149. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3150. @end example
  3151. @end itemize
  3152. @section silenceremove
  3153. Remove silence from the beginning, middle or end of the audio.
  3154. The filter accepts the following options:
  3155. @table @option
  3156. @item start_periods
  3157. This value is used to indicate if audio should be trimmed at beginning of
  3158. the audio. A value of zero indicates no silence should be trimmed from the
  3159. beginning. When specifying a non-zero value, it trims audio up until it
  3160. finds non-silence. Normally, when trimming silence from beginning of audio
  3161. the @var{start_periods} will be @code{1} but it can be increased to higher
  3162. values to trim all audio up to specific count of non-silence periods.
  3163. Default value is @code{0}.
  3164. @item start_duration
  3165. Specify the amount of time that non-silence must be detected before it stops
  3166. trimming audio. By increasing the duration, bursts of noises can be treated
  3167. as silence and trimmed off. Default value is @code{0}.
  3168. @item start_threshold
  3169. This indicates what sample value should be treated as silence. For digital
  3170. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3171. you may wish to increase the value to account for background noise.
  3172. Can be specified in dB (in case "dB" is appended to the specified value)
  3173. or amplitude ratio. Default value is @code{0}.
  3174. @item stop_periods
  3175. Set the count for trimming silence from the end of audio.
  3176. To remove silence from the middle of a file, specify a @var{stop_periods}
  3177. that is negative. This value is then treated as a positive value and is
  3178. used to indicate the effect should restart processing as specified by
  3179. @var{start_periods}, making it suitable for removing periods of silence
  3180. in the middle of the audio.
  3181. Default value is @code{0}.
  3182. @item stop_duration
  3183. Specify a duration of silence that must exist before audio is not copied any
  3184. more. By specifying a higher duration, silence that is wanted can be left in
  3185. the audio.
  3186. Default value is @code{0}.
  3187. @item stop_threshold
  3188. This is the same as @option{start_threshold} but for trimming silence from
  3189. the end of audio.
  3190. Can be specified in dB (in case "dB" is appended to the specified value)
  3191. or amplitude ratio. Default value is @code{0}.
  3192. @item leave_silence
  3193. This indicates that @var{stop_duration} length of audio should be left intact
  3194. at the beginning of each period of silence.
  3195. For example, if you want to remove long pauses between words but do not want
  3196. to remove the pauses completely. Default value is @code{0}.
  3197. @item detection
  3198. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3199. and works better with digital silence which is exactly 0.
  3200. Default value is @code{rms}.
  3201. @item window
  3202. Set ratio used to calculate size of window for detecting silence.
  3203. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3204. @end table
  3205. @subsection Examples
  3206. @itemize
  3207. @item
  3208. The following example shows how this filter can be used to start a recording
  3209. that does not contain the delay at the start which usually occurs between
  3210. pressing the record button and the start of the performance:
  3211. @example
  3212. silenceremove=1:5:0.02
  3213. @end example
  3214. @item
  3215. Trim all silence encountered from beginning to end where there is more than 1
  3216. second of silence in audio:
  3217. @example
  3218. silenceremove=0:0:0:-1:1:-90dB
  3219. @end example
  3220. @end itemize
  3221. @section sofalizer
  3222. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3223. loudspeakers around the user for binaural listening via headphones (audio
  3224. formats up to 9 channels supported).
  3225. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3226. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3227. Austrian Academy of Sciences.
  3228. To enable compilation of this filter you need to configure FFmpeg with
  3229. @code{--enable-libmysofa}.
  3230. The filter accepts the following options:
  3231. @table @option
  3232. @item sofa
  3233. Set the SOFA file used for rendering.
  3234. @item gain
  3235. Set gain applied to audio. Value is in dB. Default is 0.
  3236. @item rotation
  3237. Set rotation of virtual loudspeakers in deg. Default is 0.
  3238. @item elevation
  3239. Set elevation of virtual speakers in deg. Default is 0.
  3240. @item radius
  3241. Set distance in meters between loudspeakers and the listener with near-field
  3242. HRTFs. Default is 1.
  3243. @item type
  3244. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3245. processing audio in time domain which is slow.
  3246. @var{freq} is processing audio in frequency domain which is fast.
  3247. Default is @var{freq}.
  3248. @item speakers
  3249. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3250. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3251. Each virtual loudspeaker is described with short channel name following with
  3252. azimuth and elevation in degrees.
  3253. Each virtual loudspeaker description is separated by '|'.
  3254. For example to override front left and front right channel positions use:
  3255. 'speakers=FL 45 15|FR 345 15'.
  3256. Descriptions with unrecognised channel names are ignored.
  3257. @item lfegain
  3258. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3259. @end table
  3260. @subsection Examples
  3261. @itemize
  3262. @item
  3263. Using ClubFritz6 sofa file:
  3264. @example
  3265. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3266. @end example
  3267. @item
  3268. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3269. @example
  3270. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3271. @end example
  3272. @item
  3273. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3274. and also with custom gain:
  3275. @example
  3276. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3277. @end example
  3278. @end itemize
  3279. @section stereotools
  3280. This filter has some handy utilities to manage stereo signals, for converting
  3281. M/S stereo recordings to L/R signal while having control over the parameters
  3282. or spreading the stereo image of master track.
  3283. The filter accepts the following options:
  3284. @table @option
  3285. @item level_in
  3286. Set input level before filtering for both channels. Defaults is 1.
  3287. Allowed range is from 0.015625 to 64.
  3288. @item level_out
  3289. Set output level after filtering for both channels. Defaults is 1.
  3290. Allowed range is from 0.015625 to 64.
  3291. @item balance_in
  3292. Set input balance between both channels. Default is 0.
  3293. Allowed range is from -1 to 1.
  3294. @item balance_out
  3295. Set output balance between both channels. Default is 0.
  3296. Allowed range is from -1 to 1.
  3297. @item softclip
  3298. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3299. clipping. Disabled by default.
  3300. @item mutel
  3301. Mute the left channel. Disabled by default.
  3302. @item muter
  3303. Mute the right channel. Disabled by default.
  3304. @item phasel
  3305. Change the phase of the left channel. Disabled by default.
  3306. @item phaser
  3307. Change the phase of the right channel. Disabled by default.
  3308. @item mode
  3309. Set stereo mode. Available values are:
  3310. @table @samp
  3311. @item lr>lr
  3312. Left/Right to Left/Right, this is default.
  3313. @item lr>ms
  3314. Left/Right to Mid/Side.
  3315. @item ms>lr
  3316. Mid/Side to Left/Right.
  3317. @item lr>ll
  3318. Left/Right to Left/Left.
  3319. @item lr>rr
  3320. Left/Right to Right/Right.
  3321. @item lr>l+r
  3322. Left/Right to Left + Right.
  3323. @item lr>rl
  3324. Left/Right to Right/Left.
  3325. @item ms>ll
  3326. Mid/Side to Left/Left.
  3327. @item ms>rr
  3328. Mid/Side to Right/Right.
  3329. @end table
  3330. @item slev
  3331. Set level of side signal. Default is 1.
  3332. Allowed range is from 0.015625 to 64.
  3333. @item sbal
  3334. Set balance of side signal. Default is 0.
  3335. Allowed range is from -1 to 1.
  3336. @item mlev
  3337. Set level of the middle signal. Default is 1.
  3338. Allowed range is from 0.015625 to 64.
  3339. @item mpan
  3340. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3341. @item base
  3342. Set stereo base between mono and inversed channels. Default is 0.
  3343. Allowed range is from -1 to 1.
  3344. @item delay
  3345. Set delay in milliseconds how much to delay left from right channel and
  3346. vice versa. Default is 0. Allowed range is from -20 to 20.
  3347. @item sclevel
  3348. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3349. @item phase
  3350. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3351. @item bmode_in, bmode_out
  3352. Set balance mode for balance_in/balance_out option.
  3353. Can be one of the following:
  3354. @table @samp
  3355. @item balance
  3356. Classic balance mode. Attenuate one channel at time.
  3357. Gain is raised up to 1.
  3358. @item amplitude
  3359. Similar as classic mode above but gain is raised up to 2.
  3360. @item power
  3361. Equal power distribution, from -6dB to +6dB range.
  3362. @end table
  3363. @end table
  3364. @subsection Examples
  3365. @itemize
  3366. @item
  3367. Apply karaoke like effect:
  3368. @example
  3369. stereotools=mlev=0.015625
  3370. @end example
  3371. @item
  3372. Convert M/S signal to L/R:
  3373. @example
  3374. "stereotools=mode=ms>lr"
  3375. @end example
  3376. @end itemize
  3377. @section stereowiden
  3378. This filter enhance the stereo effect by suppressing signal common to both
  3379. channels and by delaying the signal of left into right and vice versa,
  3380. thereby widening the stereo effect.
  3381. The filter accepts the following options:
  3382. @table @option
  3383. @item delay
  3384. Time in milliseconds of the delay of left signal into right and vice versa.
  3385. Default is 20 milliseconds.
  3386. @item feedback
  3387. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3388. effect of left signal in right output and vice versa which gives widening
  3389. effect. Default is 0.3.
  3390. @item crossfeed
  3391. Cross feed of left into right with inverted phase. This helps in suppressing
  3392. the mono. If the value is 1 it will cancel all the signal common to both
  3393. channels. Default is 0.3.
  3394. @item drymix
  3395. Set level of input signal of original channel. Default is 0.8.
  3396. @end table
  3397. @section superequalizer
  3398. Apply 18 band equalizer.
  3399. The filter accepts the following options:
  3400. @table @option
  3401. @item 1b
  3402. Set 65Hz band gain.
  3403. @item 2b
  3404. Set 92Hz band gain.
  3405. @item 3b
  3406. Set 131Hz band gain.
  3407. @item 4b
  3408. Set 185Hz band gain.
  3409. @item 5b
  3410. Set 262Hz band gain.
  3411. @item 6b
  3412. Set 370Hz band gain.
  3413. @item 7b
  3414. Set 523Hz band gain.
  3415. @item 8b
  3416. Set 740Hz band gain.
  3417. @item 9b
  3418. Set 1047Hz band gain.
  3419. @item 10b
  3420. Set 1480Hz band gain.
  3421. @item 11b
  3422. Set 2093Hz band gain.
  3423. @item 12b
  3424. Set 2960Hz band gain.
  3425. @item 13b
  3426. Set 4186Hz band gain.
  3427. @item 14b
  3428. Set 5920Hz band gain.
  3429. @item 15b
  3430. Set 8372Hz band gain.
  3431. @item 16b
  3432. Set 11840Hz band gain.
  3433. @item 17b
  3434. Set 16744Hz band gain.
  3435. @item 18b
  3436. Set 20000Hz band gain.
  3437. @end table
  3438. @section surround
  3439. Apply audio surround upmix filter.
  3440. This filter allows to produce multichannel output from audio stream.
  3441. The filter accepts the following options:
  3442. @table @option
  3443. @item chl_out
  3444. Set output channel layout. By default, this is @var{5.1}.
  3445. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3446. for the required syntax.
  3447. @item chl_in
  3448. Set input channel layout. By default, this is @var{stereo}.
  3449. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3450. for the required syntax.
  3451. @item level_in
  3452. Set input volume level. By default, this is @var{1}.
  3453. @item level_out
  3454. Set output volume level. By default, this is @var{1}.
  3455. @item lfe
  3456. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3457. @item lfe_low
  3458. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3459. @item lfe_high
  3460. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3461. @item fc_in
  3462. Set front center input volume. By default, this is @var{1}.
  3463. @item fc_out
  3464. Set front center output volume. By default, this is @var{1}.
  3465. @item lfe_in
  3466. Set LFE input volume. By default, this is @var{1}.
  3467. @item lfe_out
  3468. Set LFE output volume. By default, this is @var{1}.
  3469. @end table
  3470. @section treble
  3471. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3472. shelving filter with a response similar to that of a standard
  3473. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3474. The filter accepts the following options:
  3475. @table @option
  3476. @item gain, g
  3477. Give the gain at whichever is the lower of ~22 kHz and the
  3478. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3479. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3480. @item frequency, f
  3481. Set the filter's central frequency and so can be used
  3482. to extend or reduce the frequency range to be boosted or cut.
  3483. The default value is @code{3000} Hz.
  3484. @item width_type, t
  3485. Set method to specify band-width of filter.
  3486. @table @option
  3487. @item h
  3488. Hz
  3489. @item q
  3490. Q-Factor
  3491. @item o
  3492. octave
  3493. @item s
  3494. slope
  3495. @item k
  3496. kHz
  3497. @end table
  3498. @item width, w
  3499. Determine how steep is the filter's shelf transition.
  3500. @item channels, c
  3501. Specify which channels to filter, by default all available are filtered.
  3502. @end table
  3503. @subsection Commands
  3504. This filter supports the following commands:
  3505. @table @option
  3506. @item frequency, f
  3507. Change treble frequency.
  3508. Syntax for the command is : "@var{frequency}"
  3509. @item width_type, t
  3510. Change treble width_type.
  3511. Syntax for the command is : "@var{width_type}"
  3512. @item width, w
  3513. Change treble width.
  3514. Syntax for the command is : "@var{width}"
  3515. @item gain, g
  3516. Change treble gain.
  3517. Syntax for the command is : "@var{gain}"
  3518. @end table
  3519. @section tremolo
  3520. Sinusoidal amplitude modulation.
  3521. The filter accepts the following options:
  3522. @table @option
  3523. @item f
  3524. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3525. (20 Hz or lower) will result in a tremolo effect.
  3526. This filter may also be used as a ring modulator by specifying
  3527. a modulation frequency higher than 20 Hz.
  3528. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3529. @item d
  3530. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3531. Default value is 0.5.
  3532. @end table
  3533. @section vibrato
  3534. Sinusoidal phase modulation.
  3535. The filter accepts the following options:
  3536. @table @option
  3537. @item f
  3538. Modulation frequency in Hertz.
  3539. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3540. @item d
  3541. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3542. Default value is 0.5.
  3543. @end table
  3544. @section volume
  3545. Adjust the input audio volume.
  3546. It accepts the following parameters:
  3547. @table @option
  3548. @item volume
  3549. Set audio volume expression.
  3550. Output values are clipped to the maximum value.
  3551. The output audio volume is given by the relation:
  3552. @example
  3553. @var{output_volume} = @var{volume} * @var{input_volume}
  3554. @end example
  3555. The default value for @var{volume} is "1.0".
  3556. @item precision
  3557. This parameter represents the mathematical precision.
  3558. It determines which input sample formats will be allowed, which affects the
  3559. precision of the volume scaling.
  3560. @table @option
  3561. @item fixed
  3562. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  3563. @item float
  3564. 32-bit floating-point; this limits input sample format to FLT. (default)
  3565. @item double
  3566. 64-bit floating-point; this limits input sample format to DBL.
  3567. @end table
  3568. @item replaygain
  3569. Choose the behaviour on encountering ReplayGain side data in input frames.
  3570. @table @option
  3571. @item drop
  3572. Remove ReplayGain side data, ignoring its contents (the default).
  3573. @item ignore
  3574. Ignore ReplayGain side data, but leave it in the frame.
  3575. @item track
  3576. Prefer the track gain, if present.
  3577. @item album
  3578. Prefer the album gain, if present.
  3579. @end table
  3580. @item replaygain_preamp
  3581. Pre-amplification gain in dB to apply to the selected replaygain gain.
  3582. Default value for @var{replaygain_preamp} is 0.0.
  3583. @item eval
  3584. Set when the volume expression is evaluated.
  3585. It accepts the following values:
  3586. @table @samp
  3587. @item once
  3588. only evaluate expression once during the filter initialization, or
  3589. when the @samp{volume} command is sent
  3590. @item frame
  3591. evaluate expression for each incoming frame
  3592. @end table
  3593. Default value is @samp{once}.
  3594. @end table
  3595. The volume expression can contain the following parameters.
  3596. @table @option
  3597. @item n
  3598. frame number (starting at zero)
  3599. @item nb_channels
  3600. number of channels
  3601. @item nb_consumed_samples
  3602. number of samples consumed by the filter
  3603. @item nb_samples
  3604. number of samples in the current frame
  3605. @item pos
  3606. original frame position in the file
  3607. @item pts
  3608. frame PTS
  3609. @item sample_rate
  3610. sample rate
  3611. @item startpts
  3612. PTS at start of stream
  3613. @item startt
  3614. time at start of stream
  3615. @item t
  3616. frame time
  3617. @item tb
  3618. timestamp timebase
  3619. @item volume
  3620. last set volume value
  3621. @end table
  3622. Note that when @option{eval} is set to @samp{once} only the
  3623. @var{sample_rate} and @var{tb} variables are available, all other
  3624. variables will evaluate to NAN.
  3625. @subsection Commands
  3626. This filter supports the following commands:
  3627. @table @option
  3628. @item volume
  3629. Modify the volume expression.
  3630. The command accepts the same syntax of the corresponding option.
  3631. If the specified expression is not valid, it is kept at its current
  3632. value.
  3633. @item replaygain_noclip
  3634. Prevent clipping by limiting the gain applied.
  3635. Default value for @var{replaygain_noclip} is 1.
  3636. @end table
  3637. @subsection Examples
  3638. @itemize
  3639. @item
  3640. Halve the input audio volume:
  3641. @example
  3642. volume=volume=0.5
  3643. volume=volume=1/2
  3644. volume=volume=-6.0206dB
  3645. @end example
  3646. In all the above example the named key for @option{volume} can be
  3647. omitted, for example like in:
  3648. @example
  3649. volume=0.5
  3650. @end example
  3651. @item
  3652. Increase input audio power by 6 decibels using fixed-point precision:
  3653. @example
  3654. volume=volume=6dB:precision=fixed
  3655. @end example
  3656. @item
  3657. Fade volume after time 10 with an annihilation period of 5 seconds:
  3658. @example
  3659. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3660. @end example
  3661. @end itemize
  3662. @section volumedetect
  3663. Detect the volume of the input video.
  3664. The filter has no parameters. The input is not modified. Statistics about
  3665. the volume will be printed in the log when the input stream end is reached.
  3666. In particular it will show the mean volume (root mean square), maximum
  3667. volume (on a per-sample basis), and the beginning of a histogram of the
  3668. registered volume values (from the maximum value to a cumulated 1/1000 of
  3669. the samples).
  3670. All volumes are in decibels relative to the maximum PCM value.
  3671. @subsection Examples
  3672. Here is an excerpt of the output:
  3673. @example
  3674. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3675. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3676. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3677. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3678. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3679. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3680. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3681. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3682. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3683. @end example
  3684. It means that:
  3685. @itemize
  3686. @item
  3687. The mean square energy is approximately -27 dB, or 10^-2.7.
  3688. @item
  3689. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3690. @item
  3691. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3692. @end itemize
  3693. In other words, raising the volume by +4 dB does not cause any clipping,
  3694. raising it by +5 dB causes clipping for 6 samples, etc.
  3695. @c man end AUDIO FILTERS
  3696. @chapter Audio Sources
  3697. @c man begin AUDIO SOURCES
  3698. Below is a description of the currently available audio sources.
  3699. @section abuffer
  3700. Buffer audio frames, and make them available to the filter chain.
  3701. This source is mainly intended for a programmatic use, in particular
  3702. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3703. It accepts the following parameters:
  3704. @table @option
  3705. @item time_base
  3706. The timebase which will be used for timestamps of submitted frames. It must be
  3707. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3708. @item sample_rate
  3709. The sample rate of the incoming audio buffers.
  3710. @item sample_fmt
  3711. The sample format of the incoming audio buffers.
  3712. Either a sample format name or its corresponding integer representation from
  3713. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3714. @item channel_layout
  3715. The channel layout of the incoming audio buffers.
  3716. Either a channel layout name from channel_layout_map in
  3717. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3718. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3719. @item channels
  3720. The number of channels of the incoming audio buffers.
  3721. If both @var{channels} and @var{channel_layout} are specified, then they
  3722. must be consistent.
  3723. @end table
  3724. @subsection Examples
  3725. @example
  3726. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3727. @end example
  3728. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3729. Since the sample format with name "s16p" corresponds to the number
  3730. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3731. equivalent to:
  3732. @example
  3733. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3734. @end example
  3735. @section aevalsrc
  3736. Generate an audio signal specified by an expression.
  3737. This source accepts in input one or more expressions (one for each
  3738. channel), which are evaluated and used to generate a corresponding
  3739. audio signal.
  3740. This source accepts the following options:
  3741. @table @option
  3742. @item exprs
  3743. Set the '|'-separated expressions list for each separate channel. In case the
  3744. @option{channel_layout} option is not specified, the selected channel layout
  3745. depends on the number of provided expressions. Otherwise the last
  3746. specified expression is applied to the remaining output channels.
  3747. @item channel_layout, c
  3748. Set the channel layout. The number of channels in the specified layout
  3749. must be equal to the number of specified expressions.
  3750. @item duration, d
  3751. Set the minimum duration of the sourced audio. See
  3752. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3753. for the accepted syntax.
  3754. Note that the resulting duration may be greater than the specified
  3755. duration, as the generated audio is always cut at the end of a
  3756. complete frame.
  3757. If not specified, or the expressed duration is negative, the audio is
  3758. supposed to be generated forever.
  3759. @item nb_samples, n
  3760. Set the number of samples per channel per each output frame,
  3761. default to 1024.
  3762. @item sample_rate, s
  3763. Specify the sample rate, default to 44100.
  3764. @end table
  3765. Each expression in @var{exprs} can contain the following constants:
  3766. @table @option
  3767. @item n
  3768. number of the evaluated sample, starting from 0
  3769. @item t
  3770. time of the evaluated sample expressed in seconds, starting from 0
  3771. @item s
  3772. sample rate
  3773. @end table
  3774. @subsection Examples
  3775. @itemize
  3776. @item
  3777. Generate silence:
  3778. @example
  3779. aevalsrc=0
  3780. @end example
  3781. @item
  3782. Generate a sin signal with frequency of 440 Hz, set sample rate to
  3783. 8000 Hz:
  3784. @example
  3785. aevalsrc="sin(440*2*PI*t):s=8000"
  3786. @end example
  3787. @item
  3788. Generate a two channels signal, specify the channel layout (Front
  3789. Center + Back Center) explicitly:
  3790. @example
  3791. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  3792. @end example
  3793. @item
  3794. Generate white noise:
  3795. @example
  3796. aevalsrc="-2+random(0)"
  3797. @end example
  3798. @item
  3799. Generate an amplitude modulated signal:
  3800. @example
  3801. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  3802. @end example
  3803. @item
  3804. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  3805. @example
  3806. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  3807. @end example
  3808. @end itemize
  3809. @section anullsrc
  3810. The null audio source, return unprocessed audio frames. It is mainly useful
  3811. as a template and to be employed in analysis / debugging tools, or as
  3812. the source for filters which ignore the input data (for example the sox
  3813. synth filter).
  3814. This source accepts the following options:
  3815. @table @option
  3816. @item channel_layout, cl
  3817. Specifies the channel layout, and can be either an integer or a string
  3818. representing a channel layout. The default value of @var{channel_layout}
  3819. is "stereo".
  3820. Check the channel_layout_map definition in
  3821. @file{libavutil/channel_layout.c} for the mapping between strings and
  3822. channel layout values.
  3823. @item sample_rate, r
  3824. Specifies the sample rate, and defaults to 44100.
  3825. @item nb_samples, n
  3826. Set the number of samples per requested frames.
  3827. @end table
  3828. @subsection Examples
  3829. @itemize
  3830. @item
  3831. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3832. @example
  3833. anullsrc=r=48000:cl=4
  3834. @end example
  3835. @item
  3836. Do the same operation with a more obvious syntax:
  3837. @example
  3838. anullsrc=r=48000:cl=mono
  3839. @end example
  3840. @end itemize
  3841. All the parameters need to be explicitly defined.
  3842. @section flite
  3843. Synthesize a voice utterance using the libflite library.
  3844. To enable compilation of this filter you need to configure FFmpeg with
  3845. @code{--enable-libflite}.
  3846. Note that versions of the flite library prior to 2.0 are not thread-safe.
  3847. The filter accepts the following options:
  3848. @table @option
  3849. @item list_voices
  3850. If set to 1, list the names of the available voices and exit
  3851. immediately. Default value is 0.
  3852. @item nb_samples, n
  3853. Set the maximum number of samples per frame. Default value is 512.
  3854. @item textfile
  3855. Set the filename containing the text to speak.
  3856. @item text
  3857. Set the text to speak.
  3858. @item voice, v
  3859. Set the voice to use for the speech synthesis. Default value is
  3860. @code{kal}. See also the @var{list_voices} option.
  3861. @end table
  3862. @subsection Examples
  3863. @itemize
  3864. @item
  3865. Read from file @file{speech.txt}, and synthesize the text using the
  3866. standard flite voice:
  3867. @example
  3868. flite=textfile=speech.txt
  3869. @end example
  3870. @item
  3871. Read the specified text selecting the @code{slt} voice:
  3872. @example
  3873. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3874. @end example
  3875. @item
  3876. Input text to ffmpeg:
  3877. @example
  3878. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3879. @end example
  3880. @item
  3881. Make @file{ffplay} speak the specified text, using @code{flite} and
  3882. the @code{lavfi} device:
  3883. @example
  3884. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3885. @end example
  3886. @end itemize
  3887. For more information about libflite, check:
  3888. @url{http://www.festvox.org/flite/}
  3889. @section anoisesrc
  3890. Generate a noise audio signal.
  3891. The filter accepts the following options:
  3892. @table @option
  3893. @item sample_rate, r
  3894. Specify the sample rate. Default value is 48000 Hz.
  3895. @item amplitude, a
  3896. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  3897. is 1.0.
  3898. @item duration, d
  3899. Specify the duration of the generated audio stream. Not specifying this option
  3900. results in noise with an infinite length.
  3901. @item color, colour, c
  3902. Specify the color of noise. Available noise colors are white, pink, brown,
  3903. blue and violet. Default color is white.
  3904. @item seed, s
  3905. Specify a value used to seed the PRNG.
  3906. @item nb_samples, n
  3907. Set the number of samples per each output frame, default is 1024.
  3908. @end table
  3909. @subsection Examples
  3910. @itemize
  3911. @item
  3912. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  3913. @example
  3914. anoisesrc=d=60:c=pink:r=44100:a=0.5
  3915. @end example
  3916. @end itemize
  3917. @section hilbert
  3918. Generate odd-tap Hilbert transform FIR coefficients.
  3919. The resulting stream can be used with @ref{afir} filter for phase-shifting
  3920. the signal by 90 degrees.
  3921. This is used in many matrix coding schemes and for analytic signal generation.
  3922. The process is often written as a multiplication by i (or j), the imaginary unit.
  3923. The filter accepts the following options:
  3924. @table @option
  3925. @item sample_rate, s
  3926. Set sample rate, default is 44100.
  3927. @item taps, t
  3928. Set length of FIR filter, default is 22051.
  3929. @item nb_samples, n
  3930. Set number of samples per each frame.
  3931. @item win_func, w
  3932. Set window function to be used when generating FIR coefficients.
  3933. @end table
  3934. @section sine
  3935. Generate an audio signal made of a sine wave with amplitude 1/8.
  3936. The audio signal is bit-exact.
  3937. The filter accepts the following options:
  3938. @table @option
  3939. @item frequency, f
  3940. Set the carrier frequency. Default is 440 Hz.
  3941. @item beep_factor, b
  3942. Enable a periodic beep every second with frequency @var{beep_factor} times
  3943. the carrier frequency. Default is 0, meaning the beep is disabled.
  3944. @item sample_rate, r
  3945. Specify the sample rate, default is 44100.
  3946. @item duration, d
  3947. Specify the duration of the generated audio stream.
  3948. @item samples_per_frame
  3949. Set the number of samples per output frame.
  3950. The expression can contain the following constants:
  3951. @table @option
  3952. @item n
  3953. The (sequential) number of the output audio frame, starting from 0.
  3954. @item pts
  3955. The PTS (Presentation TimeStamp) of the output audio frame,
  3956. expressed in @var{TB} units.
  3957. @item t
  3958. The PTS of the output audio frame, expressed in seconds.
  3959. @item TB
  3960. The timebase of the output audio frames.
  3961. @end table
  3962. Default is @code{1024}.
  3963. @end table
  3964. @subsection Examples
  3965. @itemize
  3966. @item
  3967. Generate a simple 440 Hz sine wave:
  3968. @example
  3969. sine
  3970. @end example
  3971. @item
  3972. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  3973. @example
  3974. sine=220:4:d=5
  3975. sine=f=220:b=4:d=5
  3976. sine=frequency=220:beep_factor=4:duration=5
  3977. @end example
  3978. @item
  3979. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  3980. pattern:
  3981. @example
  3982. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  3983. @end example
  3984. @end itemize
  3985. @c man end AUDIO SOURCES
  3986. @chapter Audio Sinks
  3987. @c man begin AUDIO SINKS
  3988. Below is a description of the currently available audio sinks.
  3989. @section abuffersink
  3990. Buffer audio frames, and make them available to the end of filter chain.
  3991. This sink is mainly intended for programmatic use, in particular
  3992. through the interface defined in @file{libavfilter/buffersink.h}
  3993. or the options system.
  3994. It accepts a pointer to an AVABufferSinkContext structure, which
  3995. defines the incoming buffers' formats, to be passed as the opaque
  3996. parameter to @code{avfilter_init_filter} for initialization.
  3997. @section anullsink
  3998. Null audio sink; do absolutely nothing with the input audio. It is
  3999. mainly useful as a template and for use in analysis / debugging
  4000. tools.
  4001. @c man end AUDIO SINKS
  4002. @chapter Video Filters
  4003. @c man begin VIDEO FILTERS
  4004. When you configure your FFmpeg build, you can disable any of the
  4005. existing filters using @code{--disable-filters}.
  4006. The configure output will show the video filters included in your
  4007. build.
  4008. Below is a description of the currently available video filters.
  4009. @section alphaextract
  4010. Extract the alpha component from the input as a grayscale video. This
  4011. is especially useful with the @var{alphamerge} filter.
  4012. @section alphamerge
  4013. Add or replace the alpha component of the primary input with the
  4014. grayscale value of a second input. This is intended for use with
  4015. @var{alphaextract} to allow the transmission or storage of frame
  4016. sequences that have alpha in a format that doesn't support an alpha
  4017. channel.
  4018. For example, to reconstruct full frames from a normal YUV-encoded video
  4019. and a separate video created with @var{alphaextract}, you might use:
  4020. @example
  4021. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4022. @end example
  4023. Since this filter is designed for reconstruction, it operates on frame
  4024. sequences without considering timestamps, and terminates when either
  4025. input reaches end of stream. This will cause problems if your encoding
  4026. pipeline drops frames. If you're trying to apply an image as an
  4027. overlay to a video stream, consider the @var{overlay} filter instead.
  4028. @section ass
  4029. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4030. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4031. Substation Alpha) subtitles files.
  4032. This filter accepts the following option in addition to the common options from
  4033. the @ref{subtitles} filter:
  4034. @table @option
  4035. @item shaping
  4036. Set the shaping engine
  4037. Available values are:
  4038. @table @samp
  4039. @item auto
  4040. The default libass shaping engine, which is the best available.
  4041. @item simple
  4042. Fast, font-agnostic shaper that can do only substitutions
  4043. @item complex
  4044. Slower shaper using OpenType for substitutions and positioning
  4045. @end table
  4046. The default is @code{auto}.
  4047. @end table
  4048. @section atadenoise
  4049. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4050. The filter accepts the following options:
  4051. @table @option
  4052. @item 0a
  4053. Set threshold A for 1st plane. Default is 0.02.
  4054. Valid range is 0 to 0.3.
  4055. @item 0b
  4056. Set threshold B for 1st plane. Default is 0.04.
  4057. Valid range is 0 to 5.
  4058. @item 1a
  4059. Set threshold A for 2nd plane. Default is 0.02.
  4060. Valid range is 0 to 0.3.
  4061. @item 1b
  4062. Set threshold B for 2nd plane. Default is 0.04.
  4063. Valid range is 0 to 5.
  4064. @item 2a
  4065. Set threshold A for 3rd plane. Default is 0.02.
  4066. Valid range is 0 to 0.3.
  4067. @item 2b
  4068. Set threshold B for 3rd plane. Default is 0.04.
  4069. Valid range is 0 to 5.
  4070. Threshold A is designed to react on abrupt changes in the input signal and
  4071. threshold B is designed to react on continuous changes in the input signal.
  4072. @item s
  4073. Set number of frames filter will use for averaging. Default is 33. Must be odd
  4074. number in range [5, 129].
  4075. @item p
  4076. Set what planes of frame filter will use for averaging. Default is all.
  4077. @end table
  4078. @section avgblur
  4079. Apply average blur filter.
  4080. The filter accepts the following options:
  4081. @table @option
  4082. @item sizeX
  4083. Set horizontal kernel size.
  4084. @item planes
  4085. Set which planes to filter. By default all planes are filtered.
  4086. @item sizeY
  4087. Set vertical kernel size, if zero it will be same as @code{sizeX}.
  4088. Default is @code{0}.
  4089. @end table
  4090. @section bbox
  4091. Compute the bounding box for the non-black pixels in the input frame
  4092. luminance plane.
  4093. This filter computes the bounding box containing all the pixels with a
  4094. luminance value greater than the minimum allowed value.
  4095. The parameters describing the bounding box are printed on the filter
  4096. log.
  4097. The filter accepts the following option:
  4098. @table @option
  4099. @item min_val
  4100. Set the minimal luminance value. Default is @code{16}.
  4101. @end table
  4102. @section bitplanenoise
  4103. Show and measure bit plane noise.
  4104. The filter accepts the following options:
  4105. @table @option
  4106. @item bitplane
  4107. Set which plane to analyze. Default is @code{1}.
  4108. @item filter
  4109. Filter out noisy pixels from @code{bitplane} set above.
  4110. Default is disabled.
  4111. @end table
  4112. @section blackdetect
  4113. Detect video intervals that are (almost) completely black. Can be
  4114. useful to detect chapter transitions, commercials, or invalid
  4115. recordings. Output lines contains the time for the start, end and
  4116. duration of the detected black interval expressed in seconds.
  4117. In order to display the output lines, you need to set the loglevel at
  4118. least to the AV_LOG_INFO value.
  4119. The filter accepts the following options:
  4120. @table @option
  4121. @item black_min_duration, d
  4122. Set the minimum detected black duration expressed in seconds. It must
  4123. be a non-negative floating point number.
  4124. Default value is 2.0.
  4125. @item picture_black_ratio_th, pic_th
  4126. Set the threshold for considering a picture "black".
  4127. Express the minimum value for the ratio:
  4128. @example
  4129. @var{nb_black_pixels} / @var{nb_pixels}
  4130. @end example
  4131. for which a picture is considered black.
  4132. Default value is 0.98.
  4133. @item pixel_black_th, pix_th
  4134. Set the threshold for considering a pixel "black".
  4135. The threshold expresses the maximum pixel luminance value for which a
  4136. pixel is considered "black". The provided value is scaled according to
  4137. the following equation:
  4138. @example
  4139. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  4140. @end example
  4141. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  4142. the input video format, the range is [0-255] for YUV full-range
  4143. formats and [16-235] for YUV non full-range formats.
  4144. Default value is 0.10.
  4145. @end table
  4146. The following example sets the maximum pixel threshold to the minimum
  4147. value, and detects only black intervals of 2 or more seconds:
  4148. @example
  4149. blackdetect=d=2:pix_th=0.00
  4150. @end example
  4151. @section blackframe
  4152. Detect frames that are (almost) completely black. Can be useful to
  4153. detect chapter transitions or commercials. Output lines consist of
  4154. the frame number of the detected frame, the percentage of blackness,
  4155. the position in the file if known or -1 and the timestamp in seconds.
  4156. In order to display the output lines, you need to set the loglevel at
  4157. least to the AV_LOG_INFO value.
  4158. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  4159. The value represents the percentage of pixels in the picture that
  4160. are below the threshold value.
  4161. It accepts the following parameters:
  4162. @table @option
  4163. @item amount
  4164. The percentage of the pixels that have to be below the threshold; it defaults to
  4165. @code{98}.
  4166. @item threshold, thresh
  4167. The threshold below which a pixel value is considered black; it defaults to
  4168. @code{32}.
  4169. @end table
  4170. @section blend, tblend
  4171. Blend two video frames into each other.
  4172. The @code{blend} filter takes two input streams and outputs one
  4173. stream, the first input is the "top" layer and second input is
  4174. "bottom" layer. By default, the output terminates when the longest input terminates.
  4175. The @code{tblend} (time blend) filter takes two consecutive frames
  4176. from one single stream, and outputs the result obtained by blending
  4177. the new frame on top of the old frame.
  4178. A description of the accepted options follows.
  4179. @table @option
  4180. @item c0_mode
  4181. @item c1_mode
  4182. @item c2_mode
  4183. @item c3_mode
  4184. @item all_mode
  4185. Set blend mode for specific pixel component or all pixel components in case
  4186. of @var{all_mode}. Default value is @code{normal}.
  4187. Available values for component modes are:
  4188. @table @samp
  4189. @item addition
  4190. @item grainmerge
  4191. @item and
  4192. @item average
  4193. @item burn
  4194. @item darken
  4195. @item difference
  4196. @item grainextract
  4197. @item divide
  4198. @item dodge
  4199. @item freeze
  4200. @item exclusion
  4201. @item extremity
  4202. @item glow
  4203. @item hardlight
  4204. @item hardmix
  4205. @item heat
  4206. @item lighten
  4207. @item linearlight
  4208. @item multiply
  4209. @item multiply128
  4210. @item negation
  4211. @item normal
  4212. @item or
  4213. @item overlay
  4214. @item phoenix
  4215. @item pinlight
  4216. @item reflect
  4217. @item screen
  4218. @item softlight
  4219. @item subtract
  4220. @item vividlight
  4221. @item xor
  4222. @end table
  4223. @item c0_opacity
  4224. @item c1_opacity
  4225. @item c2_opacity
  4226. @item c3_opacity
  4227. @item all_opacity
  4228. Set blend opacity for specific pixel component or all pixel components in case
  4229. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  4230. @item c0_expr
  4231. @item c1_expr
  4232. @item c2_expr
  4233. @item c3_expr
  4234. @item all_expr
  4235. Set blend expression for specific pixel component or all pixel components in case
  4236. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  4237. The expressions can use the following variables:
  4238. @table @option
  4239. @item N
  4240. The sequential number of the filtered frame, starting from @code{0}.
  4241. @item X
  4242. @item Y
  4243. the coordinates of the current sample
  4244. @item W
  4245. @item H
  4246. the width and height of currently filtered plane
  4247. @item SW
  4248. @item SH
  4249. Width and height scale depending on the currently filtered plane. It is the
  4250. ratio between the corresponding luma plane number of pixels and the current
  4251. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  4252. @code{0.5,0.5} for chroma planes.
  4253. @item T
  4254. Time of the current frame, expressed in seconds.
  4255. @item TOP, A
  4256. Value of pixel component at current location for first video frame (top layer).
  4257. @item BOTTOM, B
  4258. Value of pixel component at current location for second video frame (bottom layer).
  4259. @end table
  4260. @end table
  4261. The @code{blend} filter also supports the @ref{framesync} options.
  4262. @subsection Examples
  4263. @itemize
  4264. @item
  4265. Apply transition from bottom layer to top layer in first 10 seconds:
  4266. @example
  4267. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  4268. @end example
  4269. @item
  4270. Apply linear horizontal transition from top layer to bottom layer:
  4271. @example
  4272. blend=all_expr='A*(X/W)+B*(1-X/W)'
  4273. @end example
  4274. @item
  4275. Apply 1x1 checkerboard effect:
  4276. @example
  4277. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  4278. @end example
  4279. @item
  4280. Apply uncover left effect:
  4281. @example
  4282. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  4283. @end example
  4284. @item
  4285. Apply uncover down effect:
  4286. @example
  4287. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  4288. @end example
  4289. @item
  4290. Apply uncover up-left effect:
  4291. @example
  4292. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  4293. @end example
  4294. @item
  4295. Split diagonally video and shows top and bottom layer on each side:
  4296. @example
  4297. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  4298. @end example
  4299. @item
  4300. Display differences between the current and the previous frame:
  4301. @example
  4302. tblend=all_mode=grainextract
  4303. @end example
  4304. @end itemize
  4305. @section boxblur
  4306. Apply a boxblur algorithm to the input video.
  4307. It accepts the following parameters:
  4308. @table @option
  4309. @item luma_radius, lr
  4310. @item luma_power, lp
  4311. @item chroma_radius, cr
  4312. @item chroma_power, cp
  4313. @item alpha_radius, ar
  4314. @item alpha_power, ap
  4315. @end table
  4316. A description of the accepted options follows.
  4317. @table @option
  4318. @item luma_radius, lr
  4319. @item chroma_radius, cr
  4320. @item alpha_radius, ar
  4321. Set an expression for the box radius in pixels used for blurring the
  4322. corresponding input plane.
  4323. The radius value must be a non-negative number, and must not be
  4324. greater than the value of the expression @code{min(w,h)/2} for the
  4325. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  4326. planes.
  4327. Default value for @option{luma_radius} is "2". If not specified,
  4328. @option{chroma_radius} and @option{alpha_radius} default to the
  4329. corresponding value set for @option{luma_radius}.
  4330. The expressions can contain the following constants:
  4331. @table @option
  4332. @item w
  4333. @item h
  4334. The input width and height in pixels.
  4335. @item cw
  4336. @item ch
  4337. The input chroma image width and height in pixels.
  4338. @item hsub
  4339. @item vsub
  4340. The horizontal and vertical chroma subsample values. For example, for the
  4341. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  4342. @end table
  4343. @item luma_power, lp
  4344. @item chroma_power, cp
  4345. @item alpha_power, ap
  4346. Specify how many times the boxblur filter is applied to the
  4347. corresponding plane.
  4348. Default value for @option{luma_power} is 2. If not specified,
  4349. @option{chroma_power} and @option{alpha_power} default to the
  4350. corresponding value set for @option{luma_power}.
  4351. A value of 0 will disable the effect.
  4352. @end table
  4353. @subsection Examples
  4354. @itemize
  4355. @item
  4356. Apply a boxblur filter with the luma, chroma, and alpha radii
  4357. set to 2:
  4358. @example
  4359. boxblur=luma_radius=2:luma_power=1
  4360. boxblur=2:1
  4361. @end example
  4362. @item
  4363. Set the luma radius to 2, and alpha and chroma radius to 0:
  4364. @example
  4365. boxblur=2:1:cr=0:ar=0
  4366. @end example
  4367. @item
  4368. Set the luma and chroma radii to a fraction of the video dimension:
  4369. @example
  4370. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  4371. @end example
  4372. @end itemize
  4373. @section bwdif
  4374. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  4375. Deinterlacing Filter").
  4376. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  4377. interpolation algorithms.
  4378. It accepts the following parameters:
  4379. @table @option
  4380. @item mode
  4381. The interlacing mode to adopt. It accepts one of the following values:
  4382. @table @option
  4383. @item 0, send_frame
  4384. Output one frame for each frame.
  4385. @item 1, send_field
  4386. Output one frame for each field.
  4387. @end table
  4388. The default value is @code{send_field}.
  4389. @item parity
  4390. The picture field parity assumed for the input interlaced video. It accepts one
  4391. of the following values:
  4392. @table @option
  4393. @item 0, tff
  4394. Assume the top field is first.
  4395. @item 1, bff
  4396. Assume the bottom field is first.
  4397. @item -1, auto
  4398. Enable automatic detection of field parity.
  4399. @end table
  4400. The default value is @code{auto}.
  4401. If the interlacing is unknown or the decoder does not export this information,
  4402. top field first will be assumed.
  4403. @item deint
  4404. Specify which frames to deinterlace. Accept one of the following
  4405. values:
  4406. @table @option
  4407. @item 0, all
  4408. Deinterlace all frames.
  4409. @item 1, interlaced
  4410. Only deinterlace frames marked as interlaced.
  4411. @end table
  4412. The default value is @code{all}.
  4413. @end table
  4414. @section chromakey
  4415. YUV colorspace color/chroma keying.
  4416. The filter accepts the following options:
  4417. @table @option
  4418. @item color
  4419. The color which will be replaced with transparency.
  4420. @item similarity
  4421. Similarity percentage with the key color.
  4422. 0.01 matches only the exact key color, while 1.0 matches everything.
  4423. @item blend
  4424. Blend percentage.
  4425. 0.0 makes pixels either fully transparent, or not transparent at all.
  4426. Higher values result in semi-transparent pixels, with a higher transparency
  4427. the more similar the pixels color is to the key color.
  4428. @item yuv
  4429. Signals that the color passed is already in YUV instead of RGB.
  4430. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  4431. This can be used to pass exact YUV values as hexadecimal numbers.
  4432. @end table
  4433. @subsection Examples
  4434. @itemize
  4435. @item
  4436. Make every green pixel in the input image transparent:
  4437. @example
  4438. ffmpeg -i input.png -vf chromakey=green out.png
  4439. @end example
  4440. @item
  4441. Overlay a greenscreen-video on top of a static black background.
  4442. @example
  4443. 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
  4444. @end example
  4445. @end itemize
  4446. @section ciescope
  4447. Display CIE color diagram with pixels overlaid onto it.
  4448. The filter accepts the following options:
  4449. @table @option
  4450. @item system
  4451. Set color system.
  4452. @table @samp
  4453. @item ntsc, 470m
  4454. @item ebu, 470bg
  4455. @item smpte
  4456. @item 240m
  4457. @item apple
  4458. @item widergb
  4459. @item cie1931
  4460. @item rec709, hdtv
  4461. @item uhdtv, rec2020
  4462. @end table
  4463. @item cie
  4464. Set CIE system.
  4465. @table @samp
  4466. @item xyy
  4467. @item ucs
  4468. @item luv
  4469. @end table
  4470. @item gamuts
  4471. Set what gamuts to draw.
  4472. See @code{system} option for available values.
  4473. @item size, s
  4474. Set ciescope size, by default set to 512.
  4475. @item intensity, i
  4476. Set intensity used to map input pixel values to CIE diagram.
  4477. @item contrast
  4478. Set contrast used to draw tongue colors that are out of active color system gamut.
  4479. @item corrgamma
  4480. Correct gamma displayed on scope, by default enabled.
  4481. @item showwhite
  4482. Show white point on CIE diagram, by default disabled.
  4483. @item gamma
  4484. Set input gamma. Used only with XYZ input color space.
  4485. @end table
  4486. @section codecview
  4487. Visualize information exported by some codecs.
  4488. Some codecs can export information through frames using side-data or other
  4489. means. For example, some MPEG based codecs export motion vectors through the
  4490. @var{export_mvs} flag in the codec @option{flags2} option.
  4491. The filter accepts the following option:
  4492. @table @option
  4493. @item mv
  4494. Set motion vectors to visualize.
  4495. Available flags for @var{mv} are:
  4496. @table @samp
  4497. @item pf
  4498. forward predicted MVs of P-frames
  4499. @item bf
  4500. forward predicted MVs of B-frames
  4501. @item bb
  4502. backward predicted MVs of B-frames
  4503. @end table
  4504. @item qp
  4505. Display quantization parameters using the chroma planes.
  4506. @item mv_type, mvt
  4507. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  4508. Available flags for @var{mv_type} are:
  4509. @table @samp
  4510. @item fp
  4511. forward predicted MVs
  4512. @item bp
  4513. backward predicted MVs
  4514. @end table
  4515. @item frame_type, ft
  4516. Set frame type to visualize motion vectors of.
  4517. Available flags for @var{frame_type} are:
  4518. @table @samp
  4519. @item if
  4520. intra-coded frames (I-frames)
  4521. @item pf
  4522. predicted frames (P-frames)
  4523. @item bf
  4524. bi-directionally predicted frames (B-frames)
  4525. @end table
  4526. @end table
  4527. @subsection Examples
  4528. @itemize
  4529. @item
  4530. Visualize forward predicted MVs of all frames using @command{ffplay}:
  4531. @example
  4532. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  4533. @end example
  4534. @item
  4535. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  4536. @example
  4537. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  4538. @end example
  4539. @end itemize
  4540. @section colorbalance
  4541. Modify intensity of primary colors (red, green and blue) of input frames.
  4542. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  4543. regions for the red-cyan, green-magenta or blue-yellow balance.
  4544. A positive adjustment value shifts the balance towards the primary color, a negative
  4545. value towards the complementary color.
  4546. The filter accepts the following options:
  4547. @table @option
  4548. @item rs
  4549. @item gs
  4550. @item bs
  4551. Adjust red, green and blue shadows (darkest pixels).
  4552. @item rm
  4553. @item gm
  4554. @item bm
  4555. Adjust red, green and blue midtones (medium pixels).
  4556. @item rh
  4557. @item gh
  4558. @item bh
  4559. Adjust red, green and blue highlights (brightest pixels).
  4560. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4561. @end table
  4562. @subsection Examples
  4563. @itemize
  4564. @item
  4565. Add red color cast to shadows:
  4566. @example
  4567. colorbalance=rs=.3
  4568. @end example
  4569. @end itemize
  4570. @section colorkey
  4571. RGB colorspace color keying.
  4572. The filter accepts the following options:
  4573. @table @option
  4574. @item color
  4575. The color which will be replaced with transparency.
  4576. @item similarity
  4577. Similarity percentage with the key color.
  4578. 0.01 matches only the exact key color, while 1.0 matches everything.
  4579. @item blend
  4580. Blend percentage.
  4581. 0.0 makes pixels either fully transparent, or not transparent at all.
  4582. Higher values result in semi-transparent pixels, with a higher transparency
  4583. the more similar the pixels color is to the key color.
  4584. @end table
  4585. @subsection Examples
  4586. @itemize
  4587. @item
  4588. Make every green pixel in the input image transparent:
  4589. @example
  4590. ffmpeg -i input.png -vf colorkey=green out.png
  4591. @end example
  4592. @item
  4593. Overlay a greenscreen-video on top of a static background image.
  4594. @example
  4595. 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
  4596. @end example
  4597. @end itemize
  4598. @section colorlevels
  4599. Adjust video input frames using levels.
  4600. The filter accepts the following options:
  4601. @table @option
  4602. @item rimin
  4603. @item gimin
  4604. @item bimin
  4605. @item aimin
  4606. Adjust red, green, blue and alpha input black point.
  4607. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4608. @item rimax
  4609. @item gimax
  4610. @item bimax
  4611. @item aimax
  4612. Adjust red, green, blue and alpha input white point.
  4613. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  4614. Input levels are used to lighten highlights (bright tones), darken shadows
  4615. (dark tones), change the balance of bright and dark tones.
  4616. @item romin
  4617. @item gomin
  4618. @item bomin
  4619. @item aomin
  4620. Adjust red, green, blue and alpha output black point.
  4621. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  4622. @item romax
  4623. @item gomax
  4624. @item bomax
  4625. @item aomax
  4626. Adjust red, green, blue and alpha output white point.
  4627. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  4628. Output levels allows manual selection of a constrained output level range.
  4629. @end table
  4630. @subsection Examples
  4631. @itemize
  4632. @item
  4633. Make video output darker:
  4634. @example
  4635. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  4636. @end example
  4637. @item
  4638. Increase contrast:
  4639. @example
  4640. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  4641. @end example
  4642. @item
  4643. Make video output lighter:
  4644. @example
  4645. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  4646. @end example
  4647. @item
  4648. Increase brightness:
  4649. @example
  4650. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  4651. @end example
  4652. @end itemize
  4653. @section colorchannelmixer
  4654. Adjust video input frames by re-mixing color channels.
  4655. This filter modifies a color channel by adding the values associated to
  4656. the other channels of the same pixels. For example if the value to
  4657. modify is red, the output value will be:
  4658. @example
  4659. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  4660. @end example
  4661. The filter accepts the following options:
  4662. @table @option
  4663. @item rr
  4664. @item rg
  4665. @item rb
  4666. @item ra
  4667. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  4668. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  4669. @item gr
  4670. @item gg
  4671. @item gb
  4672. @item ga
  4673. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  4674. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  4675. @item br
  4676. @item bg
  4677. @item bb
  4678. @item ba
  4679. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  4680. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  4681. @item ar
  4682. @item ag
  4683. @item ab
  4684. @item aa
  4685. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  4686. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  4687. Allowed ranges for options are @code{[-2.0, 2.0]}.
  4688. @end table
  4689. @subsection Examples
  4690. @itemize
  4691. @item
  4692. Convert source to grayscale:
  4693. @example
  4694. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  4695. @end example
  4696. @item
  4697. Simulate sepia tones:
  4698. @example
  4699. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  4700. @end example
  4701. @end itemize
  4702. @section colormatrix
  4703. Convert color matrix.
  4704. The filter accepts the following options:
  4705. @table @option
  4706. @item src
  4707. @item dst
  4708. Specify the source and destination color matrix. Both values must be
  4709. specified.
  4710. The accepted values are:
  4711. @table @samp
  4712. @item bt709
  4713. BT.709
  4714. @item fcc
  4715. FCC
  4716. @item bt601
  4717. BT.601
  4718. @item bt470
  4719. BT.470
  4720. @item bt470bg
  4721. BT.470BG
  4722. @item smpte170m
  4723. SMPTE-170M
  4724. @item smpte240m
  4725. SMPTE-240M
  4726. @item bt2020
  4727. BT.2020
  4728. @end table
  4729. @end table
  4730. For example to convert from BT.601 to SMPTE-240M, use the command:
  4731. @example
  4732. colormatrix=bt601:smpte240m
  4733. @end example
  4734. @section colorspace
  4735. Convert colorspace, transfer characteristics or color primaries.
  4736. Input video needs to have an even size.
  4737. The filter accepts the following options:
  4738. @table @option
  4739. @anchor{all}
  4740. @item all
  4741. Specify all color properties at once.
  4742. The accepted values are:
  4743. @table @samp
  4744. @item bt470m
  4745. BT.470M
  4746. @item bt470bg
  4747. BT.470BG
  4748. @item bt601-6-525
  4749. BT.601-6 525
  4750. @item bt601-6-625
  4751. BT.601-6 625
  4752. @item bt709
  4753. BT.709
  4754. @item smpte170m
  4755. SMPTE-170M
  4756. @item smpte240m
  4757. SMPTE-240M
  4758. @item bt2020
  4759. BT.2020
  4760. @end table
  4761. @anchor{space}
  4762. @item space
  4763. Specify output colorspace.
  4764. The accepted values are:
  4765. @table @samp
  4766. @item bt709
  4767. BT.709
  4768. @item fcc
  4769. FCC
  4770. @item bt470bg
  4771. BT.470BG or BT.601-6 625
  4772. @item smpte170m
  4773. SMPTE-170M or BT.601-6 525
  4774. @item smpte240m
  4775. SMPTE-240M
  4776. @item ycgco
  4777. YCgCo
  4778. @item bt2020ncl
  4779. BT.2020 with non-constant luminance
  4780. @end table
  4781. @anchor{trc}
  4782. @item trc
  4783. Specify output transfer characteristics.
  4784. The accepted values are:
  4785. @table @samp
  4786. @item bt709
  4787. BT.709
  4788. @item bt470m
  4789. BT.470M
  4790. @item bt470bg
  4791. BT.470BG
  4792. @item gamma22
  4793. Constant gamma of 2.2
  4794. @item gamma28
  4795. Constant gamma of 2.8
  4796. @item smpte170m
  4797. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  4798. @item smpte240m
  4799. SMPTE-240M
  4800. @item srgb
  4801. SRGB
  4802. @item iec61966-2-1
  4803. iec61966-2-1
  4804. @item iec61966-2-4
  4805. iec61966-2-4
  4806. @item xvycc
  4807. xvycc
  4808. @item bt2020-10
  4809. BT.2020 for 10-bits content
  4810. @item bt2020-12
  4811. BT.2020 for 12-bits content
  4812. @end table
  4813. @anchor{primaries}
  4814. @item primaries
  4815. Specify output color primaries.
  4816. The accepted values are:
  4817. @table @samp
  4818. @item bt709
  4819. BT.709
  4820. @item bt470m
  4821. BT.470M
  4822. @item bt470bg
  4823. BT.470BG or BT.601-6 625
  4824. @item smpte170m
  4825. SMPTE-170M or BT.601-6 525
  4826. @item smpte240m
  4827. SMPTE-240M
  4828. @item film
  4829. film
  4830. @item smpte431
  4831. SMPTE-431
  4832. @item smpte432
  4833. SMPTE-432
  4834. @item bt2020
  4835. BT.2020
  4836. @item jedec-p22
  4837. JEDEC P22 phosphors
  4838. @end table
  4839. @anchor{range}
  4840. @item range
  4841. Specify output color range.
  4842. The accepted values are:
  4843. @table @samp
  4844. @item tv
  4845. TV (restricted) range
  4846. @item mpeg
  4847. MPEG (restricted) range
  4848. @item pc
  4849. PC (full) range
  4850. @item jpeg
  4851. JPEG (full) range
  4852. @end table
  4853. @item format
  4854. Specify output color format.
  4855. The accepted values are:
  4856. @table @samp
  4857. @item yuv420p
  4858. YUV 4:2:0 planar 8-bits
  4859. @item yuv420p10
  4860. YUV 4:2:0 planar 10-bits
  4861. @item yuv420p12
  4862. YUV 4:2:0 planar 12-bits
  4863. @item yuv422p
  4864. YUV 4:2:2 planar 8-bits
  4865. @item yuv422p10
  4866. YUV 4:2:2 planar 10-bits
  4867. @item yuv422p12
  4868. YUV 4:2:2 planar 12-bits
  4869. @item yuv444p
  4870. YUV 4:4:4 planar 8-bits
  4871. @item yuv444p10
  4872. YUV 4:4:4 planar 10-bits
  4873. @item yuv444p12
  4874. YUV 4:4:4 planar 12-bits
  4875. @end table
  4876. @item fast
  4877. Do a fast conversion, which skips gamma/primary correction. This will take
  4878. significantly less CPU, but will be mathematically incorrect. To get output
  4879. compatible with that produced by the colormatrix filter, use fast=1.
  4880. @item dither
  4881. Specify dithering mode.
  4882. The accepted values are:
  4883. @table @samp
  4884. @item none
  4885. No dithering
  4886. @item fsb
  4887. Floyd-Steinberg dithering
  4888. @end table
  4889. @item wpadapt
  4890. Whitepoint adaptation mode.
  4891. The accepted values are:
  4892. @table @samp
  4893. @item bradford
  4894. Bradford whitepoint adaptation
  4895. @item vonkries
  4896. von Kries whitepoint adaptation
  4897. @item identity
  4898. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  4899. @end table
  4900. @item iall
  4901. Override all input properties at once. Same accepted values as @ref{all}.
  4902. @item ispace
  4903. Override input colorspace. Same accepted values as @ref{space}.
  4904. @item iprimaries
  4905. Override input color primaries. Same accepted values as @ref{primaries}.
  4906. @item itrc
  4907. Override input transfer characteristics. Same accepted values as @ref{trc}.
  4908. @item irange
  4909. Override input color range. Same accepted values as @ref{range}.
  4910. @end table
  4911. The filter converts the transfer characteristics, color space and color
  4912. primaries to the specified user values. The output value, if not specified,
  4913. is set to a default value based on the "all" property. If that property is
  4914. also not specified, the filter will log an error. The output color range and
  4915. format default to the same value as the input color range and format. The
  4916. input transfer characteristics, color space, color primaries and color range
  4917. should be set on the input data. If any of these are missing, the filter will
  4918. log an error and no conversion will take place.
  4919. For example to convert the input to SMPTE-240M, use the command:
  4920. @example
  4921. colorspace=smpte240m
  4922. @end example
  4923. @section convolution
  4924. Apply convolution 3x3, 5x5 or 7x7 filter.
  4925. The filter accepts the following options:
  4926. @table @option
  4927. @item 0m
  4928. @item 1m
  4929. @item 2m
  4930. @item 3m
  4931. Set matrix for each plane.
  4932. Matrix is sequence of 9, 25 or 49 signed integers.
  4933. @item 0rdiv
  4934. @item 1rdiv
  4935. @item 2rdiv
  4936. @item 3rdiv
  4937. Set multiplier for calculated value for each plane.
  4938. @item 0bias
  4939. @item 1bias
  4940. @item 2bias
  4941. @item 3bias
  4942. Set bias for each plane. This value is added to the result of the multiplication.
  4943. Useful for making the overall image brighter or darker. Default is 0.0.
  4944. @end table
  4945. @subsection Examples
  4946. @itemize
  4947. @item
  4948. Apply sharpen:
  4949. @example
  4950. 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"
  4951. @end example
  4952. @item
  4953. Apply blur:
  4954. @example
  4955. 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"
  4956. @end example
  4957. @item
  4958. Apply edge enhance:
  4959. @example
  4960. 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"
  4961. @end example
  4962. @item
  4963. Apply edge detect:
  4964. @example
  4965. 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"
  4966. @end example
  4967. @item
  4968. Apply laplacian edge detector which includes diagonals:
  4969. @example
  4970. 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"
  4971. @end example
  4972. @item
  4973. Apply emboss:
  4974. @example
  4975. 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"
  4976. @end example
  4977. @end itemize
  4978. @section convolve
  4979. Apply 2D convolution of video stream in frequency domain using second stream
  4980. as impulse.
  4981. The filter accepts the following options:
  4982. @table @option
  4983. @item planes
  4984. Set which planes to process.
  4985. @item impulse
  4986. Set which impulse video frames will be processed, can be @var{first}
  4987. or @var{all}. Default is @var{all}.
  4988. @end table
  4989. The @code{convolve} filter also supports the @ref{framesync} options.
  4990. @section copy
  4991. Copy the input video source unchanged to the output. This is mainly useful for
  4992. testing purposes.
  4993. @anchor{coreimage}
  4994. @section coreimage
  4995. Video filtering on GPU using Apple's CoreImage API on OSX.
  4996. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  4997. processed by video hardware. However, software-based OpenGL implementations
  4998. exist which means there is no guarantee for hardware processing. It depends on
  4999. the respective OSX.
  5000. There are many filters and image generators provided by Apple that come with a
  5001. large variety of options. The filter has to be referenced by its name along
  5002. with its options.
  5003. The coreimage filter accepts the following options:
  5004. @table @option
  5005. @item list_filters
  5006. List all available filters and generators along with all their respective
  5007. options as well as possible minimum and maximum values along with the default
  5008. values.
  5009. @example
  5010. list_filters=true
  5011. @end example
  5012. @item filter
  5013. Specify all filters by their respective name and options.
  5014. Use @var{list_filters} to determine all valid filter names and options.
  5015. Numerical options are specified by a float value and are automatically clamped
  5016. to their respective value range. Vector and color options have to be specified
  5017. by a list of space separated float values. Character escaping has to be done.
  5018. A special option name @code{default} is available to use default options for a
  5019. filter.
  5020. It is required to specify either @code{default} or at least one of the filter options.
  5021. All omitted options are used with their default values.
  5022. The syntax of the filter string is as follows:
  5023. @example
  5024. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  5025. @end example
  5026. @item output_rect
  5027. Specify a rectangle where the output of the filter chain is copied into the
  5028. input image. It is given by a list of space separated float values:
  5029. @example
  5030. output_rect=x\ y\ width\ height
  5031. @end example
  5032. If not given, the output rectangle equals the dimensions of the input image.
  5033. The output rectangle is automatically cropped at the borders of the input
  5034. image. Negative values are valid for each component.
  5035. @example
  5036. output_rect=25\ 25\ 100\ 100
  5037. @end example
  5038. @end table
  5039. Several filters can be chained for successive processing without GPU-HOST
  5040. transfers allowing for fast processing of complex filter chains.
  5041. Currently, only filters with zero (generators) or exactly one (filters) input
  5042. image and one output image are supported. Also, transition filters are not yet
  5043. usable as intended.
  5044. Some filters generate output images with additional padding depending on the
  5045. respective filter kernel. The padding is automatically removed to ensure the
  5046. filter output has the same size as the input image.
  5047. For image generators, the size of the output image is determined by the
  5048. previous output image of the filter chain or the input image of the whole
  5049. filterchain, respectively. The generators do not use the pixel information of
  5050. this image to generate their output. However, the generated output is
  5051. blended onto this image, resulting in partial or complete coverage of the
  5052. output image.
  5053. The @ref{coreimagesrc} video source can be used for generating input images
  5054. which are directly fed into the filter chain. By using it, providing input
  5055. images by another video source or an input video is not required.
  5056. @subsection Examples
  5057. @itemize
  5058. @item
  5059. List all filters available:
  5060. @example
  5061. coreimage=list_filters=true
  5062. @end example
  5063. @item
  5064. Use the CIBoxBlur filter with default options to blur an image:
  5065. @example
  5066. coreimage=filter=CIBoxBlur@@default
  5067. @end example
  5068. @item
  5069. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  5070. its center at 100x100 and a radius of 50 pixels:
  5071. @example
  5072. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  5073. @end example
  5074. @item
  5075. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  5076. given as complete and escaped command-line for Apple's standard bash shell:
  5077. @example
  5078. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  5079. @end example
  5080. @end itemize
  5081. @section crop
  5082. Crop the input video to given dimensions.
  5083. It accepts the following parameters:
  5084. @table @option
  5085. @item w, out_w
  5086. The width of the output video. It defaults to @code{iw}.
  5087. This expression is evaluated only once during the filter
  5088. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  5089. @item h, out_h
  5090. The height of the output video. It defaults to @code{ih}.
  5091. This expression is evaluated only once during the filter
  5092. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  5093. @item x
  5094. The horizontal position, in the input video, of the left edge of the output
  5095. video. It defaults to @code{(in_w-out_w)/2}.
  5096. This expression is evaluated per-frame.
  5097. @item y
  5098. The vertical position, in the input video, of the top edge of the output video.
  5099. It defaults to @code{(in_h-out_h)/2}.
  5100. This expression is evaluated per-frame.
  5101. @item keep_aspect
  5102. If set to 1 will force the output display aspect ratio
  5103. to be the same of the input, by changing the output sample aspect
  5104. ratio. It defaults to 0.
  5105. @item exact
  5106. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  5107. width/height/x/y as specified and will not be rounded to nearest smaller value.
  5108. It defaults to 0.
  5109. @end table
  5110. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  5111. expressions containing the following constants:
  5112. @table @option
  5113. @item x
  5114. @item y
  5115. The computed values for @var{x} and @var{y}. They are evaluated for
  5116. each new frame.
  5117. @item in_w
  5118. @item in_h
  5119. The input width and height.
  5120. @item iw
  5121. @item ih
  5122. These are the same as @var{in_w} and @var{in_h}.
  5123. @item out_w
  5124. @item out_h
  5125. The output (cropped) width and height.
  5126. @item ow
  5127. @item oh
  5128. These are the same as @var{out_w} and @var{out_h}.
  5129. @item a
  5130. same as @var{iw} / @var{ih}
  5131. @item sar
  5132. input sample aspect ratio
  5133. @item dar
  5134. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  5135. @item hsub
  5136. @item vsub
  5137. horizontal and vertical chroma subsample values. For example for the
  5138. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5139. @item n
  5140. The number of the input frame, starting from 0.
  5141. @item pos
  5142. the position in the file of the input frame, NAN if unknown
  5143. @item t
  5144. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  5145. @end table
  5146. The expression for @var{out_w} may depend on the value of @var{out_h},
  5147. and the expression for @var{out_h} may depend on @var{out_w}, but they
  5148. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  5149. evaluated after @var{out_w} and @var{out_h}.
  5150. The @var{x} and @var{y} parameters specify the expressions for the
  5151. position of the top-left corner of the output (non-cropped) area. They
  5152. are evaluated for each frame. If the evaluated value is not valid, it
  5153. is approximated to the nearest valid value.
  5154. The expression for @var{x} may depend on @var{y}, and the expression
  5155. for @var{y} may depend on @var{x}.
  5156. @subsection Examples
  5157. @itemize
  5158. @item
  5159. Crop area with size 100x100 at position (12,34).
  5160. @example
  5161. crop=100:100:12:34
  5162. @end example
  5163. Using named options, the example above becomes:
  5164. @example
  5165. crop=w=100:h=100:x=12:y=34
  5166. @end example
  5167. @item
  5168. Crop the central input area with size 100x100:
  5169. @example
  5170. crop=100:100
  5171. @end example
  5172. @item
  5173. Crop the central input area with size 2/3 of the input video:
  5174. @example
  5175. crop=2/3*in_w:2/3*in_h
  5176. @end example
  5177. @item
  5178. Crop the input video central square:
  5179. @example
  5180. crop=out_w=in_h
  5181. crop=in_h
  5182. @end example
  5183. @item
  5184. Delimit the rectangle with the top-left corner placed at position
  5185. 100:100 and the right-bottom corner corresponding to the right-bottom
  5186. corner of the input image.
  5187. @example
  5188. crop=in_w-100:in_h-100:100:100
  5189. @end example
  5190. @item
  5191. Crop 10 pixels from the left and right borders, and 20 pixels from
  5192. the top and bottom borders
  5193. @example
  5194. crop=in_w-2*10:in_h-2*20
  5195. @end example
  5196. @item
  5197. Keep only the bottom right quarter of the input image:
  5198. @example
  5199. crop=in_w/2:in_h/2:in_w/2:in_h/2
  5200. @end example
  5201. @item
  5202. Crop height for getting Greek harmony:
  5203. @example
  5204. crop=in_w:1/PHI*in_w
  5205. @end example
  5206. @item
  5207. Apply trembling effect:
  5208. @example
  5209. 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)
  5210. @end example
  5211. @item
  5212. Apply erratic camera effect depending on timestamp:
  5213. @example
  5214. 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)"
  5215. @end example
  5216. @item
  5217. Set x depending on the value of y:
  5218. @example
  5219. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  5220. @end example
  5221. @end itemize
  5222. @subsection Commands
  5223. This filter supports the following commands:
  5224. @table @option
  5225. @item w, out_w
  5226. @item h, out_h
  5227. @item x
  5228. @item y
  5229. Set width/height of the output video and the horizontal/vertical position
  5230. in the input video.
  5231. The command accepts the same syntax of the corresponding option.
  5232. If the specified expression is not valid, it is kept at its current
  5233. value.
  5234. @end table
  5235. @section cropdetect
  5236. Auto-detect the crop size.
  5237. It calculates the necessary cropping parameters and prints the
  5238. recommended parameters via the logging system. The detected dimensions
  5239. correspond to the non-black area of the input video.
  5240. It accepts the following parameters:
  5241. @table @option
  5242. @item limit
  5243. Set higher black value threshold, which can be optionally specified
  5244. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  5245. value greater to the set value is considered non-black. It defaults to 24.
  5246. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  5247. on the bitdepth of the pixel format.
  5248. @item round
  5249. The value which the width/height should be divisible by. It defaults to
  5250. 16. The offset is automatically adjusted to center the video. Use 2 to
  5251. get only even dimensions (needed for 4:2:2 video). 16 is best when
  5252. encoding to most video codecs.
  5253. @item reset_count, reset
  5254. Set the counter that determines after how many frames cropdetect will
  5255. reset the previously detected largest video area and start over to
  5256. detect the current optimal crop area. Default value is 0.
  5257. This can be useful when channel logos distort the video area. 0
  5258. indicates 'never reset', and returns the largest area encountered during
  5259. playback.
  5260. @end table
  5261. @anchor{curves}
  5262. @section curves
  5263. Apply color adjustments using curves.
  5264. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  5265. component (red, green and blue) has its values defined by @var{N} key points
  5266. tied from each other using a smooth curve. The x-axis represents the pixel
  5267. values from the input frame, and the y-axis the new pixel values to be set for
  5268. the output frame.
  5269. By default, a component curve is defined by the two points @var{(0;0)} and
  5270. @var{(1;1)}. This creates a straight line where each original pixel value is
  5271. "adjusted" to its own value, which means no change to the image.
  5272. The filter allows you to redefine these two points and add some more. A new
  5273. curve (using a natural cubic spline interpolation) will be define to pass
  5274. smoothly through all these new coordinates. The new defined points needs to be
  5275. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  5276. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  5277. the vector spaces, the values will be clipped accordingly.
  5278. The filter accepts the following options:
  5279. @table @option
  5280. @item preset
  5281. Select one of the available color presets. This option can be used in addition
  5282. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  5283. options takes priority on the preset values.
  5284. Available presets are:
  5285. @table @samp
  5286. @item none
  5287. @item color_negative
  5288. @item cross_process
  5289. @item darker
  5290. @item increase_contrast
  5291. @item lighter
  5292. @item linear_contrast
  5293. @item medium_contrast
  5294. @item negative
  5295. @item strong_contrast
  5296. @item vintage
  5297. @end table
  5298. Default is @code{none}.
  5299. @item master, m
  5300. Set the master key points. These points will define a second pass mapping. It
  5301. is sometimes called a "luminance" or "value" mapping. It can be used with
  5302. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  5303. post-processing LUT.
  5304. @item red, r
  5305. Set the key points for the red component.
  5306. @item green, g
  5307. Set the key points for the green component.
  5308. @item blue, b
  5309. Set the key points for the blue component.
  5310. @item all
  5311. Set the key points for all components (not including master).
  5312. Can be used in addition to the other key points component
  5313. options. In this case, the unset component(s) will fallback on this
  5314. @option{all} setting.
  5315. @item psfile
  5316. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  5317. @item plot
  5318. Save Gnuplot script of the curves in specified file.
  5319. @end table
  5320. To avoid some filtergraph syntax conflicts, each key points list need to be
  5321. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  5322. @subsection Examples
  5323. @itemize
  5324. @item
  5325. Increase slightly the middle level of blue:
  5326. @example
  5327. curves=blue='0/0 0.5/0.58 1/1'
  5328. @end example
  5329. @item
  5330. Vintage effect:
  5331. @example
  5332. 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'
  5333. @end example
  5334. Here we obtain the following coordinates for each components:
  5335. @table @var
  5336. @item red
  5337. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  5338. @item green
  5339. @code{(0;0) (0.50;0.48) (1;1)}
  5340. @item blue
  5341. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  5342. @end table
  5343. @item
  5344. The previous example can also be achieved with the associated built-in preset:
  5345. @example
  5346. curves=preset=vintage
  5347. @end example
  5348. @item
  5349. Or simply:
  5350. @example
  5351. curves=vintage
  5352. @end example
  5353. @item
  5354. Use a Photoshop preset and redefine the points of the green component:
  5355. @example
  5356. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  5357. @end example
  5358. @item
  5359. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  5360. and @command{gnuplot}:
  5361. @example
  5362. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  5363. gnuplot -p /tmp/curves.plt
  5364. @end example
  5365. @end itemize
  5366. @section datascope
  5367. Video data analysis filter.
  5368. This filter shows hexadecimal pixel values of part of video.
  5369. The filter accepts the following options:
  5370. @table @option
  5371. @item size, s
  5372. Set output video size.
  5373. @item x
  5374. Set x offset from where to pick pixels.
  5375. @item y
  5376. Set y offset from where to pick pixels.
  5377. @item mode
  5378. Set scope mode, can be one of the following:
  5379. @table @samp
  5380. @item mono
  5381. Draw hexadecimal pixel values with white color on black background.
  5382. @item color
  5383. Draw hexadecimal pixel values with input video pixel color on black
  5384. background.
  5385. @item color2
  5386. Draw hexadecimal pixel values on color background picked from input video,
  5387. the text color is picked in such way so its always visible.
  5388. @end table
  5389. @item axis
  5390. Draw rows and columns numbers on left and top of video.
  5391. @item opacity
  5392. Set background opacity.
  5393. @end table
  5394. @section dctdnoiz
  5395. Denoise frames using 2D DCT (frequency domain filtering).
  5396. This filter is not designed for real time.
  5397. The filter accepts the following options:
  5398. @table @option
  5399. @item sigma, s
  5400. Set the noise sigma constant.
  5401. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  5402. coefficient (absolute value) below this threshold with be dropped.
  5403. If you need a more advanced filtering, see @option{expr}.
  5404. Default is @code{0}.
  5405. @item overlap
  5406. Set number overlapping pixels for each block. Since the filter can be slow, you
  5407. may want to reduce this value, at the cost of a less effective filter and the
  5408. risk of various artefacts.
  5409. If the overlapping value doesn't permit processing the whole input width or
  5410. height, a warning will be displayed and according borders won't be denoised.
  5411. Default value is @var{blocksize}-1, which is the best possible setting.
  5412. @item expr, e
  5413. Set the coefficient factor expression.
  5414. For each coefficient of a DCT block, this expression will be evaluated as a
  5415. multiplier value for the coefficient.
  5416. If this is option is set, the @option{sigma} option will be ignored.
  5417. The absolute value of the coefficient can be accessed through the @var{c}
  5418. variable.
  5419. @item n
  5420. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  5421. @var{blocksize}, which is the width and height of the processed blocks.
  5422. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  5423. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  5424. on the speed processing. Also, a larger block size does not necessarily means a
  5425. better de-noising.
  5426. @end table
  5427. @subsection Examples
  5428. Apply a denoise with a @option{sigma} of @code{4.5}:
  5429. @example
  5430. dctdnoiz=4.5
  5431. @end example
  5432. The same operation can be achieved using the expression system:
  5433. @example
  5434. dctdnoiz=e='gte(c, 4.5*3)'
  5435. @end example
  5436. Violent denoise using a block size of @code{16x16}:
  5437. @example
  5438. dctdnoiz=15:n=4
  5439. @end example
  5440. @section deband
  5441. Remove banding artifacts from input video.
  5442. It works by replacing banded pixels with average value of referenced pixels.
  5443. The filter accepts the following options:
  5444. @table @option
  5445. @item 1thr
  5446. @item 2thr
  5447. @item 3thr
  5448. @item 4thr
  5449. Set banding detection threshold for each plane. Default is 0.02.
  5450. Valid range is 0.00003 to 0.5.
  5451. If difference between current pixel and reference pixel is less than threshold,
  5452. it will be considered as banded.
  5453. @item range, r
  5454. Banding detection range in pixels. Default is 16. If positive, random number
  5455. in range 0 to set value will be used. If negative, exact absolute value
  5456. will be used.
  5457. The range defines square of four pixels around current pixel.
  5458. @item direction, d
  5459. Set direction in radians from which four pixel will be compared. If positive,
  5460. random direction from 0 to set direction will be picked. If negative, exact of
  5461. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  5462. will pick only pixels on same row and -PI/2 will pick only pixels on same
  5463. column.
  5464. @item blur, b
  5465. If enabled, current pixel is compared with average value of all four
  5466. surrounding pixels. The default is enabled. If disabled current pixel is
  5467. compared with all four surrounding pixels. The pixel is considered banded
  5468. if only all four differences with surrounding pixels are less than threshold.
  5469. @item coupling, c
  5470. If enabled, current pixel is changed if and only if all pixel components are banded,
  5471. e.g. banding detection threshold is triggered for all color components.
  5472. The default is disabled.
  5473. @end table
  5474. @anchor{decimate}
  5475. @section decimate
  5476. Drop duplicated frames at regular intervals.
  5477. The filter accepts the following options:
  5478. @table @option
  5479. @item cycle
  5480. Set the number of frames from which one will be dropped. Setting this to
  5481. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  5482. Default is @code{5}.
  5483. @item dupthresh
  5484. Set the threshold for duplicate detection. If the difference metric for a frame
  5485. is less than or equal to this value, then it is declared as duplicate. Default
  5486. is @code{1.1}
  5487. @item scthresh
  5488. Set scene change threshold. Default is @code{15}.
  5489. @item blockx
  5490. @item blocky
  5491. Set the size of the x and y-axis blocks used during metric calculations.
  5492. Larger blocks give better noise suppression, but also give worse detection of
  5493. small movements. Must be a power of two. Default is @code{32}.
  5494. @item ppsrc
  5495. Mark main input as a pre-processed input and activate clean source input
  5496. stream. This allows the input to be pre-processed with various filters to help
  5497. the metrics calculation while keeping the frame selection lossless. When set to
  5498. @code{1}, the first stream is for the pre-processed input, and the second
  5499. stream is the clean source from where the kept frames are chosen. Default is
  5500. @code{0}.
  5501. @item chroma
  5502. Set whether or not chroma is considered in the metric calculations. Default is
  5503. @code{1}.
  5504. @end table
  5505. @section deconvolve
  5506. Apply 2D deconvolution of video stream in frequency domain using second stream
  5507. as impulse.
  5508. The filter accepts the following options:
  5509. @table @option
  5510. @item planes
  5511. Set which planes to process.
  5512. @item impulse
  5513. Set which impulse video frames will be processed, can be @var{first}
  5514. or @var{all}. Default is @var{all}.
  5515. @item noise
  5516. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  5517. and height are not same and not power of 2 or if stream prior to convolving
  5518. had noise.
  5519. @end table
  5520. The @code{deconvolve} filter also supports the @ref{framesync} options.
  5521. @section deflate
  5522. Apply deflate effect to the video.
  5523. This filter replaces the pixel by the local(3x3) average by taking into account
  5524. only values lower than the pixel.
  5525. It accepts the following options:
  5526. @table @option
  5527. @item threshold0
  5528. @item threshold1
  5529. @item threshold2
  5530. @item threshold3
  5531. Limit the maximum change for each plane, default is 65535.
  5532. If 0, plane will remain unchanged.
  5533. @end table
  5534. @section deflicker
  5535. Remove temporal frame luminance variations.
  5536. It accepts the following options:
  5537. @table @option
  5538. @item size, s
  5539. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  5540. @item mode, m
  5541. Set averaging mode to smooth temporal luminance variations.
  5542. Available values are:
  5543. @table @samp
  5544. @item am
  5545. Arithmetic mean
  5546. @item gm
  5547. Geometric mean
  5548. @item hm
  5549. Harmonic mean
  5550. @item qm
  5551. Quadratic mean
  5552. @item cm
  5553. Cubic mean
  5554. @item pm
  5555. Power mean
  5556. @item median
  5557. Median
  5558. @end table
  5559. @item bypass
  5560. Do not actually modify frame. Useful when one only wants metadata.
  5561. @end table
  5562. @section dejudder
  5563. Remove judder produced by partially interlaced telecined content.
  5564. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  5565. source was partially telecined content then the output of @code{pullup,dejudder}
  5566. will have a variable frame rate. May change the recorded frame rate of the
  5567. container. Aside from that change, this filter will not affect constant frame
  5568. rate video.
  5569. The option available in this filter is:
  5570. @table @option
  5571. @item cycle
  5572. Specify the length of the window over which the judder repeats.
  5573. Accepts any integer greater than 1. Useful values are:
  5574. @table @samp
  5575. @item 4
  5576. If the original was telecined from 24 to 30 fps (Film to NTSC).
  5577. @item 5
  5578. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  5579. @item 20
  5580. If a mixture of the two.
  5581. @end table
  5582. The default is @samp{4}.
  5583. @end table
  5584. @section delogo
  5585. Suppress a TV station logo by a simple interpolation of the surrounding
  5586. pixels. Just set a rectangle covering the logo and watch it disappear
  5587. (and sometimes something even uglier appear - your mileage may vary).
  5588. It accepts the following parameters:
  5589. @table @option
  5590. @item x
  5591. @item y
  5592. Specify the top left corner coordinates of the logo. They must be
  5593. specified.
  5594. @item w
  5595. @item h
  5596. Specify the width and height of the logo to clear. They must be
  5597. specified.
  5598. @item band, t
  5599. Specify the thickness of the fuzzy edge of the rectangle (added to
  5600. @var{w} and @var{h}). The default value is 1. This option is
  5601. deprecated, setting higher values should no longer be necessary and
  5602. is not recommended.
  5603. @item show
  5604. When set to 1, a green rectangle is drawn on the screen to simplify
  5605. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  5606. The default value is 0.
  5607. The rectangle is drawn on the outermost pixels which will be (partly)
  5608. replaced with interpolated values. The values of the next pixels
  5609. immediately outside this rectangle in each direction will be used to
  5610. compute the interpolated pixel values inside the rectangle.
  5611. @end table
  5612. @subsection Examples
  5613. @itemize
  5614. @item
  5615. Set a rectangle covering the area with top left corner coordinates 0,0
  5616. and size 100x77, and a band of size 10:
  5617. @example
  5618. delogo=x=0:y=0:w=100:h=77:band=10
  5619. @end example
  5620. @end itemize
  5621. @section deshake
  5622. Attempt to fix small changes in horizontal and/or vertical shift. This
  5623. filter helps remove camera shake from hand-holding a camera, bumping a
  5624. tripod, moving on a vehicle, etc.
  5625. The filter accepts the following options:
  5626. @table @option
  5627. @item x
  5628. @item y
  5629. @item w
  5630. @item h
  5631. Specify a rectangular area where to limit the search for motion
  5632. vectors.
  5633. If desired the search for motion vectors can be limited to a
  5634. rectangular area of the frame defined by its top left corner, width
  5635. and height. These parameters have the same meaning as the drawbox
  5636. filter which can be used to visualise the position of the bounding
  5637. box.
  5638. This is useful when simultaneous movement of subjects within the frame
  5639. might be confused for camera motion by the motion vector search.
  5640. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  5641. then the full frame is used. This allows later options to be set
  5642. without specifying the bounding box for the motion vector search.
  5643. Default - search the whole frame.
  5644. @item rx
  5645. @item ry
  5646. Specify the maximum extent of movement in x and y directions in the
  5647. range 0-64 pixels. Default 16.
  5648. @item edge
  5649. Specify how to generate pixels to fill blanks at the edge of the
  5650. frame. Available values are:
  5651. @table @samp
  5652. @item blank, 0
  5653. Fill zeroes at blank locations
  5654. @item original, 1
  5655. Original image at blank locations
  5656. @item clamp, 2
  5657. Extruded edge value at blank locations
  5658. @item mirror, 3
  5659. Mirrored edge at blank locations
  5660. @end table
  5661. Default value is @samp{mirror}.
  5662. @item blocksize
  5663. Specify the blocksize to use for motion search. Range 4-128 pixels,
  5664. default 8.
  5665. @item contrast
  5666. Specify the contrast threshold for blocks. Only blocks with more than
  5667. the specified contrast (difference between darkest and lightest
  5668. pixels) will be considered. Range 1-255, default 125.
  5669. @item search
  5670. Specify the search strategy. Available values are:
  5671. @table @samp
  5672. @item exhaustive, 0
  5673. Set exhaustive search
  5674. @item less, 1
  5675. Set less exhaustive search.
  5676. @end table
  5677. Default value is @samp{exhaustive}.
  5678. @item filename
  5679. If set then a detailed log of the motion search is written to the
  5680. specified file.
  5681. @end table
  5682. @section despill
  5683. Remove unwanted contamination of foreground colors, caused by reflected color of
  5684. greenscreen or bluescreen.
  5685. This filter accepts the following options:
  5686. @table @option
  5687. @item type
  5688. Set what type of despill to use.
  5689. @item mix
  5690. Set how spillmap will be generated.
  5691. @item expand
  5692. Set how much to get rid of still remaining spill.
  5693. @item red
  5694. Controls amount of red in spill area.
  5695. @item green
  5696. Controls amount of green in spill area.
  5697. Should be -1 for greenscreen.
  5698. @item blue
  5699. Controls amount of blue in spill area.
  5700. Should be -1 for bluescreen.
  5701. @item brightness
  5702. Controls brightness of spill area, preserving colors.
  5703. @item alpha
  5704. Modify alpha from generated spillmap.
  5705. @end table
  5706. @section detelecine
  5707. Apply an exact inverse of the telecine operation. It requires a predefined
  5708. pattern specified using the pattern option which must be the same as that passed
  5709. to the telecine filter.
  5710. This filter accepts the following options:
  5711. @table @option
  5712. @item first_field
  5713. @table @samp
  5714. @item top, t
  5715. top field first
  5716. @item bottom, b
  5717. bottom field first
  5718. The default value is @code{top}.
  5719. @end table
  5720. @item pattern
  5721. A string of numbers representing the pulldown pattern you wish to apply.
  5722. The default value is @code{23}.
  5723. @item start_frame
  5724. A number representing position of the first frame with respect to the telecine
  5725. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  5726. @end table
  5727. @section dilation
  5728. Apply dilation effect to the video.
  5729. This filter replaces the pixel by the local(3x3) maximum.
  5730. It accepts the following options:
  5731. @table @option
  5732. @item threshold0
  5733. @item threshold1
  5734. @item threshold2
  5735. @item threshold3
  5736. Limit the maximum change for each plane, default is 65535.
  5737. If 0, plane will remain unchanged.
  5738. @item coordinates
  5739. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5740. pixels are used.
  5741. Flags to local 3x3 coordinates maps like this:
  5742. 1 2 3
  5743. 4 5
  5744. 6 7 8
  5745. @end table
  5746. @section displace
  5747. Displace pixels as indicated by second and third input stream.
  5748. It takes three input streams and outputs one stream, the first input is the
  5749. source, and second and third input are displacement maps.
  5750. The second input specifies how much to displace pixels along the
  5751. x-axis, while the third input specifies how much to displace pixels
  5752. along the y-axis.
  5753. If one of displacement map streams terminates, last frame from that
  5754. displacement map will be used.
  5755. Note that once generated, displacements maps can be reused over and over again.
  5756. A description of the accepted options follows.
  5757. @table @option
  5758. @item edge
  5759. Set displace behavior for pixels that are out of range.
  5760. Available values are:
  5761. @table @samp
  5762. @item blank
  5763. Missing pixels are replaced by black pixels.
  5764. @item smear
  5765. Adjacent pixels will spread out to replace missing pixels.
  5766. @item wrap
  5767. Out of range pixels are wrapped so they point to pixels of other side.
  5768. @item mirror
  5769. Out of range pixels will be replaced with mirrored pixels.
  5770. @end table
  5771. Default is @samp{smear}.
  5772. @end table
  5773. @subsection Examples
  5774. @itemize
  5775. @item
  5776. Add ripple effect to rgb input of video size hd720:
  5777. @example
  5778. 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
  5779. @end example
  5780. @item
  5781. Add wave effect to rgb input of video size hd720:
  5782. @example
  5783. 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
  5784. @end example
  5785. @end itemize
  5786. @section drawbox
  5787. Draw a colored box on the input image.
  5788. It accepts the following parameters:
  5789. @table @option
  5790. @item x
  5791. @item y
  5792. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  5793. @item width, w
  5794. @item height, h
  5795. The expressions which specify the width and height of the box; if 0 they are interpreted as
  5796. the input width and height. It defaults to 0.
  5797. @item color, c
  5798. Specify the color of the box to write. For the general syntax of this option,
  5799. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  5800. value @code{invert} is used, the box edge color is the same as the
  5801. video with inverted luma.
  5802. @item thickness, t
  5803. The expression which sets the thickness of the box edge.
  5804. A value of @code{fill} will create a filled box. Default value is @code{3}.
  5805. See below for the list of accepted constants.
  5806. @item replace
  5807. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  5808. will overwrite the video's color and alpha pixels.
  5809. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  5810. @end table
  5811. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5812. following constants:
  5813. @table @option
  5814. @item dar
  5815. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5816. @item hsub
  5817. @item vsub
  5818. horizontal and vertical chroma subsample values. For example for the
  5819. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5820. @item in_h, ih
  5821. @item in_w, iw
  5822. The input width and height.
  5823. @item sar
  5824. The input sample aspect ratio.
  5825. @item x
  5826. @item y
  5827. The x and y offset coordinates where the box is drawn.
  5828. @item w
  5829. @item h
  5830. The width and height of the drawn box.
  5831. @item t
  5832. The thickness of the drawn box.
  5833. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5834. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5835. @end table
  5836. @subsection Examples
  5837. @itemize
  5838. @item
  5839. Draw a black box around the edge of the input image:
  5840. @example
  5841. drawbox
  5842. @end example
  5843. @item
  5844. Draw a box with color red and an opacity of 50%:
  5845. @example
  5846. drawbox=10:20:200:60:red@@0.5
  5847. @end example
  5848. The previous example can be specified as:
  5849. @example
  5850. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  5851. @end example
  5852. @item
  5853. Fill the box with pink color:
  5854. @example
  5855. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  5856. @end example
  5857. @item
  5858. Draw a 2-pixel red 2.40:1 mask:
  5859. @example
  5860. 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
  5861. @end example
  5862. @end itemize
  5863. @section drawgrid
  5864. Draw a grid on the input image.
  5865. It accepts the following parameters:
  5866. @table @option
  5867. @item x
  5868. @item y
  5869. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  5870. @item width, w
  5871. @item height, h
  5872. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  5873. input width and height, respectively, minus @code{thickness}, so image gets
  5874. framed. Default to 0.
  5875. @item color, c
  5876. Specify the color of the grid. For the general syntax of this option,
  5877. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  5878. value @code{invert} is used, the grid color is the same as the
  5879. video with inverted luma.
  5880. @item thickness, t
  5881. The expression which sets the thickness of the grid line. Default value is @code{1}.
  5882. See below for the list of accepted constants.
  5883. @item replace
  5884. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  5885. will overwrite the video's color and alpha pixels.
  5886. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  5887. @end table
  5888. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5889. following constants:
  5890. @table @option
  5891. @item dar
  5892. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5893. @item hsub
  5894. @item vsub
  5895. horizontal and vertical chroma subsample values. For example for the
  5896. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5897. @item in_h, ih
  5898. @item in_w, iw
  5899. The input grid cell width and height.
  5900. @item sar
  5901. The input sample aspect ratio.
  5902. @item x
  5903. @item y
  5904. The x and y coordinates of some point of grid intersection (meant to configure offset).
  5905. @item w
  5906. @item h
  5907. The width and height of the drawn cell.
  5908. @item t
  5909. The thickness of the drawn cell.
  5910. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5911. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5912. @end table
  5913. @subsection Examples
  5914. @itemize
  5915. @item
  5916. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  5917. @example
  5918. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  5919. @end example
  5920. @item
  5921. Draw a white 3x3 grid with an opacity of 50%:
  5922. @example
  5923. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  5924. @end example
  5925. @end itemize
  5926. @anchor{drawtext}
  5927. @section drawtext
  5928. Draw a text string or text from a specified file on top of a video, using the
  5929. libfreetype library.
  5930. To enable compilation of this filter, you need to configure FFmpeg with
  5931. @code{--enable-libfreetype}.
  5932. To enable default font fallback and the @var{font} option you need to
  5933. configure FFmpeg with @code{--enable-libfontconfig}.
  5934. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  5935. @code{--enable-libfribidi}.
  5936. @subsection Syntax
  5937. It accepts the following parameters:
  5938. @table @option
  5939. @item box
  5940. Used to draw a box around text using the background color.
  5941. The value must be either 1 (enable) or 0 (disable).
  5942. The default value of @var{box} is 0.
  5943. @item boxborderw
  5944. Set the width of the border to be drawn around the box using @var{boxcolor}.
  5945. The default value of @var{boxborderw} is 0.
  5946. @item boxcolor
  5947. The color to be used for drawing box around text. For the syntax of this
  5948. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  5949. The default value of @var{boxcolor} is "white".
  5950. @item line_spacing
  5951. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  5952. The default value of @var{line_spacing} is 0.
  5953. @item borderw
  5954. Set the width of the border to be drawn around the text using @var{bordercolor}.
  5955. The default value of @var{borderw} is 0.
  5956. @item bordercolor
  5957. Set the color to be used for drawing border around text. For the syntax of this
  5958. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  5959. The default value of @var{bordercolor} is "black".
  5960. @item expansion
  5961. Select how the @var{text} is expanded. Can be either @code{none},
  5962. @code{strftime} (deprecated) or
  5963. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  5964. below for details.
  5965. @item basetime
  5966. Set a start time for the count. Value is in microseconds. Only applied
  5967. in the deprecated strftime expansion mode. To emulate in normal expansion
  5968. mode use the @code{pts} function, supplying the start time (in seconds)
  5969. as the second argument.
  5970. @item fix_bounds
  5971. If true, check and fix text coords to avoid clipping.
  5972. @item fontcolor
  5973. The color to be used for drawing fonts. For the syntax of this option, check
  5974. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  5975. The default value of @var{fontcolor} is "black".
  5976. @item fontcolor_expr
  5977. String which is expanded the same way as @var{text} to obtain dynamic
  5978. @var{fontcolor} value. By default this option has empty value and is not
  5979. processed. When this option is set, it overrides @var{fontcolor} option.
  5980. @item font
  5981. The font family to be used for drawing text. By default Sans.
  5982. @item fontfile
  5983. The font file to be used for drawing text. The path must be included.
  5984. This parameter is mandatory if the fontconfig support is disabled.
  5985. @item alpha
  5986. Draw the text applying alpha blending. The value can
  5987. be a number between 0.0 and 1.0.
  5988. The expression accepts the same variables @var{x, y} as well.
  5989. The default value is 1.
  5990. Please see @var{fontcolor_expr}.
  5991. @item fontsize
  5992. The font size to be used for drawing text.
  5993. The default value of @var{fontsize} is 16.
  5994. @item text_shaping
  5995. If set to 1, attempt to shape the text (for example, reverse the order of
  5996. right-to-left text and join Arabic characters) before drawing it.
  5997. Otherwise, just draw the text exactly as given.
  5998. By default 1 (if supported).
  5999. @item ft_load_flags
  6000. The flags to be used for loading the fonts.
  6001. The flags map the corresponding flags supported by libfreetype, and are
  6002. a combination of the following values:
  6003. @table @var
  6004. @item default
  6005. @item no_scale
  6006. @item no_hinting
  6007. @item render
  6008. @item no_bitmap
  6009. @item vertical_layout
  6010. @item force_autohint
  6011. @item crop_bitmap
  6012. @item pedantic
  6013. @item ignore_global_advance_width
  6014. @item no_recurse
  6015. @item ignore_transform
  6016. @item monochrome
  6017. @item linear_design
  6018. @item no_autohint
  6019. @end table
  6020. Default value is "default".
  6021. For more information consult the documentation for the FT_LOAD_*
  6022. libfreetype flags.
  6023. @item shadowcolor
  6024. The color to be used for drawing a shadow behind the drawn text. For the
  6025. syntax of this option, check the @ref{color syntax,,"Color" section in the
  6026. ffmpeg-utils manual,ffmpeg-utils}.
  6027. The default value of @var{shadowcolor} is "black".
  6028. @item shadowx
  6029. @item shadowy
  6030. The x and y offsets for the text shadow position with respect to the
  6031. position of the text. They can be either positive or negative
  6032. values. The default value for both is "0".
  6033. @item start_number
  6034. The starting frame number for the n/frame_num variable. The default value
  6035. is "0".
  6036. @item tabsize
  6037. The size in number of spaces to use for rendering the tab.
  6038. Default value is 4.
  6039. @item timecode
  6040. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  6041. format. It can be used with or without text parameter. @var{timecode_rate}
  6042. option must be specified.
  6043. @item timecode_rate, rate, r
  6044. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  6045. integer. Minimum value is "1".
  6046. Drop-frame timecode is supported for frame rates 30 & 60.
  6047. @item tc24hmax
  6048. If set to 1, the output of the timecode option will wrap around at 24 hours.
  6049. Default is 0 (disabled).
  6050. @item text
  6051. The text string to be drawn. The text must be a sequence of UTF-8
  6052. encoded characters.
  6053. This parameter is mandatory if no file is specified with the parameter
  6054. @var{textfile}.
  6055. @item textfile
  6056. A text file containing text to be drawn. The text must be a sequence
  6057. of UTF-8 encoded characters.
  6058. This parameter is mandatory if no text string is specified with the
  6059. parameter @var{text}.
  6060. If both @var{text} and @var{textfile} are specified, an error is thrown.
  6061. @item reload
  6062. If set to 1, the @var{textfile} will be reloaded before each frame.
  6063. Be sure to update it atomically, or it may be read partially, or even fail.
  6064. @item x
  6065. @item y
  6066. The expressions which specify the offsets where text will be drawn
  6067. within the video frame. They are relative to the top/left border of the
  6068. output image.
  6069. The default value of @var{x} and @var{y} is "0".
  6070. See below for the list of accepted constants and functions.
  6071. @end table
  6072. The parameters for @var{x} and @var{y} are expressions containing the
  6073. following constants and functions:
  6074. @table @option
  6075. @item dar
  6076. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  6077. @item hsub
  6078. @item vsub
  6079. horizontal and vertical chroma subsample values. For example for the
  6080. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6081. @item line_h, lh
  6082. the height of each text line
  6083. @item main_h, h, H
  6084. the input height
  6085. @item main_w, w, W
  6086. the input width
  6087. @item max_glyph_a, ascent
  6088. the maximum distance from the baseline to the highest/upper grid
  6089. coordinate used to place a glyph outline point, for all the rendered
  6090. glyphs.
  6091. It is a positive value, due to the grid's orientation with the Y axis
  6092. upwards.
  6093. @item max_glyph_d, descent
  6094. the maximum distance from the baseline to the lowest grid coordinate
  6095. used to place a glyph outline point, for all the rendered glyphs.
  6096. This is a negative value, due to the grid's orientation, with the Y axis
  6097. upwards.
  6098. @item max_glyph_h
  6099. maximum glyph height, that is the maximum height for all the glyphs
  6100. contained in the rendered text, it is equivalent to @var{ascent} -
  6101. @var{descent}.
  6102. @item max_glyph_w
  6103. maximum glyph width, that is the maximum width for all the glyphs
  6104. contained in the rendered text
  6105. @item n
  6106. the number of input frame, starting from 0
  6107. @item rand(min, max)
  6108. return a random number included between @var{min} and @var{max}
  6109. @item sar
  6110. The input sample aspect ratio.
  6111. @item t
  6112. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6113. @item text_h, th
  6114. the height of the rendered text
  6115. @item text_w, tw
  6116. the width of the rendered text
  6117. @item x
  6118. @item y
  6119. the x and y offset coordinates where the text is drawn.
  6120. These parameters allow the @var{x} and @var{y} expressions to refer
  6121. each other, so you can for example specify @code{y=x/dar}.
  6122. @end table
  6123. @anchor{drawtext_expansion}
  6124. @subsection Text expansion
  6125. If @option{expansion} is set to @code{strftime},
  6126. the filter recognizes strftime() sequences in the provided text and
  6127. expands them accordingly. Check the documentation of strftime(). This
  6128. feature is deprecated.
  6129. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  6130. If @option{expansion} is set to @code{normal} (which is the default),
  6131. the following expansion mechanism is used.
  6132. The backslash character @samp{\}, followed by any character, always expands to
  6133. the second character.
  6134. Sequences of the form @code{%@{...@}} are expanded. The text between the
  6135. braces is a function name, possibly followed by arguments separated by ':'.
  6136. If the arguments contain special characters or delimiters (':' or '@}'),
  6137. they should be escaped.
  6138. Note that they probably must also be escaped as the value for the
  6139. @option{text} option in the filter argument string and as the filter
  6140. argument in the filtergraph description, and possibly also for the shell,
  6141. that makes up to four levels of escaping; using a text file avoids these
  6142. problems.
  6143. The following functions are available:
  6144. @table @command
  6145. @item expr, e
  6146. The expression evaluation result.
  6147. It must take one argument specifying the expression to be evaluated,
  6148. which accepts the same constants and functions as the @var{x} and
  6149. @var{y} values. Note that not all constants should be used, for
  6150. example the text size is not known when evaluating the expression, so
  6151. the constants @var{text_w} and @var{text_h} will have an undefined
  6152. value.
  6153. @item expr_int_format, eif
  6154. Evaluate the expression's value and output as formatted integer.
  6155. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  6156. The second argument specifies the output format. Allowed values are @samp{x},
  6157. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  6158. @code{printf} function.
  6159. The third parameter is optional and sets the number of positions taken by the output.
  6160. It can be used to add padding with zeros from the left.
  6161. @item gmtime
  6162. The time at which the filter is running, expressed in UTC.
  6163. It can accept an argument: a strftime() format string.
  6164. @item localtime
  6165. The time at which the filter is running, expressed in the local time zone.
  6166. It can accept an argument: a strftime() format string.
  6167. @item metadata
  6168. Frame metadata. Takes one or two arguments.
  6169. The first argument is mandatory and specifies the metadata key.
  6170. The second argument is optional and specifies a default value, used when the
  6171. metadata key is not found or empty.
  6172. @item n, frame_num
  6173. The frame number, starting from 0.
  6174. @item pict_type
  6175. A 1 character description of the current picture type.
  6176. @item pts
  6177. The timestamp of the current frame.
  6178. It can take up to three arguments.
  6179. The first argument is the format of the timestamp; it defaults to @code{flt}
  6180. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  6181. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  6182. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  6183. @code{localtime} stands for the timestamp of the frame formatted as
  6184. local time zone time.
  6185. The second argument is an offset added to the timestamp.
  6186. If the format is set to @code{localtime} or @code{gmtime},
  6187. a third argument may be supplied: a strftime() format string.
  6188. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  6189. @end table
  6190. @subsection Examples
  6191. @itemize
  6192. @item
  6193. Draw "Test Text" with font FreeSerif, using the default values for the
  6194. optional parameters.
  6195. @example
  6196. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  6197. @end example
  6198. @item
  6199. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  6200. and y=50 (counting from the top-left corner of the screen), text is
  6201. yellow with a red box around it. Both the text and the box have an
  6202. opacity of 20%.
  6203. @example
  6204. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  6205. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  6206. @end example
  6207. Note that the double quotes are not necessary if spaces are not used
  6208. within the parameter list.
  6209. @item
  6210. Show the text at the center of the video frame:
  6211. @example
  6212. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  6213. @end example
  6214. @item
  6215. Show the text at a random position, switching to a new position every 30 seconds:
  6216. @example
  6217. 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)"
  6218. @end example
  6219. @item
  6220. Show a text line sliding from right to left in the last row of the video
  6221. frame. The file @file{LONG_LINE} is assumed to contain a single line
  6222. with no newlines.
  6223. @example
  6224. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  6225. @end example
  6226. @item
  6227. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  6228. @example
  6229. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  6230. @end example
  6231. @item
  6232. Draw a single green letter "g", at the center of the input video.
  6233. The glyph baseline is placed at half screen height.
  6234. @example
  6235. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  6236. @end example
  6237. @item
  6238. Show text for 1 second every 3 seconds:
  6239. @example
  6240. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  6241. @end example
  6242. @item
  6243. Use fontconfig to set the font. Note that the colons need to be escaped.
  6244. @example
  6245. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  6246. @end example
  6247. @item
  6248. Print the date of a real-time encoding (see strftime(3)):
  6249. @example
  6250. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  6251. @end example
  6252. @item
  6253. Show text fading in and out (appearing/disappearing):
  6254. @example
  6255. #!/bin/sh
  6256. DS=1.0 # display start
  6257. DE=10.0 # display end
  6258. FID=1.5 # fade in duration
  6259. FOD=5 # fade out duration
  6260. 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 @}"
  6261. @end example
  6262. @item
  6263. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  6264. and the @option{fontsize} value are included in the @option{y} offset.
  6265. @example
  6266. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  6267. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  6268. @end example
  6269. @end itemize
  6270. For more information about libfreetype, check:
  6271. @url{http://www.freetype.org/}.
  6272. For more information about fontconfig, check:
  6273. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  6274. For more information about libfribidi, check:
  6275. @url{http://fribidi.org/}.
  6276. @section edgedetect
  6277. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  6278. The filter accepts the following options:
  6279. @table @option
  6280. @item low
  6281. @item high
  6282. Set low and high threshold values used by the Canny thresholding
  6283. algorithm.
  6284. The high threshold selects the "strong" edge pixels, which are then
  6285. connected through 8-connectivity with the "weak" edge pixels selected
  6286. by the low threshold.
  6287. @var{low} and @var{high} threshold values must be chosen in the range
  6288. [0,1], and @var{low} should be lesser or equal to @var{high}.
  6289. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  6290. is @code{50/255}.
  6291. @item mode
  6292. Define the drawing mode.
  6293. @table @samp
  6294. @item wires
  6295. Draw white/gray wires on black background.
  6296. @item colormix
  6297. Mix the colors to create a paint/cartoon effect.
  6298. @end table
  6299. Default value is @var{wires}.
  6300. @end table
  6301. @subsection Examples
  6302. @itemize
  6303. @item
  6304. Standard edge detection with custom values for the hysteresis thresholding:
  6305. @example
  6306. edgedetect=low=0.1:high=0.4
  6307. @end example
  6308. @item
  6309. Painting effect without thresholding:
  6310. @example
  6311. edgedetect=mode=colormix:high=0
  6312. @end example
  6313. @end itemize
  6314. @section eq
  6315. Set brightness, contrast, saturation and approximate gamma adjustment.
  6316. The filter accepts the following options:
  6317. @table @option
  6318. @item contrast
  6319. Set the contrast expression. The value must be a float value in range
  6320. @code{-2.0} to @code{2.0}. The default value is "1".
  6321. @item brightness
  6322. Set the brightness expression. The value must be a float value in
  6323. range @code{-1.0} to @code{1.0}. The default value is "0".
  6324. @item saturation
  6325. Set the saturation expression. The value must be a float in
  6326. range @code{0.0} to @code{3.0}. The default value is "1".
  6327. @item gamma
  6328. Set the gamma expression. The value must be a float in range
  6329. @code{0.1} to @code{10.0}. The default value is "1".
  6330. @item gamma_r
  6331. Set the gamma expression for red. The value must be a float in
  6332. range @code{0.1} to @code{10.0}. The default value is "1".
  6333. @item gamma_g
  6334. Set the gamma expression for green. The value must be a float in range
  6335. @code{0.1} to @code{10.0}. The default value is "1".
  6336. @item gamma_b
  6337. Set the gamma expression for blue. The value must be a float in range
  6338. @code{0.1} to @code{10.0}. The default value is "1".
  6339. @item gamma_weight
  6340. Set the gamma weight expression. It can be used to reduce the effect
  6341. of a high gamma value on bright image areas, e.g. keep them from
  6342. getting overamplified and just plain white. The value must be a float
  6343. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  6344. gamma correction all the way down while @code{1.0} leaves it at its
  6345. full strength. Default is "1".
  6346. @item eval
  6347. Set when the expressions for brightness, contrast, saturation and
  6348. gamma expressions are evaluated.
  6349. It accepts the following values:
  6350. @table @samp
  6351. @item init
  6352. only evaluate expressions once during the filter initialization or
  6353. when a command is processed
  6354. @item frame
  6355. evaluate expressions for each incoming frame
  6356. @end table
  6357. Default value is @samp{init}.
  6358. @end table
  6359. The expressions accept the following parameters:
  6360. @table @option
  6361. @item n
  6362. frame count of the input frame starting from 0
  6363. @item pos
  6364. byte position of the corresponding packet in the input file, NAN if
  6365. unspecified
  6366. @item r
  6367. frame rate of the input video, NAN if the input frame rate is unknown
  6368. @item t
  6369. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6370. @end table
  6371. @subsection Commands
  6372. The filter supports the following commands:
  6373. @table @option
  6374. @item contrast
  6375. Set the contrast expression.
  6376. @item brightness
  6377. Set the brightness expression.
  6378. @item saturation
  6379. Set the saturation expression.
  6380. @item gamma
  6381. Set the gamma expression.
  6382. @item gamma_r
  6383. Set the gamma_r expression.
  6384. @item gamma_g
  6385. Set gamma_g expression.
  6386. @item gamma_b
  6387. Set gamma_b expression.
  6388. @item gamma_weight
  6389. Set gamma_weight expression.
  6390. The command accepts the same syntax of the corresponding option.
  6391. If the specified expression is not valid, it is kept at its current
  6392. value.
  6393. @end table
  6394. @section erosion
  6395. Apply erosion effect to the video.
  6396. This filter replaces the pixel by the local(3x3) minimum.
  6397. It accepts the following options:
  6398. @table @option
  6399. @item threshold0
  6400. @item threshold1
  6401. @item threshold2
  6402. @item threshold3
  6403. Limit the maximum change for each plane, default is 65535.
  6404. If 0, plane will remain unchanged.
  6405. @item coordinates
  6406. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6407. pixels are used.
  6408. Flags to local 3x3 coordinates maps like this:
  6409. 1 2 3
  6410. 4 5
  6411. 6 7 8
  6412. @end table
  6413. @section extractplanes
  6414. Extract color channel components from input video stream into
  6415. separate grayscale video streams.
  6416. The filter accepts the following option:
  6417. @table @option
  6418. @item planes
  6419. Set plane(s) to extract.
  6420. Available values for planes are:
  6421. @table @samp
  6422. @item y
  6423. @item u
  6424. @item v
  6425. @item a
  6426. @item r
  6427. @item g
  6428. @item b
  6429. @end table
  6430. Choosing planes not available in the input will result in an error.
  6431. That means you cannot select @code{r}, @code{g}, @code{b} planes
  6432. with @code{y}, @code{u}, @code{v} planes at same time.
  6433. @end table
  6434. @subsection Examples
  6435. @itemize
  6436. @item
  6437. Extract luma, u and v color channel component from input video frame
  6438. into 3 grayscale outputs:
  6439. @example
  6440. 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
  6441. @end example
  6442. @end itemize
  6443. @section elbg
  6444. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  6445. For each input image, the filter will compute the optimal mapping from
  6446. the input to the output given the codebook length, that is the number
  6447. of distinct output colors.
  6448. This filter accepts the following options.
  6449. @table @option
  6450. @item codebook_length, l
  6451. Set codebook length. The value must be a positive integer, and
  6452. represents the number of distinct output colors. Default value is 256.
  6453. @item nb_steps, n
  6454. Set the maximum number of iterations to apply for computing the optimal
  6455. mapping. The higher the value the better the result and the higher the
  6456. computation time. Default value is 1.
  6457. @item seed, s
  6458. Set a random seed, must be an integer included between 0 and
  6459. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  6460. will try to use a good random seed on a best effort basis.
  6461. @item pal8
  6462. Set pal8 output pixel format. This option does not work with codebook
  6463. length greater than 256.
  6464. @end table
  6465. @section entropy
  6466. Measure graylevel entropy in histogram of color channels of video frames.
  6467. It accepts the following parameters:
  6468. @table @option
  6469. @item mode
  6470. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  6471. @var{diff} mode measures entropy of histogram delta values, absolute differences
  6472. between neighbour histogram values.
  6473. @end table
  6474. @section fade
  6475. Apply a fade-in/out effect to the input video.
  6476. It accepts the following parameters:
  6477. @table @option
  6478. @item type, t
  6479. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  6480. effect.
  6481. Default is @code{in}.
  6482. @item start_frame, s
  6483. Specify the number of the frame to start applying the fade
  6484. effect at. Default is 0.
  6485. @item nb_frames, n
  6486. The number of frames that the fade effect lasts. At the end of the
  6487. fade-in effect, the output video will have the same intensity as the input video.
  6488. At the end of the fade-out transition, the output video will be filled with the
  6489. selected @option{color}.
  6490. Default is 25.
  6491. @item alpha
  6492. If set to 1, fade only alpha channel, if one exists on the input.
  6493. Default value is 0.
  6494. @item start_time, st
  6495. Specify the timestamp (in seconds) of the frame to start to apply the fade
  6496. effect. If both start_frame and start_time are specified, the fade will start at
  6497. whichever comes last. Default is 0.
  6498. @item duration, d
  6499. The number of seconds for which the fade effect has to last. At the end of the
  6500. fade-in effect the output video will have the same intensity as the input video,
  6501. at the end of the fade-out transition the output video will be filled with the
  6502. selected @option{color}.
  6503. If both duration and nb_frames are specified, duration is used. Default is 0
  6504. (nb_frames is used by default).
  6505. @item color, c
  6506. Specify the color of the fade. Default is "black".
  6507. @end table
  6508. @subsection Examples
  6509. @itemize
  6510. @item
  6511. Fade in the first 30 frames of video:
  6512. @example
  6513. fade=in:0:30
  6514. @end example
  6515. The command above is equivalent to:
  6516. @example
  6517. fade=t=in:s=0:n=30
  6518. @end example
  6519. @item
  6520. Fade out the last 45 frames of a 200-frame video:
  6521. @example
  6522. fade=out:155:45
  6523. fade=type=out:start_frame=155:nb_frames=45
  6524. @end example
  6525. @item
  6526. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  6527. @example
  6528. fade=in:0:25, fade=out:975:25
  6529. @end example
  6530. @item
  6531. Make the first 5 frames yellow, then fade in from frame 5-24:
  6532. @example
  6533. fade=in:5:20:color=yellow
  6534. @end example
  6535. @item
  6536. Fade in alpha over first 25 frames of video:
  6537. @example
  6538. fade=in:0:25:alpha=1
  6539. @end example
  6540. @item
  6541. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  6542. @example
  6543. fade=t=in:st=5.5:d=0.5
  6544. @end example
  6545. @end itemize
  6546. @section fftfilt
  6547. Apply arbitrary expressions to samples in frequency domain
  6548. @table @option
  6549. @item dc_Y
  6550. Adjust the dc value (gain) of the luma plane of the image. The filter
  6551. accepts an integer value in range @code{0} to @code{1000}. The default
  6552. value is set to @code{0}.
  6553. @item dc_U
  6554. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  6555. filter accepts an integer value in range @code{0} to @code{1000}. The
  6556. default value is set to @code{0}.
  6557. @item dc_V
  6558. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  6559. filter accepts an integer value in range @code{0} to @code{1000}. The
  6560. default value is set to @code{0}.
  6561. @item weight_Y
  6562. Set the frequency domain weight expression for the luma plane.
  6563. @item weight_U
  6564. Set the frequency domain weight expression for the 1st chroma plane.
  6565. @item weight_V
  6566. Set the frequency domain weight expression for the 2nd chroma plane.
  6567. @item eval
  6568. Set when the expressions are evaluated.
  6569. It accepts the following values:
  6570. @table @samp
  6571. @item init
  6572. Only evaluate expressions once during the filter initialization.
  6573. @item frame
  6574. Evaluate expressions for each incoming frame.
  6575. @end table
  6576. Default value is @samp{init}.
  6577. The filter accepts the following variables:
  6578. @item X
  6579. @item Y
  6580. The coordinates of the current sample.
  6581. @item W
  6582. @item H
  6583. The width and height of the image.
  6584. @item N
  6585. The number of input frame, starting from 0.
  6586. @end table
  6587. @subsection Examples
  6588. @itemize
  6589. @item
  6590. High-pass:
  6591. @example
  6592. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  6593. @end example
  6594. @item
  6595. Low-pass:
  6596. @example
  6597. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  6598. @end example
  6599. @item
  6600. Sharpen:
  6601. @example
  6602. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  6603. @end example
  6604. @item
  6605. Blur:
  6606. @example
  6607. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  6608. @end example
  6609. @end itemize
  6610. @section field
  6611. Extract a single field from an interlaced image using stride
  6612. arithmetic to avoid wasting CPU time. The output frames are marked as
  6613. non-interlaced.
  6614. The filter accepts the following options:
  6615. @table @option
  6616. @item type
  6617. Specify whether to extract the top (if the value is @code{0} or
  6618. @code{top}) or the bottom field (if the value is @code{1} or
  6619. @code{bottom}).
  6620. @end table
  6621. @section fieldhint
  6622. Create new frames by copying the top and bottom fields from surrounding frames
  6623. supplied as numbers by the hint file.
  6624. @table @option
  6625. @item hint
  6626. Set file containing hints: absolute/relative frame numbers.
  6627. There must be one line for each frame in a clip. Each line must contain two
  6628. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  6629. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  6630. is current frame number for @code{absolute} mode or out of [-1, 1] range
  6631. for @code{relative} mode. First number tells from which frame to pick up top
  6632. field and second number tells from which frame to pick up bottom field.
  6633. If optionally followed by @code{+} output frame will be marked as interlaced,
  6634. else if followed by @code{-} output frame will be marked as progressive, else
  6635. it will be marked same as input frame.
  6636. If line starts with @code{#} or @code{;} that line is skipped.
  6637. @item mode
  6638. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  6639. @end table
  6640. Example of first several lines of @code{hint} file for @code{relative} mode:
  6641. @example
  6642. 0,0 - # first frame
  6643. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  6644. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  6645. 1,0 -
  6646. 0,0 -
  6647. 0,0 -
  6648. 1,0 -
  6649. 1,0 -
  6650. 1,0 -
  6651. 0,0 -
  6652. 0,0 -
  6653. 1,0 -
  6654. 1,0 -
  6655. 1,0 -
  6656. 0,0 -
  6657. @end example
  6658. @section fieldmatch
  6659. Field matching filter for inverse telecine. It is meant to reconstruct the
  6660. progressive frames from a telecined stream. The filter does not drop duplicated
  6661. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  6662. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  6663. The separation of the field matching and the decimation is notably motivated by
  6664. the possibility of inserting a de-interlacing filter fallback between the two.
  6665. If the source has mixed telecined and real interlaced content,
  6666. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  6667. But these remaining combed frames will be marked as interlaced, and thus can be
  6668. de-interlaced by a later filter such as @ref{yadif} before decimation.
  6669. In addition to the various configuration options, @code{fieldmatch} can take an
  6670. optional second stream, activated through the @option{ppsrc} option. If
  6671. enabled, the frames reconstruction will be based on the fields and frames from
  6672. this second stream. This allows the first input to be pre-processed in order to
  6673. help the various algorithms of the filter, while keeping the output lossless
  6674. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  6675. or brightness/contrast adjustments can help.
  6676. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  6677. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  6678. which @code{fieldmatch} is based on. While the semantic and usage are very
  6679. close, some behaviour and options names can differ.
  6680. The @ref{decimate} filter currently only works for constant frame rate input.
  6681. If your input has mixed telecined (30fps) and progressive content with a lower
  6682. framerate like 24fps use the following filterchain to produce the necessary cfr
  6683. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  6684. The filter accepts the following options:
  6685. @table @option
  6686. @item order
  6687. Specify the assumed field order of the input stream. Available values are:
  6688. @table @samp
  6689. @item auto
  6690. Auto detect parity (use FFmpeg's internal parity value).
  6691. @item bff
  6692. Assume bottom field first.
  6693. @item tff
  6694. Assume top field first.
  6695. @end table
  6696. Note that it is sometimes recommended not to trust the parity announced by the
  6697. stream.
  6698. Default value is @var{auto}.
  6699. @item mode
  6700. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  6701. sense that it won't risk creating jerkiness due to duplicate frames when
  6702. possible, but if there are bad edits or blended fields it will end up
  6703. outputting combed frames when a good match might actually exist. On the other
  6704. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  6705. but will almost always find a good frame if there is one. The other values are
  6706. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  6707. jerkiness and creating duplicate frames versus finding good matches in sections
  6708. with bad edits, orphaned fields, blended fields, etc.
  6709. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  6710. Available values are:
  6711. @table @samp
  6712. @item pc
  6713. 2-way matching (p/c)
  6714. @item pc_n
  6715. 2-way matching, and trying 3rd match if still combed (p/c + n)
  6716. @item pc_u
  6717. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  6718. @item pc_n_ub
  6719. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  6720. still combed (p/c + n + u/b)
  6721. @item pcn
  6722. 3-way matching (p/c/n)
  6723. @item pcn_ub
  6724. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  6725. detected as combed (p/c/n + u/b)
  6726. @end table
  6727. The parenthesis at the end indicate the matches that would be used for that
  6728. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  6729. @var{top}).
  6730. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  6731. the slowest.
  6732. Default value is @var{pc_n}.
  6733. @item ppsrc
  6734. Mark the main input stream as a pre-processed input, and enable the secondary
  6735. input stream as the clean source to pick the fields from. See the filter
  6736. introduction for more details. It is similar to the @option{clip2} feature from
  6737. VFM/TFM.
  6738. Default value is @code{0} (disabled).
  6739. @item field
  6740. Set the field to match from. It is recommended to set this to the same value as
  6741. @option{order} unless you experience matching failures with that setting. In
  6742. certain circumstances changing the field that is used to match from can have a
  6743. large impact on matching performance. Available values are:
  6744. @table @samp
  6745. @item auto
  6746. Automatic (same value as @option{order}).
  6747. @item bottom
  6748. Match from the bottom field.
  6749. @item top
  6750. Match from the top field.
  6751. @end table
  6752. Default value is @var{auto}.
  6753. @item mchroma
  6754. Set whether or not chroma is included during the match comparisons. In most
  6755. cases it is recommended to leave this enabled. You should set this to @code{0}
  6756. only if your clip has bad chroma problems such as heavy rainbowing or other
  6757. artifacts. Setting this to @code{0} could also be used to speed things up at
  6758. the cost of some accuracy.
  6759. Default value is @code{1}.
  6760. @item y0
  6761. @item y1
  6762. These define an exclusion band which excludes the lines between @option{y0} and
  6763. @option{y1} from being included in the field matching decision. An exclusion
  6764. band can be used to ignore subtitles, a logo, or other things that may
  6765. interfere with the matching. @option{y0} sets the starting scan line and
  6766. @option{y1} sets the ending line; all lines in between @option{y0} and
  6767. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  6768. @option{y0} and @option{y1} to the same value will disable the feature.
  6769. @option{y0} and @option{y1} defaults to @code{0}.
  6770. @item scthresh
  6771. Set the scene change detection threshold as a percentage of maximum change on
  6772. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  6773. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  6774. @option{scthresh} is @code{[0.0, 100.0]}.
  6775. Default value is @code{12.0}.
  6776. @item combmatch
  6777. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  6778. account the combed scores of matches when deciding what match to use as the
  6779. final match. Available values are:
  6780. @table @samp
  6781. @item none
  6782. No final matching based on combed scores.
  6783. @item sc
  6784. Combed scores are only used when a scene change is detected.
  6785. @item full
  6786. Use combed scores all the time.
  6787. @end table
  6788. Default is @var{sc}.
  6789. @item combdbg
  6790. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  6791. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  6792. Available values are:
  6793. @table @samp
  6794. @item none
  6795. No forced calculation.
  6796. @item pcn
  6797. Force p/c/n calculations.
  6798. @item pcnub
  6799. Force p/c/n/u/b calculations.
  6800. @end table
  6801. Default value is @var{none}.
  6802. @item cthresh
  6803. This is the area combing threshold used for combed frame detection. This
  6804. essentially controls how "strong" or "visible" combing must be to be detected.
  6805. Larger values mean combing must be more visible and smaller values mean combing
  6806. can be less visible or strong and still be detected. Valid settings are from
  6807. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  6808. be detected as combed). This is basically a pixel difference value. A good
  6809. range is @code{[8, 12]}.
  6810. Default value is @code{9}.
  6811. @item chroma
  6812. Sets whether or not chroma is considered in the combed frame decision. Only
  6813. disable this if your source has chroma problems (rainbowing, etc.) that are
  6814. causing problems for the combed frame detection with chroma enabled. Actually,
  6815. using @option{chroma}=@var{0} is usually more reliable, except for the case
  6816. where there is chroma only combing in the source.
  6817. Default value is @code{0}.
  6818. @item blockx
  6819. @item blocky
  6820. Respectively set the x-axis and y-axis size of the window used during combed
  6821. frame detection. This has to do with the size of the area in which
  6822. @option{combpel} pixels are required to be detected as combed for a frame to be
  6823. declared combed. See the @option{combpel} parameter description for more info.
  6824. Possible values are any number that is a power of 2 starting at 4 and going up
  6825. to 512.
  6826. Default value is @code{16}.
  6827. @item combpel
  6828. The number of combed pixels inside any of the @option{blocky} by
  6829. @option{blockx} size blocks on the frame for the frame to be detected as
  6830. combed. While @option{cthresh} controls how "visible" the combing must be, this
  6831. setting controls "how much" combing there must be in any localized area (a
  6832. window defined by the @option{blockx} and @option{blocky} settings) on the
  6833. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  6834. which point no frames will ever be detected as combed). This setting is known
  6835. as @option{MI} in TFM/VFM vocabulary.
  6836. Default value is @code{80}.
  6837. @end table
  6838. @anchor{p/c/n/u/b meaning}
  6839. @subsection p/c/n/u/b meaning
  6840. @subsubsection p/c/n
  6841. We assume the following telecined stream:
  6842. @example
  6843. Top fields: 1 2 2 3 4
  6844. Bottom fields: 1 2 3 4 4
  6845. @end example
  6846. The numbers correspond to the progressive frame the fields relate to. Here, the
  6847. first two frames are progressive, the 3rd and 4th are combed, and so on.
  6848. When @code{fieldmatch} is configured to run a matching from bottom
  6849. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  6850. @example
  6851. Input stream:
  6852. T 1 2 2 3 4
  6853. B 1 2 3 4 4 <-- matching reference
  6854. Matches: c c n n c
  6855. Output stream:
  6856. T 1 2 3 4 4
  6857. B 1 2 3 4 4
  6858. @end example
  6859. As a result of the field matching, we can see that some frames get duplicated.
  6860. To perform a complete inverse telecine, you need to rely on a decimation filter
  6861. after this operation. See for instance the @ref{decimate} filter.
  6862. The same operation now matching from top fields (@option{field}=@var{top})
  6863. looks like this:
  6864. @example
  6865. Input stream:
  6866. T 1 2 2 3 4 <-- matching reference
  6867. B 1 2 3 4 4
  6868. Matches: c c p p c
  6869. Output stream:
  6870. T 1 2 2 3 4
  6871. B 1 2 2 3 4
  6872. @end example
  6873. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  6874. basically, they refer to the frame and field of the opposite parity:
  6875. @itemize
  6876. @item @var{p} matches the field of the opposite parity in the previous frame
  6877. @item @var{c} matches the field of the opposite parity in the current frame
  6878. @item @var{n} matches the field of the opposite parity in the next frame
  6879. @end itemize
  6880. @subsubsection u/b
  6881. The @var{u} and @var{b} matching are a bit special in the sense that they match
  6882. from the opposite parity flag. In the following examples, we assume that we are
  6883. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  6884. 'x' is placed above and below each matched fields.
  6885. With bottom matching (@option{field}=@var{bottom}):
  6886. @example
  6887. Match: c p n b u
  6888. x x x x x
  6889. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6890. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6891. x x x x x
  6892. Output frames:
  6893. 2 1 2 2 2
  6894. 2 2 2 1 3
  6895. @end example
  6896. With top matching (@option{field}=@var{top}):
  6897. @example
  6898. Match: c p n b u
  6899. x x x x x
  6900. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6901. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6902. x x x x x
  6903. Output frames:
  6904. 2 2 2 1 2
  6905. 2 1 3 2 2
  6906. @end example
  6907. @subsection Examples
  6908. Simple IVTC of a top field first telecined stream:
  6909. @example
  6910. fieldmatch=order=tff:combmatch=none, decimate
  6911. @end example
  6912. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  6913. @example
  6914. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  6915. @end example
  6916. @section fieldorder
  6917. Transform the field order of the input video.
  6918. It accepts the following parameters:
  6919. @table @option
  6920. @item order
  6921. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  6922. for bottom field first.
  6923. @end table
  6924. The default value is @samp{tff}.
  6925. The transformation is done by shifting the picture content up or down
  6926. by one line, and filling the remaining line with appropriate picture content.
  6927. This method is consistent with most broadcast field order converters.
  6928. If the input video is not flagged as being interlaced, or it is already
  6929. flagged as being of the required output field order, then this filter does
  6930. not alter the incoming video.
  6931. It is very useful when converting to or from PAL DV material,
  6932. which is bottom field first.
  6933. For example:
  6934. @example
  6935. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  6936. @end example
  6937. @section fifo, afifo
  6938. Buffer input images and send them when they are requested.
  6939. It is mainly useful when auto-inserted by the libavfilter
  6940. framework.
  6941. It does not take parameters.
  6942. @section fillborders
  6943. Fill borders of the input video, without changing video stream dimensions.
  6944. Sometimes video can have garbage at the four edges and you may not want to
  6945. crop video input to keep size multiple of some number.
  6946. This filter accepts the following options:
  6947. @table @option
  6948. @item left
  6949. Number of pixels to fill from left border.
  6950. @item right
  6951. Number of pixels to fill from right border.
  6952. @item top
  6953. Number of pixels to fill from top border.
  6954. @item bottom
  6955. Number of pixels to fill from bottom border.
  6956. @item mode
  6957. Set fill mode.
  6958. It accepts the following values:
  6959. @table @samp
  6960. @item smear
  6961. fill pixels using outermost pixels
  6962. @item mirror
  6963. fill pixels using mirroring
  6964. @item fixed
  6965. fill pixels with constant value
  6966. @end table
  6967. Default is @var{smear}.
  6968. @item color
  6969. Set color for pixels in fixed mode. Default is @var{black}.
  6970. @end table
  6971. @section find_rect
  6972. Find a rectangular object
  6973. It accepts the following options:
  6974. @table @option
  6975. @item object
  6976. Filepath of the object image, needs to be in gray8.
  6977. @item threshold
  6978. Detection threshold, default is 0.5.
  6979. @item mipmaps
  6980. Number of mipmaps, default is 3.
  6981. @item xmin, ymin, xmax, ymax
  6982. Specifies the rectangle in which to search.
  6983. @end table
  6984. @subsection Examples
  6985. @itemize
  6986. @item
  6987. Generate a representative palette of a given video using @command{ffmpeg}:
  6988. @example
  6989. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6990. @end example
  6991. @end itemize
  6992. @section cover_rect
  6993. Cover a rectangular object
  6994. It accepts the following options:
  6995. @table @option
  6996. @item cover
  6997. Filepath of the optional cover image, needs to be in yuv420.
  6998. @item mode
  6999. Set covering mode.
  7000. It accepts the following values:
  7001. @table @samp
  7002. @item cover
  7003. cover it by the supplied image
  7004. @item blur
  7005. cover it by interpolating the surrounding pixels
  7006. @end table
  7007. Default value is @var{blur}.
  7008. @end table
  7009. @subsection Examples
  7010. @itemize
  7011. @item
  7012. Generate a representative palette of a given video using @command{ffmpeg}:
  7013. @example
  7014. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7015. @end example
  7016. @end itemize
  7017. @section floodfill
  7018. Flood area with values of same pixel components with another values.
  7019. It accepts the following options:
  7020. @table @option
  7021. @item x
  7022. Set pixel x coordinate.
  7023. @item y
  7024. Set pixel y coordinate.
  7025. @item s0
  7026. Set source #0 component value.
  7027. @item s1
  7028. Set source #1 component value.
  7029. @item s2
  7030. Set source #2 component value.
  7031. @item s3
  7032. Set source #3 component value.
  7033. @item d0
  7034. Set destination #0 component value.
  7035. @item d1
  7036. Set destination #1 component value.
  7037. @item d2
  7038. Set destination #2 component value.
  7039. @item d3
  7040. Set destination #3 component value.
  7041. @end table
  7042. @anchor{format}
  7043. @section format
  7044. Convert the input video to one of the specified pixel formats.
  7045. Libavfilter will try to pick one that is suitable as input to
  7046. the next filter.
  7047. It accepts the following parameters:
  7048. @table @option
  7049. @item pix_fmts
  7050. A '|'-separated list of pixel format names, such as
  7051. "pix_fmts=yuv420p|monow|rgb24".
  7052. @end table
  7053. @subsection Examples
  7054. @itemize
  7055. @item
  7056. Convert the input video to the @var{yuv420p} format
  7057. @example
  7058. format=pix_fmts=yuv420p
  7059. @end example
  7060. Convert the input video to any of the formats in the list
  7061. @example
  7062. format=pix_fmts=yuv420p|yuv444p|yuv410p
  7063. @end example
  7064. @end itemize
  7065. @anchor{fps}
  7066. @section fps
  7067. Convert the video to specified constant frame rate by duplicating or dropping
  7068. frames as necessary.
  7069. It accepts the following parameters:
  7070. @table @option
  7071. @item fps
  7072. The desired output frame rate. The default is @code{25}.
  7073. @item start_time
  7074. Assume the first PTS should be the given value, in seconds. This allows for
  7075. padding/trimming at the start of stream. By default, no assumption is made
  7076. about the first frame's expected PTS, so no padding or trimming is done.
  7077. For example, this could be set to 0 to pad the beginning with duplicates of
  7078. the first frame if a video stream starts after the audio stream or to trim any
  7079. frames with a negative PTS.
  7080. @item round
  7081. Timestamp (PTS) rounding method.
  7082. Possible values are:
  7083. @table @option
  7084. @item zero
  7085. round towards 0
  7086. @item inf
  7087. round away from 0
  7088. @item down
  7089. round towards -infinity
  7090. @item up
  7091. round towards +infinity
  7092. @item near
  7093. round to nearest
  7094. @end table
  7095. The default is @code{near}.
  7096. @item eof_action
  7097. Action performed when reading the last frame.
  7098. Possible values are:
  7099. @table @option
  7100. @item round
  7101. Use same timestamp rounding method as used for other frames.
  7102. @item pass
  7103. Pass through last frame if input duration has not been reached yet.
  7104. @end table
  7105. The default is @code{round}.
  7106. @end table
  7107. Alternatively, the options can be specified as a flat string:
  7108. @var{fps}[:@var{start_time}[:@var{round}]].
  7109. See also the @ref{setpts} filter.
  7110. @subsection Examples
  7111. @itemize
  7112. @item
  7113. A typical usage in order to set the fps to 25:
  7114. @example
  7115. fps=fps=25
  7116. @end example
  7117. @item
  7118. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  7119. @example
  7120. fps=fps=film:round=near
  7121. @end example
  7122. @end itemize
  7123. @section framepack
  7124. Pack two different video streams into a stereoscopic video, setting proper
  7125. metadata on supported codecs. The two views should have the same size and
  7126. framerate and processing will stop when the shorter video ends. Please note
  7127. that you may conveniently adjust view properties with the @ref{scale} and
  7128. @ref{fps} filters.
  7129. It accepts the following parameters:
  7130. @table @option
  7131. @item format
  7132. The desired packing format. Supported values are:
  7133. @table @option
  7134. @item sbs
  7135. The views are next to each other (default).
  7136. @item tab
  7137. The views are on top of each other.
  7138. @item lines
  7139. The views are packed by line.
  7140. @item columns
  7141. The views are packed by column.
  7142. @item frameseq
  7143. The views are temporally interleaved.
  7144. @end table
  7145. @end table
  7146. Some examples:
  7147. @example
  7148. # Convert left and right views into a frame-sequential video
  7149. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  7150. # Convert views into a side-by-side video with the same output resolution as the input
  7151. 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
  7152. @end example
  7153. @section framerate
  7154. Change the frame rate by interpolating new video output frames from the source
  7155. frames.
  7156. This filter is not designed to function correctly with interlaced media. If
  7157. you wish to change the frame rate of interlaced media then you are required
  7158. to deinterlace before this filter and re-interlace after this filter.
  7159. A description of the accepted options follows.
  7160. @table @option
  7161. @item fps
  7162. Specify the output frames per second. This option can also be specified
  7163. as a value alone. The default is @code{50}.
  7164. @item interp_start
  7165. Specify the start of a range where the output frame will be created as a
  7166. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7167. the default is @code{15}.
  7168. @item interp_end
  7169. Specify the end of a range where the output frame will be created as a
  7170. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7171. the default is @code{240}.
  7172. @item scene
  7173. Specify the level at which a scene change is detected as a value between
  7174. 0 and 100 to indicate a new scene; a low value reflects a low
  7175. probability for the current frame to introduce a new scene, while a higher
  7176. value means the current frame is more likely to be one.
  7177. The default is @code{8.2}.
  7178. @item flags
  7179. Specify flags influencing the filter process.
  7180. Available value for @var{flags} is:
  7181. @table @option
  7182. @item scene_change_detect, scd
  7183. Enable scene change detection using the value of the option @var{scene}.
  7184. This flag is enabled by default.
  7185. @end table
  7186. @end table
  7187. @section framestep
  7188. Select one frame every N-th frame.
  7189. This filter accepts the following option:
  7190. @table @option
  7191. @item step
  7192. Select frame after every @code{step} frames.
  7193. Allowed values are positive integers higher than 0. Default value is @code{1}.
  7194. @end table
  7195. @anchor{frei0r}
  7196. @section frei0r
  7197. Apply a frei0r effect to the input video.
  7198. To enable the compilation of this filter, you need to install the frei0r
  7199. header and configure FFmpeg with @code{--enable-frei0r}.
  7200. It accepts the following parameters:
  7201. @table @option
  7202. @item filter_name
  7203. The name of the frei0r effect to load. If the environment variable
  7204. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  7205. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  7206. Otherwise, the standard frei0r paths are searched, in this order:
  7207. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  7208. @file{/usr/lib/frei0r-1/}.
  7209. @item filter_params
  7210. A '|'-separated list of parameters to pass to the frei0r effect.
  7211. @end table
  7212. A frei0r effect parameter can be a boolean (its value is either
  7213. "y" or "n"), a double, a color (specified as
  7214. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  7215. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  7216. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  7217. a position (specified as @var{X}/@var{Y}, where
  7218. @var{X} and @var{Y} are floating point numbers) and/or a string.
  7219. The number and types of parameters depend on the loaded effect. If an
  7220. effect parameter is not specified, the default value is set.
  7221. @subsection Examples
  7222. @itemize
  7223. @item
  7224. Apply the distort0r effect, setting the first two double parameters:
  7225. @example
  7226. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  7227. @end example
  7228. @item
  7229. Apply the colordistance effect, taking a color as the first parameter:
  7230. @example
  7231. frei0r=colordistance:0.2/0.3/0.4
  7232. frei0r=colordistance:violet
  7233. frei0r=colordistance:0x112233
  7234. @end example
  7235. @item
  7236. Apply the perspective effect, specifying the top left and top right image
  7237. positions:
  7238. @example
  7239. frei0r=perspective:0.2/0.2|0.8/0.2
  7240. @end example
  7241. @end itemize
  7242. For more information, see
  7243. @url{http://frei0r.dyne.org}
  7244. @section fspp
  7245. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  7246. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  7247. processing filter, one of them is performed once per block, not per pixel.
  7248. This allows for much higher speed.
  7249. The filter accepts the following options:
  7250. @table @option
  7251. @item quality
  7252. Set quality. This option defines the number of levels for averaging. It accepts
  7253. an integer in the range 4-5. Default value is @code{4}.
  7254. @item qp
  7255. Force a constant quantization parameter. It accepts an integer in range 0-63.
  7256. If not set, the filter will use the QP from the video stream (if available).
  7257. @item strength
  7258. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  7259. more details but also more artifacts, while higher values make the image smoother
  7260. but also blurrier. Default value is @code{0} − PSNR optimal.
  7261. @item use_bframe_qp
  7262. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  7263. option may cause flicker since the B-Frames have often larger QP. Default is
  7264. @code{0} (not enabled).
  7265. @end table
  7266. @section gblur
  7267. Apply Gaussian blur filter.
  7268. The filter accepts the following options:
  7269. @table @option
  7270. @item sigma
  7271. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  7272. @item steps
  7273. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  7274. @item planes
  7275. Set which planes to filter. By default all planes are filtered.
  7276. @item sigmaV
  7277. Set vertical sigma, if negative it will be same as @code{sigma}.
  7278. Default is @code{-1}.
  7279. @end table
  7280. @section geq
  7281. The filter accepts the following options:
  7282. @table @option
  7283. @item lum_expr, lum
  7284. Set the luminance expression.
  7285. @item cb_expr, cb
  7286. Set the chrominance blue expression.
  7287. @item cr_expr, cr
  7288. Set the chrominance red expression.
  7289. @item alpha_expr, a
  7290. Set the alpha expression.
  7291. @item red_expr, r
  7292. Set the red expression.
  7293. @item green_expr, g
  7294. Set the green expression.
  7295. @item blue_expr, b
  7296. Set the blue expression.
  7297. @end table
  7298. The colorspace is selected according to the specified options. If one
  7299. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  7300. options is specified, the filter will automatically select a YCbCr
  7301. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  7302. @option{blue_expr} options is specified, it will select an RGB
  7303. colorspace.
  7304. If one of the chrominance expression is not defined, it falls back on the other
  7305. one. If no alpha expression is specified it will evaluate to opaque value.
  7306. If none of chrominance expressions are specified, they will evaluate
  7307. to the luminance expression.
  7308. The expressions can use the following variables and functions:
  7309. @table @option
  7310. @item N
  7311. The sequential number of the filtered frame, starting from @code{0}.
  7312. @item X
  7313. @item Y
  7314. The coordinates of the current sample.
  7315. @item W
  7316. @item H
  7317. The width and height of the image.
  7318. @item SW
  7319. @item SH
  7320. Width and height scale depending on the currently filtered plane. It is the
  7321. ratio between the corresponding luma plane number of pixels and the current
  7322. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  7323. @code{0.5,0.5} for chroma planes.
  7324. @item T
  7325. Time of the current frame, expressed in seconds.
  7326. @item p(x, y)
  7327. Return the value of the pixel at location (@var{x},@var{y}) of the current
  7328. plane.
  7329. @item lum(x, y)
  7330. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  7331. plane.
  7332. @item cb(x, y)
  7333. Return the value of the pixel at location (@var{x},@var{y}) of the
  7334. blue-difference chroma plane. Return 0 if there is no such plane.
  7335. @item cr(x, y)
  7336. Return the value of the pixel at location (@var{x},@var{y}) of the
  7337. red-difference chroma plane. Return 0 if there is no such plane.
  7338. @item r(x, y)
  7339. @item g(x, y)
  7340. @item b(x, y)
  7341. Return the value of the pixel at location (@var{x},@var{y}) of the
  7342. red/green/blue component. Return 0 if there is no such component.
  7343. @item alpha(x, y)
  7344. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  7345. plane. Return 0 if there is no such plane.
  7346. @end table
  7347. For functions, if @var{x} and @var{y} are outside the area, the value will be
  7348. automatically clipped to the closer edge.
  7349. @subsection Examples
  7350. @itemize
  7351. @item
  7352. Flip the image horizontally:
  7353. @example
  7354. geq=p(W-X\,Y)
  7355. @end example
  7356. @item
  7357. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  7358. wavelength of 100 pixels:
  7359. @example
  7360. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  7361. @end example
  7362. @item
  7363. Generate a fancy enigmatic moving light:
  7364. @example
  7365. 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
  7366. @end example
  7367. @item
  7368. Generate a quick emboss effect:
  7369. @example
  7370. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  7371. @end example
  7372. @item
  7373. Modify RGB components depending on pixel position:
  7374. @example
  7375. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  7376. @end example
  7377. @item
  7378. Create a radial gradient that is the same size as the input (also see
  7379. the @ref{vignette} filter):
  7380. @example
  7381. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  7382. @end example
  7383. @end itemize
  7384. @section gradfun
  7385. Fix the banding artifacts that are sometimes introduced into nearly flat
  7386. regions by truncation to 8-bit color depth.
  7387. Interpolate the gradients that should go where the bands are, and
  7388. dither them.
  7389. It is designed for playback only. Do not use it prior to
  7390. lossy compression, because compression tends to lose the dither and
  7391. bring back the bands.
  7392. It accepts the following parameters:
  7393. @table @option
  7394. @item strength
  7395. The maximum amount by which the filter will change any one pixel. This is also
  7396. the threshold for detecting nearly flat regions. Acceptable values range from
  7397. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  7398. valid range.
  7399. @item radius
  7400. The neighborhood to fit the gradient to. A larger radius makes for smoother
  7401. gradients, but also prevents the filter from modifying the pixels near detailed
  7402. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  7403. values will be clipped to the valid range.
  7404. @end table
  7405. Alternatively, the options can be specified as a flat string:
  7406. @var{strength}[:@var{radius}]
  7407. @subsection Examples
  7408. @itemize
  7409. @item
  7410. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  7411. @example
  7412. gradfun=3.5:8
  7413. @end example
  7414. @item
  7415. Specify radius, omitting the strength (which will fall-back to the default
  7416. value):
  7417. @example
  7418. gradfun=radius=8
  7419. @end example
  7420. @end itemize
  7421. @anchor{haldclut}
  7422. @section haldclut
  7423. Apply a Hald CLUT to a video stream.
  7424. First input is the video stream to process, and second one is the Hald CLUT.
  7425. The Hald CLUT input can be a simple picture or a complete video stream.
  7426. The filter accepts the following options:
  7427. @table @option
  7428. @item shortest
  7429. Force termination when the shortest input terminates. Default is @code{0}.
  7430. @item repeatlast
  7431. Continue applying the last CLUT after the end of the stream. A value of
  7432. @code{0} disable the filter after the last frame of the CLUT is reached.
  7433. Default is @code{1}.
  7434. @end table
  7435. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  7436. filters share the same internals).
  7437. More information about the Hald CLUT can be found on Eskil Steenberg's website
  7438. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  7439. @subsection Workflow examples
  7440. @subsubsection Hald CLUT video stream
  7441. Generate an identity Hald CLUT stream altered with various effects:
  7442. @example
  7443. 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
  7444. @end example
  7445. Note: make sure you use a lossless codec.
  7446. Then use it with @code{haldclut} to apply it on some random stream:
  7447. @example
  7448. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  7449. @end example
  7450. The Hald CLUT will be applied to the 10 first seconds (duration of
  7451. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  7452. to the remaining frames of the @code{mandelbrot} stream.
  7453. @subsubsection Hald CLUT with preview
  7454. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  7455. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  7456. biggest possible square starting at the top left of the picture. The remaining
  7457. padding pixels (bottom or right) will be ignored. This area can be used to add
  7458. a preview of the Hald CLUT.
  7459. Typically, the following generated Hald CLUT will be supported by the
  7460. @code{haldclut} filter:
  7461. @example
  7462. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  7463. pad=iw+320 [padded_clut];
  7464. smptebars=s=320x256, split [a][b];
  7465. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  7466. [main][b] overlay=W-320" -frames:v 1 clut.png
  7467. @end example
  7468. It contains the original and a preview of the effect of the CLUT: SMPTE color
  7469. bars are displayed on the right-top, and below the same color bars processed by
  7470. the color changes.
  7471. Then, the effect of this Hald CLUT can be visualized with:
  7472. @example
  7473. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  7474. @end example
  7475. @section hflip
  7476. Flip the input video horizontally.
  7477. For example, to horizontally flip the input video with @command{ffmpeg}:
  7478. @example
  7479. ffmpeg -i in.avi -vf "hflip" out.avi
  7480. @end example
  7481. @section histeq
  7482. This filter applies a global color histogram equalization on a
  7483. per-frame basis.
  7484. It can be used to correct video that has a compressed range of pixel
  7485. intensities. The filter redistributes the pixel intensities to
  7486. equalize their distribution across the intensity range. It may be
  7487. viewed as an "automatically adjusting contrast filter". This filter is
  7488. useful only for correcting degraded or poorly captured source
  7489. video.
  7490. The filter accepts the following options:
  7491. @table @option
  7492. @item strength
  7493. Determine the amount of equalization to be applied. As the strength
  7494. is reduced, the distribution of pixel intensities more-and-more
  7495. approaches that of the input frame. The value must be a float number
  7496. in the range [0,1] and defaults to 0.200.
  7497. @item intensity
  7498. Set the maximum intensity that can generated and scale the output
  7499. values appropriately. The strength should be set as desired and then
  7500. the intensity can be limited if needed to avoid washing-out. The value
  7501. must be a float number in the range [0,1] and defaults to 0.210.
  7502. @item antibanding
  7503. Set the antibanding level. If enabled the filter will randomly vary
  7504. the luminance of output pixels by a small amount to avoid banding of
  7505. the histogram. Possible values are @code{none}, @code{weak} or
  7506. @code{strong}. It defaults to @code{none}.
  7507. @end table
  7508. @section histogram
  7509. Compute and draw a color distribution histogram for the input video.
  7510. The computed histogram is a representation of the color component
  7511. distribution in an image.
  7512. Standard histogram displays the color components distribution in an image.
  7513. Displays color graph for each color component. Shows distribution of
  7514. the Y, U, V, A or R, G, B components, depending on input format, in the
  7515. current frame. Below each graph a color component scale meter is shown.
  7516. The filter accepts the following options:
  7517. @table @option
  7518. @item level_height
  7519. Set height of level. Default value is @code{200}.
  7520. Allowed range is [50, 2048].
  7521. @item scale_height
  7522. Set height of color scale. Default value is @code{12}.
  7523. Allowed range is [0, 40].
  7524. @item display_mode
  7525. Set display mode.
  7526. It accepts the following values:
  7527. @table @samp
  7528. @item stack
  7529. Per color component graphs are placed below each other.
  7530. @item parade
  7531. Per color component graphs are placed side by side.
  7532. @item overlay
  7533. Presents information identical to that in the @code{parade}, except
  7534. that the graphs representing color components are superimposed directly
  7535. over one another.
  7536. @end table
  7537. Default is @code{stack}.
  7538. @item levels_mode
  7539. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  7540. Default is @code{linear}.
  7541. @item components
  7542. Set what color components to display.
  7543. Default is @code{7}.
  7544. @item fgopacity
  7545. Set foreground opacity. Default is @code{0.7}.
  7546. @item bgopacity
  7547. Set background opacity. Default is @code{0.5}.
  7548. @end table
  7549. @subsection Examples
  7550. @itemize
  7551. @item
  7552. Calculate and draw histogram:
  7553. @example
  7554. ffplay -i input -vf histogram
  7555. @end example
  7556. @end itemize
  7557. @anchor{hqdn3d}
  7558. @section hqdn3d
  7559. This is a high precision/quality 3d denoise filter. It aims to reduce
  7560. image noise, producing smooth images and making still images really
  7561. still. It should enhance compressibility.
  7562. It accepts the following optional parameters:
  7563. @table @option
  7564. @item luma_spatial
  7565. A non-negative floating point number which specifies spatial luma strength.
  7566. It defaults to 4.0.
  7567. @item chroma_spatial
  7568. A non-negative floating point number which specifies spatial chroma strength.
  7569. It defaults to 3.0*@var{luma_spatial}/4.0.
  7570. @item luma_tmp
  7571. A floating point number which specifies luma temporal strength. It defaults to
  7572. 6.0*@var{luma_spatial}/4.0.
  7573. @item chroma_tmp
  7574. A floating point number which specifies chroma temporal strength. It defaults to
  7575. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  7576. @end table
  7577. @section hwdownload
  7578. Download hardware frames to system memory.
  7579. The input must be in hardware frames, and the output a non-hardware format.
  7580. Not all formats will be supported on the output - it may be necessary to insert
  7581. an additional @option{format} filter immediately following in the graph to get
  7582. the output in a supported format.
  7583. @section hwmap
  7584. Map hardware frames to system memory or to another device.
  7585. This filter has several different modes of operation; which one is used depends
  7586. on the input and output formats:
  7587. @itemize
  7588. @item
  7589. Hardware frame input, normal frame output
  7590. Map the input frames to system memory and pass them to the output. If the
  7591. original hardware frame is later required (for example, after overlaying
  7592. something else on part of it), the @option{hwmap} filter can be used again
  7593. in the next mode to retrieve it.
  7594. @item
  7595. Normal frame input, hardware frame output
  7596. If the input is actually a software-mapped hardware frame, then unmap it -
  7597. that is, return the original hardware frame.
  7598. Otherwise, a device must be provided. Create new hardware surfaces on that
  7599. device for the output, then map them back to the software format at the input
  7600. and give those frames to the preceding filter. This will then act like the
  7601. @option{hwupload} filter, but may be able to avoid an additional copy when
  7602. the input is already in a compatible format.
  7603. @item
  7604. Hardware frame input and output
  7605. A device must be supplied for the output, either directly or with the
  7606. @option{derive_device} option. The input and output devices must be of
  7607. different types and compatible - the exact meaning of this is
  7608. system-dependent, but typically it means that they must refer to the same
  7609. underlying hardware context (for example, refer to the same graphics card).
  7610. If the input frames were originally created on the output device, then unmap
  7611. to retrieve the original frames.
  7612. Otherwise, map the frames to the output device - create new hardware frames
  7613. on the output corresponding to the frames on the input.
  7614. @end itemize
  7615. The following additional parameters are accepted:
  7616. @table @option
  7617. @item mode
  7618. Set the frame mapping mode. Some combination of:
  7619. @table @var
  7620. @item read
  7621. The mapped frame should be readable.
  7622. @item write
  7623. The mapped frame should be writeable.
  7624. @item overwrite
  7625. The mapping will always overwrite the entire frame.
  7626. This may improve performance in some cases, as the original contents of the
  7627. frame need not be loaded.
  7628. @item direct
  7629. The mapping must not involve any copying.
  7630. Indirect mappings to copies of frames are created in some cases where either
  7631. direct mapping is not possible or it would have unexpected properties.
  7632. Setting this flag ensures that the mapping is direct and will fail if that is
  7633. not possible.
  7634. @end table
  7635. Defaults to @var{read+write} if not specified.
  7636. @item derive_device @var{type}
  7637. Rather than using the device supplied at initialisation, instead derive a new
  7638. device of type @var{type} from the device the input frames exist on.
  7639. @item reverse
  7640. In a hardware to hardware mapping, map in reverse - create frames in the sink
  7641. and map them back to the source. This may be necessary in some cases where
  7642. a mapping in one direction is required but only the opposite direction is
  7643. supported by the devices being used.
  7644. This option is dangerous - it may break the preceding filter in undefined
  7645. ways if there are any additional constraints on that filter's output.
  7646. Do not use it without fully understanding the implications of its use.
  7647. @end table
  7648. @section hwupload
  7649. Upload system memory frames to hardware surfaces.
  7650. The device to upload to must be supplied when the filter is initialised. If
  7651. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  7652. option.
  7653. @anchor{hwupload_cuda}
  7654. @section hwupload_cuda
  7655. Upload system memory frames to a CUDA device.
  7656. It accepts the following optional parameters:
  7657. @table @option
  7658. @item device
  7659. The number of the CUDA device to use
  7660. @end table
  7661. @section hqx
  7662. Apply a high-quality magnification filter designed for pixel art. This filter
  7663. was originally created by Maxim Stepin.
  7664. It accepts the following option:
  7665. @table @option
  7666. @item n
  7667. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  7668. @code{hq3x} and @code{4} for @code{hq4x}.
  7669. Default is @code{3}.
  7670. @end table
  7671. @section hstack
  7672. Stack input videos horizontally.
  7673. All streams must be of same pixel format and of same height.
  7674. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  7675. to create same output.
  7676. The filter accept the following option:
  7677. @table @option
  7678. @item inputs
  7679. Set number of input streams. Default is 2.
  7680. @item shortest
  7681. If set to 1, force the output to terminate when the shortest input
  7682. terminates. Default value is 0.
  7683. @end table
  7684. @section hue
  7685. Modify the hue and/or the saturation of the input.
  7686. It accepts the following parameters:
  7687. @table @option
  7688. @item h
  7689. Specify the hue angle as a number of degrees. It accepts an expression,
  7690. and defaults to "0".
  7691. @item s
  7692. Specify the saturation in the [-10,10] range. It accepts an expression and
  7693. defaults to "1".
  7694. @item H
  7695. Specify the hue angle as a number of radians. It accepts an
  7696. expression, and defaults to "0".
  7697. @item b
  7698. Specify the brightness in the [-10,10] range. It accepts an expression and
  7699. defaults to "0".
  7700. @end table
  7701. @option{h} and @option{H} are mutually exclusive, and can't be
  7702. specified at the same time.
  7703. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  7704. expressions containing the following constants:
  7705. @table @option
  7706. @item n
  7707. frame count of the input frame starting from 0
  7708. @item pts
  7709. presentation timestamp of the input frame expressed in time base units
  7710. @item r
  7711. frame rate of the input video, NAN if the input frame rate is unknown
  7712. @item t
  7713. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7714. @item tb
  7715. time base of the input video
  7716. @end table
  7717. @subsection Examples
  7718. @itemize
  7719. @item
  7720. Set the hue to 90 degrees and the saturation to 1.0:
  7721. @example
  7722. hue=h=90:s=1
  7723. @end example
  7724. @item
  7725. Same command but expressing the hue in radians:
  7726. @example
  7727. hue=H=PI/2:s=1
  7728. @end example
  7729. @item
  7730. Rotate hue and make the saturation swing between 0
  7731. and 2 over a period of 1 second:
  7732. @example
  7733. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  7734. @end example
  7735. @item
  7736. Apply a 3 seconds saturation fade-in effect starting at 0:
  7737. @example
  7738. hue="s=min(t/3\,1)"
  7739. @end example
  7740. The general fade-in expression can be written as:
  7741. @example
  7742. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  7743. @end example
  7744. @item
  7745. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  7746. @example
  7747. hue="s=max(0\, min(1\, (8-t)/3))"
  7748. @end example
  7749. The general fade-out expression can be written as:
  7750. @example
  7751. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  7752. @end example
  7753. @end itemize
  7754. @subsection Commands
  7755. This filter supports the following commands:
  7756. @table @option
  7757. @item b
  7758. @item s
  7759. @item h
  7760. @item H
  7761. Modify the hue and/or the saturation and/or brightness of the input video.
  7762. The command accepts the same syntax of the corresponding option.
  7763. If the specified expression is not valid, it is kept at its current
  7764. value.
  7765. @end table
  7766. @section hysteresis
  7767. Grow first stream into second stream by connecting components.
  7768. This makes it possible to build more robust edge masks.
  7769. This filter accepts the following options:
  7770. @table @option
  7771. @item planes
  7772. Set which planes will be processed as bitmap, unprocessed planes will be
  7773. copied from first stream.
  7774. By default value 0xf, all planes will be processed.
  7775. @item threshold
  7776. Set threshold which is used in filtering. If pixel component value is higher than
  7777. this value filter algorithm for connecting components is activated.
  7778. By default value is 0.
  7779. @end table
  7780. @section idet
  7781. Detect video interlacing type.
  7782. This filter tries to detect if the input frames are interlaced, progressive,
  7783. top or bottom field first. It will also try to detect fields that are
  7784. repeated between adjacent frames (a sign of telecine).
  7785. Single frame detection considers only immediately adjacent frames when classifying each frame.
  7786. Multiple frame detection incorporates the classification history of previous frames.
  7787. The filter will log these metadata values:
  7788. @table @option
  7789. @item single.current_frame
  7790. Detected type of current frame using single-frame detection. One of:
  7791. ``tff'' (top field first), ``bff'' (bottom field first),
  7792. ``progressive'', or ``undetermined''
  7793. @item single.tff
  7794. Cumulative number of frames detected as top field first using single-frame detection.
  7795. @item multiple.tff
  7796. Cumulative number of frames detected as top field first using multiple-frame detection.
  7797. @item single.bff
  7798. Cumulative number of frames detected as bottom field first using single-frame detection.
  7799. @item multiple.current_frame
  7800. Detected type of current frame using multiple-frame detection. One of:
  7801. ``tff'' (top field first), ``bff'' (bottom field first),
  7802. ``progressive'', or ``undetermined''
  7803. @item multiple.bff
  7804. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  7805. @item single.progressive
  7806. Cumulative number of frames detected as progressive using single-frame detection.
  7807. @item multiple.progressive
  7808. Cumulative number of frames detected as progressive using multiple-frame detection.
  7809. @item single.undetermined
  7810. Cumulative number of frames that could not be classified using single-frame detection.
  7811. @item multiple.undetermined
  7812. Cumulative number of frames that could not be classified using multiple-frame detection.
  7813. @item repeated.current_frame
  7814. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  7815. @item repeated.neither
  7816. Cumulative number of frames with no repeated field.
  7817. @item repeated.top
  7818. Cumulative number of frames with the top field repeated from the previous frame's top field.
  7819. @item repeated.bottom
  7820. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  7821. @end table
  7822. The filter accepts the following options:
  7823. @table @option
  7824. @item intl_thres
  7825. Set interlacing threshold.
  7826. @item prog_thres
  7827. Set progressive threshold.
  7828. @item rep_thres
  7829. Threshold for repeated field detection.
  7830. @item half_life
  7831. Number of frames after which a given frame's contribution to the
  7832. statistics is halved (i.e., it contributes only 0.5 to its
  7833. classification). The default of 0 means that all frames seen are given
  7834. full weight of 1.0 forever.
  7835. @item analyze_interlaced_flag
  7836. When this is not 0 then idet will use the specified number of frames to determine
  7837. if the interlaced flag is accurate, it will not count undetermined frames.
  7838. If the flag is found to be accurate it will be used without any further
  7839. computations, if it is found to be inaccurate it will be cleared without any
  7840. further computations. This allows inserting the idet filter as a low computational
  7841. method to clean up the interlaced flag
  7842. @end table
  7843. @section il
  7844. Deinterleave or interleave fields.
  7845. This filter allows one to process interlaced images fields without
  7846. deinterlacing them. Deinterleaving splits the input frame into 2
  7847. fields (so called half pictures). Odd lines are moved to the top
  7848. half of the output image, even lines to the bottom half.
  7849. You can process (filter) them independently and then re-interleave them.
  7850. The filter accepts the following options:
  7851. @table @option
  7852. @item luma_mode, l
  7853. @item chroma_mode, c
  7854. @item alpha_mode, a
  7855. Available values for @var{luma_mode}, @var{chroma_mode} and
  7856. @var{alpha_mode} are:
  7857. @table @samp
  7858. @item none
  7859. Do nothing.
  7860. @item deinterleave, d
  7861. Deinterleave fields, placing one above the other.
  7862. @item interleave, i
  7863. Interleave fields. Reverse the effect of deinterleaving.
  7864. @end table
  7865. Default value is @code{none}.
  7866. @item luma_swap, ls
  7867. @item chroma_swap, cs
  7868. @item alpha_swap, as
  7869. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  7870. @end table
  7871. @section inflate
  7872. Apply inflate effect to the video.
  7873. This filter replaces the pixel by the local(3x3) average by taking into account
  7874. only values higher than the pixel.
  7875. It accepts the following options:
  7876. @table @option
  7877. @item threshold0
  7878. @item threshold1
  7879. @item threshold2
  7880. @item threshold3
  7881. Limit the maximum change for each plane, default is 65535.
  7882. If 0, plane will remain unchanged.
  7883. @end table
  7884. @section interlace
  7885. Simple interlacing filter from progressive contents. This interleaves upper (or
  7886. lower) lines from odd frames with lower (or upper) lines from even frames,
  7887. halving the frame rate and preserving image height.
  7888. @example
  7889. Original Original New Frame
  7890. Frame 'j' Frame 'j+1' (tff)
  7891. ========== =========== ==================
  7892. Line 0 --------------------> Frame 'j' Line 0
  7893. Line 1 Line 1 ----> Frame 'j+1' Line 1
  7894. Line 2 ---------------------> Frame 'j' Line 2
  7895. Line 3 Line 3 ----> Frame 'j+1' Line 3
  7896. ... ... ...
  7897. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  7898. @end example
  7899. It accepts the following optional parameters:
  7900. @table @option
  7901. @item scan
  7902. This determines whether the interlaced frame is taken from the even
  7903. (tff - default) or odd (bff) lines of the progressive frame.
  7904. @item lowpass
  7905. Vertical lowpass filter to avoid twitter interlacing and
  7906. reduce moire patterns.
  7907. @table @samp
  7908. @item 0, off
  7909. Disable vertical lowpass filter
  7910. @item 1, linear
  7911. Enable linear filter (default)
  7912. @item 2, complex
  7913. Enable complex filter. This will slightly less reduce twitter and moire
  7914. but better retain detail and subjective sharpness impression.
  7915. @end table
  7916. @end table
  7917. @section kerndeint
  7918. Deinterlace input video by applying Donald Graft's adaptive kernel
  7919. deinterling. Work on interlaced parts of a video to produce
  7920. progressive frames.
  7921. The description of the accepted parameters follows.
  7922. @table @option
  7923. @item thresh
  7924. Set the threshold which affects the filter's tolerance when
  7925. determining if a pixel line must be processed. It must be an integer
  7926. in the range [0,255] and defaults to 10. A value of 0 will result in
  7927. applying the process on every pixels.
  7928. @item map
  7929. Paint pixels exceeding the threshold value to white if set to 1.
  7930. Default is 0.
  7931. @item order
  7932. Set the fields order. Swap fields if set to 1, leave fields alone if
  7933. 0. Default is 0.
  7934. @item sharp
  7935. Enable additional sharpening if set to 1. Default is 0.
  7936. @item twoway
  7937. Enable twoway sharpening if set to 1. Default is 0.
  7938. @end table
  7939. @subsection Examples
  7940. @itemize
  7941. @item
  7942. Apply default values:
  7943. @example
  7944. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  7945. @end example
  7946. @item
  7947. Enable additional sharpening:
  7948. @example
  7949. kerndeint=sharp=1
  7950. @end example
  7951. @item
  7952. Paint processed pixels in white:
  7953. @example
  7954. kerndeint=map=1
  7955. @end example
  7956. @end itemize
  7957. @section lenscorrection
  7958. Correct radial lens distortion
  7959. This filter can be used to correct for radial distortion as can result from the use
  7960. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  7961. one can use tools available for example as part of opencv or simply trial-and-error.
  7962. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  7963. and extract the k1 and k2 coefficients from the resulting matrix.
  7964. Note that effectively the same filter is available in the open-source tools Krita and
  7965. Digikam from the KDE project.
  7966. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  7967. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  7968. brightness distribution, so you may want to use both filters together in certain
  7969. cases, though you will have to take care of ordering, i.e. whether vignetting should
  7970. be applied before or after lens correction.
  7971. @subsection Options
  7972. The filter accepts the following options:
  7973. @table @option
  7974. @item cx
  7975. Relative x-coordinate of the focal point of the image, and thereby the center of the
  7976. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7977. width. Default is 0.5.
  7978. @item cy
  7979. Relative y-coordinate of the focal point of the image, and thereby the center of the
  7980. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7981. height. Default is 0.5.
  7982. @item k1
  7983. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  7984. no correction. Default is 0.
  7985. @item k2
  7986. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  7987. 0 means no correction. Default is 0.
  7988. @end table
  7989. The formula that generates the correction is:
  7990. @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)
  7991. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  7992. distances from the focal point in the source and target images, respectively.
  7993. @section libvmaf
  7994. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  7995. score between two input videos.
  7996. The obtained VMAF score is printed through the logging system.
  7997. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  7998. After installing the library it can be enabled using:
  7999. @code{./configure --enable-libvmaf}.
  8000. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  8001. The filter has following options:
  8002. @table @option
  8003. @item model_path
  8004. Set the model path which is to be used for SVM.
  8005. Default value: @code{"vmaf_v0.6.1.pkl"}
  8006. @item log_path
  8007. Set the file path to be used to store logs.
  8008. @item log_fmt
  8009. Set the format of the log file (xml or json).
  8010. @item enable_transform
  8011. Enables transform for computing vmaf.
  8012. @item phone_model
  8013. Invokes the phone model which will generate VMAF scores higher than in the
  8014. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  8015. @item psnr
  8016. Enables computing psnr along with vmaf.
  8017. @item ssim
  8018. Enables computing ssim along with vmaf.
  8019. @item ms_ssim
  8020. Enables computing ms_ssim along with vmaf.
  8021. @item pool
  8022. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  8023. @end table
  8024. This filter also supports the @ref{framesync} options.
  8025. On the below examples the input file @file{main.mpg} being processed is
  8026. compared with the reference file @file{ref.mpg}.
  8027. @example
  8028. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  8029. @end example
  8030. Example with options:
  8031. @example
  8032. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:enable-transform=1" -f null -
  8033. @end example
  8034. @section limiter
  8035. Limits the pixel components values to the specified range [min, max].
  8036. The filter accepts the following options:
  8037. @table @option
  8038. @item min
  8039. Lower bound. Defaults to the lowest allowed value for the input.
  8040. @item max
  8041. Upper bound. Defaults to the highest allowed value for the input.
  8042. @item planes
  8043. Specify which planes will be processed. Defaults to all available.
  8044. @end table
  8045. @section loop
  8046. Loop video frames.
  8047. The filter accepts the following options:
  8048. @table @option
  8049. @item loop
  8050. Set the number of loops. Setting this value to -1 will result in infinite loops.
  8051. Default is 0.
  8052. @item size
  8053. Set maximal size in number of frames. Default is 0.
  8054. @item start
  8055. Set first frame of loop. Default is 0.
  8056. @end table
  8057. @anchor{lut3d}
  8058. @section lut3d
  8059. Apply a 3D LUT to an input video.
  8060. The filter accepts the following options:
  8061. @table @option
  8062. @item file
  8063. Set the 3D LUT file name.
  8064. Currently supported formats:
  8065. @table @samp
  8066. @item 3dl
  8067. AfterEffects
  8068. @item cube
  8069. Iridas
  8070. @item dat
  8071. DaVinci
  8072. @item m3d
  8073. Pandora
  8074. @end table
  8075. @item interp
  8076. Select interpolation mode.
  8077. Available values are:
  8078. @table @samp
  8079. @item nearest
  8080. Use values from the nearest defined point.
  8081. @item trilinear
  8082. Interpolate values using the 8 points defining a cube.
  8083. @item tetrahedral
  8084. Interpolate values using a tetrahedron.
  8085. @end table
  8086. @end table
  8087. This filter also supports the @ref{framesync} options.
  8088. @section lumakey
  8089. Turn certain luma values into transparency.
  8090. The filter accepts the following options:
  8091. @table @option
  8092. @item threshold
  8093. Set the luma which will be used as base for transparency.
  8094. Default value is @code{0}.
  8095. @item tolerance
  8096. Set the range of luma values to be keyed out.
  8097. Default value is @code{0}.
  8098. @item softness
  8099. Set the range of softness. Default value is @code{0}.
  8100. Use this to control gradual transition from zero to full transparency.
  8101. @end table
  8102. @section lut, lutrgb, lutyuv
  8103. Compute a look-up table for binding each pixel component input value
  8104. to an output value, and apply it to the input video.
  8105. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  8106. to an RGB input video.
  8107. These filters accept the following parameters:
  8108. @table @option
  8109. @item c0
  8110. set first pixel component expression
  8111. @item c1
  8112. set second pixel component expression
  8113. @item c2
  8114. set third pixel component expression
  8115. @item c3
  8116. set fourth pixel component expression, corresponds to the alpha component
  8117. @item r
  8118. set red component expression
  8119. @item g
  8120. set green component expression
  8121. @item b
  8122. set blue component expression
  8123. @item a
  8124. alpha component expression
  8125. @item y
  8126. set Y/luminance component expression
  8127. @item u
  8128. set U/Cb component expression
  8129. @item v
  8130. set V/Cr component expression
  8131. @end table
  8132. Each of them specifies the expression to use for computing the lookup table for
  8133. the corresponding pixel component values.
  8134. The exact component associated to each of the @var{c*} options depends on the
  8135. format in input.
  8136. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  8137. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  8138. The expressions can contain the following constants and functions:
  8139. @table @option
  8140. @item w
  8141. @item h
  8142. The input width and height.
  8143. @item val
  8144. The input value for the pixel component.
  8145. @item clipval
  8146. The input value, clipped to the @var{minval}-@var{maxval} range.
  8147. @item maxval
  8148. The maximum value for the pixel component.
  8149. @item minval
  8150. The minimum value for the pixel component.
  8151. @item negval
  8152. The negated value for the pixel component value, clipped to the
  8153. @var{minval}-@var{maxval} range; it corresponds to the expression
  8154. "maxval-clipval+minval".
  8155. @item clip(val)
  8156. The computed value in @var{val}, clipped to the
  8157. @var{minval}-@var{maxval} range.
  8158. @item gammaval(gamma)
  8159. The computed gamma correction value of the pixel component value,
  8160. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  8161. expression
  8162. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  8163. @end table
  8164. All expressions default to "val".
  8165. @subsection Examples
  8166. @itemize
  8167. @item
  8168. Negate input video:
  8169. @example
  8170. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  8171. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  8172. @end example
  8173. The above is the same as:
  8174. @example
  8175. lutrgb="r=negval:g=negval:b=negval"
  8176. lutyuv="y=negval:u=negval:v=negval"
  8177. @end example
  8178. @item
  8179. Negate luminance:
  8180. @example
  8181. lutyuv=y=negval
  8182. @end example
  8183. @item
  8184. Remove chroma components, turning the video into a graytone image:
  8185. @example
  8186. lutyuv="u=128:v=128"
  8187. @end example
  8188. @item
  8189. Apply a luma burning effect:
  8190. @example
  8191. lutyuv="y=2*val"
  8192. @end example
  8193. @item
  8194. Remove green and blue components:
  8195. @example
  8196. lutrgb="g=0:b=0"
  8197. @end example
  8198. @item
  8199. Set a constant alpha channel value on input:
  8200. @example
  8201. format=rgba,lutrgb=a="maxval-minval/2"
  8202. @end example
  8203. @item
  8204. Correct luminance gamma by a factor of 0.5:
  8205. @example
  8206. lutyuv=y=gammaval(0.5)
  8207. @end example
  8208. @item
  8209. Discard least significant bits of luma:
  8210. @example
  8211. lutyuv=y='bitand(val, 128+64+32)'
  8212. @end example
  8213. @item
  8214. Technicolor like effect:
  8215. @example
  8216. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  8217. @end example
  8218. @end itemize
  8219. @section lut2, tlut2
  8220. The @code{lut2} filter takes two input streams and outputs one
  8221. stream.
  8222. The @code{tlut2} (time lut2) filter takes two consecutive frames
  8223. from one single stream.
  8224. This filter accepts the following parameters:
  8225. @table @option
  8226. @item c0
  8227. set first pixel component expression
  8228. @item c1
  8229. set second pixel component expression
  8230. @item c2
  8231. set third pixel component expression
  8232. @item c3
  8233. set fourth pixel component expression, corresponds to the alpha component
  8234. @end table
  8235. Each of them specifies the expression to use for computing the lookup table for
  8236. the corresponding pixel component values.
  8237. The exact component associated to each of the @var{c*} options depends on the
  8238. format in inputs.
  8239. The expressions can contain the following constants:
  8240. @table @option
  8241. @item w
  8242. @item h
  8243. The input width and height.
  8244. @item x
  8245. The first input value for the pixel component.
  8246. @item y
  8247. The second input value for the pixel component.
  8248. @item bdx
  8249. The first input video bit depth.
  8250. @item bdy
  8251. The second input video bit depth.
  8252. @end table
  8253. All expressions default to "x".
  8254. @subsection Examples
  8255. @itemize
  8256. @item
  8257. Highlight differences between two RGB video streams:
  8258. @example
  8259. 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)'
  8260. @end example
  8261. @item
  8262. Highlight differences between two YUV video streams:
  8263. @example
  8264. 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)'
  8265. @end example
  8266. @item
  8267. Show max difference between two video streams:
  8268. @example
  8269. 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)))'
  8270. @end example
  8271. @end itemize
  8272. @section maskedclamp
  8273. Clamp the first input stream with the second input and third input stream.
  8274. Returns the value of first stream to be between second input
  8275. stream - @code{undershoot} and third input stream + @code{overshoot}.
  8276. This filter accepts the following options:
  8277. @table @option
  8278. @item undershoot
  8279. Default value is @code{0}.
  8280. @item overshoot
  8281. Default value is @code{0}.
  8282. @item planes
  8283. Set which planes will be processed as bitmap, unprocessed planes will be
  8284. copied from first stream.
  8285. By default value 0xf, all planes will be processed.
  8286. @end table
  8287. @section maskedmerge
  8288. Merge the first input stream with the second input stream using per pixel
  8289. weights in the third input stream.
  8290. A value of 0 in the third stream pixel component means that pixel component
  8291. from first stream is returned unchanged, while maximum value (eg. 255 for
  8292. 8-bit videos) means that pixel component from second stream is returned
  8293. unchanged. Intermediate values define the amount of merging between both
  8294. input stream's pixel components.
  8295. This filter accepts the following options:
  8296. @table @option
  8297. @item planes
  8298. Set which planes will be processed as bitmap, unprocessed planes will be
  8299. copied from first stream.
  8300. By default value 0xf, all planes will be processed.
  8301. @end table
  8302. @section mcdeint
  8303. Apply motion-compensation deinterlacing.
  8304. It needs one field per frame as input and must thus be used together
  8305. with yadif=1/3 or equivalent.
  8306. This filter accepts the following options:
  8307. @table @option
  8308. @item mode
  8309. Set the deinterlacing mode.
  8310. It accepts one of the following values:
  8311. @table @samp
  8312. @item fast
  8313. @item medium
  8314. @item slow
  8315. use iterative motion estimation
  8316. @item extra_slow
  8317. like @samp{slow}, but use multiple reference frames.
  8318. @end table
  8319. Default value is @samp{fast}.
  8320. @item parity
  8321. Set the picture field parity assumed for the input video. It must be
  8322. one of the following values:
  8323. @table @samp
  8324. @item 0, tff
  8325. assume top field first
  8326. @item 1, bff
  8327. assume bottom field first
  8328. @end table
  8329. Default value is @samp{bff}.
  8330. @item qp
  8331. Set per-block quantization parameter (QP) used by the internal
  8332. encoder.
  8333. Higher values should result in a smoother motion vector field but less
  8334. optimal individual vectors. Default value is 1.
  8335. @end table
  8336. @section mergeplanes
  8337. Merge color channel components from several video streams.
  8338. The filter accepts up to 4 input streams, and merge selected input
  8339. planes to the output video.
  8340. This filter accepts the following options:
  8341. @table @option
  8342. @item mapping
  8343. Set input to output plane mapping. Default is @code{0}.
  8344. The mappings is specified as a bitmap. It should be specified as a
  8345. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  8346. mapping for the first plane of the output stream. 'A' sets the number of
  8347. the input stream to use (from 0 to 3), and 'a' the plane number of the
  8348. corresponding input to use (from 0 to 3). The rest of the mappings is
  8349. similar, 'Bb' describes the mapping for the output stream second
  8350. plane, 'Cc' describes the mapping for the output stream third plane and
  8351. 'Dd' describes the mapping for the output stream fourth plane.
  8352. @item format
  8353. Set output pixel format. Default is @code{yuva444p}.
  8354. @end table
  8355. @subsection Examples
  8356. @itemize
  8357. @item
  8358. Merge three gray video streams of same width and height into single video stream:
  8359. @example
  8360. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  8361. @end example
  8362. @item
  8363. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  8364. @example
  8365. [a0][a1]mergeplanes=0x00010210:yuva444p
  8366. @end example
  8367. @item
  8368. Swap Y and A plane in yuva444p stream:
  8369. @example
  8370. format=yuva444p,mergeplanes=0x03010200:yuva444p
  8371. @end example
  8372. @item
  8373. Swap U and V plane in yuv420p stream:
  8374. @example
  8375. format=yuv420p,mergeplanes=0x000201:yuv420p
  8376. @end example
  8377. @item
  8378. Cast a rgb24 clip to yuv444p:
  8379. @example
  8380. format=rgb24,mergeplanes=0x000102:yuv444p
  8381. @end example
  8382. @end itemize
  8383. @section mestimate
  8384. Estimate and export motion vectors using block matching algorithms.
  8385. Motion vectors are stored in frame side data to be used by other filters.
  8386. This filter accepts the following options:
  8387. @table @option
  8388. @item method
  8389. Specify the motion estimation method. Accepts one of the following values:
  8390. @table @samp
  8391. @item esa
  8392. Exhaustive search algorithm.
  8393. @item tss
  8394. Three step search algorithm.
  8395. @item tdls
  8396. Two dimensional logarithmic search algorithm.
  8397. @item ntss
  8398. New three step search algorithm.
  8399. @item fss
  8400. Four step search algorithm.
  8401. @item ds
  8402. Diamond search algorithm.
  8403. @item hexbs
  8404. Hexagon-based search algorithm.
  8405. @item epzs
  8406. Enhanced predictive zonal search algorithm.
  8407. @item umh
  8408. Uneven multi-hexagon search algorithm.
  8409. @end table
  8410. Default value is @samp{esa}.
  8411. @item mb_size
  8412. Macroblock size. Default @code{16}.
  8413. @item search_param
  8414. Search parameter. Default @code{7}.
  8415. @end table
  8416. @section midequalizer
  8417. Apply Midway Image Equalization effect using two video streams.
  8418. Midway Image Equalization adjusts a pair of images to have the same
  8419. histogram, while maintaining their dynamics as much as possible. It's
  8420. useful for e.g. matching exposures from a pair of stereo cameras.
  8421. This filter has two inputs and one output, which must be of same pixel format, but
  8422. may be of different sizes. The output of filter is first input adjusted with
  8423. midway histogram of both inputs.
  8424. This filter accepts the following option:
  8425. @table @option
  8426. @item planes
  8427. Set which planes to process. Default is @code{15}, which is all available planes.
  8428. @end table
  8429. @section minterpolate
  8430. Convert the video to specified frame rate using motion interpolation.
  8431. This filter accepts the following options:
  8432. @table @option
  8433. @item fps
  8434. 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}.
  8435. @item mi_mode
  8436. Motion interpolation mode. Following values are accepted:
  8437. @table @samp
  8438. @item dup
  8439. Duplicate previous or next frame for interpolating new ones.
  8440. @item blend
  8441. Blend source frames. Interpolated frame is mean of previous and next frames.
  8442. @item mci
  8443. Motion compensated interpolation. Following options are effective when this mode is selected:
  8444. @table @samp
  8445. @item mc_mode
  8446. Motion compensation mode. Following values are accepted:
  8447. @table @samp
  8448. @item obmc
  8449. Overlapped block motion compensation.
  8450. @item aobmc
  8451. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  8452. @end table
  8453. Default mode is @samp{obmc}.
  8454. @item me_mode
  8455. Motion estimation mode. Following values are accepted:
  8456. @table @samp
  8457. @item bidir
  8458. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  8459. @item bilat
  8460. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  8461. @end table
  8462. Default mode is @samp{bilat}.
  8463. @item me
  8464. The algorithm to be used for motion estimation. Following values are accepted:
  8465. @table @samp
  8466. @item esa
  8467. Exhaustive search algorithm.
  8468. @item tss
  8469. Three step search algorithm.
  8470. @item tdls
  8471. Two dimensional logarithmic search algorithm.
  8472. @item ntss
  8473. New three step search algorithm.
  8474. @item fss
  8475. Four step search algorithm.
  8476. @item ds
  8477. Diamond search algorithm.
  8478. @item hexbs
  8479. Hexagon-based search algorithm.
  8480. @item epzs
  8481. Enhanced predictive zonal search algorithm.
  8482. @item umh
  8483. Uneven multi-hexagon search algorithm.
  8484. @end table
  8485. Default algorithm is @samp{epzs}.
  8486. @item mb_size
  8487. Macroblock size. Default @code{16}.
  8488. @item search_param
  8489. Motion estimation search parameter. Default @code{32}.
  8490. @item vsbmc
  8491. 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).
  8492. @end table
  8493. @end table
  8494. @item scd
  8495. 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:
  8496. @table @samp
  8497. @item none
  8498. Disable scene change detection.
  8499. @item fdiff
  8500. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  8501. @end table
  8502. Default method is @samp{fdiff}.
  8503. @item scd_threshold
  8504. Scene change detection threshold. Default is @code{5.0}.
  8505. @end table
  8506. @section mix
  8507. Mix several video input streams into one video stream.
  8508. A description of the accepted options follows.
  8509. @table @option
  8510. @item nb_inputs
  8511. The number of inputs. If unspecified, it defaults to 2.
  8512. @item weights
  8513. Specify weight of each input video stream as sequence.
  8514. Each weight is separated by space.
  8515. @item duration
  8516. Specify how end of stream is determined.
  8517. @table @samp
  8518. @item longest
  8519. The duration of the longest input. (default)
  8520. @item shortest
  8521. The duration of the shortest input.
  8522. @item first
  8523. The duration of the first input.
  8524. @end table
  8525. @end table
  8526. @section mpdecimate
  8527. Drop frames that do not differ greatly from the previous frame in
  8528. order to reduce frame rate.
  8529. The main use of this filter is for very-low-bitrate encoding
  8530. (e.g. streaming over dialup modem), but it could in theory be used for
  8531. fixing movies that were inverse-telecined incorrectly.
  8532. A description of the accepted options follows.
  8533. @table @option
  8534. @item max
  8535. Set the maximum number of consecutive frames which can be dropped (if
  8536. positive), or the minimum interval between dropped frames (if
  8537. negative). If the value is 0, the frame is dropped disregarding the
  8538. number of previous sequentially dropped frames.
  8539. Default value is 0.
  8540. @item hi
  8541. @item lo
  8542. @item frac
  8543. Set the dropping threshold values.
  8544. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  8545. represent actual pixel value differences, so a threshold of 64
  8546. corresponds to 1 unit of difference for each pixel, or the same spread
  8547. out differently over the block.
  8548. A frame is a candidate for dropping if no 8x8 blocks differ by more
  8549. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  8550. meaning the whole image) differ by more than a threshold of @option{lo}.
  8551. Default value for @option{hi} is 64*12, default value for @option{lo} is
  8552. 64*5, and default value for @option{frac} is 0.33.
  8553. @end table
  8554. @section negate
  8555. Negate input video.
  8556. It accepts an integer in input; if non-zero it negates the
  8557. alpha component (if available). The default value in input is 0.
  8558. @section nlmeans
  8559. Denoise frames using Non-Local Means algorithm.
  8560. Each pixel is adjusted by looking for other pixels with similar contexts. This
  8561. context similarity is defined by comparing their surrounding patches of size
  8562. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  8563. around the pixel.
  8564. Note that the research area defines centers for patches, which means some
  8565. patches will be made of pixels outside that research area.
  8566. The filter accepts the following options.
  8567. @table @option
  8568. @item s
  8569. Set denoising strength.
  8570. @item p
  8571. Set patch size.
  8572. @item pc
  8573. Same as @option{p} but for chroma planes.
  8574. The default value is @var{0} and means automatic.
  8575. @item r
  8576. Set research size.
  8577. @item rc
  8578. Same as @option{r} but for chroma planes.
  8579. The default value is @var{0} and means automatic.
  8580. @end table
  8581. @section nnedi
  8582. Deinterlace video using neural network edge directed interpolation.
  8583. This filter accepts the following options:
  8584. @table @option
  8585. @item weights
  8586. Mandatory option, without binary file filter can not work.
  8587. Currently file can be found here:
  8588. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  8589. @item deint
  8590. Set which frames to deinterlace, by default it is @code{all}.
  8591. Can be @code{all} or @code{interlaced}.
  8592. @item field
  8593. Set mode of operation.
  8594. Can be one of the following:
  8595. @table @samp
  8596. @item af
  8597. Use frame flags, both fields.
  8598. @item a
  8599. Use frame flags, single field.
  8600. @item t
  8601. Use top field only.
  8602. @item b
  8603. Use bottom field only.
  8604. @item tf
  8605. Use both fields, top first.
  8606. @item bf
  8607. Use both fields, bottom first.
  8608. @end table
  8609. @item planes
  8610. Set which planes to process, by default filter process all frames.
  8611. @item nsize
  8612. Set size of local neighborhood around each pixel, used by the predictor neural
  8613. network.
  8614. Can be one of the following:
  8615. @table @samp
  8616. @item s8x6
  8617. @item s16x6
  8618. @item s32x6
  8619. @item s48x6
  8620. @item s8x4
  8621. @item s16x4
  8622. @item s32x4
  8623. @end table
  8624. @item nns
  8625. Set the number of neurons in predictor neural network.
  8626. Can be one of the following:
  8627. @table @samp
  8628. @item n16
  8629. @item n32
  8630. @item n64
  8631. @item n128
  8632. @item n256
  8633. @end table
  8634. @item qual
  8635. Controls the number of different neural network predictions that are blended
  8636. together to compute the final output value. Can be @code{fast}, default or
  8637. @code{slow}.
  8638. @item etype
  8639. Set which set of weights to use in the predictor.
  8640. Can be one of the following:
  8641. @table @samp
  8642. @item a
  8643. weights trained to minimize absolute error
  8644. @item s
  8645. weights trained to minimize squared error
  8646. @end table
  8647. @item pscrn
  8648. Controls whether or not the prescreener neural network is used to decide
  8649. which pixels should be processed by the predictor neural network and which
  8650. can be handled by simple cubic interpolation.
  8651. The prescreener is trained to know whether cubic interpolation will be
  8652. sufficient for a pixel or whether it should be predicted by the predictor nn.
  8653. The computational complexity of the prescreener nn is much less than that of
  8654. the predictor nn. Since most pixels can be handled by cubic interpolation,
  8655. using the prescreener generally results in much faster processing.
  8656. The prescreener is pretty accurate, so the difference between using it and not
  8657. using it is almost always unnoticeable.
  8658. Can be one of the following:
  8659. @table @samp
  8660. @item none
  8661. @item original
  8662. @item new
  8663. @end table
  8664. Default is @code{new}.
  8665. @item fapprox
  8666. Set various debugging flags.
  8667. @end table
  8668. @section noformat
  8669. Force libavfilter not to use any of the specified pixel formats for the
  8670. input to the next filter.
  8671. It accepts the following parameters:
  8672. @table @option
  8673. @item pix_fmts
  8674. A '|'-separated list of pixel format names, such as
  8675. pix_fmts=yuv420p|monow|rgb24".
  8676. @end table
  8677. @subsection Examples
  8678. @itemize
  8679. @item
  8680. Force libavfilter to use a format different from @var{yuv420p} for the
  8681. input to the vflip filter:
  8682. @example
  8683. noformat=pix_fmts=yuv420p,vflip
  8684. @end example
  8685. @item
  8686. Convert the input video to any of the formats not contained in the list:
  8687. @example
  8688. noformat=yuv420p|yuv444p|yuv410p
  8689. @end example
  8690. @end itemize
  8691. @section noise
  8692. Add noise on video input frame.
  8693. The filter accepts the following options:
  8694. @table @option
  8695. @item all_seed
  8696. @item c0_seed
  8697. @item c1_seed
  8698. @item c2_seed
  8699. @item c3_seed
  8700. Set noise seed for specific pixel component or all pixel components in case
  8701. of @var{all_seed}. Default value is @code{123457}.
  8702. @item all_strength, alls
  8703. @item c0_strength, c0s
  8704. @item c1_strength, c1s
  8705. @item c2_strength, c2s
  8706. @item c3_strength, c3s
  8707. Set noise strength for specific pixel component or all pixel components in case
  8708. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  8709. @item all_flags, allf
  8710. @item c0_flags, c0f
  8711. @item c1_flags, c1f
  8712. @item c2_flags, c2f
  8713. @item c3_flags, c3f
  8714. Set pixel component flags or set flags for all components if @var{all_flags}.
  8715. Available values for component flags are:
  8716. @table @samp
  8717. @item a
  8718. averaged temporal noise (smoother)
  8719. @item p
  8720. mix random noise with a (semi)regular pattern
  8721. @item t
  8722. temporal noise (noise pattern changes between frames)
  8723. @item u
  8724. uniform noise (gaussian otherwise)
  8725. @end table
  8726. @end table
  8727. @subsection Examples
  8728. Add temporal and uniform noise to input video:
  8729. @example
  8730. noise=alls=20:allf=t+u
  8731. @end example
  8732. @section normalize
  8733. Normalize RGB video (aka histogram stretching, contrast stretching).
  8734. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  8735. For each channel of each frame, the filter computes the input range and maps
  8736. it linearly to the user-specified output range. The output range defaults
  8737. to the full dynamic range from pure black to pure white.
  8738. Temporal smoothing can be used on the input range to reduce flickering (rapid
  8739. changes in brightness) caused when small dark or bright objects enter or leave
  8740. the scene. This is similar to the auto-exposure (automatic gain control) on a
  8741. video camera, and, like a video camera, it may cause a period of over- or
  8742. under-exposure of the video.
  8743. The R,G,B channels can be normalized independently, which may cause some
  8744. color shifting, or linked together as a single channel, which prevents
  8745. color shifting. Linked normalization preserves hue. Independent normalization
  8746. does not, so it can be used to remove some color casts. Independent and linked
  8747. normalization can be combined in any ratio.
  8748. The normalize filter accepts the following options:
  8749. @table @option
  8750. @item blackpt
  8751. @item whitept
  8752. Colors which define the output range. The minimum input value is mapped to
  8753. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  8754. The defaults are black and white respectively. Specifying white for
  8755. @var{blackpt} and black for @var{whitept} will give color-inverted,
  8756. normalized video. Shades of grey can be used to reduce the dynamic range
  8757. (contrast). Specifying saturated colors here can create some interesting
  8758. effects.
  8759. @item smoothing
  8760. The number of previous frames to use for temporal smoothing. The input range
  8761. of each channel is smoothed using a rolling average over the current frame
  8762. and the @var{smoothing} previous frames. The default is 0 (no temporal
  8763. smoothing).
  8764. @item independence
  8765. Controls the ratio of independent (color shifting) channel normalization to
  8766. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  8767. independent. Defaults to 1.0 (fully independent).
  8768. @item strength
  8769. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  8770. expensive no-op. Defaults to 1.0 (full strength).
  8771. @end table
  8772. @subsection Examples
  8773. Stretch video contrast to use the full dynamic range, with no temporal
  8774. smoothing; may flicker depending on the source content:
  8775. @example
  8776. normalize=blackpt=black:whitept=white:smoothing=0
  8777. @end example
  8778. As above, but with 50 frames of temporal smoothing; flicker should be
  8779. reduced, depending on the source content:
  8780. @example
  8781. normalize=blackpt=black:whitept=white:smoothing=50
  8782. @end example
  8783. As above, but with hue-preserving linked channel normalization:
  8784. @example
  8785. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  8786. @end example
  8787. As above, but with half strength:
  8788. @example
  8789. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  8790. @end example
  8791. Map the darkest input color to red, the brightest input color to cyan:
  8792. @example
  8793. normalize=blackpt=red:whitept=cyan
  8794. @end example
  8795. @section null
  8796. Pass the video source unchanged to the output.
  8797. @section ocr
  8798. Optical Character Recognition
  8799. This filter uses Tesseract for optical character recognition.
  8800. It accepts the following options:
  8801. @table @option
  8802. @item datapath
  8803. Set datapath to tesseract data. Default is to use whatever was
  8804. set at installation.
  8805. @item language
  8806. Set language, default is "eng".
  8807. @item whitelist
  8808. Set character whitelist.
  8809. @item blacklist
  8810. Set character blacklist.
  8811. @end table
  8812. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  8813. @section ocv
  8814. Apply a video transform using libopencv.
  8815. To enable this filter, install the libopencv library and headers and
  8816. configure FFmpeg with @code{--enable-libopencv}.
  8817. It accepts the following parameters:
  8818. @table @option
  8819. @item filter_name
  8820. The name of the libopencv filter to apply.
  8821. @item filter_params
  8822. The parameters to pass to the libopencv filter. If not specified, the default
  8823. values are assumed.
  8824. @end table
  8825. Refer to the official libopencv documentation for more precise
  8826. information:
  8827. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  8828. Several libopencv filters are supported; see the following subsections.
  8829. @anchor{dilate}
  8830. @subsection dilate
  8831. Dilate an image by using a specific structuring element.
  8832. It corresponds to the libopencv function @code{cvDilate}.
  8833. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  8834. @var{struct_el} represents a structuring element, and has the syntax:
  8835. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  8836. @var{cols} and @var{rows} represent the number of columns and rows of
  8837. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  8838. point, and @var{shape} the shape for the structuring element. @var{shape}
  8839. must be "rect", "cross", "ellipse", or "custom".
  8840. If the value for @var{shape} is "custom", it must be followed by a
  8841. string of the form "=@var{filename}". The file with name
  8842. @var{filename} is assumed to represent a binary image, with each
  8843. printable character corresponding to a bright pixel. When a custom
  8844. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  8845. or columns and rows of the read file are assumed instead.
  8846. The default value for @var{struct_el} is "3x3+0x0/rect".
  8847. @var{nb_iterations} specifies the number of times the transform is
  8848. applied to the image, and defaults to 1.
  8849. Some examples:
  8850. @example
  8851. # Use the default values
  8852. ocv=dilate
  8853. # Dilate using a structuring element with a 5x5 cross, iterating two times
  8854. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  8855. # Read the shape from the file diamond.shape, iterating two times.
  8856. # The file diamond.shape may contain a pattern of characters like this
  8857. # *
  8858. # ***
  8859. # *****
  8860. # ***
  8861. # *
  8862. # The specified columns and rows are ignored
  8863. # but the anchor point coordinates are not
  8864. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  8865. @end example
  8866. @subsection erode
  8867. Erode an image by using a specific structuring element.
  8868. It corresponds to the libopencv function @code{cvErode}.
  8869. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  8870. with the same syntax and semantics as the @ref{dilate} filter.
  8871. @subsection smooth
  8872. Smooth the input video.
  8873. The filter takes the following parameters:
  8874. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  8875. @var{type} is the type of smooth filter to apply, and must be one of
  8876. the following values: "blur", "blur_no_scale", "median", "gaussian",
  8877. or "bilateral". The default value is "gaussian".
  8878. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  8879. depend on the smooth type. @var{param1} and
  8880. @var{param2} accept integer positive values or 0. @var{param3} and
  8881. @var{param4} accept floating point values.
  8882. The default value for @var{param1} is 3. The default value for the
  8883. other parameters is 0.
  8884. These parameters correspond to the parameters assigned to the
  8885. libopencv function @code{cvSmooth}.
  8886. @section oscilloscope
  8887. 2D Video Oscilloscope.
  8888. Useful to measure spatial impulse, step responses, chroma delays, etc.
  8889. It accepts the following parameters:
  8890. @table @option
  8891. @item x
  8892. Set scope center x position.
  8893. @item y
  8894. Set scope center y position.
  8895. @item s
  8896. Set scope size, relative to frame diagonal.
  8897. @item t
  8898. Set scope tilt/rotation.
  8899. @item o
  8900. Set trace opacity.
  8901. @item tx
  8902. Set trace center x position.
  8903. @item ty
  8904. Set trace center y position.
  8905. @item tw
  8906. Set trace width, relative to width of frame.
  8907. @item th
  8908. Set trace height, relative to height of frame.
  8909. @item c
  8910. Set which components to trace. By default it traces first three components.
  8911. @item g
  8912. Draw trace grid. By default is enabled.
  8913. @item st
  8914. Draw some statistics. By default is enabled.
  8915. @item sc
  8916. Draw scope. By default is enabled.
  8917. @end table
  8918. @subsection Examples
  8919. @itemize
  8920. @item
  8921. Inspect full first row of video frame.
  8922. @example
  8923. oscilloscope=x=0.5:y=0:s=1
  8924. @end example
  8925. @item
  8926. Inspect full last row of video frame.
  8927. @example
  8928. oscilloscope=x=0.5:y=1:s=1
  8929. @end example
  8930. @item
  8931. Inspect full 5th line of video frame of height 1080.
  8932. @example
  8933. oscilloscope=x=0.5:y=5/1080:s=1
  8934. @end example
  8935. @item
  8936. Inspect full last column of video frame.
  8937. @example
  8938. oscilloscope=x=1:y=0.5:s=1:t=1
  8939. @end example
  8940. @end itemize
  8941. @anchor{overlay}
  8942. @section overlay
  8943. Overlay one video on top of another.
  8944. It takes two inputs and has one output. The first input is the "main"
  8945. video on which the second input is overlaid.
  8946. It accepts the following parameters:
  8947. A description of the accepted options follows.
  8948. @table @option
  8949. @item x
  8950. @item y
  8951. Set the expression for the x and y coordinates of the overlaid video
  8952. on the main video. Default value is "0" for both expressions. In case
  8953. the expression is invalid, it is set to a huge value (meaning that the
  8954. overlay will not be displayed within the output visible area).
  8955. @item eof_action
  8956. See @ref{framesync}.
  8957. @item eval
  8958. Set when the expressions for @option{x}, and @option{y} are evaluated.
  8959. It accepts the following values:
  8960. @table @samp
  8961. @item init
  8962. only evaluate expressions once during the filter initialization or
  8963. when a command is processed
  8964. @item frame
  8965. evaluate expressions for each incoming frame
  8966. @end table
  8967. Default value is @samp{frame}.
  8968. @item shortest
  8969. See @ref{framesync}.
  8970. @item format
  8971. Set the format for the output video.
  8972. It accepts the following values:
  8973. @table @samp
  8974. @item yuv420
  8975. force YUV420 output
  8976. @item yuv422
  8977. force YUV422 output
  8978. @item yuv444
  8979. force YUV444 output
  8980. @item rgb
  8981. force packed RGB output
  8982. @item gbrp
  8983. force planar RGB output
  8984. @item auto
  8985. automatically pick format
  8986. @end table
  8987. Default value is @samp{yuv420}.
  8988. @item repeatlast
  8989. See @ref{framesync}.
  8990. @item alpha
  8991. Set format of alpha of the overlaid video, it can be @var{straight} or
  8992. @var{premultiplied}. Default is @var{straight}.
  8993. @end table
  8994. The @option{x}, and @option{y} expressions can contain the following
  8995. parameters.
  8996. @table @option
  8997. @item main_w, W
  8998. @item main_h, H
  8999. The main input width and height.
  9000. @item overlay_w, w
  9001. @item overlay_h, h
  9002. The overlay input width and height.
  9003. @item x
  9004. @item y
  9005. The computed values for @var{x} and @var{y}. They are evaluated for
  9006. each new frame.
  9007. @item hsub
  9008. @item vsub
  9009. horizontal and vertical chroma subsample values of the output
  9010. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  9011. @var{vsub} is 1.
  9012. @item n
  9013. the number of input frame, starting from 0
  9014. @item pos
  9015. the position in the file of the input frame, NAN if unknown
  9016. @item t
  9017. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  9018. @end table
  9019. This filter also supports the @ref{framesync} options.
  9020. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  9021. when evaluation is done @emph{per frame}, and will evaluate to NAN
  9022. when @option{eval} is set to @samp{init}.
  9023. Be aware that frames are taken from each input video in timestamp
  9024. order, hence, if their initial timestamps differ, it is a good idea
  9025. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  9026. have them begin in the same zero timestamp, as the example for
  9027. the @var{movie} filter does.
  9028. You can chain together more overlays but you should test the
  9029. efficiency of such approach.
  9030. @subsection Commands
  9031. This filter supports the following commands:
  9032. @table @option
  9033. @item x
  9034. @item y
  9035. Modify the x and y of the overlay input.
  9036. The command accepts the same syntax of the corresponding option.
  9037. If the specified expression is not valid, it is kept at its current
  9038. value.
  9039. @end table
  9040. @subsection Examples
  9041. @itemize
  9042. @item
  9043. Draw the overlay at 10 pixels from the bottom right corner of the main
  9044. video:
  9045. @example
  9046. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  9047. @end example
  9048. Using named options the example above becomes:
  9049. @example
  9050. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  9051. @end example
  9052. @item
  9053. Insert a transparent PNG logo in the bottom left corner of the input,
  9054. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  9055. @example
  9056. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  9057. @end example
  9058. @item
  9059. Insert 2 different transparent PNG logos (second logo on bottom
  9060. right corner) using the @command{ffmpeg} tool:
  9061. @example
  9062. 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
  9063. @end example
  9064. @item
  9065. Add a transparent color layer on top of the main video; @code{WxH}
  9066. must specify the size of the main input to the overlay filter:
  9067. @example
  9068. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  9069. @end example
  9070. @item
  9071. Play an original video and a filtered version (here with the deshake
  9072. filter) side by side using the @command{ffplay} tool:
  9073. @example
  9074. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  9075. @end example
  9076. The above command is the same as:
  9077. @example
  9078. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  9079. @end example
  9080. @item
  9081. Make a sliding overlay appearing from the left to the right top part of the
  9082. screen starting since time 2:
  9083. @example
  9084. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  9085. @end example
  9086. @item
  9087. Compose output by putting two input videos side to side:
  9088. @example
  9089. ffmpeg -i left.avi -i right.avi -filter_complex "
  9090. nullsrc=size=200x100 [background];
  9091. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  9092. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  9093. [background][left] overlay=shortest=1 [background+left];
  9094. [background+left][right] overlay=shortest=1:x=100 [left+right]
  9095. "
  9096. @end example
  9097. @item
  9098. Mask 10-20 seconds of a video by applying the delogo filter to a section
  9099. @example
  9100. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  9101. -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]'
  9102. masked.avi
  9103. @end example
  9104. @item
  9105. Chain several overlays in cascade:
  9106. @example
  9107. nullsrc=s=200x200 [bg];
  9108. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  9109. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  9110. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  9111. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  9112. [in3] null, [mid2] overlay=100:100 [out0]
  9113. @end example
  9114. @end itemize
  9115. @section owdenoise
  9116. Apply Overcomplete Wavelet denoiser.
  9117. The filter accepts the following options:
  9118. @table @option
  9119. @item depth
  9120. Set depth.
  9121. Larger depth values will denoise lower frequency components more, but
  9122. slow down filtering.
  9123. Must be an int in the range 8-16, default is @code{8}.
  9124. @item luma_strength, ls
  9125. Set luma strength.
  9126. Must be a double value in the range 0-1000, default is @code{1.0}.
  9127. @item chroma_strength, cs
  9128. Set chroma strength.
  9129. Must be a double value in the range 0-1000, default is @code{1.0}.
  9130. @end table
  9131. @anchor{pad}
  9132. @section pad
  9133. Add paddings to the input image, and place the original input at the
  9134. provided @var{x}, @var{y} coordinates.
  9135. It accepts the following parameters:
  9136. @table @option
  9137. @item width, w
  9138. @item height, h
  9139. Specify an expression for the size of the output image with the
  9140. paddings added. If the value for @var{width} or @var{height} is 0, the
  9141. corresponding input size is used for the output.
  9142. The @var{width} expression can reference the value set by the
  9143. @var{height} expression, and vice versa.
  9144. The default value of @var{width} and @var{height} is 0.
  9145. @item x
  9146. @item y
  9147. Specify the offsets to place the input image at within the padded area,
  9148. with respect to the top/left border of the output image.
  9149. The @var{x} expression can reference the value set by the @var{y}
  9150. expression, and vice versa.
  9151. The default value of @var{x} and @var{y} is 0.
  9152. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  9153. so the input image is centered on the padded area.
  9154. @item color
  9155. Specify the color of the padded area. For the syntax of this option,
  9156. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  9157. manual,ffmpeg-utils}.
  9158. The default value of @var{color} is "black".
  9159. @item eval
  9160. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  9161. It accepts the following values:
  9162. @table @samp
  9163. @item init
  9164. Only evaluate expressions once during the filter initialization or when
  9165. a command is processed.
  9166. @item frame
  9167. Evaluate expressions for each incoming frame.
  9168. @end table
  9169. Default value is @samp{init}.
  9170. @item aspect
  9171. Pad to aspect instead to a resolution.
  9172. @end table
  9173. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  9174. options are expressions containing the following constants:
  9175. @table @option
  9176. @item in_w
  9177. @item in_h
  9178. The input video width and height.
  9179. @item iw
  9180. @item ih
  9181. These are the same as @var{in_w} and @var{in_h}.
  9182. @item out_w
  9183. @item out_h
  9184. The output width and height (the size of the padded area), as
  9185. specified by the @var{width} and @var{height} expressions.
  9186. @item ow
  9187. @item oh
  9188. These are the same as @var{out_w} and @var{out_h}.
  9189. @item x
  9190. @item y
  9191. The x and y offsets as specified by the @var{x} and @var{y}
  9192. expressions, or NAN if not yet specified.
  9193. @item a
  9194. same as @var{iw} / @var{ih}
  9195. @item sar
  9196. input sample aspect ratio
  9197. @item dar
  9198. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  9199. @item hsub
  9200. @item vsub
  9201. The horizontal and vertical chroma subsample values. For example for the
  9202. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9203. @end table
  9204. @subsection Examples
  9205. @itemize
  9206. @item
  9207. Add paddings with the color "violet" to the input video. The output video
  9208. size is 640x480, and the top-left corner of the input video is placed at
  9209. column 0, row 40
  9210. @example
  9211. pad=640:480:0:40:violet
  9212. @end example
  9213. The example above is equivalent to the following command:
  9214. @example
  9215. pad=width=640:height=480:x=0:y=40:color=violet
  9216. @end example
  9217. @item
  9218. Pad the input to get an output with dimensions increased by 3/2,
  9219. and put the input video at the center of the padded area:
  9220. @example
  9221. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  9222. @end example
  9223. @item
  9224. Pad the input to get a squared output with size equal to the maximum
  9225. value between the input width and height, and put the input video at
  9226. the center of the padded area:
  9227. @example
  9228. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  9229. @end example
  9230. @item
  9231. Pad the input to get a final w/h ratio of 16:9:
  9232. @example
  9233. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  9234. @end example
  9235. @item
  9236. In case of anamorphic video, in order to set the output display aspect
  9237. correctly, it is necessary to use @var{sar} in the expression,
  9238. according to the relation:
  9239. @example
  9240. (ih * X / ih) * sar = output_dar
  9241. X = output_dar / sar
  9242. @end example
  9243. Thus the previous example needs to be modified to:
  9244. @example
  9245. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  9246. @end example
  9247. @item
  9248. Double the output size and put the input video in the bottom-right
  9249. corner of the output padded area:
  9250. @example
  9251. pad="2*iw:2*ih:ow-iw:oh-ih"
  9252. @end example
  9253. @end itemize
  9254. @anchor{palettegen}
  9255. @section palettegen
  9256. Generate one palette for a whole video stream.
  9257. It accepts the following options:
  9258. @table @option
  9259. @item max_colors
  9260. Set the maximum number of colors to quantize in the palette.
  9261. Note: the palette will still contain 256 colors; the unused palette entries
  9262. will be black.
  9263. @item reserve_transparent
  9264. Create a palette of 255 colors maximum and reserve the last one for
  9265. transparency. Reserving the transparency color is useful for GIF optimization.
  9266. If not set, the maximum of colors in the palette will be 256. You probably want
  9267. to disable this option for a standalone image.
  9268. Set by default.
  9269. @item transparency_color
  9270. Set the color that will be used as background for transparency.
  9271. @item stats_mode
  9272. Set statistics mode.
  9273. It accepts the following values:
  9274. @table @samp
  9275. @item full
  9276. Compute full frame histograms.
  9277. @item diff
  9278. Compute histograms only for the part that differs from previous frame. This
  9279. might be relevant to give more importance to the moving part of your input if
  9280. the background is static.
  9281. @item single
  9282. Compute new histogram for each frame.
  9283. @end table
  9284. Default value is @var{full}.
  9285. @end table
  9286. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  9287. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  9288. color quantization of the palette. This information is also visible at
  9289. @var{info} logging level.
  9290. @subsection Examples
  9291. @itemize
  9292. @item
  9293. Generate a representative palette of a given video using @command{ffmpeg}:
  9294. @example
  9295. ffmpeg -i input.mkv -vf palettegen palette.png
  9296. @end example
  9297. @end itemize
  9298. @section paletteuse
  9299. Use a palette to downsample an input video stream.
  9300. The filter takes two inputs: one video stream and a palette. The palette must
  9301. be a 256 pixels image.
  9302. It accepts the following options:
  9303. @table @option
  9304. @item dither
  9305. Select dithering mode. Available algorithms are:
  9306. @table @samp
  9307. @item bayer
  9308. Ordered 8x8 bayer dithering (deterministic)
  9309. @item heckbert
  9310. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  9311. Note: this dithering is sometimes considered "wrong" and is included as a
  9312. reference.
  9313. @item floyd_steinberg
  9314. Floyd and Steingberg dithering (error diffusion)
  9315. @item sierra2
  9316. Frankie Sierra dithering v2 (error diffusion)
  9317. @item sierra2_4a
  9318. Frankie Sierra dithering v2 "Lite" (error diffusion)
  9319. @end table
  9320. Default is @var{sierra2_4a}.
  9321. @item bayer_scale
  9322. When @var{bayer} dithering is selected, this option defines the scale of the
  9323. pattern (how much the crosshatch pattern is visible). A low value means more
  9324. visible pattern for less banding, and higher value means less visible pattern
  9325. at the cost of more banding.
  9326. The option must be an integer value in the range [0,5]. Default is @var{2}.
  9327. @item diff_mode
  9328. If set, define the zone to process
  9329. @table @samp
  9330. @item rectangle
  9331. Only the changing rectangle will be reprocessed. This is similar to GIF
  9332. cropping/offsetting compression mechanism. This option can be useful for speed
  9333. if only a part of the image is changing, and has use cases such as limiting the
  9334. scope of the error diffusal @option{dither} to the rectangle that bounds the
  9335. moving scene (it leads to more deterministic output if the scene doesn't change
  9336. much, and as a result less moving noise and better GIF compression).
  9337. @end table
  9338. Default is @var{none}.
  9339. @item new
  9340. Take new palette for each output frame.
  9341. @item alpha_threshold
  9342. Sets the alpha threshold for transparency. Alpha values above this threshold
  9343. will be treated as completely opaque, and values below this threshold will be
  9344. treated as completely transparent.
  9345. The option must be an integer value in the range [0,255]. Default is @var{128}.
  9346. @end table
  9347. @subsection Examples
  9348. @itemize
  9349. @item
  9350. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  9351. using @command{ffmpeg}:
  9352. @example
  9353. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  9354. @end example
  9355. @end itemize
  9356. @section perspective
  9357. Correct perspective of video not recorded perpendicular to the screen.
  9358. A description of the accepted parameters follows.
  9359. @table @option
  9360. @item x0
  9361. @item y0
  9362. @item x1
  9363. @item y1
  9364. @item x2
  9365. @item y2
  9366. @item x3
  9367. @item y3
  9368. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  9369. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  9370. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  9371. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  9372. then the corners of the source will be sent to the specified coordinates.
  9373. The expressions can use the following variables:
  9374. @table @option
  9375. @item W
  9376. @item H
  9377. the width and height of video frame.
  9378. @item in
  9379. Input frame count.
  9380. @item on
  9381. Output frame count.
  9382. @end table
  9383. @item interpolation
  9384. Set interpolation for perspective correction.
  9385. It accepts the following values:
  9386. @table @samp
  9387. @item linear
  9388. @item cubic
  9389. @end table
  9390. Default value is @samp{linear}.
  9391. @item sense
  9392. Set interpretation of coordinate options.
  9393. It accepts the following values:
  9394. @table @samp
  9395. @item 0, source
  9396. Send point in the source specified by the given coordinates to
  9397. the corners of the destination.
  9398. @item 1, destination
  9399. Send the corners of the source to the point in the destination specified
  9400. by the given coordinates.
  9401. Default value is @samp{source}.
  9402. @end table
  9403. @item eval
  9404. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  9405. It accepts the following values:
  9406. @table @samp
  9407. @item init
  9408. only evaluate expressions once during the filter initialization or
  9409. when a command is processed
  9410. @item frame
  9411. evaluate expressions for each incoming frame
  9412. @end table
  9413. Default value is @samp{init}.
  9414. @end table
  9415. @section phase
  9416. Delay interlaced video by one field time so that the field order changes.
  9417. The intended use is to fix PAL movies that have been captured with the
  9418. opposite field order to the film-to-video transfer.
  9419. A description of the accepted parameters follows.
  9420. @table @option
  9421. @item mode
  9422. Set phase mode.
  9423. It accepts the following values:
  9424. @table @samp
  9425. @item t
  9426. Capture field order top-first, transfer bottom-first.
  9427. Filter will delay the bottom field.
  9428. @item b
  9429. Capture field order bottom-first, transfer top-first.
  9430. Filter will delay the top field.
  9431. @item p
  9432. Capture and transfer with the same field order. This mode only exists
  9433. for the documentation of the other options to refer to, but if you
  9434. actually select it, the filter will faithfully do nothing.
  9435. @item a
  9436. Capture field order determined automatically by field flags, transfer
  9437. opposite.
  9438. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  9439. basis using field flags. If no field information is available,
  9440. then this works just like @samp{u}.
  9441. @item u
  9442. Capture unknown or varying, transfer opposite.
  9443. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  9444. analyzing the images and selecting the alternative that produces best
  9445. match between the fields.
  9446. @item T
  9447. Capture top-first, transfer unknown or varying.
  9448. Filter selects among @samp{t} and @samp{p} using image analysis.
  9449. @item B
  9450. Capture bottom-first, transfer unknown or varying.
  9451. Filter selects among @samp{b} and @samp{p} using image analysis.
  9452. @item A
  9453. Capture determined by field flags, transfer unknown or varying.
  9454. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  9455. image analysis. If no field information is available, then this works just
  9456. like @samp{U}. This is the default mode.
  9457. @item U
  9458. Both capture and transfer unknown or varying.
  9459. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  9460. @end table
  9461. @end table
  9462. @section pixdesctest
  9463. Pixel format descriptor test filter, mainly useful for internal
  9464. testing. The output video should be equal to the input video.
  9465. For example:
  9466. @example
  9467. format=monow, pixdesctest
  9468. @end example
  9469. can be used to test the monowhite pixel format descriptor definition.
  9470. @section pixscope
  9471. Display sample values of color channels. Mainly useful for checking color
  9472. and levels. Minimum supported resolution is 640x480.
  9473. The filters accept the following options:
  9474. @table @option
  9475. @item x
  9476. Set scope X position, relative offset on X axis.
  9477. @item y
  9478. Set scope Y position, relative offset on Y axis.
  9479. @item w
  9480. Set scope width.
  9481. @item h
  9482. Set scope height.
  9483. @item o
  9484. Set window opacity. This window also holds statistics about pixel area.
  9485. @item wx
  9486. Set window X position, relative offset on X axis.
  9487. @item wy
  9488. Set window Y position, relative offset on Y axis.
  9489. @end table
  9490. @section pp
  9491. Enable the specified chain of postprocessing subfilters using libpostproc. This
  9492. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  9493. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  9494. Each subfilter and some options have a short and a long name that can be used
  9495. interchangeably, i.e. dr/dering are the same.
  9496. The filters accept the following options:
  9497. @table @option
  9498. @item subfilters
  9499. Set postprocessing subfilters string.
  9500. @end table
  9501. All subfilters share common options to determine their scope:
  9502. @table @option
  9503. @item a/autoq
  9504. Honor the quality commands for this subfilter.
  9505. @item c/chrom
  9506. Do chrominance filtering, too (default).
  9507. @item y/nochrom
  9508. Do luminance filtering only (no chrominance).
  9509. @item n/noluma
  9510. Do chrominance filtering only (no luminance).
  9511. @end table
  9512. These options can be appended after the subfilter name, separated by a '|'.
  9513. Available subfilters are:
  9514. @table @option
  9515. @item hb/hdeblock[|difference[|flatness]]
  9516. Horizontal deblocking filter
  9517. @table @option
  9518. @item difference
  9519. Difference factor where higher values mean more deblocking (default: @code{32}).
  9520. @item flatness
  9521. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9522. @end table
  9523. @item vb/vdeblock[|difference[|flatness]]
  9524. Vertical deblocking filter
  9525. @table @option
  9526. @item difference
  9527. Difference factor where higher values mean more deblocking (default: @code{32}).
  9528. @item flatness
  9529. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9530. @end table
  9531. @item ha/hadeblock[|difference[|flatness]]
  9532. Accurate horizontal deblocking filter
  9533. @table @option
  9534. @item difference
  9535. Difference factor where higher values mean more deblocking (default: @code{32}).
  9536. @item flatness
  9537. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9538. @end table
  9539. @item va/vadeblock[|difference[|flatness]]
  9540. Accurate vertical deblocking filter
  9541. @table @option
  9542. @item difference
  9543. Difference factor where higher values mean more deblocking (default: @code{32}).
  9544. @item flatness
  9545. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9546. @end table
  9547. @end table
  9548. The horizontal and vertical deblocking filters share the difference and
  9549. flatness values so you cannot set different horizontal and vertical
  9550. thresholds.
  9551. @table @option
  9552. @item h1/x1hdeblock
  9553. Experimental horizontal deblocking filter
  9554. @item v1/x1vdeblock
  9555. Experimental vertical deblocking filter
  9556. @item dr/dering
  9557. Deringing filter
  9558. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  9559. @table @option
  9560. @item threshold1
  9561. larger -> stronger filtering
  9562. @item threshold2
  9563. larger -> stronger filtering
  9564. @item threshold3
  9565. larger -> stronger filtering
  9566. @end table
  9567. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  9568. @table @option
  9569. @item f/fullyrange
  9570. Stretch luminance to @code{0-255}.
  9571. @end table
  9572. @item lb/linblenddeint
  9573. Linear blend deinterlacing filter that deinterlaces the given block by
  9574. filtering all lines with a @code{(1 2 1)} filter.
  9575. @item li/linipoldeint
  9576. Linear interpolating deinterlacing filter that deinterlaces the given block by
  9577. linearly interpolating every second line.
  9578. @item ci/cubicipoldeint
  9579. Cubic interpolating deinterlacing filter deinterlaces the given block by
  9580. cubically interpolating every second line.
  9581. @item md/mediandeint
  9582. Median deinterlacing filter that deinterlaces the given block by applying a
  9583. median filter to every second line.
  9584. @item fd/ffmpegdeint
  9585. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  9586. second line with a @code{(-1 4 2 4 -1)} filter.
  9587. @item l5/lowpass5
  9588. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  9589. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  9590. @item fq/forceQuant[|quantizer]
  9591. Overrides the quantizer table from the input with the constant quantizer you
  9592. specify.
  9593. @table @option
  9594. @item quantizer
  9595. Quantizer to use
  9596. @end table
  9597. @item de/default
  9598. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  9599. @item fa/fast
  9600. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  9601. @item ac
  9602. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  9603. @end table
  9604. @subsection Examples
  9605. @itemize
  9606. @item
  9607. Apply horizontal and vertical deblocking, deringing and automatic
  9608. brightness/contrast:
  9609. @example
  9610. pp=hb/vb/dr/al
  9611. @end example
  9612. @item
  9613. Apply default filters without brightness/contrast correction:
  9614. @example
  9615. pp=de/-al
  9616. @end example
  9617. @item
  9618. Apply default filters and temporal denoiser:
  9619. @example
  9620. pp=default/tmpnoise|1|2|3
  9621. @end example
  9622. @item
  9623. Apply deblocking on luminance only, and switch vertical deblocking on or off
  9624. automatically depending on available CPU time:
  9625. @example
  9626. pp=hb|y/vb|a
  9627. @end example
  9628. @end itemize
  9629. @section pp7
  9630. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  9631. similar to spp = 6 with 7 point DCT, where only the center sample is
  9632. used after IDCT.
  9633. The filter accepts the following options:
  9634. @table @option
  9635. @item qp
  9636. Force a constant quantization parameter. It accepts an integer in range
  9637. 0 to 63. If not set, the filter will use the QP from the video stream
  9638. (if available).
  9639. @item mode
  9640. Set thresholding mode. Available modes are:
  9641. @table @samp
  9642. @item hard
  9643. Set hard thresholding.
  9644. @item soft
  9645. Set soft thresholding (better de-ringing effect, but likely blurrier).
  9646. @item medium
  9647. Set medium thresholding (good results, default).
  9648. @end table
  9649. @end table
  9650. @section premultiply
  9651. Apply alpha premultiply effect to input video stream using first plane
  9652. of second stream as alpha.
  9653. Both streams must have same dimensions and same pixel format.
  9654. The filter accepts the following option:
  9655. @table @option
  9656. @item planes
  9657. Set which planes will be processed, unprocessed planes will be copied.
  9658. By default value 0xf, all planes will be processed.
  9659. @item inplace
  9660. Do not require 2nd input for processing, instead use alpha plane from input stream.
  9661. @end table
  9662. @section prewitt
  9663. Apply prewitt operator to input video stream.
  9664. The filter accepts the following option:
  9665. @table @option
  9666. @item planes
  9667. Set which planes will be processed, unprocessed planes will be copied.
  9668. By default value 0xf, all planes will be processed.
  9669. @item scale
  9670. Set value which will be multiplied with filtered result.
  9671. @item delta
  9672. Set value which will be added to filtered result.
  9673. @end table
  9674. @anchor{program_opencl}
  9675. @section program_opencl
  9676. Filter video using an OpenCL program.
  9677. @table @option
  9678. @item source
  9679. OpenCL program source file.
  9680. @item kernel
  9681. Kernel name in program.
  9682. @item inputs
  9683. Number of inputs to the filter. Defaults to 1.
  9684. @item size, s
  9685. Size of output frames. Defaults to the same as the first input.
  9686. @end table
  9687. The program source file must contain a kernel function with the given name,
  9688. which will be run once for each plane of the output. Each run on a plane
  9689. gets enqueued as a separate 2D global NDRange with one work-item for each
  9690. pixel to be generated. The global ID offset for each work-item is therefore
  9691. the coordinates of a pixel in the destination image.
  9692. The kernel function needs to take the following arguments:
  9693. @itemize
  9694. @item
  9695. Destination image, @var{__write_only image2d_t}.
  9696. This image will become the output; the kernel should write all of it.
  9697. @item
  9698. Frame index, @var{unsigned int}.
  9699. This is a counter starting from zero and increasing by one for each frame.
  9700. @item
  9701. Source images, @var{__read_only image2d_t}.
  9702. These are the most recent images on each input. The kernel may read from
  9703. them to generate the output, but they can't be written to.
  9704. @end itemize
  9705. Example programs:
  9706. @itemize
  9707. @item
  9708. Copy the input to the output (output must be the same size as the input).
  9709. @verbatim
  9710. __kernel void copy(__write_only image2d_t destination,
  9711. unsigned int index,
  9712. __read_only image2d_t source)
  9713. {
  9714. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  9715. int2 location = (int2)(get_global_id(0), get_global_id(1));
  9716. float4 value = read_imagef(source, sampler, location);
  9717. write_imagef(destination, location, value);
  9718. }
  9719. @end verbatim
  9720. @item
  9721. Apply a simple transformation, rotating the input by an amount increasing
  9722. with the index counter. Pixel values are linearly interpolated by the
  9723. sampler, and the output need not have the same dimensions as the input.
  9724. @verbatim
  9725. __kernel void rotate_image(__write_only image2d_t dst,
  9726. unsigned int index,
  9727. __read_only image2d_t src)
  9728. {
  9729. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  9730. CLK_FILTER_LINEAR);
  9731. float angle = (float)index / 100.0f;
  9732. float2 dst_dim = convert_float2(get_image_dim(dst));
  9733. float2 src_dim = convert_float2(get_image_dim(src));
  9734. float2 dst_cen = dst_dim / 2.0f;
  9735. float2 src_cen = src_dim / 2.0f;
  9736. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  9737. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  9738. float2 src_pos = {
  9739. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  9740. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  9741. };
  9742. src_pos = src_pos * src_dim / dst_dim;
  9743. float2 src_loc = src_pos + src_cen;
  9744. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  9745. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  9746. write_imagef(dst, dst_loc, 0.5f);
  9747. else
  9748. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  9749. }
  9750. @end verbatim
  9751. @item
  9752. Blend two inputs together, with the amount of each input used varying
  9753. with the index counter.
  9754. @verbatim
  9755. __kernel void blend_images(__write_only image2d_t dst,
  9756. unsigned int index,
  9757. __read_only image2d_t src1,
  9758. __read_only image2d_t src2)
  9759. {
  9760. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  9761. CLK_FILTER_LINEAR);
  9762. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  9763. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  9764. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  9765. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  9766. float4 val1 = read_imagef(src1, sampler, src1_loc);
  9767. float4 val2 = read_imagef(src2, sampler, src2_loc);
  9768. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  9769. }
  9770. @end verbatim
  9771. @end itemize
  9772. @section pseudocolor
  9773. Alter frame colors in video with pseudocolors.
  9774. This filter accept the following options:
  9775. @table @option
  9776. @item c0
  9777. set pixel first component expression
  9778. @item c1
  9779. set pixel second component expression
  9780. @item c2
  9781. set pixel third component expression
  9782. @item c3
  9783. set pixel fourth component expression, corresponds to the alpha component
  9784. @item i
  9785. set component to use as base for altering colors
  9786. @end table
  9787. Each of them specifies the expression to use for computing the lookup table for
  9788. the corresponding pixel component values.
  9789. The expressions can contain the following constants and functions:
  9790. @table @option
  9791. @item w
  9792. @item h
  9793. The input width and height.
  9794. @item val
  9795. The input value for the pixel component.
  9796. @item ymin, umin, vmin, amin
  9797. The minimum allowed component value.
  9798. @item ymax, umax, vmax, amax
  9799. The maximum allowed component value.
  9800. @end table
  9801. All expressions default to "val".
  9802. @subsection Examples
  9803. @itemize
  9804. @item
  9805. Change too high luma values to gradient:
  9806. @example
  9807. 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'"
  9808. @end example
  9809. @end itemize
  9810. @section psnr
  9811. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  9812. Ratio) between two input videos.
  9813. This filter takes in input two input videos, the first input is
  9814. considered the "main" source and is passed unchanged to the
  9815. output. The second input is used as a "reference" video for computing
  9816. the PSNR.
  9817. Both video inputs must have the same resolution and pixel format for
  9818. this filter to work correctly. Also it assumes that both inputs
  9819. have the same number of frames, which are compared one by one.
  9820. The obtained average PSNR is printed through the logging system.
  9821. The filter stores the accumulated MSE (mean squared error) of each
  9822. frame, and at the end of the processing it is averaged across all frames
  9823. equally, and the following formula is applied to obtain the PSNR:
  9824. @example
  9825. PSNR = 10*log10(MAX^2/MSE)
  9826. @end example
  9827. Where MAX is the average of the maximum values of each component of the
  9828. image.
  9829. The description of the accepted parameters follows.
  9830. @table @option
  9831. @item stats_file, f
  9832. If specified the filter will use the named file to save the PSNR of
  9833. each individual frame. When filename equals "-" the data is sent to
  9834. standard output.
  9835. @item stats_version
  9836. Specifies which version of the stats file format to use. Details of
  9837. each format are written below.
  9838. Default value is 1.
  9839. @item stats_add_max
  9840. Determines whether the max value is output to the stats log.
  9841. Default value is 0.
  9842. Requires stats_version >= 2. If this is set and stats_version < 2,
  9843. the filter will return an error.
  9844. @end table
  9845. This filter also supports the @ref{framesync} options.
  9846. The file printed if @var{stats_file} is selected, contains a sequence of
  9847. key/value pairs of the form @var{key}:@var{value} for each compared
  9848. couple of frames.
  9849. If a @var{stats_version} greater than 1 is specified, a header line precedes
  9850. the list of per-frame-pair stats, with key value pairs following the frame
  9851. format with the following parameters:
  9852. @table @option
  9853. @item psnr_log_version
  9854. The version of the log file format. Will match @var{stats_version}.
  9855. @item fields
  9856. A comma separated list of the per-frame-pair parameters included in
  9857. the log.
  9858. @end table
  9859. A description of each shown per-frame-pair parameter follows:
  9860. @table @option
  9861. @item n
  9862. sequential number of the input frame, starting from 1
  9863. @item mse_avg
  9864. Mean Square Error pixel-by-pixel average difference of the compared
  9865. frames, averaged over all the image components.
  9866. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  9867. Mean Square Error pixel-by-pixel average difference of the compared
  9868. frames for the component specified by the suffix.
  9869. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  9870. Peak Signal to Noise ratio of the compared frames for the component
  9871. specified by the suffix.
  9872. @item max_avg, max_y, max_u, max_v
  9873. Maximum allowed value for each channel, and average over all
  9874. channels.
  9875. @end table
  9876. For example:
  9877. @example
  9878. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  9879. [main][ref] psnr="stats_file=stats.log" [out]
  9880. @end example
  9881. On this example the input file being processed is compared with the
  9882. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  9883. is stored in @file{stats.log}.
  9884. @anchor{pullup}
  9885. @section pullup
  9886. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  9887. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  9888. content.
  9889. The pullup filter is designed to take advantage of future context in making
  9890. its decisions. This filter is stateless in the sense that it does not lock
  9891. onto a pattern to follow, but it instead looks forward to the following
  9892. fields in order to identify matches and rebuild progressive frames.
  9893. To produce content with an even framerate, insert the fps filter after
  9894. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  9895. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  9896. The filter accepts the following options:
  9897. @table @option
  9898. @item jl
  9899. @item jr
  9900. @item jt
  9901. @item jb
  9902. These options set the amount of "junk" to ignore at the left, right, top, and
  9903. bottom of the image, respectively. Left and right are in units of 8 pixels,
  9904. while top and bottom are in units of 2 lines.
  9905. The default is 8 pixels on each side.
  9906. @item sb
  9907. Set the strict breaks. Setting this option to 1 will reduce the chances of
  9908. filter generating an occasional mismatched frame, but it may also cause an
  9909. excessive number of frames to be dropped during high motion sequences.
  9910. Conversely, setting it to -1 will make filter match fields more easily.
  9911. This may help processing of video where there is slight blurring between
  9912. the fields, but may also cause there to be interlaced frames in the output.
  9913. Default value is @code{0}.
  9914. @item mp
  9915. Set the metric plane to use. It accepts the following values:
  9916. @table @samp
  9917. @item l
  9918. Use luma plane.
  9919. @item u
  9920. Use chroma blue plane.
  9921. @item v
  9922. Use chroma red plane.
  9923. @end table
  9924. This option may be set to use chroma plane instead of the default luma plane
  9925. for doing filter's computations. This may improve accuracy on very clean
  9926. source material, but more likely will decrease accuracy, especially if there
  9927. is chroma noise (rainbow effect) or any grayscale video.
  9928. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  9929. load and make pullup usable in realtime on slow machines.
  9930. @end table
  9931. For best results (without duplicated frames in the output file) it is
  9932. necessary to change the output frame rate. For example, to inverse
  9933. telecine NTSC input:
  9934. @example
  9935. ffmpeg -i input -vf pullup -r 24000/1001 ...
  9936. @end example
  9937. @section qp
  9938. Change video quantization parameters (QP).
  9939. The filter accepts the following option:
  9940. @table @option
  9941. @item qp
  9942. Set expression for quantization parameter.
  9943. @end table
  9944. The expression is evaluated through the eval API and can contain, among others,
  9945. the following constants:
  9946. @table @var
  9947. @item known
  9948. 1 if index is not 129, 0 otherwise.
  9949. @item qp
  9950. Sequential index starting from -129 to 128.
  9951. @end table
  9952. @subsection Examples
  9953. @itemize
  9954. @item
  9955. Some equation like:
  9956. @example
  9957. qp=2+2*sin(PI*qp)
  9958. @end example
  9959. @end itemize
  9960. @section random
  9961. Flush video frames from internal cache of frames into a random order.
  9962. No frame is discarded.
  9963. Inspired by @ref{frei0r} nervous filter.
  9964. @table @option
  9965. @item frames
  9966. Set size in number of frames of internal cache, in range from @code{2} to
  9967. @code{512}. Default is @code{30}.
  9968. @item seed
  9969. Set seed for random number generator, must be an integer included between
  9970. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  9971. less than @code{0}, the filter will try to use a good random seed on a
  9972. best effort basis.
  9973. @end table
  9974. @section readeia608
  9975. Read closed captioning (EIA-608) information from the top lines of a video frame.
  9976. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  9977. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  9978. with EIA-608 data (starting from 0). A description of each metadata value follows:
  9979. @table @option
  9980. @item lavfi.readeia608.X.cc
  9981. The two bytes stored as EIA-608 data (printed in hexadecimal).
  9982. @item lavfi.readeia608.X.line
  9983. The number of the line on which the EIA-608 data was identified and read.
  9984. @end table
  9985. This filter accepts the following options:
  9986. @table @option
  9987. @item scan_min
  9988. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  9989. @item scan_max
  9990. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  9991. @item mac
  9992. Set minimal acceptable amplitude change for sync codes detection.
  9993. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  9994. @item spw
  9995. Set the ratio of width reserved for sync code detection.
  9996. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  9997. @item mhd
  9998. Set the max peaks height difference for sync code detection.
  9999. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  10000. @item mpd
  10001. Set max peaks period difference for sync code detection.
  10002. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  10003. @item msd
  10004. Set the first two max start code bits differences.
  10005. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  10006. @item bhd
  10007. Set the minimum ratio of bits height compared to 3rd start code bit.
  10008. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  10009. @item th_w
  10010. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  10011. @item th_b
  10012. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  10013. @item chp
  10014. Enable checking the parity bit. In the event of a parity error, the filter will output
  10015. @code{0x00} for that character. Default is false.
  10016. @end table
  10017. @subsection Examples
  10018. @itemize
  10019. @item
  10020. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  10021. @example
  10022. 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
  10023. @end example
  10024. @end itemize
  10025. @section readvitc
  10026. Read vertical interval timecode (VITC) information from the top lines of a
  10027. video frame.
  10028. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  10029. timecode value, if a valid timecode has been detected. Further metadata key
  10030. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  10031. timecode data has been found or not.
  10032. This filter accepts the following options:
  10033. @table @option
  10034. @item scan_max
  10035. Set the maximum number of lines to scan for VITC data. If the value is set to
  10036. @code{-1} the full video frame is scanned. Default is @code{45}.
  10037. @item thr_b
  10038. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  10039. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  10040. @item thr_w
  10041. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  10042. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  10043. @end table
  10044. @subsection Examples
  10045. @itemize
  10046. @item
  10047. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  10048. draw @code{--:--:--:--} as a placeholder:
  10049. @example
  10050. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  10051. @end example
  10052. @end itemize
  10053. @section remap
  10054. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  10055. Destination pixel at position (X, Y) will be picked from source (x, y) position
  10056. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  10057. value for pixel will be used for destination pixel.
  10058. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  10059. will have Xmap/Ymap video stream dimensions.
  10060. Xmap and Ymap input video streams are 16bit depth, single channel.
  10061. @section removegrain
  10062. The removegrain filter is a spatial denoiser for progressive video.
  10063. @table @option
  10064. @item m0
  10065. Set mode for the first plane.
  10066. @item m1
  10067. Set mode for the second plane.
  10068. @item m2
  10069. Set mode for the third plane.
  10070. @item m3
  10071. Set mode for the fourth plane.
  10072. @end table
  10073. Range of mode is from 0 to 24. Description of each mode follows:
  10074. @table @var
  10075. @item 0
  10076. Leave input plane unchanged. Default.
  10077. @item 1
  10078. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  10079. @item 2
  10080. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  10081. @item 3
  10082. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  10083. @item 4
  10084. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  10085. This is equivalent to a median filter.
  10086. @item 5
  10087. Line-sensitive clipping giving the minimal change.
  10088. @item 6
  10089. Line-sensitive clipping, intermediate.
  10090. @item 7
  10091. Line-sensitive clipping, intermediate.
  10092. @item 8
  10093. Line-sensitive clipping, intermediate.
  10094. @item 9
  10095. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  10096. @item 10
  10097. Replaces the target pixel with the closest neighbour.
  10098. @item 11
  10099. [1 2 1] horizontal and vertical kernel blur.
  10100. @item 12
  10101. Same as mode 11.
  10102. @item 13
  10103. Bob mode, interpolates top field from the line where the neighbours
  10104. pixels are the closest.
  10105. @item 14
  10106. Bob mode, interpolates bottom field from the line where the neighbours
  10107. pixels are the closest.
  10108. @item 15
  10109. Bob mode, interpolates top field. Same as 13 but with a more complicated
  10110. interpolation formula.
  10111. @item 16
  10112. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  10113. interpolation formula.
  10114. @item 17
  10115. Clips the pixel with the minimum and maximum of respectively the maximum and
  10116. minimum of each pair of opposite neighbour pixels.
  10117. @item 18
  10118. Line-sensitive clipping using opposite neighbours whose greatest distance from
  10119. the current pixel is minimal.
  10120. @item 19
  10121. Replaces the pixel with the average of its 8 neighbours.
  10122. @item 20
  10123. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  10124. @item 21
  10125. Clips pixels using the averages of opposite neighbour.
  10126. @item 22
  10127. Same as mode 21 but simpler and faster.
  10128. @item 23
  10129. Small edge and halo removal, but reputed useless.
  10130. @item 24
  10131. Similar as 23.
  10132. @end table
  10133. @section removelogo
  10134. Suppress a TV station logo, using an image file to determine which
  10135. pixels comprise the logo. It works by filling in the pixels that
  10136. comprise the logo with neighboring pixels.
  10137. The filter accepts the following options:
  10138. @table @option
  10139. @item filename, f
  10140. Set the filter bitmap file, which can be any image format supported by
  10141. libavformat. The width and height of the image file must match those of the
  10142. video stream being processed.
  10143. @end table
  10144. Pixels in the provided bitmap image with a value of zero are not
  10145. considered part of the logo, non-zero pixels are considered part of
  10146. the logo. If you use white (255) for the logo and black (0) for the
  10147. rest, you will be safe. For making the filter bitmap, it is
  10148. recommended to take a screen capture of a black frame with the logo
  10149. visible, and then using a threshold filter followed by the erode
  10150. filter once or twice.
  10151. If needed, little splotches can be fixed manually. Remember that if
  10152. logo pixels are not covered, the filter quality will be much
  10153. reduced. Marking too many pixels as part of the logo does not hurt as
  10154. much, but it will increase the amount of blurring needed to cover over
  10155. the image and will destroy more information than necessary, and extra
  10156. pixels will slow things down on a large logo.
  10157. @section repeatfields
  10158. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  10159. fields based on its value.
  10160. @section reverse
  10161. Reverse a video clip.
  10162. Warning: This filter requires memory to buffer the entire clip, so trimming
  10163. is suggested.
  10164. @subsection Examples
  10165. @itemize
  10166. @item
  10167. Take the first 5 seconds of a clip, and reverse it.
  10168. @example
  10169. trim=end=5,reverse
  10170. @end example
  10171. @end itemize
  10172. @section roberts
  10173. Apply roberts cross operator to input video stream.
  10174. The filter accepts the following option:
  10175. @table @option
  10176. @item planes
  10177. Set which planes will be processed, unprocessed planes will be copied.
  10178. By default value 0xf, all planes will be processed.
  10179. @item scale
  10180. Set value which will be multiplied with filtered result.
  10181. @item delta
  10182. Set value which will be added to filtered result.
  10183. @end table
  10184. @section rotate
  10185. Rotate video by an arbitrary angle expressed in radians.
  10186. The filter accepts the following options:
  10187. A description of the optional parameters follows.
  10188. @table @option
  10189. @item angle, a
  10190. Set an expression for the angle by which to rotate the input video
  10191. clockwise, expressed as a number of radians. A negative value will
  10192. result in a counter-clockwise rotation. By default it is set to "0".
  10193. This expression is evaluated for each frame.
  10194. @item out_w, ow
  10195. Set the output width expression, default value is "iw".
  10196. This expression is evaluated just once during configuration.
  10197. @item out_h, oh
  10198. Set the output height expression, default value is "ih".
  10199. This expression is evaluated just once during configuration.
  10200. @item bilinear
  10201. Enable bilinear interpolation if set to 1, a value of 0 disables
  10202. it. Default value is 1.
  10203. @item fillcolor, c
  10204. Set the color used to fill the output area not covered by the rotated
  10205. image. For the general syntax of this option, check the
  10206. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10207. If the special value "none" is selected then no
  10208. background is printed (useful for example if the background is never shown).
  10209. Default value is "black".
  10210. @end table
  10211. The expressions for the angle and the output size can contain the
  10212. following constants and functions:
  10213. @table @option
  10214. @item n
  10215. sequential number of the input frame, starting from 0. It is always NAN
  10216. before the first frame is filtered.
  10217. @item t
  10218. time in seconds of the input frame, it is set to 0 when the filter is
  10219. configured. It is always NAN before the first frame is filtered.
  10220. @item hsub
  10221. @item vsub
  10222. horizontal and vertical chroma subsample values. For example for the
  10223. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10224. @item in_w, iw
  10225. @item in_h, ih
  10226. the input video width and height
  10227. @item out_w, ow
  10228. @item out_h, oh
  10229. the output width and height, that is the size of the padded area as
  10230. specified by the @var{width} and @var{height} expressions
  10231. @item rotw(a)
  10232. @item roth(a)
  10233. the minimal width/height required for completely containing the input
  10234. video rotated by @var{a} radians.
  10235. These are only available when computing the @option{out_w} and
  10236. @option{out_h} expressions.
  10237. @end table
  10238. @subsection Examples
  10239. @itemize
  10240. @item
  10241. Rotate the input by PI/6 radians clockwise:
  10242. @example
  10243. rotate=PI/6
  10244. @end example
  10245. @item
  10246. Rotate the input by PI/6 radians counter-clockwise:
  10247. @example
  10248. rotate=-PI/6
  10249. @end example
  10250. @item
  10251. Rotate the input by 45 degrees clockwise:
  10252. @example
  10253. rotate=45*PI/180
  10254. @end example
  10255. @item
  10256. Apply a constant rotation with period T, starting from an angle of PI/3:
  10257. @example
  10258. rotate=PI/3+2*PI*t/T
  10259. @end example
  10260. @item
  10261. Make the input video rotation oscillating with a period of T
  10262. seconds and an amplitude of A radians:
  10263. @example
  10264. rotate=A*sin(2*PI/T*t)
  10265. @end example
  10266. @item
  10267. Rotate the video, output size is chosen so that the whole rotating
  10268. input video is always completely contained in the output:
  10269. @example
  10270. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  10271. @end example
  10272. @item
  10273. Rotate the video, reduce the output size so that no background is ever
  10274. shown:
  10275. @example
  10276. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  10277. @end example
  10278. @end itemize
  10279. @subsection Commands
  10280. The filter supports the following commands:
  10281. @table @option
  10282. @item a, angle
  10283. Set the angle expression.
  10284. The command accepts the same syntax of the corresponding option.
  10285. If the specified expression is not valid, it is kept at its current
  10286. value.
  10287. @end table
  10288. @section sab
  10289. Apply Shape Adaptive Blur.
  10290. The filter accepts the following options:
  10291. @table @option
  10292. @item luma_radius, lr
  10293. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  10294. value is 1.0. A greater value will result in a more blurred image, and
  10295. in slower processing.
  10296. @item luma_pre_filter_radius, lpfr
  10297. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  10298. value is 1.0.
  10299. @item luma_strength, ls
  10300. Set luma maximum difference between pixels to still be considered, must
  10301. be a value in the 0.1-100.0 range, default value is 1.0.
  10302. @item chroma_radius, cr
  10303. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  10304. greater value will result in a more blurred image, and in slower
  10305. processing.
  10306. @item chroma_pre_filter_radius, cpfr
  10307. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  10308. @item chroma_strength, cs
  10309. Set chroma maximum difference between pixels to still be considered,
  10310. must be a value in the -0.9-100.0 range.
  10311. @end table
  10312. Each chroma option value, if not explicitly specified, is set to the
  10313. corresponding luma option value.
  10314. @anchor{scale}
  10315. @section scale
  10316. Scale (resize) the input video, using the libswscale library.
  10317. The scale filter forces the output display aspect ratio to be the same
  10318. of the input, by changing the output sample aspect ratio.
  10319. If the input image format is different from the format requested by
  10320. the next filter, the scale filter will convert the input to the
  10321. requested format.
  10322. @subsection Options
  10323. The filter accepts the following options, or any of the options
  10324. supported by the libswscale scaler.
  10325. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  10326. the complete list of scaler options.
  10327. @table @option
  10328. @item width, w
  10329. @item height, h
  10330. Set the output video dimension expression. Default value is the input
  10331. dimension.
  10332. If the @var{width} or @var{w} value is 0, the input width is used for
  10333. the output. If the @var{height} or @var{h} value is 0, the input height
  10334. is used for the output.
  10335. If one and only one of the values is -n with n >= 1, the scale filter
  10336. will use a value that maintains the aspect ratio of the input image,
  10337. calculated from the other specified dimension. After that it will,
  10338. however, make sure that the calculated dimension is divisible by n and
  10339. adjust the value if necessary.
  10340. If both values are -n with n >= 1, the behavior will be identical to
  10341. both values being set to 0 as previously detailed.
  10342. See below for the list of accepted constants for use in the dimension
  10343. expression.
  10344. @item eval
  10345. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  10346. @table @samp
  10347. @item init
  10348. Only evaluate expressions once during the filter initialization or when a command is processed.
  10349. @item frame
  10350. Evaluate expressions for each incoming frame.
  10351. @end table
  10352. Default value is @samp{init}.
  10353. @item interl
  10354. Set the interlacing mode. It accepts the following values:
  10355. @table @samp
  10356. @item 1
  10357. Force interlaced aware scaling.
  10358. @item 0
  10359. Do not apply interlaced scaling.
  10360. @item -1
  10361. Select interlaced aware scaling depending on whether the source frames
  10362. are flagged as interlaced or not.
  10363. @end table
  10364. Default value is @samp{0}.
  10365. @item flags
  10366. Set libswscale scaling flags. See
  10367. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  10368. complete list of values. If not explicitly specified the filter applies
  10369. the default flags.
  10370. @item param0, param1
  10371. Set libswscale input parameters for scaling algorithms that need them. See
  10372. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  10373. complete documentation. If not explicitly specified the filter applies
  10374. empty parameters.
  10375. @item size, s
  10376. Set the video size. For the syntax of this option, check the
  10377. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10378. @item in_color_matrix
  10379. @item out_color_matrix
  10380. Set in/output YCbCr color space type.
  10381. This allows the autodetected value to be overridden as well as allows forcing
  10382. a specific value used for the output and encoder.
  10383. If not specified, the color space type depends on the pixel format.
  10384. Possible values:
  10385. @table @samp
  10386. @item auto
  10387. Choose automatically.
  10388. @item bt709
  10389. Format conforming to International Telecommunication Union (ITU)
  10390. Recommendation BT.709.
  10391. @item fcc
  10392. Set color space conforming to the United States Federal Communications
  10393. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  10394. @item bt601
  10395. Set color space conforming to:
  10396. @itemize
  10397. @item
  10398. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  10399. @item
  10400. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  10401. @item
  10402. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  10403. @end itemize
  10404. @item smpte240m
  10405. Set color space conforming to SMPTE ST 240:1999.
  10406. @end table
  10407. @item in_range
  10408. @item out_range
  10409. Set in/output YCbCr sample range.
  10410. This allows the autodetected value to be overridden as well as allows forcing
  10411. a specific value used for the output and encoder. If not specified, the
  10412. range depends on the pixel format. Possible values:
  10413. @table @samp
  10414. @item auto/unknown
  10415. Choose automatically.
  10416. @item jpeg/full/pc
  10417. Set full range (0-255 in case of 8-bit luma).
  10418. @item mpeg/limited/tv
  10419. Set "MPEG" range (16-235 in case of 8-bit luma).
  10420. @end table
  10421. @item force_original_aspect_ratio
  10422. Enable decreasing or increasing output video width or height if necessary to
  10423. keep the original aspect ratio. Possible values:
  10424. @table @samp
  10425. @item disable
  10426. Scale the video as specified and disable this feature.
  10427. @item decrease
  10428. The output video dimensions will automatically be decreased if needed.
  10429. @item increase
  10430. The output video dimensions will automatically be increased if needed.
  10431. @end table
  10432. One useful instance of this option is that when you know a specific device's
  10433. maximum allowed resolution, you can use this to limit the output video to
  10434. that, while retaining the aspect ratio. For example, device A allows
  10435. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  10436. decrease) and specifying 1280x720 to the command line makes the output
  10437. 1280x533.
  10438. Please note that this is a different thing than specifying -1 for @option{w}
  10439. or @option{h}, you still need to specify the output resolution for this option
  10440. to work.
  10441. @end table
  10442. The values of the @option{w} and @option{h} options are expressions
  10443. containing the following constants:
  10444. @table @var
  10445. @item in_w
  10446. @item in_h
  10447. The input width and height
  10448. @item iw
  10449. @item ih
  10450. These are the same as @var{in_w} and @var{in_h}.
  10451. @item out_w
  10452. @item out_h
  10453. The output (scaled) width and height
  10454. @item ow
  10455. @item oh
  10456. These are the same as @var{out_w} and @var{out_h}
  10457. @item a
  10458. The same as @var{iw} / @var{ih}
  10459. @item sar
  10460. input sample aspect ratio
  10461. @item dar
  10462. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  10463. @item hsub
  10464. @item vsub
  10465. horizontal and vertical input chroma subsample values. For example for the
  10466. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10467. @item ohsub
  10468. @item ovsub
  10469. horizontal and vertical output chroma subsample values. For example for the
  10470. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10471. @end table
  10472. @subsection Examples
  10473. @itemize
  10474. @item
  10475. Scale the input video to a size of 200x100
  10476. @example
  10477. scale=w=200:h=100
  10478. @end example
  10479. This is equivalent to:
  10480. @example
  10481. scale=200:100
  10482. @end example
  10483. or:
  10484. @example
  10485. scale=200x100
  10486. @end example
  10487. @item
  10488. Specify a size abbreviation for the output size:
  10489. @example
  10490. scale=qcif
  10491. @end example
  10492. which can also be written as:
  10493. @example
  10494. scale=size=qcif
  10495. @end example
  10496. @item
  10497. Scale the input to 2x:
  10498. @example
  10499. scale=w=2*iw:h=2*ih
  10500. @end example
  10501. @item
  10502. The above is the same as:
  10503. @example
  10504. scale=2*in_w:2*in_h
  10505. @end example
  10506. @item
  10507. Scale the input to 2x with forced interlaced scaling:
  10508. @example
  10509. scale=2*iw:2*ih:interl=1
  10510. @end example
  10511. @item
  10512. Scale the input to half size:
  10513. @example
  10514. scale=w=iw/2:h=ih/2
  10515. @end example
  10516. @item
  10517. Increase the width, and set the height to the same size:
  10518. @example
  10519. scale=3/2*iw:ow
  10520. @end example
  10521. @item
  10522. Seek Greek harmony:
  10523. @example
  10524. scale=iw:1/PHI*iw
  10525. scale=ih*PHI:ih
  10526. @end example
  10527. @item
  10528. Increase the height, and set the width to 3/2 of the height:
  10529. @example
  10530. scale=w=3/2*oh:h=3/5*ih
  10531. @end example
  10532. @item
  10533. Increase the size, making the size a multiple of the chroma
  10534. subsample values:
  10535. @example
  10536. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  10537. @end example
  10538. @item
  10539. Increase the width to a maximum of 500 pixels,
  10540. keeping the same aspect ratio as the input:
  10541. @example
  10542. scale=w='min(500\, iw*3/2):h=-1'
  10543. @end example
  10544. @item
  10545. Make pixels square by combining scale and setsar:
  10546. @example
  10547. scale='trunc(ih*dar):ih',setsar=1/1
  10548. @end example
  10549. @item
  10550. Make pixels square by combining scale and setsar,
  10551. making sure the resulting resolution is even (required by some codecs):
  10552. @example
  10553. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  10554. @end example
  10555. @end itemize
  10556. @subsection Commands
  10557. This filter supports the following commands:
  10558. @table @option
  10559. @item width, w
  10560. @item height, h
  10561. Set the output video dimension expression.
  10562. The command accepts the same syntax of the corresponding option.
  10563. If the specified expression is not valid, it is kept at its current
  10564. value.
  10565. @end table
  10566. @section scale_npp
  10567. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  10568. format conversion on CUDA video frames. Setting the output width and height
  10569. works in the same way as for the @var{scale} filter.
  10570. The following additional options are accepted:
  10571. @table @option
  10572. @item format
  10573. The pixel format of the output CUDA frames. If set to the string "same" (the
  10574. default), the input format will be kept. Note that automatic format negotiation
  10575. and conversion is not yet supported for hardware frames
  10576. @item interp_algo
  10577. The interpolation algorithm used for resizing. One of the following:
  10578. @table @option
  10579. @item nn
  10580. Nearest neighbour.
  10581. @item linear
  10582. @item cubic
  10583. @item cubic2p_bspline
  10584. 2-parameter cubic (B=1, C=0)
  10585. @item cubic2p_catmullrom
  10586. 2-parameter cubic (B=0, C=1/2)
  10587. @item cubic2p_b05c03
  10588. 2-parameter cubic (B=1/2, C=3/10)
  10589. @item super
  10590. Supersampling
  10591. @item lanczos
  10592. @end table
  10593. @end table
  10594. @section scale2ref
  10595. Scale (resize) the input video, based on a reference video.
  10596. See the scale filter for available options, scale2ref supports the same but
  10597. uses the reference video instead of the main input as basis. scale2ref also
  10598. supports the following additional constants for the @option{w} and
  10599. @option{h} options:
  10600. @table @var
  10601. @item main_w
  10602. @item main_h
  10603. The main input video's width and height
  10604. @item main_a
  10605. The same as @var{main_w} / @var{main_h}
  10606. @item main_sar
  10607. The main input video's sample aspect ratio
  10608. @item main_dar, mdar
  10609. The main input video's display aspect ratio. Calculated from
  10610. @code{(main_w / main_h) * main_sar}.
  10611. @item main_hsub
  10612. @item main_vsub
  10613. The main input video's horizontal and vertical chroma subsample values.
  10614. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  10615. is 1.
  10616. @end table
  10617. @subsection Examples
  10618. @itemize
  10619. @item
  10620. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  10621. @example
  10622. 'scale2ref[b][a];[a][b]overlay'
  10623. @end example
  10624. @end itemize
  10625. @anchor{selectivecolor}
  10626. @section selectivecolor
  10627. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  10628. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  10629. by the "purity" of the color (that is, how saturated it already is).
  10630. This filter is similar to the Adobe Photoshop Selective Color tool.
  10631. The filter accepts the following options:
  10632. @table @option
  10633. @item correction_method
  10634. Select color correction method.
  10635. Available values are:
  10636. @table @samp
  10637. @item absolute
  10638. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  10639. component value).
  10640. @item relative
  10641. Specified adjustments are relative to the original component value.
  10642. @end table
  10643. Default is @code{absolute}.
  10644. @item reds
  10645. Adjustments for red pixels (pixels where the red component is the maximum)
  10646. @item yellows
  10647. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  10648. @item greens
  10649. Adjustments for green pixels (pixels where the green component is the maximum)
  10650. @item cyans
  10651. Adjustments for cyan pixels (pixels where the red component is the minimum)
  10652. @item blues
  10653. Adjustments for blue pixels (pixels where the blue component is the maximum)
  10654. @item magentas
  10655. Adjustments for magenta pixels (pixels where the green component is the minimum)
  10656. @item whites
  10657. Adjustments for white pixels (pixels where all components are greater than 128)
  10658. @item neutrals
  10659. Adjustments for all pixels except pure black and pure white
  10660. @item blacks
  10661. Adjustments for black pixels (pixels where all components are lesser than 128)
  10662. @item psfile
  10663. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  10664. @end table
  10665. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  10666. 4 space separated floating point adjustment values in the [-1,1] range,
  10667. respectively to adjust the amount of cyan, magenta, yellow and black for the
  10668. pixels of its range.
  10669. @subsection Examples
  10670. @itemize
  10671. @item
  10672. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  10673. increase magenta by 27% in blue areas:
  10674. @example
  10675. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  10676. @end example
  10677. @item
  10678. Use a Photoshop selective color preset:
  10679. @example
  10680. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  10681. @end example
  10682. @end itemize
  10683. @anchor{separatefields}
  10684. @section separatefields
  10685. The @code{separatefields} takes a frame-based video input and splits
  10686. each frame into its components fields, producing a new half height clip
  10687. with twice the frame rate and twice the frame count.
  10688. This filter use field-dominance information in frame to decide which
  10689. of each pair of fields to place first in the output.
  10690. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  10691. @section setdar, setsar
  10692. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  10693. output video.
  10694. This is done by changing the specified Sample (aka Pixel) Aspect
  10695. Ratio, according to the following equation:
  10696. @example
  10697. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  10698. @end example
  10699. Keep in mind that the @code{setdar} filter does not modify the pixel
  10700. dimensions of the video frame. Also, the display aspect ratio set by
  10701. this filter may be changed by later filters in the filterchain,
  10702. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  10703. applied.
  10704. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  10705. the filter output video.
  10706. Note that as a consequence of the application of this filter, the
  10707. output display aspect ratio will change according to the equation
  10708. above.
  10709. Keep in mind that the sample aspect ratio set by the @code{setsar}
  10710. filter may be changed by later filters in the filterchain, e.g. if
  10711. another "setsar" or a "setdar" filter is applied.
  10712. It accepts the following parameters:
  10713. @table @option
  10714. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  10715. Set the aspect ratio used by the filter.
  10716. The parameter can be a floating point number string, an expression, or
  10717. a string of the form @var{num}:@var{den}, where @var{num} and
  10718. @var{den} are the numerator and denominator of the aspect ratio. If
  10719. the parameter is not specified, it is assumed the value "0".
  10720. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  10721. should be escaped.
  10722. @item max
  10723. Set the maximum integer value to use for expressing numerator and
  10724. denominator when reducing the expressed aspect ratio to a rational.
  10725. Default value is @code{100}.
  10726. @end table
  10727. The parameter @var{sar} is an expression containing
  10728. the following constants:
  10729. @table @option
  10730. @item E, PI, PHI
  10731. These are approximated values for the mathematical constants e
  10732. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  10733. @item w, h
  10734. The input width and height.
  10735. @item a
  10736. These are the same as @var{w} / @var{h}.
  10737. @item sar
  10738. The input sample aspect ratio.
  10739. @item dar
  10740. The input display aspect ratio. It is the same as
  10741. (@var{w} / @var{h}) * @var{sar}.
  10742. @item hsub, vsub
  10743. Horizontal and vertical chroma subsample values. For example, for the
  10744. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10745. @end table
  10746. @subsection Examples
  10747. @itemize
  10748. @item
  10749. To change the display aspect ratio to 16:9, specify one of the following:
  10750. @example
  10751. setdar=dar=1.77777
  10752. setdar=dar=16/9
  10753. @end example
  10754. @item
  10755. To change the sample aspect ratio to 10:11, specify:
  10756. @example
  10757. setsar=sar=10/11
  10758. @end example
  10759. @item
  10760. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  10761. 1000 in the aspect ratio reduction, use the command:
  10762. @example
  10763. setdar=ratio=16/9:max=1000
  10764. @end example
  10765. @end itemize
  10766. @anchor{setfield}
  10767. @section setfield
  10768. Force field for the output video frame.
  10769. The @code{setfield} filter marks the interlace type field for the
  10770. output frames. It does not change the input frame, but only sets the
  10771. corresponding property, which affects how the frame is treated by
  10772. following filters (e.g. @code{fieldorder} or @code{yadif}).
  10773. The filter accepts the following options:
  10774. @table @option
  10775. @item mode
  10776. Available values are:
  10777. @table @samp
  10778. @item auto
  10779. Keep the same field property.
  10780. @item bff
  10781. Mark the frame as bottom-field-first.
  10782. @item tff
  10783. Mark the frame as top-field-first.
  10784. @item prog
  10785. Mark the frame as progressive.
  10786. @end table
  10787. @end table
  10788. @section showinfo
  10789. Show a line containing various information for each input video frame.
  10790. The input video is not modified.
  10791. The shown line contains a sequence of key/value pairs of the form
  10792. @var{key}:@var{value}.
  10793. The following values are shown in the output:
  10794. @table @option
  10795. @item n
  10796. The (sequential) number of the input frame, starting from 0.
  10797. @item pts
  10798. The Presentation TimeStamp of the input frame, expressed as a number of
  10799. time base units. The time base unit depends on the filter input pad.
  10800. @item pts_time
  10801. The Presentation TimeStamp of the input frame, expressed as a number of
  10802. seconds.
  10803. @item pos
  10804. The position of the frame in the input stream, or -1 if this information is
  10805. unavailable and/or meaningless (for example in case of synthetic video).
  10806. @item fmt
  10807. The pixel format name.
  10808. @item sar
  10809. The sample aspect ratio of the input frame, expressed in the form
  10810. @var{num}/@var{den}.
  10811. @item s
  10812. The size of the input frame. For the syntax of this option, check the
  10813. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10814. @item i
  10815. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  10816. for bottom field first).
  10817. @item iskey
  10818. This is 1 if the frame is a key frame, 0 otherwise.
  10819. @item type
  10820. The picture type of the input frame ("I" for an I-frame, "P" for a
  10821. P-frame, "B" for a B-frame, or "?" for an unknown type).
  10822. Also refer to the documentation of the @code{AVPictureType} enum and of
  10823. the @code{av_get_picture_type_char} function defined in
  10824. @file{libavutil/avutil.h}.
  10825. @item checksum
  10826. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  10827. @item plane_checksum
  10828. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  10829. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  10830. @end table
  10831. @section showpalette
  10832. Displays the 256 colors palette of each frame. This filter is only relevant for
  10833. @var{pal8} pixel format frames.
  10834. It accepts the following option:
  10835. @table @option
  10836. @item s
  10837. Set the size of the box used to represent one palette color entry. Default is
  10838. @code{30} (for a @code{30x30} pixel box).
  10839. @end table
  10840. @section shuffleframes
  10841. Reorder and/or duplicate and/or drop video frames.
  10842. It accepts the following parameters:
  10843. @table @option
  10844. @item mapping
  10845. Set the destination indexes of input frames.
  10846. This is space or '|' separated list of indexes that maps input frames to output
  10847. frames. Number of indexes also sets maximal value that each index may have.
  10848. '-1' index have special meaning and that is to drop frame.
  10849. @end table
  10850. The first frame has the index 0. The default is to keep the input unchanged.
  10851. @subsection Examples
  10852. @itemize
  10853. @item
  10854. Swap second and third frame of every three frames of the input:
  10855. @example
  10856. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  10857. @end example
  10858. @item
  10859. Swap 10th and 1st frame of every ten frames of the input:
  10860. @example
  10861. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  10862. @end example
  10863. @end itemize
  10864. @section shuffleplanes
  10865. Reorder and/or duplicate video planes.
  10866. It accepts the following parameters:
  10867. @table @option
  10868. @item map0
  10869. The index of the input plane to be used as the first output plane.
  10870. @item map1
  10871. The index of the input plane to be used as the second output plane.
  10872. @item map2
  10873. The index of the input plane to be used as the third output plane.
  10874. @item map3
  10875. The index of the input plane to be used as the fourth output plane.
  10876. @end table
  10877. The first plane has the index 0. The default is to keep the input unchanged.
  10878. @subsection Examples
  10879. @itemize
  10880. @item
  10881. Swap the second and third planes of the input:
  10882. @example
  10883. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  10884. @end example
  10885. @end itemize
  10886. @anchor{signalstats}
  10887. @section signalstats
  10888. Evaluate various visual metrics that assist in determining issues associated
  10889. with the digitization of analog video media.
  10890. By default the filter will log these metadata values:
  10891. @table @option
  10892. @item YMIN
  10893. Display the minimal Y value contained within the input frame. Expressed in
  10894. range of [0-255].
  10895. @item YLOW
  10896. Display the Y value at the 10% percentile within the input frame. Expressed in
  10897. range of [0-255].
  10898. @item YAVG
  10899. Display the average Y value within the input frame. Expressed in range of
  10900. [0-255].
  10901. @item YHIGH
  10902. Display the Y value at the 90% percentile within the input frame. Expressed in
  10903. range of [0-255].
  10904. @item YMAX
  10905. Display the maximum Y value contained within the input frame. Expressed in
  10906. range of [0-255].
  10907. @item UMIN
  10908. Display the minimal U value contained within the input frame. Expressed in
  10909. range of [0-255].
  10910. @item ULOW
  10911. Display the U value at the 10% percentile within the input frame. Expressed in
  10912. range of [0-255].
  10913. @item UAVG
  10914. Display the average U value within the input frame. Expressed in range of
  10915. [0-255].
  10916. @item UHIGH
  10917. Display the U value at the 90% percentile within the input frame. Expressed in
  10918. range of [0-255].
  10919. @item UMAX
  10920. Display the maximum U value contained within the input frame. Expressed in
  10921. range of [0-255].
  10922. @item VMIN
  10923. Display the minimal V value contained within the input frame. Expressed in
  10924. range of [0-255].
  10925. @item VLOW
  10926. Display the V value at the 10% percentile within the input frame. Expressed in
  10927. range of [0-255].
  10928. @item VAVG
  10929. Display the average V value within the input frame. Expressed in range of
  10930. [0-255].
  10931. @item VHIGH
  10932. Display the V value at the 90% percentile within the input frame. Expressed in
  10933. range of [0-255].
  10934. @item VMAX
  10935. Display the maximum V value contained within the input frame. Expressed in
  10936. range of [0-255].
  10937. @item SATMIN
  10938. Display the minimal saturation value contained within the input frame.
  10939. Expressed in range of [0-~181.02].
  10940. @item SATLOW
  10941. Display the saturation value at the 10% percentile within the input frame.
  10942. Expressed in range of [0-~181.02].
  10943. @item SATAVG
  10944. Display the average saturation value within the input frame. Expressed in range
  10945. of [0-~181.02].
  10946. @item SATHIGH
  10947. Display the saturation value at the 90% percentile within the input frame.
  10948. Expressed in range of [0-~181.02].
  10949. @item SATMAX
  10950. Display the maximum saturation value contained within the input frame.
  10951. Expressed in range of [0-~181.02].
  10952. @item HUEMED
  10953. Display the median value for hue within the input frame. Expressed in range of
  10954. [0-360].
  10955. @item HUEAVG
  10956. Display the average value for hue within the input frame. Expressed in range of
  10957. [0-360].
  10958. @item YDIF
  10959. Display the average of sample value difference between all values of the Y
  10960. plane in the current frame and corresponding values of the previous input frame.
  10961. Expressed in range of [0-255].
  10962. @item UDIF
  10963. Display the average of sample value difference between all values of the U
  10964. plane in the current frame and corresponding values of the previous input frame.
  10965. Expressed in range of [0-255].
  10966. @item VDIF
  10967. Display the average of sample value difference between all values of the V
  10968. plane in the current frame and corresponding values of the previous input frame.
  10969. Expressed in range of [0-255].
  10970. @item YBITDEPTH
  10971. Display bit depth of Y plane in current frame.
  10972. Expressed in range of [0-16].
  10973. @item UBITDEPTH
  10974. Display bit depth of U plane in current frame.
  10975. Expressed in range of [0-16].
  10976. @item VBITDEPTH
  10977. Display bit depth of V plane in current frame.
  10978. Expressed in range of [0-16].
  10979. @end table
  10980. The filter accepts the following options:
  10981. @table @option
  10982. @item stat
  10983. @item out
  10984. @option{stat} specify an additional form of image analysis.
  10985. @option{out} output video with the specified type of pixel highlighted.
  10986. Both options accept the following values:
  10987. @table @samp
  10988. @item tout
  10989. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  10990. unlike the neighboring pixels of the same field. Examples of temporal outliers
  10991. include the results of video dropouts, head clogs, or tape tracking issues.
  10992. @item vrep
  10993. Identify @var{vertical line repetition}. Vertical line repetition includes
  10994. similar rows of pixels within a frame. In born-digital video vertical line
  10995. repetition is common, but this pattern is uncommon in video digitized from an
  10996. analog source. When it occurs in video that results from the digitization of an
  10997. analog source it can indicate concealment from a dropout compensator.
  10998. @item brng
  10999. Identify pixels that fall outside of legal broadcast range.
  11000. @end table
  11001. @item color, c
  11002. Set the highlight color for the @option{out} option. The default color is
  11003. yellow.
  11004. @end table
  11005. @subsection Examples
  11006. @itemize
  11007. @item
  11008. Output data of various video metrics:
  11009. @example
  11010. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  11011. @end example
  11012. @item
  11013. Output specific data about the minimum and maximum values of the Y plane per frame:
  11014. @example
  11015. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  11016. @end example
  11017. @item
  11018. Playback video while highlighting pixels that are outside of broadcast range in red.
  11019. @example
  11020. ffplay example.mov -vf signalstats="out=brng:color=red"
  11021. @end example
  11022. @item
  11023. Playback video with signalstats metadata drawn over the frame.
  11024. @example
  11025. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  11026. @end example
  11027. The contents of signalstat_drawtext.txt used in the command are:
  11028. @example
  11029. time %@{pts:hms@}
  11030. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  11031. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  11032. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  11033. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  11034. @end example
  11035. @end itemize
  11036. @anchor{signature}
  11037. @section signature
  11038. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  11039. input. In this case the matching between the inputs can be calculated additionally.
  11040. The filter always passes through the first input. The signature of each stream can
  11041. be written into a file.
  11042. It accepts the following options:
  11043. @table @option
  11044. @item detectmode
  11045. Enable or disable the matching process.
  11046. Available values are:
  11047. @table @samp
  11048. @item off
  11049. Disable the calculation of a matching (default).
  11050. @item full
  11051. Calculate the matching for the whole video and output whether the whole video
  11052. matches or only parts.
  11053. @item fast
  11054. Calculate only until a matching is found or the video ends. Should be faster in
  11055. some cases.
  11056. @end table
  11057. @item nb_inputs
  11058. Set the number of inputs. The option value must be a non negative integer.
  11059. Default value is 1.
  11060. @item filename
  11061. Set the path to which the output is written. If there is more than one input,
  11062. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  11063. integer), that will be replaced with the input number. If no filename is
  11064. specified, no output will be written. This is the default.
  11065. @item format
  11066. Choose the output format.
  11067. Available values are:
  11068. @table @samp
  11069. @item binary
  11070. Use the specified binary representation (default).
  11071. @item xml
  11072. Use the specified xml representation.
  11073. @end table
  11074. @item th_d
  11075. Set threshold to detect one word as similar. The option value must be an integer
  11076. greater than zero. The default value is 9000.
  11077. @item th_dc
  11078. Set threshold to detect all words as similar. The option value must be an integer
  11079. greater than zero. The default value is 60000.
  11080. @item th_xh
  11081. Set threshold to detect frames as similar. The option value must be an integer
  11082. greater than zero. The default value is 116.
  11083. @item th_di
  11084. Set the minimum length of a sequence in frames to recognize it as matching
  11085. sequence. The option value must be a non negative integer value.
  11086. The default value is 0.
  11087. @item th_it
  11088. Set the minimum relation, that matching frames to all frames must have.
  11089. The option value must be a double value between 0 and 1. The default value is 0.5.
  11090. @end table
  11091. @subsection Examples
  11092. @itemize
  11093. @item
  11094. To calculate the signature of an input video and store it in signature.bin:
  11095. @example
  11096. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  11097. @end example
  11098. @item
  11099. To detect whether two videos match and store the signatures in XML format in
  11100. signature0.xml and signature1.xml:
  11101. @example
  11102. 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 -
  11103. @end example
  11104. @end itemize
  11105. @anchor{smartblur}
  11106. @section smartblur
  11107. Blur the input video without impacting the outlines.
  11108. It accepts the following options:
  11109. @table @option
  11110. @item luma_radius, lr
  11111. Set the luma radius. The option value must be a float number in
  11112. the range [0.1,5.0] that specifies the variance of the gaussian filter
  11113. used to blur the image (slower if larger). Default value is 1.0.
  11114. @item luma_strength, ls
  11115. Set the luma strength. The option value must be a float number
  11116. in the range [-1.0,1.0] that configures the blurring. A value included
  11117. in [0.0,1.0] will blur the image whereas a value included in
  11118. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  11119. @item luma_threshold, lt
  11120. Set the luma threshold used as a coefficient to determine
  11121. whether a pixel should be blurred or not. The option value must be an
  11122. integer in the range [-30,30]. A value of 0 will filter all the image,
  11123. a value included in [0,30] will filter flat areas and a value included
  11124. in [-30,0] will filter edges. Default value is 0.
  11125. @item chroma_radius, cr
  11126. Set the chroma radius. The option value must be a float number in
  11127. the range [0.1,5.0] that specifies the variance of the gaussian filter
  11128. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  11129. @item chroma_strength, cs
  11130. Set the chroma strength. The option value must be a float number
  11131. in the range [-1.0,1.0] that configures the blurring. A value included
  11132. in [0.0,1.0] will blur the image whereas a value included in
  11133. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  11134. @item chroma_threshold, ct
  11135. Set the chroma threshold used as a coefficient to determine
  11136. whether a pixel should be blurred or not. The option value must be an
  11137. integer in the range [-30,30]. A value of 0 will filter all the image,
  11138. a value included in [0,30] will filter flat areas and a value included
  11139. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  11140. @end table
  11141. If a chroma option is not explicitly set, the corresponding luma value
  11142. is set.
  11143. @section ssim
  11144. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  11145. This filter takes in input two input videos, the first input is
  11146. considered the "main" source and is passed unchanged to the
  11147. output. The second input is used as a "reference" video for computing
  11148. the SSIM.
  11149. Both video inputs must have the same resolution and pixel format for
  11150. this filter to work correctly. Also it assumes that both inputs
  11151. have the same number of frames, which are compared one by one.
  11152. The filter stores the calculated SSIM of each frame.
  11153. The description of the accepted parameters follows.
  11154. @table @option
  11155. @item stats_file, f
  11156. If specified the filter will use the named file to save the SSIM of
  11157. each individual frame. When filename equals "-" the data is sent to
  11158. standard output.
  11159. @end table
  11160. The file printed if @var{stats_file} is selected, contains a sequence of
  11161. key/value pairs of the form @var{key}:@var{value} for each compared
  11162. couple of frames.
  11163. A description of each shown parameter follows:
  11164. @table @option
  11165. @item n
  11166. sequential number of the input frame, starting from 1
  11167. @item Y, U, V, R, G, B
  11168. SSIM of the compared frames for the component specified by the suffix.
  11169. @item All
  11170. SSIM of the compared frames for the whole frame.
  11171. @item dB
  11172. Same as above but in dB representation.
  11173. @end table
  11174. This filter also supports the @ref{framesync} options.
  11175. For example:
  11176. @example
  11177. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  11178. [main][ref] ssim="stats_file=stats.log" [out]
  11179. @end example
  11180. On this example the input file being processed is compared with the
  11181. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  11182. is stored in @file{stats.log}.
  11183. Another example with both psnr and ssim at same time:
  11184. @example
  11185. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  11186. @end example
  11187. @section stereo3d
  11188. Convert between different stereoscopic image formats.
  11189. The filters accept the following options:
  11190. @table @option
  11191. @item in
  11192. Set stereoscopic image format of input.
  11193. Available values for input image formats are:
  11194. @table @samp
  11195. @item sbsl
  11196. side by side parallel (left eye left, right eye right)
  11197. @item sbsr
  11198. side by side crosseye (right eye left, left eye right)
  11199. @item sbs2l
  11200. side by side parallel with half width resolution
  11201. (left eye left, right eye right)
  11202. @item sbs2r
  11203. side by side crosseye with half width resolution
  11204. (right eye left, left eye right)
  11205. @item abl
  11206. above-below (left eye above, right eye below)
  11207. @item abr
  11208. above-below (right eye above, left eye below)
  11209. @item ab2l
  11210. above-below with half height resolution
  11211. (left eye above, right eye below)
  11212. @item ab2r
  11213. above-below with half height resolution
  11214. (right eye above, left eye below)
  11215. @item al
  11216. alternating frames (left eye first, right eye second)
  11217. @item ar
  11218. alternating frames (right eye first, left eye second)
  11219. @item irl
  11220. interleaved rows (left eye has top row, right eye starts on next row)
  11221. @item irr
  11222. interleaved rows (right eye has top row, left eye starts on next row)
  11223. @item icl
  11224. interleaved columns, left eye first
  11225. @item icr
  11226. interleaved columns, right eye first
  11227. Default value is @samp{sbsl}.
  11228. @end table
  11229. @item out
  11230. Set stereoscopic image format of output.
  11231. @table @samp
  11232. @item sbsl
  11233. side by side parallel (left eye left, right eye right)
  11234. @item sbsr
  11235. side by side crosseye (right eye left, left eye right)
  11236. @item sbs2l
  11237. side by side parallel with half width resolution
  11238. (left eye left, right eye right)
  11239. @item sbs2r
  11240. side by side crosseye with half width resolution
  11241. (right eye left, left eye right)
  11242. @item abl
  11243. above-below (left eye above, right eye below)
  11244. @item abr
  11245. above-below (right eye above, left eye below)
  11246. @item ab2l
  11247. above-below with half height resolution
  11248. (left eye above, right eye below)
  11249. @item ab2r
  11250. above-below with half height resolution
  11251. (right eye above, left eye below)
  11252. @item al
  11253. alternating frames (left eye first, right eye second)
  11254. @item ar
  11255. alternating frames (right eye first, left eye second)
  11256. @item irl
  11257. interleaved rows (left eye has top row, right eye starts on next row)
  11258. @item irr
  11259. interleaved rows (right eye has top row, left eye starts on next row)
  11260. @item arbg
  11261. anaglyph red/blue gray
  11262. (red filter on left eye, blue filter on right eye)
  11263. @item argg
  11264. anaglyph red/green gray
  11265. (red filter on left eye, green filter on right eye)
  11266. @item arcg
  11267. anaglyph red/cyan gray
  11268. (red filter on left eye, cyan filter on right eye)
  11269. @item arch
  11270. anaglyph red/cyan half colored
  11271. (red filter on left eye, cyan filter on right eye)
  11272. @item arcc
  11273. anaglyph red/cyan color
  11274. (red filter on left eye, cyan filter on right eye)
  11275. @item arcd
  11276. anaglyph red/cyan color optimized with the least squares projection of dubois
  11277. (red filter on left eye, cyan filter on right eye)
  11278. @item agmg
  11279. anaglyph green/magenta gray
  11280. (green filter on left eye, magenta filter on right eye)
  11281. @item agmh
  11282. anaglyph green/magenta half colored
  11283. (green filter on left eye, magenta filter on right eye)
  11284. @item agmc
  11285. anaglyph green/magenta colored
  11286. (green filter on left eye, magenta filter on right eye)
  11287. @item agmd
  11288. anaglyph green/magenta color optimized with the least squares projection of dubois
  11289. (green filter on left eye, magenta filter on right eye)
  11290. @item aybg
  11291. anaglyph yellow/blue gray
  11292. (yellow filter on left eye, blue filter on right eye)
  11293. @item aybh
  11294. anaglyph yellow/blue half colored
  11295. (yellow filter on left eye, blue filter on right eye)
  11296. @item aybc
  11297. anaglyph yellow/blue colored
  11298. (yellow filter on left eye, blue filter on right eye)
  11299. @item aybd
  11300. anaglyph yellow/blue color optimized with the least squares projection of dubois
  11301. (yellow filter on left eye, blue filter on right eye)
  11302. @item ml
  11303. mono output (left eye only)
  11304. @item mr
  11305. mono output (right eye only)
  11306. @item chl
  11307. checkerboard, left eye first
  11308. @item chr
  11309. checkerboard, right eye first
  11310. @item icl
  11311. interleaved columns, left eye first
  11312. @item icr
  11313. interleaved columns, right eye first
  11314. @item hdmi
  11315. HDMI frame pack
  11316. @end table
  11317. Default value is @samp{arcd}.
  11318. @end table
  11319. @subsection Examples
  11320. @itemize
  11321. @item
  11322. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  11323. @example
  11324. stereo3d=sbsl:aybd
  11325. @end example
  11326. @item
  11327. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  11328. @example
  11329. stereo3d=abl:sbsr
  11330. @end example
  11331. @end itemize
  11332. @section streamselect, astreamselect
  11333. Select video or audio streams.
  11334. The filter accepts the following options:
  11335. @table @option
  11336. @item inputs
  11337. Set number of inputs. Default is 2.
  11338. @item map
  11339. Set input indexes to remap to outputs.
  11340. @end table
  11341. @subsection Commands
  11342. The @code{streamselect} and @code{astreamselect} filter supports the following
  11343. commands:
  11344. @table @option
  11345. @item map
  11346. Set input indexes to remap to outputs.
  11347. @end table
  11348. @subsection Examples
  11349. @itemize
  11350. @item
  11351. Select first 5 seconds 1st stream and rest of time 2nd stream:
  11352. @example
  11353. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  11354. @end example
  11355. @item
  11356. Same as above, but for audio:
  11357. @example
  11358. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  11359. @end example
  11360. @end itemize
  11361. @section sobel
  11362. Apply sobel operator to input video stream.
  11363. The filter accepts the following option:
  11364. @table @option
  11365. @item planes
  11366. Set which planes will be processed, unprocessed planes will be copied.
  11367. By default value 0xf, all planes will be processed.
  11368. @item scale
  11369. Set value which will be multiplied with filtered result.
  11370. @item delta
  11371. Set value which will be added to filtered result.
  11372. @end table
  11373. @anchor{spp}
  11374. @section spp
  11375. Apply a simple postprocessing filter that compresses and decompresses the image
  11376. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  11377. and average the results.
  11378. The filter accepts the following options:
  11379. @table @option
  11380. @item quality
  11381. Set quality. This option defines the number of levels for averaging. It accepts
  11382. an integer in the range 0-6. If set to @code{0}, the filter will have no
  11383. effect. A value of @code{6} means the higher quality. For each increment of
  11384. that value the speed drops by a factor of approximately 2. Default value is
  11385. @code{3}.
  11386. @item qp
  11387. Force a constant quantization parameter. If not set, the filter will use the QP
  11388. from the video stream (if available).
  11389. @item mode
  11390. Set thresholding mode. Available modes are:
  11391. @table @samp
  11392. @item hard
  11393. Set hard thresholding (default).
  11394. @item soft
  11395. Set soft thresholding (better de-ringing effect, but likely blurrier).
  11396. @end table
  11397. @item use_bframe_qp
  11398. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  11399. option may cause flicker since the B-Frames have often larger QP. Default is
  11400. @code{0} (not enabled).
  11401. @end table
  11402. @anchor{subtitles}
  11403. @section subtitles
  11404. Draw subtitles on top of input video using the libass library.
  11405. To enable compilation of this filter you need to configure FFmpeg with
  11406. @code{--enable-libass}. This filter also requires a build with libavcodec and
  11407. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  11408. Alpha) subtitles format.
  11409. The filter accepts the following options:
  11410. @table @option
  11411. @item filename, f
  11412. Set the filename of the subtitle file to read. It must be specified.
  11413. @item original_size
  11414. Specify the size of the original video, the video for which the ASS file
  11415. was composed. For the syntax of this option, check the
  11416. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11417. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  11418. correctly scale the fonts if the aspect ratio has been changed.
  11419. @item fontsdir
  11420. Set a directory path containing fonts that can be used by the filter.
  11421. These fonts will be used in addition to whatever the font provider uses.
  11422. @item alpha
  11423. Process alpha channel, by default alpha channel is untouched.
  11424. @item charenc
  11425. Set subtitles input character encoding. @code{subtitles} filter only. Only
  11426. useful if not UTF-8.
  11427. @item stream_index, si
  11428. Set subtitles stream index. @code{subtitles} filter only.
  11429. @item force_style
  11430. Override default style or script info parameters of the subtitles. It accepts a
  11431. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  11432. @end table
  11433. If the first key is not specified, it is assumed that the first value
  11434. specifies the @option{filename}.
  11435. For example, to render the file @file{sub.srt} on top of the input
  11436. video, use the command:
  11437. @example
  11438. subtitles=sub.srt
  11439. @end example
  11440. which is equivalent to:
  11441. @example
  11442. subtitles=filename=sub.srt
  11443. @end example
  11444. To render the default subtitles stream from file @file{video.mkv}, use:
  11445. @example
  11446. subtitles=video.mkv
  11447. @end example
  11448. To render the second subtitles stream from that file, use:
  11449. @example
  11450. subtitles=video.mkv:si=1
  11451. @end example
  11452. To make the subtitles stream from @file{sub.srt} appear in transparent green
  11453. @code{DejaVu Serif}, use:
  11454. @example
  11455. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  11456. @end example
  11457. @section super2xsai
  11458. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  11459. Interpolate) pixel art scaling algorithm.
  11460. Useful for enlarging pixel art images without reducing sharpness.
  11461. @section swaprect
  11462. Swap two rectangular objects in video.
  11463. This filter accepts the following options:
  11464. @table @option
  11465. @item w
  11466. Set object width.
  11467. @item h
  11468. Set object height.
  11469. @item x1
  11470. Set 1st rect x coordinate.
  11471. @item y1
  11472. Set 1st rect y coordinate.
  11473. @item x2
  11474. Set 2nd rect x coordinate.
  11475. @item y2
  11476. Set 2nd rect y coordinate.
  11477. All expressions are evaluated once for each frame.
  11478. @end table
  11479. The all options are expressions containing the following constants:
  11480. @table @option
  11481. @item w
  11482. @item h
  11483. The input width and height.
  11484. @item a
  11485. same as @var{w} / @var{h}
  11486. @item sar
  11487. input sample aspect ratio
  11488. @item dar
  11489. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  11490. @item n
  11491. The number of the input frame, starting from 0.
  11492. @item t
  11493. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  11494. @item pos
  11495. the position in the file of the input frame, NAN if unknown
  11496. @end table
  11497. @section swapuv
  11498. Swap U & V plane.
  11499. @section telecine
  11500. Apply telecine process to the video.
  11501. This filter accepts the following options:
  11502. @table @option
  11503. @item first_field
  11504. @table @samp
  11505. @item top, t
  11506. top field first
  11507. @item bottom, b
  11508. bottom field first
  11509. The default value is @code{top}.
  11510. @end table
  11511. @item pattern
  11512. A string of numbers representing the pulldown pattern you wish to apply.
  11513. The default value is @code{23}.
  11514. @end table
  11515. @example
  11516. Some typical patterns:
  11517. NTSC output (30i):
  11518. 27.5p: 32222
  11519. 24p: 23 (classic)
  11520. 24p: 2332 (preferred)
  11521. 20p: 33
  11522. 18p: 334
  11523. 16p: 3444
  11524. PAL output (25i):
  11525. 27.5p: 12222
  11526. 24p: 222222222223 ("Euro pulldown")
  11527. 16.67p: 33
  11528. 16p: 33333334
  11529. @end example
  11530. @section threshold
  11531. Apply threshold effect to video stream.
  11532. This filter needs four video streams to perform thresholding.
  11533. First stream is stream we are filtering.
  11534. Second stream is holding threshold values, third stream is holding min values,
  11535. and last, fourth stream is holding max values.
  11536. The filter accepts the following option:
  11537. @table @option
  11538. @item planes
  11539. Set which planes will be processed, unprocessed planes will be copied.
  11540. By default value 0xf, all planes will be processed.
  11541. @end table
  11542. For example if first stream pixel's component value is less then threshold value
  11543. of pixel component from 2nd threshold stream, third stream value will picked,
  11544. otherwise fourth stream pixel component value will be picked.
  11545. Using color source filter one can perform various types of thresholding:
  11546. @subsection Examples
  11547. @itemize
  11548. @item
  11549. Binary threshold, using gray color as threshold:
  11550. @example
  11551. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  11552. @end example
  11553. @item
  11554. Inverted binary threshold, using gray color as threshold:
  11555. @example
  11556. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  11557. @end example
  11558. @item
  11559. Truncate binary threshold, using gray color as threshold:
  11560. @example
  11561. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  11562. @end example
  11563. @item
  11564. Threshold to zero, using gray color as threshold:
  11565. @example
  11566. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  11567. @end example
  11568. @item
  11569. Inverted threshold to zero, using gray color as threshold:
  11570. @example
  11571. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  11572. @end example
  11573. @end itemize
  11574. @section thumbnail
  11575. Select the most representative frame in a given sequence of consecutive frames.
  11576. The filter accepts the following options:
  11577. @table @option
  11578. @item n
  11579. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  11580. will pick one of them, and then handle the next batch of @var{n} frames until
  11581. the end. Default is @code{100}.
  11582. @end table
  11583. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  11584. value will result in a higher memory usage, so a high value is not recommended.
  11585. @subsection Examples
  11586. @itemize
  11587. @item
  11588. Extract one picture each 50 frames:
  11589. @example
  11590. thumbnail=50
  11591. @end example
  11592. @item
  11593. Complete example of a thumbnail creation with @command{ffmpeg}:
  11594. @example
  11595. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  11596. @end example
  11597. @end itemize
  11598. @section tile
  11599. Tile several successive frames together.
  11600. The filter accepts the following options:
  11601. @table @option
  11602. @item layout
  11603. Set the grid size (i.e. the number of lines and columns). For the syntax of
  11604. this option, check the
  11605. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11606. @item nb_frames
  11607. Set the maximum number of frames to render in the given area. It must be less
  11608. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  11609. the area will be used.
  11610. @item margin
  11611. Set the outer border margin in pixels.
  11612. @item padding
  11613. Set the inner border thickness (i.e. the number of pixels between frames). For
  11614. more advanced padding options (such as having different values for the edges),
  11615. refer to the pad video filter.
  11616. @item color
  11617. Specify the color of the unused area. For the syntax of this option, check the
  11618. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11619. The default value of @var{color} is "black".
  11620. @item overlap
  11621. Set the number of frames to overlap when tiling several successive frames together.
  11622. The value must be between @code{0} and @var{nb_frames - 1}.
  11623. @item init_padding
  11624. Set the number of frames to initially be empty before displaying first output frame.
  11625. This controls how soon will one get first output frame.
  11626. The value must be between @code{0} and @var{nb_frames - 1}.
  11627. @end table
  11628. @subsection Examples
  11629. @itemize
  11630. @item
  11631. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  11632. @example
  11633. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  11634. @end example
  11635. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  11636. duplicating each output frame to accommodate the originally detected frame
  11637. rate.
  11638. @item
  11639. Display @code{5} pictures in an area of @code{3x2} frames,
  11640. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  11641. mixed flat and named options:
  11642. @example
  11643. tile=3x2:nb_frames=5:padding=7:margin=2
  11644. @end example
  11645. @end itemize
  11646. @section tinterlace
  11647. Perform various types of temporal field interlacing.
  11648. Frames are counted starting from 1, so the first input frame is
  11649. considered odd.
  11650. The filter accepts the following options:
  11651. @table @option
  11652. @item mode
  11653. Specify the mode of the interlacing. This option can also be specified
  11654. as a value alone. See below for a list of values for this option.
  11655. Available values are:
  11656. @table @samp
  11657. @item merge, 0
  11658. Move odd frames into the upper field, even into the lower field,
  11659. generating a double height frame at half frame rate.
  11660. @example
  11661. ------> time
  11662. Input:
  11663. Frame 1 Frame 2 Frame 3 Frame 4
  11664. 11111 22222 33333 44444
  11665. 11111 22222 33333 44444
  11666. 11111 22222 33333 44444
  11667. 11111 22222 33333 44444
  11668. Output:
  11669. 11111 33333
  11670. 22222 44444
  11671. 11111 33333
  11672. 22222 44444
  11673. 11111 33333
  11674. 22222 44444
  11675. 11111 33333
  11676. 22222 44444
  11677. @end example
  11678. @item drop_even, 1
  11679. Only output odd frames, even frames are dropped, generating a frame with
  11680. unchanged height at half frame rate.
  11681. @example
  11682. ------> time
  11683. Input:
  11684. Frame 1 Frame 2 Frame 3 Frame 4
  11685. 11111 22222 33333 44444
  11686. 11111 22222 33333 44444
  11687. 11111 22222 33333 44444
  11688. 11111 22222 33333 44444
  11689. Output:
  11690. 11111 33333
  11691. 11111 33333
  11692. 11111 33333
  11693. 11111 33333
  11694. @end example
  11695. @item drop_odd, 2
  11696. Only output even frames, odd frames are dropped, generating a frame with
  11697. unchanged height at half frame rate.
  11698. @example
  11699. ------> time
  11700. Input:
  11701. Frame 1 Frame 2 Frame 3 Frame 4
  11702. 11111 22222 33333 44444
  11703. 11111 22222 33333 44444
  11704. 11111 22222 33333 44444
  11705. 11111 22222 33333 44444
  11706. Output:
  11707. 22222 44444
  11708. 22222 44444
  11709. 22222 44444
  11710. 22222 44444
  11711. @end example
  11712. @item pad, 3
  11713. Expand each frame to full height, but pad alternate lines with black,
  11714. generating a frame with double height at the same input frame rate.
  11715. @example
  11716. ------> time
  11717. Input:
  11718. Frame 1 Frame 2 Frame 3 Frame 4
  11719. 11111 22222 33333 44444
  11720. 11111 22222 33333 44444
  11721. 11111 22222 33333 44444
  11722. 11111 22222 33333 44444
  11723. Output:
  11724. 11111 ..... 33333 .....
  11725. ..... 22222 ..... 44444
  11726. 11111 ..... 33333 .....
  11727. ..... 22222 ..... 44444
  11728. 11111 ..... 33333 .....
  11729. ..... 22222 ..... 44444
  11730. 11111 ..... 33333 .....
  11731. ..... 22222 ..... 44444
  11732. @end example
  11733. @item interleave_top, 4
  11734. Interleave the upper field from odd frames with the lower field from
  11735. even frames, generating a frame with unchanged height at half frame rate.
  11736. @example
  11737. ------> time
  11738. Input:
  11739. Frame 1 Frame 2 Frame 3 Frame 4
  11740. 11111<- 22222 33333<- 44444
  11741. 11111 22222<- 33333 44444<-
  11742. 11111<- 22222 33333<- 44444
  11743. 11111 22222<- 33333 44444<-
  11744. Output:
  11745. 11111 33333
  11746. 22222 44444
  11747. 11111 33333
  11748. 22222 44444
  11749. @end example
  11750. @item interleave_bottom, 5
  11751. Interleave the lower field from odd frames with the upper field from
  11752. even frames, generating a frame with unchanged height at half frame rate.
  11753. @example
  11754. ------> time
  11755. Input:
  11756. Frame 1 Frame 2 Frame 3 Frame 4
  11757. 11111 22222<- 33333 44444<-
  11758. 11111<- 22222 33333<- 44444
  11759. 11111 22222<- 33333 44444<-
  11760. 11111<- 22222 33333<- 44444
  11761. Output:
  11762. 22222 44444
  11763. 11111 33333
  11764. 22222 44444
  11765. 11111 33333
  11766. @end example
  11767. @item interlacex2, 6
  11768. Double frame rate with unchanged height. Frames are inserted each
  11769. containing the second temporal field from the previous input frame and
  11770. the first temporal field from the next input frame. This mode relies on
  11771. the top_field_first flag. Useful for interlaced video displays with no
  11772. field synchronisation.
  11773. @example
  11774. ------> time
  11775. Input:
  11776. Frame 1 Frame 2 Frame 3 Frame 4
  11777. 11111 22222 33333 44444
  11778. 11111 22222 33333 44444
  11779. 11111 22222 33333 44444
  11780. 11111 22222 33333 44444
  11781. Output:
  11782. 11111 22222 22222 33333 33333 44444 44444
  11783. 11111 11111 22222 22222 33333 33333 44444
  11784. 11111 22222 22222 33333 33333 44444 44444
  11785. 11111 11111 22222 22222 33333 33333 44444
  11786. @end example
  11787. @item mergex2, 7
  11788. Move odd frames into the upper field, even into the lower field,
  11789. generating a double height frame at same frame rate.
  11790. @example
  11791. ------> time
  11792. Input:
  11793. Frame 1 Frame 2 Frame 3 Frame 4
  11794. 11111 22222 33333 44444
  11795. 11111 22222 33333 44444
  11796. 11111 22222 33333 44444
  11797. 11111 22222 33333 44444
  11798. Output:
  11799. 11111 33333 33333 55555
  11800. 22222 22222 44444 44444
  11801. 11111 33333 33333 55555
  11802. 22222 22222 44444 44444
  11803. 11111 33333 33333 55555
  11804. 22222 22222 44444 44444
  11805. 11111 33333 33333 55555
  11806. 22222 22222 44444 44444
  11807. @end example
  11808. @end table
  11809. Numeric values are deprecated but are accepted for backward
  11810. compatibility reasons.
  11811. Default mode is @code{merge}.
  11812. @item flags
  11813. Specify flags influencing the filter process.
  11814. Available value for @var{flags} is:
  11815. @table @option
  11816. @item low_pass_filter, vlfp
  11817. Enable linear vertical low-pass filtering in the filter.
  11818. Vertical low-pass filtering is required when creating an interlaced
  11819. destination from a progressive source which contains high-frequency
  11820. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  11821. patterning.
  11822. @item complex_filter, cvlfp
  11823. Enable complex vertical low-pass filtering.
  11824. This will slightly less reduce interlace 'twitter' and Moire
  11825. patterning but better retain detail and subjective sharpness impression.
  11826. @end table
  11827. Vertical low-pass filtering can only be enabled for @option{mode}
  11828. @var{interleave_top} and @var{interleave_bottom}.
  11829. @end table
  11830. @section tonemap
  11831. Tone map colors from different dynamic ranges.
  11832. This filter expects data in single precision floating point, as it needs to
  11833. operate on (and can output) out-of-range values. Another filter, such as
  11834. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  11835. The tonemapping algorithms implemented only work on linear light, so input
  11836. data should be linearized beforehand (and possibly correctly tagged).
  11837. @example
  11838. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  11839. @end example
  11840. @subsection Options
  11841. The filter accepts the following options.
  11842. @table @option
  11843. @item tonemap
  11844. Set the tone map algorithm to use.
  11845. Possible values are:
  11846. @table @var
  11847. @item none
  11848. Do not apply any tone map, only desaturate overbright pixels.
  11849. @item clip
  11850. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  11851. in-range values, while distorting out-of-range values.
  11852. @item linear
  11853. Stretch the entire reference gamut to a linear multiple of the display.
  11854. @item gamma
  11855. Fit a logarithmic transfer between the tone curves.
  11856. @item reinhard
  11857. Preserve overall image brightness with a simple curve, using nonlinear
  11858. contrast, which results in flattening details and degrading color accuracy.
  11859. @item hable
  11860. Preserve both dark and bright details better than @var{reinhard}, at the cost
  11861. of slightly darkening everything. Use it when detail preservation is more
  11862. important than color and brightness accuracy.
  11863. @item mobius
  11864. Smoothly map out-of-range values, while retaining contrast and colors for
  11865. in-range material as much as possible. Use it when color accuracy is more
  11866. important than detail preservation.
  11867. @end table
  11868. Default is none.
  11869. @item param
  11870. Tune the tone mapping algorithm.
  11871. This affects the following algorithms:
  11872. @table @var
  11873. @item none
  11874. Ignored.
  11875. @item linear
  11876. Specifies the scale factor to use while stretching.
  11877. Default to 1.0.
  11878. @item gamma
  11879. Specifies the exponent of the function.
  11880. Default to 1.8.
  11881. @item clip
  11882. Specify an extra linear coefficient to multiply into the signal before clipping.
  11883. Default to 1.0.
  11884. @item reinhard
  11885. Specify the local contrast coefficient at the display peak.
  11886. Default to 0.5, which means that in-gamut values will be about half as bright
  11887. as when clipping.
  11888. @item hable
  11889. Ignored.
  11890. @item mobius
  11891. Specify the transition point from linear to mobius transform. Every value
  11892. below this point is guaranteed to be mapped 1:1. The higher the value, the
  11893. more accurate the result will be, at the cost of losing bright details.
  11894. Default to 0.3, which due to the steep initial slope still preserves in-range
  11895. colors fairly accurately.
  11896. @end table
  11897. @item desat
  11898. Apply desaturation for highlights that exceed this level of brightness. The
  11899. higher the parameter, the more color information will be preserved. This
  11900. setting helps prevent unnaturally blown-out colors for super-highlights, by
  11901. (smoothly) turning into white instead. This makes images feel more natural,
  11902. at the cost of reducing information about out-of-range colors.
  11903. The default of 2.0 is somewhat conservative and will mostly just apply to
  11904. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  11905. This option works only if the input frame has a supported color tag.
  11906. @item peak
  11907. Override signal/nominal/reference peak with this value. Useful when the
  11908. embedded peak information in display metadata is not reliable or when tone
  11909. mapping from a lower range to a higher range.
  11910. @end table
  11911. @section transpose
  11912. Transpose rows with columns in the input video and optionally flip it.
  11913. It accepts the following parameters:
  11914. @table @option
  11915. @item dir
  11916. Specify the transposition direction.
  11917. Can assume the following values:
  11918. @table @samp
  11919. @item 0, 4, cclock_flip
  11920. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  11921. @example
  11922. L.R L.l
  11923. . . -> . .
  11924. l.r R.r
  11925. @end example
  11926. @item 1, 5, clock
  11927. Rotate by 90 degrees clockwise, that is:
  11928. @example
  11929. L.R l.L
  11930. . . -> . .
  11931. l.r r.R
  11932. @end example
  11933. @item 2, 6, cclock
  11934. Rotate by 90 degrees counterclockwise, that is:
  11935. @example
  11936. L.R R.r
  11937. . . -> . .
  11938. l.r L.l
  11939. @end example
  11940. @item 3, 7, clock_flip
  11941. Rotate by 90 degrees clockwise and vertically flip, that is:
  11942. @example
  11943. L.R r.R
  11944. . . -> . .
  11945. l.r l.L
  11946. @end example
  11947. @end table
  11948. For values between 4-7, the transposition is only done if the input
  11949. video geometry is portrait and not landscape. These values are
  11950. deprecated, the @code{passthrough} option should be used instead.
  11951. Numerical values are deprecated, and should be dropped in favor of
  11952. symbolic constants.
  11953. @item passthrough
  11954. Do not apply the transposition if the input geometry matches the one
  11955. specified by the specified value. It accepts the following values:
  11956. @table @samp
  11957. @item none
  11958. Always apply transposition.
  11959. @item portrait
  11960. Preserve portrait geometry (when @var{height} >= @var{width}).
  11961. @item landscape
  11962. Preserve landscape geometry (when @var{width} >= @var{height}).
  11963. @end table
  11964. Default value is @code{none}.
  11965. @end table
  11966. For example to rotate by 90 degrees clockwise and preserve portrait
  11967. layout:
  11968. @example
  11969. transpose=dir=1:passthrough=portrait
  11970. @end example
  11971. The command above can also be specified as:
  11972. @example
  11973. transpose=1:portrait
  11974. @end example
  11975. @section trim
  11976. Trim the input so that the output contains one continuous subpart of the input.
  11977. It accepts the following parameters:
  11978. @table @option
  11979. @item start
  11980. Specify the time of the start of the kept section, i.e. the frame with the
  11981. timestamp @var{start} will be the first frame in the output.
  11982. @item end
  11983. Specify the time of the first frame that will be dropped, i.e. the frame
  11984. immediately preceding the one with the timestamp @var{end} will be the last
  11985. frame in the output.
  11986. @item start_pts
  11987. This is the same as @var{start}, except this option sets the start timestamp
  11988. in timebase units instead of seconds.
  11989. @item end_pts
  11990. This is the same as @var{end}, except this option sets the end timestamp
  11991. in timebase units instead of seconds.
  11992. @item duration
  11993. The maximum duration of the output in seconds.
  11994. @item start_frame
  11995. The number of the first frame that should be passed to the output.
  11996. @item end_frame
  11997. The number of the first frame that should be dropped.
  11998. @end table
  11999. @option{start}, @option{end}, and @option{duration} are expressed as time
  12000. duration specifications; see
  12001. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12002. for the accepted syntax.
  12003. Note that the first two sets of the start/end options and the @option{duration}
  12004. option look at the frame timestamp, while the _frame variants simply count the
  12005. frames that pass through the filter. Also note that this filter does not modify
  12006. the timestamps. If you wish for the output timestamps to start at zero, insert a
  12007. setpts filter after the trim filter.
  12008. If multiple start or end options are set, this filter tries to be greedy and
  12009. keep all the frames that match at least one of the specified constraints. To keep
  12010. only the part that matches all the constraints at once, chain multiple trim
  12011. filters.
  12012. The defaults are such that all the input is kept. So it is possible to set e.g.
  12013. just the end values to keep everything before the specified time.
  12014. Examples:
  12015. @itemize
  12016. @item
  12017. Drop everything except the second minute of input:
  12018. @example
  12019. ffmpeg -i INPUT -vf trim=60:120
  12020. @end example
  12021. @item
  12022. Keep only the first second:
  12023. @example
  12024. ffmpeg -i INPUT -vf trim=duration=1
  12025. @end example
  12026. @end itemize
  12027. @section unpremultiply
  12028. Apply alpha unpremultiply effect to input video stream using first plane
  12029. of second stream as alpha.
  12030. Both streams must have same dimensions and same pixel format.
  12031. The filter accepts the following option:
  12032. @table @option
  12033. @item planes
  12034. Set which planes will be processed, unprocessed planes will be copied.
  12035. By default value 0xf, all planes will be processed.
  12036. If the format has 1 or 2 components, then luma is bit 0.
  12037. If the format has 3 or 4 components:
  12038. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  12039. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  12040. If present, the alpha channel is always the last bit.
  12041. @item inplace
  12042. Do not require 2nd input for processing, instead use alpha plane from input stream.
  12043. @end table
  12044. @anchor{unsharp}
  12045. @section unsharp
  12046. Sharpen or blur the input video.
  12047. It accepts the following parameters:
  12048. @table @option
  12049. @item luma_msize_x, lx
  12050. Set the luma matrix horizontal size. It must be an odd integer between
  12051. 3 and 23. The default value is 5.
  12052. @item luma_msize_y, ly
  12053. Set the luma matrix vertical size. It must be an odd integer between 3
  12054. and 23. The default value is 5.
  12055. @item luma_amount, la
  12056. Set the luma effect strength. It must be a floating point number, reasonable
  12057. values lay between -1.5 and 1.5.
  12058. Negative values will blur the input video, while positive values will
  12059. sharpen it, a value of zero will disable the effect.
  12060. Default value is 1.0.
  12061. @item chroma_msize_x, cx
  12062. Set the chroma matrix horizontal size. It must be an odd integer
  12063. between 3 and 23. The default value is 5.
  12064. @item chroma_msize_y, cy
  12065. Set the chroma matrix vertical size. It must be an odd integer
  12066. between 3 and 23. The default value is 5.
  12067. @item chroma_amount, ca
  12068. Set the chroma effect strength. It must be a floating point number, reasonable
  12069. values lay between -1.5 and 1.5.
  12070. Negative values will blur the input video, while positive values will
  12071. sharpen it, a value of zero will disable the effect.
  12072. Default value is 0.0.
  12073. @end table
  12074. All parameters are optional and default to the equivalent of the
  12075. string '5:5:1.0:5:5:0.0'.
  12076. @subsection Examples
  12077. @itemize
  12078. @item
  12079. Apply strong luma sharpen effect:
  12080. @example
  12081. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  12082. @end example
  12083. @item
  12084. Apply a strong blur of both luma and chroma parameters:
  12085. @example
  12086. unsharp=7:7:-2:7:7:-2
  12087. @end example
  12088. @end itemize
  12089. @section uspp
  12090. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  12091. the image at several (or - in the case of @option{quality} level @code{8} - all)
  12092. shifts and average the results.
  12093. The way this differs from the behavior of spp is that uspp actually encodes &
  12094. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  12095. DCT similar to MJPEG.
  12096. The filter accepts the following options:
  12097. @table @option
  12098. @item quality
  12099. Set quality. This option defines the number of levels for averaging. It accepts
  12100. an integer in the range 0-8. If set to @code{0}, the filter will have no
  12101. effect. A value of @code{8} means the higher quality. For each increment of
  12102. that value the speed drops by a factor of approximately 2. Default value is
  12103. @code{3}.
  12104. @item qp
  12105. Force a constant quantization parameter. If not set, the filter will use the QP
  12106. from the video stream (if available).
  12107. @end table
  12108. @section vaguedenoiser
  12109. Apply a wavelet based denoiser.
  12110. It transforms each frame from the video input into the wavelet domain,
  12111. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  12112. the obtained coefficients. It does an inverse wavelet transform after.
  12113. Due to wavelet properties, it should give a nice smoothed result, and
  12114. reduced noise, without blurring picture features.
  12115. This filter accepts the following options:
  12116. @table @option
  12117. @item threshold
  12118. The filtering strength. The higher, the more filtered the video will be.
  12119. Hard thresholding can use a higher threshold than soft thresholding
  12120. before the video looks overfiltered. Default value is 2.
  12121. @item method
  12122. The filtering method the filter will use.
  12123. It accepts the following values:
  12124. @table @samp
  12125. @item hard
  12126. All values under the threshold will be zeroed.
  12127. @item soft
  12128. All values under the threshold will be zeroed. All values above will be
  12129. reduced by the threshold.
  12130. @item garrote
  12131. Scales or nullifies coefficients - intermediary between (more) soft and
  12132. (less) hard thresholding.
  12133. @end table
  12134. Default is garrote.
  12135. @item nsteps
  12136. Number of times, the wavelet will decompose the picture. Picture can't
  12137. be decomposed beyond a particular point (typically, 8 for a 640x480
  12138. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  12139. @item percent
  12140. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  12141. @item planes
  12142. A list of the planes to process. By default all planes are processed.
  12143. @end table
  12144. @section vectorscope
  12145. Display 2 color component values in the two dimensional graph (which is called
  12146. a vectorscope).
  12147. This filter accepts the following options:
  12148. @table @option
  12149. @item mode, m
  12150. Set vectorscope mode.
  12151. It accepts the following values:
  12152. @table @samp
  12153. @item gray
  12154. Gray values are displayed on graph, higher brightness means more pixels have
  12155. same component color value on location in graph. This is the default mode.
  12156. @item color
  12157. Gray values are displayed on graph. Surrounding pixels values which are not
  12158. present in video frame are drawn in gradient of 2 color components which are
  12159. set by option @code{x} and @code{y}. The 3rd color component is static.
  12160. @item color2
  12161. Actual color components values present in video frame are displayed on graph.
  12162. @item color3
  12163. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  12164. on graph increases value of another color component, which is luminance by
  12165. default values of @code{x} and @code{y}.
  12166. @item color4
  12167. Actual colors present in video frame are displayed on graph. If two different
  12168. colors map to same position on graph then color with higher value of component
  12169. not present in graph is picked.
  12170. @item color5
  12171. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  12172. component picked from radial gradient.
  12173. @end table
  12174. @item x
  12175. Set which color component will be represented on X-axis. Default is @code{1}.
  12176. @item y
  12177. Set which color component will be represented on Y-axis. Default is @code{2}.
  12178. @item intensity, i
  12179. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  12180. of color component which represents frequency of (X, Y) location in graph.
  12181. @item envelope, e
  12182. @table @samp
  12183. @item none
  12184. No envelope, this is default.
  12185. @item instant
  12186. Instant envelope, even darkest single pixel will be clearly highlighted.
  12187. @item peak
  12188. Hold maximum and minimum values presented in graph over time. This way you
  12189. can still spot out of range values without constantly looking at vectorscope.
  12190. @item peak+instant
  12191. Peak and instant envelope combined together.
  12192. @end table
  12193. @item graticule, g
  12194. Set what kind of graticule to draw.
  12195. @table @samp
  12196. @item none
  12197. @item green
  12198. @item color
  12199. @end table
  12200. @item opacity, o
  12201. Set graticule opacity.
  12202. @item flags, f
  12203. Set graticule flags.
  12204. @table @samp
  12205. @item white
  12206. Draw graticule for white point.
  12207. @item black
  12208. Draw graticule for black point.
  12209. @item name
  12210. Draw color points short names.
  12211. @end table
  12212. @item bgopacity, b
  12213. Set background opacity.
  12214. @item lthreshold, l
  12215. Set low threshold for color component not represented on X or Y axis.
  12216. Values lower than this value will be ignored. Default is 0.
  12217. Note this value is multiplied with actual max possible value one pixel component
  12218. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  12219. is 0.1 * 255 = 25.
  12220. @item hthreshold, h
  12221. Set high threshold for color component not represented on X or Y axis.
  12222. Values higher than this value will be ignored. Default is 1.
  12223. Note this value is multiplied with actual max possible value one pixel component
  12224. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  12225. is 0.9 * 255 = 230.
  12226. @item colorspace, c
  12227. Set what kind of colorspace to use when drawing graticule.
  12228. @table @samp
  12229. @item auto
  12230. @item 601
  12231. @item 709
  12232. @end table
  12233. Default is auto.
  12234. @end table
  12235. @anchor{vidstabdetect}
  12236. @section vidstabdetect
  12237. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  12238. @ref{vidstabtransform} for pass 2.
  12239. This filter generates a file with relative translation and rotation
  12240. transform information about subsequent frames, which is then used by
  12241. the @ref{vidstabtransform} filter.
  12242. To enable compilation of this filter you need to configure FFmpeg with
  12243. @code{--enable-libvidstab}.
  12244. This filter accepts the following options:
  12245. @table @option
  12246. @item result
  12247. Set the path to the file used to write the transforms information.
  12248. Default value is @file{transforms.trf}.
  12249. @item shakiness
  12250. Set how shaky the video is and how quick the camera is. It accepts an
  12251. integer in the range 1-10, a value of 1 means little shakiness, a
  12252. value of 10 means strong shakiness. Default value is 5.
  12253. @item accuracy
  12254. Set the accuracy of the detection process. It must be a value in the
  12255. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  12256. accuracy. Default value is 15.
  12257. @item stepsize
  12258. Set stepsize of the search process. The region around minimum is
  12259. scanned with 1 pixel resolution. Default value is 6.
  12260. @item mincontrast
  12261. Set minimum contrast. Below this value a local measurement field is
  12262. discarded. Must be a floating point value in the range 0-1. Default
  12263. value is 0.3.
  12264. @item tripod
  12265. Set reference frame number for tripod mode.
  12266. If enabled, the motion of the frames is compared to a reference frame
  12267. in the filtered stream, identified by the specified number. The idea
  12268. is to compensate all movements in a more-or-less static scene and keep
  12269. the camera view absolutely still.
  12270. If set to 0, it is disabled. The frames are counted starting from 1.
  12271. @item show
  12272. Show fields and transforms in the resulting frames. It accepts an
  12273. integer in the range 0-2. Default value is 0, which disables any
  12274. visualization.
  12275. @end table
  12276. @subsection Examples
  12277. @itemize
  12278. @item
  12279. Use default values:
  12280. @example
  12281. vidstabdetect
  12282. @end example
  12283. @item
  12284. Analyze strongly shaky movie and put the results in file
  12285. @file{mytransforms.trf}:
  12286. @example
  12287. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  12288. @end example
  12289. @item
  12290. Visualize the result of internal transformations in the resulting
  12291. video:
  12292. @example
  12293. vidstabdetect=show=1
  12294. @end example
  12295. @item
  12296. Analyze a video with medium shakiness using @command{ffmpeg}:
  12297. @example
  12298. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  12299. @end example
  12300. @end itemize
  12301. @anchor{vidstabtransform}
  12302. @section vidstabtransform
  12303. Video stabilization/deshaking: pass 2 of 2,
  12304. see @ref{vidstabdetect} for pass 1.
  12305. Read a file with transform information for each frame and
  12306. apply/compensate them. Together with the @ref{vidstabdetect}
  12307. filter this can be used to deshake videos. See also
  12308. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  12309. the @ref{unsharp} filter, see below.
  12310. To enable compilation of this filter you need to configure FFmpeg with
  12311. @code{--enable-libvidstab}.
  12312. @subsection Options
  12313. @table @option
  12314. @item input
  12315. Set path to the file used to read the transforms. Default value is
  12316. @file{transforms.trf}.
  12317. @item smoothing
  12318. Set the number of frames (value*2 + 1) used for lowpass filtering the
  12319. camera movements. Default value is 10.
  12320. For example a number of 10 means that 21 frames are used (10 in the
  12321. past and 10 in the future) to smoothen the motion in the video. A
  12322. larger value leads to a smoother video, but limits the acceleration of
  12323. the camera (pan/tilt movements). 0 is a special case where a static
  12324. camera is simulated.
  12325. @item optalgo
  12326. Set the camera path optimization algorithm.
  12327. Accepted values are:
  12328. @table @samp
  12329. @item gauss
  12330. gaussian kernel low-pass filter on camera motion (default)
  12331. @item avg
  12332. averaging on transformations
  12333. @end table
  12334. @item maxshift
  12335. Set maximal number of pixels to translate frames. Default value is -1,
  12336. meaning no limit.
  12337. @item maxangle
  12338. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  12339. value is -1, meaning no limit.
  12340. @item crop
  12341. Specify how to deal with borders that may be visible due to movement
  12342. compensation.
  12343. Available values are:
  12344. @table @samp
  12345. @item keep
  12346. keep image information from previous frame (default)
  12347. @item black
  12348. fill the border black
  12349. @end table
  12350. @item invert
  12351. Invert transforms if set to 1. Default value is 0.
  12352. @item relative
  12353. Consider transforms as relative to previous frame if set to 1,
  12354. absolute if set to 0. Default value is 0.
  12355. @item zoom
  12356. Set percentage to zoom. A positive value will result in a zoom-in
  12357. effect, a negative value in a zoom-out effect. Default value is 0 (no
  12358. zoom).
  12359. @item optzoom
  12360. Set optimal zooming to avoid borders.
  12361. Accepted values are:
  12362. @table @samp
  12363. @item 0
  12364. disabled
  12365. @item 1
  12366. optimal static zoom value is determined (only very strong movements
  12367. will lead to visible borders) (default)
  12368. @item 2
  12369. optimal adaptive zoom value is determined (no borders will be
  12370. visible), see @option{zoomspeed}
  12371. @end table
  12372. Note that the value given at zoom is added to the one calculated here.
  12373. @item zoomspeed
  12374. Set percent to zoom maximally each frame (enabled when
  12375. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  12376. 0.25.
  12377. @item interpol
  12378. Specify type of interpolation.
  12379. Available values are:
  12380. @table @samp
  12381. @item no
  12382. no interpolation
  12383. @item linear
  12384. linear only horizontal
  12385. @item bilinear
  12386. linear in both directions (default)
  12387. @item bicubic
  12388. cubic in both directions (slow)
  12389. @end table
  12390. @item tripod
  12391. Enable virtual tripod mode if set to 1, which is equivalent to
  12392. @code{relative=0:smoothing=0}. Default value is 0.
  12393. Use also @code{tripod} option of @ref{vidstabdetect}.
  12394. @item debug
  12395. Increase log verbosity if set to 1. Also the detected global motions
  12396. are written to the temporary file @file{global_motions.trf}. Default
  12397. value is 0.
  12398. @end table
  12399. @subsection Examples
  12400. @itemize
  12401. @item
  12402. Use @command{ffmpeg} for a typical stabilization with default values:
  12403. @example
  12404. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  12405. @end example
  12406. Note the use of the @ref{unsharp} filter which is always recommended.
  12407. @item
  12408. Zoom in a bit more and load transform data from a given file:
  12409. @example
  12410. vidstabtransform=zoom=5:input="mytransforms.trf"
  12411. @end example
  12412. @item
  12413. Smoothen the video even more:
  12414. @example
  12415. vidstabtransform=smoothing=30
  12416. @end example
  12417. @end itemize
  12418. @section vflip
  12419. Flip the input video vertically.
  12420. For example, to vertically flip a video with @command{ffmpeg}:
  12421. @example
  12422. ffmpeg -i in.avi -vf "vflip" out.avi
  12423. @end example
  12424. @section vfrdet
  12425. Detect variable frame rate video.
  12426. This filter tries to detect if the input is variable or constant frame rate.
  12427. At end it will output number of frames detected as having variable delta pts,
  12428. and ones with constant delta pts.
  12429. If there was frames with variable delta, than it will also show min and max delta
  12430. encountered.
  12431. @anchor{vignette}
  12432. @section vignette
  12433. Make or reverse a natural vignetting effect.
  12434. The filter accepts the following options:
  12435. @table @option
  12436. @item angle, a
  12437. Set lens angle expression as a number of radians.
  12438. The value is clipped in the @code{[0,PI/2]} range.
  12439. Default value: @code{"PI/5"}
  12440. @item x0
  12441. @item y0
  12442. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  12443. by default.
  12444. @item mode
  12445. Set forward/backward mode.
  12446. Available modes are:
  12447. @table @samp
  12448. @item forward
  12449. The larger the distance from the central point, the darker the image becomes.
  12450. @item backward
  12451. The larger the distance from the central point, the brighter the image becomes.
  12452. This can be used to reverse a vignette effect, though there is no automatic
  12453. detection to extract the lens @option{angle} and other settings (yet). It can
  12454. also be used to create a burning effect.
  12455. @end table
  12456. Default value is @samp{forward}.
  12457. @item eval
  12458. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  12459. It accepts the following values:
  12460. @table @samp
  12461. @item init
  12462. Evaluate expressions only once during the filter initialization.
  12463. @item frame
  12464. Evaluate expressions for each incoming frame. This is way slower than the
  12465. @samp{init} mode since it requires all the scalers to be re-computed, but it
  12466. allows advanced dynamic expressions.
  12467. @end table
  12468. Default value is @samp{init}.
  12469. @item dither
  12470. Set dithering to reduce the circular banding effects. Default is @code{1}
  12471. (enabled).
  12472. @item aspect
  12473. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  12474. Setting this value to the SAR of the input will make a rectangular vignetting
  12475. following the dimensions of the video.
  12476. Default is @code{1/1}.
  12477. @end table
  12478. @subsection Expressions
  12479. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  12480. following parameters.
  12481. @table @option
  12482. @item w
  12483. @item h
  12484. input width and height
  12485. @item n
  12486. the number of input frame, starting from 0
  12487. @item pts
  12488. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  12489. @var{TB} units, NAN if undefined
  12490. @item r
  12491. frame rate of the input video, NAN if the input frame rate is unknown
  12492. @item t
  12493. the PTS (Presentation TimeStamp) of the filtered video frame,
  12494. expressed in seconds, NAN if undefined
  12495. @item tb
  12496. time base of the input video
  12497. @end table
  12498. @subsection Examples
  12499. @itemize
  12500. @item
  12501. Apply simple strong vignetting effect:
  12502. @example
  12503. vignette=PI/4
  12504. @end example
  12505. @item
  12506. Make a flickering vignetting:
  12507. @example
  12508. vignette='PI/4+random(1)*PI/50':eval=frame
  12509. @end example
  12510. @end itemize
  12511. @section vmafmotion
  12512. Obtain the average vmaf motion score of a video.
  12513. It is one of the component filters of VMAF.
  12514. The obtained average motion score is printed through the logging system.
  12515. In the below example the input file @file{ref.mpg} is being processed and score
  12516. is computed.
  12517. @example
  12518. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  12519. @end example
  12520. @section vstack
  12521. Stack input videos vertically.
  12522. All streams must be of same pixel format and of same width.
  12523. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  12524. to create same output.
  12525. The filter accept the following option:
  12526. @table @option
  12527. @item inputs
  12528. Set number of input streams. Default is 2.
  12529. @item shortest
  12530. If set to 1, force the output to terminate when the shortest input
  12531. terminates. Default value is 0.
  12532. @end table
  12533. @section w3fdif
  12534. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  12535. Deinterlacing Filter").
  12536. Based on the process described by Martin Weston for BBC R&D, and
  12537. implemented based on the de-interlace algorithm written by Jim
  12538. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  12539. uses filter coefficients calculated by BBC R&D.
  12540. There are two sets of filter coefficients, so called "simple":
  12541. and "complex". Which set of filter coefficients is used can
  12542. be set by passing an optional parameter:
  12543. @table @option
  12544. @item filter
  12545. Set the interlacing filter coefficients. Accepts one of the following values:
  12546. @table @samp
  12547. @item simple
  12548. Simple filter coefficient set.
  12549. @item complex
  12550. More-complex filter coefficient set.
  12551. @end table
  12552. Default value is @samp{complex}.
  12553. @item deint
  12554. Specify which frames to deinterlace. Accept one of the following values:
  12555. @table @samp
  12556. @item all
  12557. Deinterlace all frames,
  12558. @item interlaced
  12559. Only deinterlace frames marked as interlaced.
  12560. @end table
  12561. Default value is @samp{all}.
  12562. @end table
  12563. @section waveform
  12564. Video waveform monitor.
  12565. The waveform monitor plots color component intensity. By default luminance
  12566. only. Each column of the waveform corresponds to a column of pixels in the
  12567. source video.
  12568. It accepts the following options:
  12569. @table @option
  12570. @item mode, m
  12571. Can be either @code{row}, or @code{column}. Default is @code{column}.
  12572. In row mode, the graph on the left side represents color component value 0 and
  12573. the right side represents value = 255. In column mode, the top side represents
  12574. color component value = 0 and bottom side represents value = 255.
  12575. @item intensity, i
  12576. Set intensity. Smaller values are useful to find out how many values of the same
  12577. luminance are distributed across input rows/columns.
  12578. Default value is @code{0.04}. Allowed range is [0, 1].
  12579. @item mirror, r
  12580. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  12581. In mirrored mode, higher values will be represented on the left
  12582. side for @code{row} mode and at the top for @code{column} mode. Default is
  12583. @code{1} (mirrored).
  12584. @item display, d
  12585. Set display mode.
  12586. It accepts the following values:
  12587. @table @samp
  12588. @item overlay
  12589. Presents information identical to that in the @code{parade}, except
  12590. that the graphs representing color components are superimposed directly
  12591. over one another.
  12592. This display mode makes it easier to spot relative differences or similarities
  12593. in overlapping areas of the color components that are supposed to be identical,
  12594. such as neutral whites, grays, or blacks.
  12595. @item stack
  12596. Display separate graph for the color components side by side in
  12597. @code{row} mode or one below the other in @code{column} mode.
  12598. @item parade
  12599. Display separate graph for the color components side by side in
  12600. @code{column} mode or one below the other in @code{row} mode.
  12601. Using this display mode makes it easy to spot color casts in the highlights
  12602. and shadows of an image, by comparing the contours of the top and the bottom
  12603. graphs of each waveform. Since whites, grays, and blacks are characterized
  12604. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  12605. should display three waveforms of roughly equal width/height. If not, the
  12606. correction is easy to perform by making level adjustments the three waveforms.
  12607. @end table
  12608. Default is @code{stack}.
  12609. @item components, c
  12610. Set which color components to display. Default is 1, which means only luminance
  12611. or red color component if input is in RGB colorspace. If is set for example to
  12612. 7 it will display all 3 (if) available color components.
  12613. @item envelope, e
  12614. @table @samp
  12615. @item none
  12616. No envelope, this is default.
  12617. @item instant
  12618. Instant envelope, minimum and maximum values presented in graph will be easily
  12619. visible even with small @code{step} value.
  12620. @item peak
  12621. Hold minimum and maximum values presented in graph across time. This way you
  12622. can still spot out of range values without constantly looking at waveforms.
  12623. @item peak+instant
  12624. Peak and instant envelope combined together.
  12625. @end table
  12626. @item filter, f
  12627. @table @samp
  12628. @item lowpass
  12629. No filtering, this is default.
  12630. @item flat
  12631. Luma and chroma combined together.
  12632. @item aflat
  12633. Similar as above, but shows difference between blue and red chroma.
  12634. @item xflat
  12635. Similar as above, but use different colors.
  12636. @item chroma
  12637. Displays only chroma.
  12638. @item color
  12639. Displays actual color value on waveform.
  12640. @item acolor
  12641. Similar as above, but with luma showing frequency of chroma values.
  12642. @end table
  12643. @item graticule, g
  12644. Set which graticule to display.
  12645. @table @samp
  12646. @item none
  12647. Do not display graticule.
  12648. @item green
  12649. Display green graticule showing legal broadcast ranges.
  12650. @item orange
  12651. Display orange graticule showing legal broadcast ranges.
  12652. @end table
  12653. @item opacity, o
  12654. Set graticule opacity.
  12655. @item flags, fl
  12656. Set graticule flags.
  12657. @table @samp
  12658. @item numbers
  12659. Draw numbers above lines. By default enabled.
  12660. @item dots
  12661. Draw dots instead of lines.
  12662. @end table
  12663. @item scale, s
  12664. Set scale used for displaying graticule.
  12665. @table @samp
  12666. @item digital
  12667. @item millivolts
  12668. @item ire
  12669. @end table
  12670. Default is digital.
  12671. @item bgopacity, b
  12672. Set background opacity.
  12673. @end table
  12674. @section weave, doubleweave
  12675. The @code{weave} takes a field-based video input and join
  12676. each two sequential fields into single frame, producing a new double
  12677. height clip with half the frame rate and half the frame count.
  12678. The @code{doubleweave} works same as @code{weave} but without
  12679. halving frame rate and frame count.
  12680. It accepts the following option:
  12681. @table @option
  12682. @item first_field
  12683. Set first field. Available values are:
  12684. @table @samp
  12685. @item top, t
  12686. Set the frame as top-field-first.
  12687. @item bottom, b
  12688. Set the frame as bottom-field-first.
  12689. @end table
  12690. @end table
  12691. @subsection Examples
  12692. @itemize
  12693. @item
  12694. Interlace video using @ref{select} and @ref{separatefields} filter:
  12695. @example
  12696. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  12697. @end example
  12698. @end itemize
  12699. @section xbr
  12700. Apply the xBR high-quality magnification filter which is designed for pixel
  12701. art. It follows a set of edge-detection rules, see
  12702. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  12703. It accepts the following option:
  12704. @table @option
  12705. @item n
  12706. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  12707. @code{3xBR} and @code{4} for @code{4xBR}.
  12708. Default is @code{3}.
  12709. @end table
  12710. @anchor{yadif}
  12711. @section yadif
  12712. Deinterlace the input video ("yadif" means "yet another deinterlacing
  12713. filter").
  12714. It accepts the following parameters:
  12715. @table @option
  12716. @item mode
  12717. The interlacing mode to adopt. It accepts one of the following values:
  12718. @table @option
  12719. @item 0, send_frame
  12720. Output one frame for each frame.
  12721. @item 1, send_field
  12722. Output one frame for each field.
  12723. @item 2, send_frame_nospatial
  12724. Like @code{send_frame}, but it skips the spatial interlacing check.
  12725. @item 3, send_field_nospatial
  12726. Like @code{send_field}, but it skips the spatial interlacing check.
  12727. @end table
  12728. The default value is @code{send_frame}.
  12729. @item parity
  12730. The picture field parity assumed for the input interlaced video. It accepts one
  12731. of the following values:
  12732. @table @option
  12733. @item 0, tff
  12734. Assume the top field is first.
  12735. @item 1, bff
  12736. Assume the bottom field is first.
  12737. @item -1, auto
  12738. Enable automatic detection of field parity.
  12739. @end table
  12740. The default value is @code{auto}.
  12741. If the interlacing is unknown or the decoder does not export this information,
  12742. top field first will be assumed.
  12743. @item deint
  12744. Specify which frames to deinterlace. Accept one of the following
  12745. values:
  12746. @table @option
  12747. @item 0, all
  12748. Deinterlace all frames.
  12749. @item 1, interlaced
  12750. Only deinterlace frames marked as interlaced.
  12751. @end table
  12752. The default value is @code{all}.
  12753. @end table
  12754. @section zoompan
  12755. Apply Zoom & Pan effect.
  12756. This filter accepts the following options:
  12757. @table @option
  12758. @item zoom, z
  12759. Set the zoom expression. Default is 1.
  12760. @item x
  12761. @item y
  12762. Set the x and y expression. Default is 0.
  12763. @item d
  12764. Set the duration expression in number of frames.
  12765. This sets for how many number of frames effect will last for
  12766. single input image.
  12767. @item s
  12768. Set the output image size, default is 'hd720'.
  12769. @item fps
  12770. Set the output frame rate, default is '25'.
  12771. @end table
  12772. Each expression can contain the following constants:
  12773. @table @option
  12774. @item in_w, iw
  12775. Input width.
  12776. @item in_h, ih
  12777. Input height.
  12778. @item out_w, ow
  12779. Output width.
  12780. @item out_h, oh
  12781. Output height.
  12782. @item in
  12783. Input frame count.
  12784. @item on
  12785. Output frame count.
  12786. @item x
  12787. @item y
  12788. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  12789. for current input frame.
  12790. @item px
  12791. @item py
  12792. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  12793. not yet such frame (first input frame).
  12794. @item zoom
  12795. Last calculated zoom from 'z' expression for current input frame.
  12796. @item pzoom
  12797. Last calculated zoom of last output frame of previous input frame.
  12798. @item duration
  12799. Number of output frames for current input frame. Calculated from 'd' expression
  12800. for each input frame.
  12801. @item pduration
  12802. number of output frames created for previous input frame
  12803. @item a
  12804. Rational number: input width / input height
  12805. @item sar
  12806. sample aspect ratio
  12807. @item dar
  12808. display aspect ratio
  12809. @end table
  12810. @subsection Examples
  12811. @itemize
  12812. @item
  12813. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  12814. @example
  12815. 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
  12816. @end example
  12817. @item
  12818. Zoom-in up to 1.5 and pan always at center of picture:
  12819. @example
  12820. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12821. @end example
  12822. @item
  12823. Same as above but without pausing:
  12824. @example
  12825. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12826. @end example
  12827. @end itemize
  12828. @anchor{zscale}
  12829. @section zscale
  12830. Scale (resize) the input video, using the z.lib library:
  12831. https://github.com/sekrit-twc/zimg.
  12832. The zscale filter forces the output display aspect ratio to be the same
  12833. as the input, by changing the output sample aspect ratio.
  12834. If the input image format is different from the format requested by
  12835. the next filter, the zscale filter will convert the input to the
  12836. requested format.
  12837. @subsection Options
  12838. The filter accepts the following options.
  12839. @table @option
  12840. @item width, w
  12841. @item height, h
  12842. Set the output video dimension expression. Default value is the input
  12843. dimension.
  12844. If the @var{width} or @var{w} value is 0, the input width is used for
  12845. the output. If the @var{height} or @var{h} value is 0, the input height
  12846. is used for the output.
  12847. If one and only one of the values is -n with n >= 1, the zscale filter
  12848. will use a value that maintains the aspect ratio of the input image,
  12849. calculated from the other specified dimension. After that it will,
  12850. however, make sure that the calculated dimension is divisible by n and
  12851. adjust the value if necessary.
  12852. If both values are -n with n >= 1, the behavior will be identical to
  12853. both values being set to 0 as previously detailed.
  12854. See below for the list of accepted constants for use in the dimension
  12855. expression.
  12856. @item size, s
  12857. Set the video size. For the syntax of this option, check the
  12858. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12859. @item dither, d
  12860. Set the dither type.
  12861. Possible values are:
  12862. @table @var
  12863. @item none
  12864. @item ordered
  12865. @item random
  12866. @item error_diffusion
  12867. @end table
  12868. Default is none.
  12869. @item filter, f
  12870. Set the resize filter type.
  12871. Possible values are:
  12872. @table @var
  12873. @item point
  12874. @item bilinear
  12875. @item bicubic
  12876. @item spline16
  12877. @item spline36
  12878. @item lanczos
  12879. @end table
  12880. Default is bilinear.
  12881. @item range, r
  12882. Set the color range.
  12883. Possible values are:
  12884. @table @var
  12885. @item input
  12886. @item limited
  12887. @item full
  12888. @end table
  12889. Default is same as input.
  12890. @item primaries, p
  12891. Set the color primaries.
  12892. Possible values are:
  12893. @table @var
  12894. @item input
  12895. @item 709
  12896. @item unspecified
  12897. @item 170m
  12898. @item 240m
  12899. @item 2020
  12900. @end table
  12901. Default is same as input.
  12902. @item transfer, t
  12903. Set the transfer characteristics.
  12904. Possible values are:
  12905. @table @var
  12906. @item input
  12907. @item 709
  12908. @item unspecified
  12909. @item 601
  12910. @item linear
  12911. @item 2020_10
  12912. @item 2020_12
  12913. @item smpte2084
  12914. @item iec61966-2-1
  12915. @item arib-std-b67
  12916. @end table
  12917. Default is same as input.
  12918. @item matrix, m
  12919. Set the colorspace matrix.
  12920. Possible value are:
  12921. @table @var
  12922. @item input
  12923. @item 709
  12924. @item unspecified
  12925. @item 470bg
  12926. @item 170m
  12927. @item 2020_ncl
  12928. @item 2020_cl
  12929. @end table
  12930. Default is same as input.
  12931. @item rangein, rin
  12932. Set the input color range.
  12933. Possible values are:
  12934. @table @var
  12935. @item input
  12936. @item limited
  12937. @item full
  12938. @end table
  12939. Default is same as input.
  12940. @item primariesin, pin
  12941. Set the input color primaries.
  12942. Possible values are:
  12943. @table @var
  12944. @item input
  12945. @item 709
  12946. @item unspecified
  12947. @item 170m
  12948. @item 240m
  12949. @item 2020
  12950. @end table
  12951. Default is same as input.
  12952. @item transferin, tin
  12953. Set the input transfer characteristics.
  12954. Possible values are:
  12955. @table @var
  12956. @item input
  12957. @item 709
  12958. @item unspecified
  12959. @item 601
  12960. @item linear
  12961. @item 2020_10
  12962. @item 2020_12
  12963. @end table
  12964. Default is same as input.
  12965. @item matrixin, min
  12966. Set the input colorspace matrix.
  12967. Possible value are:
  12968. @table @var
  12969. @item input
  12970. @item 709
  12971. @item unspecified
  12972. @item 470bg
  12973. @item 170m
  12974. @item 2020_ncl
  12975. @item 2020_cl
  12976. @end table
  12977. @item chromal, c
  12978. Set the output chroma location.
  12979. Possible values are:
  12980. @table @var
  12981. @item input
  12982. @item left
  12983. @item center
  12984. @item topleft
  12985. @item top
  12986. @item bottomleft
  12987. @item bottom
  12988. @end table
  12989. @item chromalin, cin
  12990. Set the input chroma location.
  12991. Possible values are:
  12992. @table @var
  12993. @item input
  12994. @item left
  12995. @item center
  12996. @item topleft
  12997. @item top
  12998. @item bottomleft
  12999. @item bottom
  13000. @end table
  13001. @item npl
  13002. Set the nominal peak luminance.
  13003. @end table
  13004. The values of the @option{w} and @option{h} options are expressions
  13005. containing the following constants:
  13006. @table @var
  13007. @item in_w
  13008. @item in_h
  13009. The input width and height
  13010. @item iw
  13011. @item ih
  13012. These are the same as @var{in_w} and @var{in_h}.
  13013. @item out_w
  13014. @item out_h
  13015. The output (scaled) width and height
  13016. @item ow
  13017. @item oh
  13018. These are the same as @var{out_w} and @var{out_h}
  13019. @item a
  13020. The same as @var{iw} / @var{ih}
  13021. @item sar
  13022. input sample aspect ratio
  13023. @item dar
  13024. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  13025. @item hsub
  13026. @item vsub
  13027. horizontal and vertical input chroma subsample values. For example for the
  13028. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13029. @item ohsub
  13030. @item ovsub
  13031. horizontal and vertical output chroma subsample values. For example for the
  13032. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13033. @end table
  13034. @table @option
  13035. @end table
  13036. @c man end VIDEO FILTERS
  13037. @chapter Video Sources
  13038. @c man begin VIDEO SOURCES
  13039. Below is a description of the currently available video sources.
  13040. @section buffer
  13041. Buffer video frames, and make them available to the filter chain.
  13042. This source is mainly intended for a programmatic use, in particular
  13043. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  13044. It accepts the following parameters:
  13045. @table @option
  13046. @item video_size
  13047. Specify the size (width and height) of the buffered video frames. For the
  13048. syntax of this option, check the
  13049. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13050. @item width
  13051. The input video width.
  13052. @item height
  13053. The input video height.
  13054. @item pix_fmt
  13055. A string representing the pixel format of the buffered video frames.
  13056. It may be a number corresponding to a pixel format, or a pixel format
  13057. name.
  13058. @item time_base
  13059. Specify the timebase assumed by the timestamps of the buffered frames.
  13060. @item frame_rate
  13061. Specify the frame rate expected for the video stream.
  13062. @item pixel_aspect, sar
  13063. The sample (pixel) aspect ratio of the input video.
  13064. @item sws_param
  13065. Specify the optional parameters to be used for the scale filter which
  13066. is automatically inserted when an input change is detected in the
  13067. input size or format.
  13068. @item hw_frames_ctx
  13069. When using a hardware pixel format, this should be a reference to an
  13070. AVHWFramesContext describing input frames.
  13071. @end table
  13072. For example:
  13073. @example
  13074. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  13075. @end example
  13076. will instruct the source to accept video frames with size 320x240 and
  13077. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  13078. square pixels (1:1 sample aspect ratio).
  13079. Since the pixel format with name "yuv410p" corresponds to the number 6
  13080. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  13081. this example corresponds to:
  13082. @example
  13083. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  13084. @end example
  13085. Alternatively, the options can be specified as a flat string, but this
  13086. syntax is deprecated:
  13087. @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}]
  13088. @section cellauto
  13089. Create a pattern generated by an elementary cellular automaton.
  13090. The initial state of the cellular automaton can be defined through the
  13091. @option{filename} and @option{pattern} options. If such options are
  13092. not specified an initial state is created randomly.
  13093. At each new frame a new row in the video is filled with the result of
  13094. the cellular automaton next generation. The behavior when the whole
  13095. frame is filled is defined by the @option{scroll} option.
  13096. This source accepts the following options:
  13097. @table @option
  13098. @item filename, f
  13099. Read the initial cellular automaton state, i.e. the starting row, from
  13100. the specified file.
  13101. In the file, each non-whitespace character is considered an alive
  13102. cell, a newline will terminate the row, and further characters in the
  13103. file will be ignored.
  13104. @item pattern, p
  13105. Read the initial cellular automaton state, i.e. the starting row, from
  13106. the specified string.
  13107. Each non-whitespace character in the string is considered an alive
  13108. cell, a newline will terminate the row, and further characters in the
  13109. string will be ignored.
  13110. @item rate, r
  13111. Set the video rate, that is the number of frames generated per second.
  13112. Default is 25.
  13113. @item random_fill_ratio, ratio
  13114. Set the random fill ratio for the initial cellular automaton row. It
  13115. is a floating point number value ranging from 0 to 1, defaults to
  13116. 1/PHI.
  13117. This option is ignored when a file or a pattern is specified.
  13118. @item random_seed, seed
  13119. Set the seed for filling randomly the initial row, must be an integer
  13120. included between 0 and UINT32_MAX. If not specified, or if explicitly
  13121. set to -1, the filter will try to use a good random seed on a best
  13122. effort basis.
  13123. @item rule
  13124. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  13125. Default value is 110.
  13126. @item size, s
  13127. Set the size of the output video. For the syntax of this option, check the
  13128. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13129. If @option{filename} or @option{pattern} is specified, the size is set
  13130. by default to the width of the specified initial state row, and the
  13131. height is set to @var{width} * PHI.
  13132. If @option{size} is set, it must contain the width of the specified
  13133. pattern string, and the specified pattern will be centered in the
  13134. larger row.
  13135. If a filename or a pattern string is not specified, the size value
  13136. defaults to "320x518" (used for a randomly generated initial state).
  13137. @item scroll
  13138. If set to 1, scroll the output upward when all the rows in the output
  13139. have been already filled. If set to 0, the new generated row will be
  13140. written over the top row just after the bottom row is filled.
  13141. Defaults to 1.
  13142. @item start_full, full
  13143. If set to 1, completely fill the output with generated rows before
  13144. outputting the first frame.
  13145. This is the default behavior, for disabling set the value to 0.
  13146. @item stitch
  13147. If set to 1, stitch the left and right row edges together.
  13148. This is the default behavior, for disabling set the value to 0.
  13149. @end table
  13150. @subsection Examples
  13151. @itemize
  13152. @item
  13153. Read the initial state from @file{pattern}, and specify an output of
  13154. size 200x400.
  13155. @example
  13156. cellauto=f=pattern:s=200x400
  13157. @end example
  13158. @item
  13159. Generate a random initial row with a width of 200 cells, with a fill
  13160. ratio of 2/3:
  13161. @example
  13162. cellauto=ratio=2/3:s=200x200
  13163. @end example
  13164. @item
  13165. Create a pattern generated by rule 18 starting by a single alive cell
  13166. centered on an initial row with width 100:
  13167. @example
  13168. cellauto=p=@@:s=100x400:full=0:rule=18
  13169. @end example
  13170. @item
  13171. Specify a more elaborated initial pattern:
  13172. @example
  13173. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  13174. @end example
  13175. @end itemize
  13176. @anchor{coreimagesrc}
  13177. @section coreimagesrc
  13178. Video source generated on GPU using Apple's CoreImage API on OSX.
  13179. This video source is a specialized version of the @ref{coreimage} video filter.
  13180. Use a core image generator at the beginning of the applied filterchain to
  13181. generate the content.
  13182. The coreimagesrc video source accepts the following options:
  13183. @table @option
  13184. @item list_generators
  13185. List all available generators along with all their respective options as well as
  13186. possible minimum and maximum values along with the default values.
  13187. @example
  13188. list_generators=true
  13189. @end example
  13190. @item size, s
  13191. Specify the size of the sourced video. For the syntax of this option, check the
  13192. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13193. The default value is @code{320x240}.
  13194. @item rate, r
  13195. Specify the frame rate of the sourced video, as the number of frames
  13196. generated per second. It has to be a string in the format
  13197. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13198. number or a valid video frame rate abbreviation. The default value is
  13199. "25".
  13200. @item sar
  13201. Set the sample aspect ratio of the sourced video.
  13202. @item duration, d
  13203. Set the duration of the sourced video. See
  13204. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13205. for the accepted syntax.
  13206. If not specified, or the expressed duration is negative, the video is
  13207. supposed to be generated forever.
  13208. @end table
  13209. Additionally, all options of the @ref{coreimage} video filter are accepted.
  13210. A complete filterchain can be used for further processing of the
  13211. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  13212. and examples for details.
  13213. @subsection Examples
  13214. @itemize
  13215. @item
  13216. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  13217. given as complete and escaped command-line for Apple's standard bash shell:
  13218. @example
  13219. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  13220. @end example
  13221. This example is equivalent to the QRCode example of @ref{coreimage} without the
  13222. need for a nullsrc video source.
  13223. @end itemize
  13224. @section mandelbrot
  13225. Generate a Mandelbrot set fractal, and progressively zoom towards the
  13226. point specified with @var{start_x} and @var{start_y}.
  13227. This source accepts the following options:
  13228. @table @option
  13229. @item end_pts
  13230. Set the terminal pts value. Default value is 400.
  13231. @item end_scale
  13232. Set the terminal scale value.
  13233. Must be a floating point value. Default value is 0.3.
  13234. @item inner
  13235. Set the inner coloring mode, that is the algorithm used to draw the
  13236. Mandelbrot fractal internal region.
  13237. It shall assume one of the following values:
  13238. @table @option
  13239. @item black
  13240. Set black mode.
  13241. @item convergence
  13242. Show time until convergence.
  13243. @item mincol
  13244. Set color based on point closest to the origin of the iterations.
  13245. @item period
  13246. Set period mode.
  13247. @end table
  13248. Default value is @var{mincol}.
  13249. @item bailout
  13250. Set the bailout value. Default value is 10.0.
  13251. @item maxiter
  13252. Set the maximum of iterations performed by the rendering
  13253. algorithm. Default value is 7189.
  13254. @item outer
  13255. Set outer coloring mode.
  13256. It shall assume one of following values:
  13257. @table @option
  13258. @item iteration_count
  13259. Set iteration cound mode.
  13260. @item normalized_iteration_count
  13261. set normalized iteration count mode.
  13262. @end table
  13263. Default value is @var{normalized_iteration_count}.
  13264. @item rate, r
  13265. Set frame rate, expressed as number of frames per second. Default
  13266. value is "25".
  13267. @item size, s
  13268. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  13269. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  13270. @item start_scale
  13271. Set the initial scale value. Default value is 3.0.
  13272. @item start_x
  13273. Set the initial x position. Must be a floating point value between
  13274. -100 and 100. Default value is -0.743643887037158704752191506114774.
  13275. @item start_y
  13276. Set the initial y position. Must be a floating point value between
  13277. -100 and 100. Default value is -0.131825904205311970493132056385139.
  13278. @end table
  13279. @section mptestsrc
  13280. Generate various test patterns, as generated by the MPlayer test filter.
  13281. The size of the generated video is fixed, and is 256x256.
  13282. This source is useful in particular for testing encoding features.
  13283. This source accepts the following options:
  13284. @table @option
  13285. @item rate, r
  13286. Specify the frame rate of the sourced video, as the number of frames
  13287. generated per second. It has to be a string in the format
  13288. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13289. number or a valid video frame rate abbreviation. The default value is
  13290. "25".
  13291. @item duration, d
  13292. Set the duration of the sourced video. See
  13293. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13294. for the accepted syntax.
  13295. If not specified, or the expressed duration is negative, the video is
  13296. supposed to be generated forever.
  13297. @item test, t
  13298. Set the number or the name of the test to perform. Supported tests are:
  13299. @table @option
  13300. @item dc_luma
  13301. @item dc_chroma
  13302. @item freq_luma
  13303. @item freq_chroma
  13304. @item amp_luma
  13305. @item amp_chroma
  13306. @item cbp
  13307. @item mv
  13308. @item ring1
  13309. @item ring2
  13310. @item all
  13311. @end table
  13312. Default value is "all", which will cycle through the list of all tests.
  13313. @end table
  13314. Some examples:
  13315. @example
  13316. mptestsrc=t=dc_luma
  13317. @end example
  13318. will generate a "dc_luma" test pattern.
  13319. @section frei0r_src
  13320. Provide a frei0r source.
  13321. To enable compilation of this filter you need to install the frei0r
  13322. header and configure FFmpeg with @code{--enable-frei0r}.
  13323. This source accepts the following parameters:
  13324. @table @option
  13325. @item size
  13326. The size of the video to generate. For the syntax of this option, check the
  13327. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13328. @item framerate
  13329. The framerate of the generated video. It may be a string of the form
  13330. @var{num}/@var{den} or a frame rate abbreviation.
  13331. @item filter_name
  13332. The name to the frei0r source to load. For more information regarding frei0r and
  13333. how to set the parameters, read the @ref{frei0r} section in the video filters
  13334. documentation.
  13335. @item filter_params
  13336. A '|'-separated list of parameters to pass to the frei0r source.
  13337. @end table
  13338. For example, to generate a frei0r partik0l source with size 200x200
  13339. and frame rate 10 which is overlaid on the overlay filter main input:
  13340. @example
  13341. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  13342. @end example
  13343. @section life
  13344. Generate a life pattern.
  13345. This source is based on a generalization of John Conway's life game.
  13346. The sourced input represents a life grid, each pixel represents a cell
  13347. which can be in one of two possible states, alive or dead. Every cell
  13348. interacts with its eight neighbours, which are the cells that are
  13349. horizontally, vertically, or diagonally adjacent.
  13350. At each interaction the grid evolves according to the adopted rule,
  13351. which specifies the number of neighbor alive cells which will make a
  13352. cell stay alive or born. The @option{rule} option allows one to specify
  13353. the rule to adopt.
  13354. This source accepts the following options:
  13355. @table @option
  13356. @item filename, f
  13357. Set the file from which to read the initial grid state. In the file,
  13358. each non-whitespace character is considered an alive cell, and newline
  13359. is used to delimit the end of each row.
  13360. If this option is not specified, the initial grid is generated
  13361. randomly.
  13362. @item rate, r
  13363. Set the video rate, that is the number of frames generated per second.
  13364. Default is 25.
  13365. @item random_fill_ratio, ratio
  13366. Set the random fill ratio for the initial random grid. It is a
  13367. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  13368. It is ignored when a file is specified.
  13369. @item random_seed, seed
  13370. Set the seed for filling the initial random grid, must be an integer
  13371. included between 0 and UINT32_MAX. If not specified, or if explicitly
  13372. set to -1, the filter will try to use a good random seed on a best
  13373. effort basis.
  13374. @item rule
  13375. Set the life rule.
  13376. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  13377. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  13378. @var{NS} specifies the number of alive neighbor cells which make a
  13379. live cell stay alive, and @var{NB} the number of alive neighbor cells
  13380. which make a dead cell to become alive (i.e. to "born").
  13381. "s" and "b" can be used in place of "S" and "B", respectively.
  13382. Alternatively a rule can be specified by an 18-bits integer. The 9
  13383. high order bits are used to encode the next cell state if it is alive
  13384. for each number of neighbor alive cells, the low order bits specify
  13385. the rule for "borning" new cells. Higher order bits encode for an
  13386. higher number of neighbor cells.
  13387. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  13388. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  13389. Default value is "S23/B3", which is the original Conway's game of life
  13390. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  13391. cells, and will born a new cell if there are three alive cells around
  13392. a dead cell.
  13393. @item size, s
  13394. Set the size of the output video. For the syntax of this option, check the
  13395. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13396. If @option{filename} is specified, the size is set by default to the
  13397. same size of the input file. If @option{size} is set, it must contain
  13398. the size specified in the input file, and the initial grid defined in
  13399. that file is centered in the larger resulting area.
  13400. If a filename is not specified, the size value defaults to "320x240"
  13401. (used for a randomly generated initial grid).
  13402. @item stitch
  13403. If set to 1, stitch the left and right grid edges together, and the
  13404. top and bottom edges also. Defaults to 1.
  13405. @item mold
  13406. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  13407. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  13408. value from 0 to 255.
  13409. @item life_color
  13410. Set the color of living (or new born) cells.
  13411. @item death_color
  13412. Set the color of dead cells. If @option{mold} is set, this is the first color
  13413. used to represent a dead cell.
  13414. @item mold_color
  13415. Set mold color, for definitely dead and moldy cells.
  13416. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  13417. ffmpeg-utils manual,ffmpeg-utils}.
  13418. @end table
  13419. @subsection Examples
  13420. @itemize
  13421. @item
  13422. Read a grid from @file{pattern}, and center it on a grid of size
  13423. 300x300 pixels:
  13424. @example
  13425. life=f=pattern:s=300x300
  13426. @end example
  13427. @item
  13428. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  13429. @example
  13430. life=ratio=2/3:s=200x200
  13431. @end example
  13432. @item
  13433. Specify a custom rule for evolving a randomly generated grid:
  13434. @example
  13435. life=rule=S14/B34
  13436. @end example
  13437. @item
  13438. Full example with slow death effect (mold) using @command{ffplay}:
  13439. @example
  13440. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  13441. @end example
  13442. @end itemize
  13443. @anchor{allrgb}
  13444. @anchor{allyuv}
  13445. @anchor{color}
  13446. @anchor{haldclutsrc}
  13447. @anchor{nullsrc}
  13448. @anchor{rgbtestsrc}
  13449. @anchor{smptebars}
  13450. @anchor{smptehdbars}
  13451. @anchor{testsrc}
  13452. @anchor{testsrc2}
  13453. @anchor{yuvtestsrc}
  13454. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  13455. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  13456. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  13457. The @code{color} source provides an uniformly colored input.
  13458. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  13459. @ref{haldclut} filter.
  13460. The @code{nullsrc} source returns unprocessed video frames. It is
  13461. mainly useful to be employed in analysis / debugging tools, or as the
  13462. source for filters which ignore the input data.
  13463. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  13464. detecting RGB vs BGR issues. You should see a red, green and blue
  13465. stripe from top to bottom.
  13466. The @code{smptebars} source generates a color bars pattern, based on
  13467. the SMPTE Engineering Guideline EG 1-1990.
  13468. The @code{smptehdbars} source generates a color bars pattern, based on
  13469. the SMPTE RP 219-2002.
  13470. The @code{testsrc} source generates a test video pattern, showing a
  13471. color pattern, a scrolling gradient and a timestamp. This is mainly
  13472. intended for testing purposes.
  13473. The @code{testsrc2} source is similar to testsrc, but supports more
  13474. pixel formats instead of just @code{rgb24}. This allows using it as an
  13475. input for other tests without requiring a format conversion.
  13476. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  13477. see a y, cb and cr stripe from top to bottom.
  13478. The sources accept the following parameters:
  13479. @table @option
  13480. @item level
  13481. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  13482. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  13483. pixels to be used as identity matrix for 3D lookup tables. Each component is
  13484. coded on a @code{1/(N*N)} scale.
  13485. @item color, c
  13486. Specify the color of the source, only available in the @code{color}
  13487. source. For the syntax of this option, check the
  13488. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13489. @item size, s
  13490. Specify the size of the sourced video. For the syntax of this option, check the
  13491. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13492. The default value is @code{320x240}.
  13493. This option is not available with the @code{allrgb}, @code{allyuv}, and
  13494. @code{haldclutsrc} filters.
  13495. @item rate, r
  13496. Specify the frame rate of the sourced video, as the number of frames
  13497. generated per second. It has to be a string in the format
  13498. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13499. number or a valid video frame rate abbreviation. The default value is
  13500. "25".
  13501. @item duration, d
  13502. Set the duration of the sourced video. See
  13503. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13504. for the accepted syntax.
  13505. If not specified, or the expressed duration is negative, the video is
  13506. supposed to be generated forever.
  13507. @item sar
  13508. Set the sample aspect ratio of the sourced video.
  13509. @item alpha
  13510. Specify the alpha (opacity) of the background, only available in the
  13511. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  13512. 255 (fully opaque, the default).
  13513. @item decimals, n
  13514. Set the number of decimals to show in the timestamp, only available in the
  13515. @code{testsrc} source.
  13516. The displayed timestamp value will correspond to the original
  13517. timestamp value multiplied by the power of 10 of the specified
  13518. value. Default value is 0.
  13519. @end table
  13520. @subsection Examples
  13521. @itemize
  13522. @item
  13523. Generate a video with a duration of 5.3 seconds, with size
  13524. 176x144 and a frame rate of 10 frames per second:
  13525. @example
  13526. testsrc=duration=5.3:size=qcif:rate=10
  13527. @end example
  13528. @item
  13529. The following graph description will generate a red source
  13530. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  13531. frames per second:
  13532. @example
  13533. color=c=red@@0.2:s=qcif:r=10
  13534. @end example
  13535. @item
  13536. If the input content is to be ignored, @code{nullsrc} can be used. The
  13537. following command generates noise in the luminance plane by employing
  13538. the @code{geq} filter:
  13539. @example
  13540. nullsrc=s=256x256, geq=random(1)*255:128:128
  13541. @end example
  13542. @end itemize
  13543. @subsection Commands
  13544. The @code{color} source supports the following commands:
  13545. @table @option
  13546. @item c, color
  13547. Set the color of the created image. Accepts the same syntax of the
  13548. corresponding @option{color} option.
  13549. @end table
  13550. @section openclsrc
  13551. Generate video using an OpenCL program.
  13552. @table @option
  13553. @item source
  13554. OpenCL program source file.
  13555. @item kernel
  13556. Kernel name in program.
  13557. @item size, s
  13558. Size of frames to generate. This must be set.
  13559. @item format
  13560. Pixel format to use for the generated frames. This must be set.
  13561. @item rate, r
  13562. Number of frames generated every second. Default value is '25'.
  13563. @end table
  13564. For details of how the program loading works, see the @ref{program_opencl}
  13565. filter.
  13566. Example programs:
  13567. @itemize
  13568. @item
  13569. Generate a colour ramp by setting pixel values from the position of the pixel
  13570. in the output image. (Note that this will work with all pixel formats, but
  13571. the generated output will not be the same.)
  13572. @verbatim
  13573. __kernel void ramp(__write_only image2d_t dst,
  13574. unsigned int index)
  13575. {
  13576. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  13577. float4 val;
  13578. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  13579. write_imagef(dst, loc, val);
  13580. }
  13581. @end verbatim
  13582. @item
  13583. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  13584. @verbatim
  13585. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  13586. unsigned int index)
  13587. {
  13588. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  13589. float4 value = 0.0f;
  13590. int x = loc.x + index;
  13591. int y = loc.y + index;
  13592. while (x > 0 || y > 0) {
  13593. if (x % 3 == 1 && y % 3 == 1) {
  13594. value = 1.0f;
  13595. break;
  13596. }
  13597. x /= 3;
  13598. y /= 3;
  13599. }
  13600. write_imagef(dst, loc, value);
  13601. }
  13602. @end verbatim
  13603. @end itemize
  13604. @c man end VIDEO SOURCES
  13605. @chapter Video Sinks
  13606. @c man begin VIDEO SINKS
  13607. Below is a description of the currently available video sinks.
  13608. @section buffersink
  13609. Buffer video frames, and make them available to the end of the filter
  13610. graph.
  13611. This sink is mainly intended for programmatic use, in particular
  13612. through the interface defined in @file{libavfilter/buffersink.h}
  13613. or the options system.
  13614. It accepts a pointer to an AVBufferSinkContext structure, which
  13615. defines the incoming buffers' formats, to be passed as the opaque
  13616. parameter to @code{avfilter_init_filter} for initialization.
  13617. @section nullsink
  13618. Null video sink: do absolutely nothing with the input video. It is
  13619. mainly useful as a template and for use in analysis / debugging
  13620. tools.
  13621. @c man end VIDEO SINKS
  13622. @chapter Multimedia Filters
  13623. @c man begin MULTIMEDIA FILTERS
  13624. Below is a description of the currently available multimedia filters.
  13625. @section abitscope
  13626. Convert input audio to a video output, displaying the audio bit scope.
  13627. The filter accepts the following options:
  13628. @table @option
  13629. @item rate, r
  13630. Set frame rate, expressed as number of frames per second. Default
  13631. value is "25".
  13632. @item size, s
  13633. Specify the video size for the output. For the syntax of this option, check the
  13634. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13635. Default value is @code{1024x256}.
  13636. @item colors
  13637. Specify list of colors separated by space or by '|' which will be used to
  13638. draw channels. Unrecognized or missing colors will be replaced
  13639. by white color.
  13640. @end table
  13641. @section ahistogram
  13642. Convert input audio to a video output, displaying the volume histogram.
  13643. The filter accepts the following options:
  13644. @table @option
  13645. @item dmode
  13646. Specify how histogram is calculated.
  13647. It accepts the following values:
  13648. @table @samp
  13649. @item single
  13650. Use single histogram for all channels.
  13651. @item separate
  13652. Use separate histogram for each channel.
  13653. @end table
  13654. Default is @code{single}.
  13655. @item rate, r
  13656. Set frame rate, expressed as number of frames per second. Default
  13657. value is "25".
  13658. @item size, s
  13659. Specify the video size for the output. For the syntax of this option, check the
  13660. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13661. Default value is @code{hd720}.
  13662. @item scale
  13663. Set display scale.
  13664. It accepts the following values:
  13665. @table @samp
  13666. @item log
  13667. logarithmic
  13668. @item sqrt
  13669. square root
  13670. @item cbrt
  13671. cubic root
  13672. @item lin
  13673. linear
  13674. @item rlog
  13675. reverse logarithmic
  13676. @end table
  13677. Default is @code{log}.
  13678. @item ascale
  13679. Set amplitude scale.
  13680. It accepts the following values:
  13681. @table @samp
  13682. @item log
  13683. logarithmic
  13684. @item lin
  13685. linear
  13686. @end table
  13687. Default is @code{log}.
  13688. @item acount
  13689. Set how much frames to accumulate in histogram.
  13690. Defauls is 1. Setting this to -1 accumulates all frames.
  13691. @item rheight
  13692. Set histogram ratio of window height.
  13693. @item slide
  13694. Set sonogram sliding.
  13695. It accepts the following values:
  13696. @table @samp
  13697. @item replace
  13698. replace old rows with new ones.
  13699. @item scroll
  13700. scroll from top to bottom.
  13701. @end table
  13702. Default is @code{replace}.
  13703. @end table
  13704. @section aphasemeter
  13705. Convert input audio to a video output, displaying the audio phase.
  13706. The filter accepts the following options:
  13707. @table @option
  13708. @item rate, r
  13709. Set the output frame rate. Default value is @code{25}.
  13710. @item size, s
  13711. Set the video size for the output. For the syntax of this option, check the
  13712. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13713. Default value is @code{800x400}.
  13714. @item rc
  13715. @item gc
  13716. @item bc
  13717. Specify the red, green, blue contrast. Default values are @code{2},
  13718. @code{7} and @code{1}.
  13719. Allowed range is @code{[0, 255]}.
  13720. @item mpc
  13721. Set color which will be used for drawing median phase. If color is
  13722. @code{none} which is default, no median phase value will be drawn.
  13723. @item video
  13724. Enable video output. Default is enabled.
  13725. @end table
  13726. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  13727. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  13728. The @code{-1} means left and right channels are completely out of phase and
  13729. @code{1} means channels are in phase.
  13730. @section avectorscope
  13731. Convert input audio to a video output, representing the audio vector
  13732. scope.
  13733. The filter is used to measure the difference between channels of stereo
  13734. audio stream. A monoaural signal, consisting of identical left and right
  13735. signal, results in straight vertical line. Any stereo separation is visible
  13736. as a deviation from this line, creating a Lissajous figure.
  13737. If the straight (or deviation from it) but horizontal line appears this
  13738. indicates that the left and right channels are out of phase.
  13739. The filter accepts the following options:
  13740. @table @option
  13741. @item mode, m
  13742. Set the vectorscope mode.
  13743. Available values are:
  13744. @table @samp
  13745. @item lissajous
  13746. Lissajous rotated by 45 degrees.
  13747. @item lissajous_xy
  13748. Same as above but not rotated.
  13749. @item polar
  13750. Shape resembling half of circle.
  13751. @end table
  13752. Default value is @samp{lissajous}.
  13753. @item size, s
  13754. Set the video size for the output. For the syntax of this option, check the
  13755. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13756. Default value is @code{400x400}.
  13757. @item rate, r
  13758. Set the output frame rate. Default value is @code{25}.
  13759. @item rc
  13760. @item gc
  13761. @item bc
  13762. @item ac
  13763. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  13764. @code{160}, @code{80} and @code{255}.
  13765. Allowed range is @code{[0, 255]}.
  13766. @item rf
  13767. @item gf
  13768. @item bf
  13769. @item af
  13770. Specify the red, green, blue and alpha fade. Default values are @code{15},
  13771. @code{10}, @code{5} and @code{5}.
  13772. Allowed range is @code{[0, 255]}.
  13773. @item zoom
  13774. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  13775. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  13776. @item draw
  13777. Set the vectorscope drawing mode.
  13778. Available values are:
  13779. @table @samp
  13780. @item dot
  13781. Draw dot for each sample.
  13782. @item line
  13783. Draw line between previous and current sample.
  13784. @end table
  13785. Default value is @samp{dot}.
  13786. @item scale
  13787. Specify amplitude scale of audio samples.
  13788. Available values are:
  13789. @table @samp
  13790. @item lin
  13791. Linear.
  13792. @item sqrt
  13793. Square root.
  13794. @item cbrt
  13795. Cubic root.
  13796. @item log
  13797. Logarithmic.
  13798. @end table
  13799. @item swap
  13800. Swap left channel axis with right channel axis.
  13801. @item mirror
  13802. Mirror axis.
  13803. @table @samp
  13804. @item none
  13805. No mirror.
  13806. @item x
  13807. Mirror only x axis.
  13808. @item y
  13809. Mirror only y axis.
  13810. @item xy
  13811. Mirror both axis.
  13812. @end table
  13813. @end table
  13814. @subsection Examples
  13815. @itemize
  13816. @item
  13817. Complete example using @command{ffplay}:
  13818. @example
  13819. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  13820. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  13821. @end example
  13822. @end itemize
  13823. @section bench, abench
  13824. Benchmark part of a filtergraph.
  13825. The filter accepts the following options:
  13826. @table @option
  13827. @item action
  13828. Start or stop a timer.
  13829. Available values are:
  13830. @table @samp
  13831. @item start
  13832. Get the current time, set it as frame metadata (using the key
  13833. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  13834. @item stop
  13835. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  13836. the input frame metadata to get the time difference. Time difference, average,
  13837. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  13838. @code{min}) are then printed. The timestamps are expressed in seconds.
  13839. @end table
  13840. @end table
  13841. @subsection Examples
  13842. @itemize
  13843. @item
  13844. Benchmark @ref{selectivecolor} filter:
  13845. @example
  13846. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  13847. @end example
  13848. @end itemize
  13849. @section concat
  13850. Concatenate audio and video streams, joining them together one after the
  13851. other.
  13852. The filter works on segments of synchronized video and audio streams. All
  13853. segments must have the same number of streams of each type, and that will
  13854. also be the number of streams at output.
  13855. The filter accepts the following options:
  13856. @table @option
  13857. @item n
  13858. Set the number of segments. Default is 2.
  13859. @item v
  13860. Set the number of output video streams, that is also the number of video
  13861. streams in each segment. Default is 1.
  13862. @item a
  13863. Set the number of output audio streams, that is also the number of audio
  13864. streams in each segment. Default is 0.
  13865. @item unsafe
  13866. Activate unsafe mode: do not fail if segments have a different format.
  13867. @end table
  13868. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  13869. @var{a} audio outputs.
  13870. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  13871. segment, in the same order as the outputs, then the inputs for the second
  13872. segment, etc.
  13873. Related streams do not always have exactly the same duration, for various
  13874. reasons including codec frame size or sloppy authoring. For that reason,
  13875. related synchronized streams (e.g. a video and its audio track) should be
  13876. concatenated at once. The concat filter will use the duration of the longest
  13877. stream in each segment (except the last one), and if necessary pad shorter
  13878. audio streams with silence.
  13879. For this filter to work correctly, all segments must start at timestamp 0.
  13880. All corresponding streams must have the same parameters in all segments; the
  13881. filtering system will automatically select a common pixel format for video
  13882. streams, and a common sample format, sample rate and channel layout for
  13883. audio streams, but other settings, such as resolution, must be converted
  13884. explicitly by the user.
  13885. Different frame rates are acceptable but will result in variable frame rate
  13886. at output; be sure to configure the output file to handle it.
  13887. @subsection Examples
  13888. @itemize
  13889. @item
  13890. Concatenate an opening, an episode and an ending, all in bilingual version
  13891. (video in stream 0, audio in streams 1 and 2):
  13892. @example
  13893. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  13894. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  13895. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  13896. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  13897. @end example
  13898. @item
  13899. Concatenate two parts, handling audio and video separately, using the
  13900. (a)movie sources, and adjusting the resolution:
  13901. @example
  13902. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  13903. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  13904. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  13905. @end example
  13906. Note that a desync will happen at the stitch if the audio and video streams
  13907. do not have exactly the same duration in the first file.
  13908. @end itemize
  13909. @subsection Commands
  13910. This filter supports the following commands:
  13911. @table @option
  13912. @item next
  13913. Close the current segment and step to the next one
  13914. @end table
  13915. @section drawgraph, adrawgraph
  13916. Draw a graph using input video or audio metadata.
  13917. It accepts the following parameters:
  13918. @table @option
  13919. @item m1
  13920. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  13921. @item fg1
  13922. Set 1st foreground color expression.
  13923. @item m2
  13924. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  13925. @item fg2
  13926. Set 2nd foreground color expression.
  13927. @item m3
  13928. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  13929. @item fg3
  13930. Set 3rd foreground color expression.
  13931. @item m4
  13932. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  13933. @item fg4
  13934. Set 4th foreground color expression.
  13935. @item min
  13936. Set minimal value of metadata value.
  13937. @item max
  13938. Set maximal value of metadata value.
  13939. @item bg
  13940. Set graph background color. Default is white.
  13941. @item mode
  13942. Set graph mode.
  13943. Available values for mode is:
  13944. @table @samp
  13945. @item bar
  13946. @item dot
  13947. @item line
  13948. @end table
  13949. Default is @code{line}.
  13950. @item slide
  13951. Set slide mode.
  13952. Available values for slide is:
  13953. @table @samp
  13954. @item frame
  13955. Draw new frame when right border is reached.
  13956. @item replace
  13957. Replace old columns with new ones.
  13958. @item scroll
  13959. Scroll from right to left.
  13960. @item rscroll
  13961. Scroll from left to right.
  13962. @item picture
  13963. Draw single picture.
  13964. @end table
  13965. Default is @code{frame}.
  13966. @item size
  13967. Set size of graph video. For the syntax of this option, check the
  13968. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13969. The default value is @code{900x256}.
  13970. The foreground color expressions can use the following variables:
  13971. @table @option
  13972. @item MIN
  13973. Minimal value of metadata value.
  13974. @item MAX
  13975. Maximal value of metadata value.
  13976. @item VAL
  13977. Current metadata key value.
  13978. @end table
  13979. The color is defined as 0xAABBGGRR.
  13980. @end table
  13981. Example using metadata from @ref{signalstats} filter:
  13982. @example
  13983. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  13984. @end example
  13985. Example using metadata from @ref{ebur128} filter:
  13986. @example
  13987. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  13988. @end example
  13989. @anchor{ebur128}
  13990. @section ebur128
  13991. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  13992. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  13993. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  13994. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  13995. The filter also has a video output (see the @var{video} option) with a real
  13996. time graph to observe the loudness evolution. The graphic contains the logged
  13997. message mentioned above, so it is not printed anymore when this option is set,
  13998. unless the verbose logging is set. The main graphing area contains the
  13999. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  14000. the momentary loudness (400 milliseconds).
  14001. More information about the Loudness Recommendation EBU R128 on
  14002. @url{http://tech.ebu.ch/loudness}.
  14003. The filter accepts the following options:
  14004. @table @option
  14005. @item video
  14006. Activate the video output. The audio stream is passed unchanged whether this
  14007. option is set or no. The video stream will be the first output stream if
  14008. activated. Default is @code{0}.
  14009. @item size
  14010. Set the video size. This option is for video only. For the syntax of this
  14011. option, check the
  14012. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14013. Default and minimum resolution is @code{640x480}.
  14014. @item meter
  14015. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  14016. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  14017. other integer value between this range is allowed.
  14018. @item metadata
  14019. Set metadata injection. If set to @code{1}, the audio input will be segmented
  14020. into 100ms output frames, each of them containing various loudness information
  14021. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  14022. Default is @code{0}.
  14023. @item framelog
  14024. Force the frame logging level.
  14025. Available values are:
  14026. @table @samp
  14027. @item info
  14028. information logging level
  14029. @item verbose
  14030. verbose logging level
  14031. @end table
  14032. By default, the logging level is set to @var{info}. If the @option{video} or
  14033. the @option{metadata} options are set, it switches to @var{verbose}.
  14034. @item peak
  14035. Set peak mode(s).
  14036. Available modes can be cumulated (the option is a @code{flag} type). Possible
  14037. values are:
  14038. @table @samp
  14039. @item none
  14040. Disable any peak mode (default).
  14041. @item sample
  14042. Enable sample-peak mode.
  14043. Simple peak mode looking for the higher sample value. It logs a message
  14044. for sample-peak (identified by @code{SPK}).
  14045. @item true
  14046. Enable true-peak mode.
  14047. If enabled, the peak lookup is done on an over-sampled version of the input
  14048. stream for better peak accuracy. It logs a message for true-peak.
  14049. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  14050. This mode requires a build with @code{libswresample}.
  14051. @end table
  14052. @item dualmono
  14053. Treat mono input files as "dual mono". If a mono file is intended for playback
  14054. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  14055. If set to @code{true}, this option will compensate for this effect.
  14056. Multi-channel input files are not affected by this option.
  14057. @item panlaw
  14058. Set a specific pan law to be used for the measurement of dual mono files.
  14059. This parameter is optional, and has a default value of -3.01dB.
  14060. @end table
  14061. @subsection Examples
  14062. @itemize
  14063. @item
  14064. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  14065. @example
  14066. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  14067. @end example
  14068. @item
  14069. Run an analysis with @command{ffmpeg}:
  14070. @example
  14071. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  14072. @end example
  14073. @end itemize
  14074. @section interleave, ainterleave
  14075. Temporally interleave frames from several inputs.
  14076. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  14077. These filters read frames from several inputs and send the oldest
  14078. queued frame to the output.
  14079. Input streams must have well defined, monotonically increasing frame
  14080. timestamp values.
  14081. In order to submit one frame to output, these filters need to enqueue
  14082. at least one frame for each input, so they cannot work in case one
  14083. input is not yet terminated and will not receive incoming frames.
  14084. For example consider the case when one input is a @code{select} filter
  14085. which always drops input frames. The @code{interleave} filter will keep
  14086. reading from that input, but it will never be able to send new frames
  14087. to output until the input sends an end-of-stream signal.
  14088. Also, depending on inputs synchronization, the filters will drop
  14089. frames in case one input receives more frames than the other ones, and
  14090. the queue is already filled.
  14091. These filters accept the following options:
  14092. @table @option
  14093. @item nb_inputs, n
  14094. Set the number of different inputs, it is 2 by default.
  14095. @end table
  14096. @subsection Examples
  14097. @itemize
  14098. @item
  14099. Interleave frames belonging to different streams using @command{ffmpeg}:
  14100. @example
  14101. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  14102. @end example
  14103. @item
  14104. Add flickering blur effect:
  14105. @example
  14106. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  14107. @end example
  14108. @end itemize
  14109. @section metadata, ametadata
  14110. Manipulate frame metadata.
  14111. This filter accepts the following options:
  14112. @table @option
  14113. @item mode
  14114. Set mode of operation of the filter.
  14115. Can be one of the following:
  14116. @table @samp
  14117. @item select
  14118. If both @code{value} and @code{key} is set, select frames
  14119. which have such metadata. If only @code{key} is set, select
  14120. every frame that has such key in metadata.
  14121. @item add
  14122. Add new metadata @code{key} and @code{value}. If key is already available
  14123. do nothing.
  14124. @item modify
  14125. Modify value of already present key.
  14126. @item delete
  14127. If @code{value} is set, delete only keys that have such value.
  14128. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  14129. the frame.
  14130. @item print
  14131. Print key and its value if metadata was found. If @code{key} is not set print all
  14132. metadata values available in frame.
  14133. @end table
  14134. @item key
  14135. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  14136. @item value
  14137. Set metadata value which will be used. This option is mandatory for
  14138. @code{modify} and @code{add} mode.
  14139. @item function
  14140. Which function to use when comparing metadata value and @code{value}.
  14141. Can be one of following:
  14142. @table @samp
  14143. @item same_str
  14144. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  14145. @item starts_with
  14146. Values are interpreted as strings, returns true if metadata value starts with
  14147. the @code{value} option string.
  14148. @item less
  14149. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  14150. @item equal
  14151. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  14152. @item greater
  14153. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  14154. @item expr
  14155. Values are interpreted as floats, returns true if expression from option @code{expr}
  14156. evaluates to true.
  14157. @end table
  14158. @item expr
  14159. Set expression which is used when @code{function} is set to @code{expr}.
  14160. The expression is evaluated through the eval API and can contain the following
  14161. constants:
  14162. @table @option
  14163. @item VALUE1
  14164. Float representation of @code{value} from metadata key.
  14165. @item VALUE2
  14166. Float representation of @code{value} as supplied by user in @code{value} option.
  14167. @end table
  14168. @item file
  14169. If specified in @code{print} mode, output is written to the named file. Instead of
  14170. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  14171. for standard output. If @code{file} option is not set, output is written to the log
  14172. with AV_LOG_INFO loglevel.
  14173. @end table
  14174. @subsection Examples
  14175. @itemize
  14176. @item
  14177. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  14178. between 0 and 1.
  14179. @example
  14180. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  14181. @end example
  14182. @item
  14183. Print silencedetect output to file @file{metadata.txt}.
  14184. @example
  14185. silencedetect,ametadata=mode=print:file=metadata.txt
  14186. @end example
  14187. @item
  14188. Direct all metadata to a pipe with file descriptor 4.
  14189. @example
  14190. metadata=mode=print:file='pipe\:4'
  14191. @end example
  14192. @end itemize
  14193. @section perms, aperms
  14194. Set read/write permissions for the output frames.
  14195. These filters are mainly aimed at developers to test direct path in the
  14196. following filter in the filtergraph.
  14197. The filters accept the following options:
  14198. @table @option
  14199. @item mode
  14200. Select the permissions mode.
  14201. It accepts the following values:
  14202. @table @samp
  14203. @item none
  14204. Do nothing. This is the default.
  14205. @item ro
  14206. Set all the output frames read-only.
  14207. @item rw
  14208. Set all the output frames directly writable.
  14209. @item toggle
  14210. Make the frame read-only if writable, and writable if read-only.
  14211. @item random
  14212. Set each output frame read-only or writable randomly.
  14213. @end table
  14214. @item seed
  14215. Set the seed for the @var{random} mode, must be an integer included between
  14216. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  14217. @code{-1}, the filter will try to use a good random seed on a best effort
  14218. basis.
  14219. @end table
  14220. Note: in case of auto-inserted filter between the permission filter and the
  14221. following one, the permission might not be received as expected in that
  14222. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  14223. perms/aperms filter can avoid this problem.
  14224. @section realtime, arealtime
  14225. Slow down filtering to match real time approximately.
  14226. These filters will pause the filtering for a variable amount of time to
  14227. match the output rate with the input timestamps.
  14228. They are similar to the @option{re} option to @code{ffmpeg}.
  14229. They accept the following options:
  14230. @table @option
  14231. @item limit
  14232. Time limit for the pauses. Any pause longer than that will be considered
  14233. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  14234. @end table
  14235. @anchor{select}
  14236. @section select, aselect
  14237. Select frames to pass in output.
  14238. This filter accepts the following options:
  14239. @table @option
  14240. @item expr, e
  14241. Set expression, which is evaluated for each input frame.
  14242. If the expression is evaluated to zero, the frame is discarded.
  14243. If the evaluation result is negative or NaN, the frame is sent to the
  14244. first output; otherwise it is sent to the output with index
  14245. @code{ceil(val)-1}, assuming that the input index starts from 0.
  14246. For example a value of @code{1.2} corresponds to the output with index
  14247. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  14248. @item outputs, n
  14249. Set the number of outputs. The output to which to send the selected
  14250. frame is based on the result of the evaluation. Default value is 1.
  14251. @end table
  14252. The expression can contain the following constants:
  14253. @table @option
  14254. @item n
  14255. The (sequential) number of the filtered frame, starting from 0.
  14256. @item selected_n
  14257. The (sequential) number of the selected frame, starting from 0.
  14258. @item prev_selected_n
  14259. The sequential number of the last selected frame. It's NAN if undefined.
  14260. @item TB
  14261. The timebase of the input timestamps.
  14262. @item pts
  14263. The PTS (Presentation TimeStamp) of the filtered video frame,
  14264. expressed in @var{TB} units. It's NAN if undefined.
  14265. @item t
  14266. The PTS of the filtered video frame,
  14267. expressed in seconds. It's NAN if undefined.
  14268. @item prev_pts
  14269. The PTS of the previously filtered video frame. It's NAN if undefined.
  14270. @item prev_selected_pts
  14271. The PTS of the last previously filtered video frame. It's NAN if undefined.
  14272. @item prev_selected_t
  14273. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  14274. @item start_pts
  14275. The PTS of the first video frame in the video. It's NAN if undefined.
  14276. @item start_t
  14277. The time of the first video frame in the video. It's NAN if undefined.
  14278. @item pict_type @emph{(video only)}
  14279. The type of the filtered frame. It can assume one of the following
  14280. values:
  14281. @table @option
  14282. @item I
  14283. @item P
  14284. @item B
  14285. @item S
  14286. @item SI
  14287. @item SP
  14288. @item BI
  14289. @end table
  14290. @item interlace_type @emph{(video only)}
  14291. The frame interlace type. It can assume one of the following values:
  14292. @table @option
  14293. @item PROGRESSIVE
  14294. The frame is progressive (not interlaced).
  14295. @item TOPFIRST
  14296. The frame is top-field-first.
  14297. @item BOTTOMFIRST
  14298. The frame is bottom-field-first.
  14299. @end table
  14300. @item consumed_sample_n @emph{(audio only)}
  14301. the number of selected samples before the current frame
  14302. @item samples_n @emph{(audio only)}
  14303. the number of samples in the current frame
  14304. @item sample_rate @emph{(audio only)}
  14305. the input sample rate
  14306. @item key
  14307. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  14308. @item pos
  14309. the position in the file of the filtered frame, -1 if the information
  14310. is not available (e.g. for synthetic video)
  14311. @item scene @emph{(video only)}
  14312. value between 0 and 1 to indicate a new scene; a low value reflects a low
  14313. probability for the current frame to introduce a new scene, while a higher
  14314. value means the current frame is more likely to be one (see the example below)
  14315. @item concatdec_select
  14316. The concat demuxer can select only part of a concat input file by setting an
  14317. inpoint and an outpoint, but the output packets may not be entirely contained
  14318. in the selected interval. By using this variable, it is possible to skip frames
  14319. generated by the concat demuxer which are not exactly contained in the selected
  14320. interval.
  14321. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  14322. and the @var{lavf.concat.duration} packet metadata values which are also
  14323. present in the decoded frames.
  14324. The @var{concatdec_select} variable is -1 if the frame pts is at least
  14325. start_time and either the duration metadata is missing or the frame pts is less
  14326. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  14327. missing.
  14328. That basically means that an input frame is selected if its pts is within the
  14329. interval set by the concat demuxer.
  14330. @end table
  14331. The default value of the select expression is "1".
  14332. @subsection Examples
  14333. @itemize
  14334. @item
  14335. Select all frames in input:
  14336. @example
  14337. select
  14338. @end example
  14339. The example above is the same as:
  14340. @example
  14341. select=1
  14342. @end example
  14343. @item
  14344. Skip all frames:
  14345. @example
  14346. select=0
  14347. @end example
  14348. @item
  14349. Select only I-frames:
  14350. @example
  14351. select='eq(pict_type\,I)'
  14352. @end example
  14353. @item
  14354. Select one frame every 100:
  14355. @example
  14356. select='not(mod(n\,100))'
  14357. @end example
  14358. @item
  14359. Select only frames contained in the 10-20 time interval:
  14360. @example
  14361. select=between(t\,10\,20)
  14362. @end example
  14363. @item
  14364. Select only I-frames contained in the 10-20 time interval:
  14365. @example
  14366. select=between(t\,10\,20)*eq(pict_type\,I)
  14367. @end example
  14368. @item
  14369. Select frames with a minimum distance of 10 seconds:
  14370. @example
  14371. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  14372. @end example
  14373. @item
  14374. Use aselect to select only audio frames with samples number > 100:
  14375. @example
  14376. aselect='gt(samples_n\,100)'
  14377. @end example
  14378. @item
  14379. Create a mosaic of the first scenes:
  14380. @example
  14381. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  14382. @end example
  14383. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  14384. choice.
  14385. @item
  14386. Send even and odd frames to separate outputs, and compose them:
  14387. @example
  14388. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  14389. @end example
  14390. @item
  14391. Select useful frames from an ffconcat file which is using inpoints and
  14392. outpoints but where the source files are not intra frame only.
  14393. @example
  14394. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  14395. @end example
  14396. @end itemize
  14397. @section sendcmd, asendcmd
  14398. Send commands to filters in the filtergraph.
  14399. These filters read commands to be sent to other filters in the
  14400. filtergraph.
  14401. @code{sendcmd} must be inserted between two video filters,
  14402. @code{asendcmd} must be inserted between two audio filters, but apart
  14403. from that they act the same way.
  14404. The specification of commands can be provided in the filter arguments
  14405. with the @var{commands} option, or in a file specified by the
  14406. @var{filename} option.
  14407. These filters accept the following options:
  14408. @table @option
  14409. @item commands, c
  14410. Set the commands to be read and sent to the other filters.
  14411. @item filename, f
  14412. Set the filename of the commands to be read and sent to the other
  14413. filters.
  14414. @end table
  14415. @subsection Commands syntax
  14416. A commands description consists of a sequence of interval
  14417. specifications, comprising a list of commands to be executed when a
  14418. particular event related to that interval occurs. The occurring event
  14419. is typically the current frame time entering or leaving a given time
  14420. interval.
  14421. An interval is specified by the following syntax:
  14422. @example
  14423. @var{START}[-@var{END}] @var{COMMANDS};
  14424. @end example
  14425. The time interval is specified by the @var{START} and @var{END} times.
  14426. @var{END} is optional and defaults to the maximum time.
  14427. The current frame time is considered within the specified interval if
  14428. it is included in the interval [@var{START}, @var{END}), that is when
  14429. the time is greater or equal to @var{START} and is lesser than
  14430. @var{END}.
  14431. @var{COMMANDS} consists of a sequence of one or more command
  14432. specifications, separated by ",", relating to that interval. The
  14433. syntax of a command specification is given by:
  14434. @example
  14435. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  14436. @end example
  14437. @var{FLAGS} is optional and specifies the type of events relating to
  14438. the time interval which enable sending the specified command, and must
  14439. be a non-null sequence of identifier flags separated by "+" or "|" and
  14440. enclosed between "[" and "]".
  14441. The following flags are recognized:
  14442. @table @option
  14443. @item enter
  14444. The command is sent when the current frame timestamp enters the
  14445. specified interval. In other words, the command is sent when the
  14446. previous frame timestamp was not in the given interval, and the
  14447. current is.
  14448. @item leave
  14449. The command is sent when the current frame timestamp leaves the
  14450. specified interval. In other words, the command is sent when the
  14451. previous frame timestamp was in the given interval, and the
  14452. current is not.
  14453. @end table
  14454. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  14455. assumed.
  14456. @var{TARGET} specifies the target of the command, usually the name of
  14457. the filter class or a specific filter instance name.
  14458. @var{COMMAND} specifies the name of the command for the target filter.
  14459. @var{ARG} is optional and specifies the optional list of argument for
  14460. the given @var{COMMAND}.
  14461. Between one interval specification and another, whitespaces, or
  14462. sequences of characters starting with @code{#} until the end of line,
  14463. are ignored and can be used to annotate comments.
  14464. A simplified BNF description of the commands specification syntax
  14465. follows:
  14466. @example
  14467. @var{COMMAND_FLAG} ::= "enter" | "leave"
  14468. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  14469. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  14470. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  14471. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  14472. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  14473. @end example
  14474. @subsection Examples
  14475. @itemize
  14476. @item
  14477. Specify audio tempo change at second 4:
  14478. @example
  14479. asendcmd=c='4.0 atempo tempo 1.5',atempo
  14480. @end example
  14481. @item
  14482. Target a specific filter instance:
  14483. @example
  14484. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  14485. @end example
  14486. @item
  14487. Specify a list of drawtext and hue commands in a file.
  14488. @example
  14489. # show text in the interval 5-10
  14490. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  14491. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  14492. # desaturate the image in the interval 15-20
  14493. 15.0-20.0 [enter] hue s 0,
  14494. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  14495. [leave] hue s 1,
  14496. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  14497. # apply an exponential saturation fade-out effect, starting from time 25
  14498. 25 [enter] hue s exp(25-t)
  14499. @end example
  14500. A filtergraph allowing to read and process the above command list
  14501. stored in a file @file{test.cmd}, can be specified with:
  14502. @example
  14503. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  14504. @end example
  14505. @end itemize
  14506. @anchor{setpts}
  14507. @section setpts, asetpts
  14508. Change the PTS (presentation timestamp) of the input frames.
  14509. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  14510. This filter accepts the following options:
  14511. @table @option
  14512. @item expr
  14513. The expression which is evaluated for each frame to construct its timestamp.
  14514. @end table
  14515. The expression is evaluated through the eval API and can contain the following
  14516. constants:
  14517. @table @option
  14518. @item FRAME_RATE
  14519. frame rate, only defined for constant frame-rate video
  14520. @item PTS
  14521. The presentation timestamp in input
  14522. @item N
  14523. The count of the input frame for video or the number of consumed samples,
  14524. not including the current frame for audio, starting from 0.
  14525. @item NB_CONSUMED_SAMPLES
  14526. The number of consumed samples, not including the current frame (only
  14527. audio)
  14528. @item NB_SAMPLES, S
  14529. The number of samples in the current frame (only audio)
  14530. @item SAMPLE_RATE, SR
  14531. The audio sample rate.
  14532. @item STARTPTS
  14533. The PTS of the first frame.
  14534. @item STARTT
  14535. the time in seconds of the first frame
  14536. @item INTERLACED
  14537. State whether the current frame is interlaced.
  14538. @item T
  14539. the time in seconds of the current frame
  14540. @item POS
  14541. original position in the file of the frame, or undefined if undefined
  14542. for the current frame
  14543. @item PREV_INPTS
  14544. The previous input PTS.
  14545. @item PREV_INT
  14546. previous input time in seconds
  14547. @item PREV_OUTPTS
  14548. The previous output PTS.
  14549. @item PREV_OUTT
  14550. previous output time in seconds
  14551. @item RTCTIME
  14552. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  14553. instead.
  14554. @item RTCSTART
  14555. The wallclock (RTC) time at the start of the movie in microseconds.
  14556. @item TB
  14557. The timebase of the input timestamps.
  14558. @end table
  14559. @subsection Examples
  14560. @itemize
  14561. @item
  14562. Start counting PTS from zero
  14563. @example
  14564. setpts=PTS-STARTPTS
  14565. @end example
  14566. @item
  14567. Apply fast motion effect:
  14568. @example
  14569. setpts=0.5*PTS
  14570. @end example
  14571. @item
  14572. Apply slow motion effect:
  14573. @example
  14574. setpts=2.0*PTS
  14575. @end example
  14576. @item
  14577. Set fixed rate of 25 frames per second:
  14578. @example
  14579. setpts=N/(25*TB)
  14580. @end example
  14581. @item
  14582. Set fixed rate 25 fps with some jitter:
  14583. @example
  14584. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  14585. @end example
  14586. @item
  14587. Apply an offset of 10 seconds to the input PTS:
  14588. @example
  14589. setpts=PTS+10/TB
  14590. @end example
  14591. @item
  14592. Generate timestamps from a "live source" and rebase onto the current timebase:
  14593. @example
  14594. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  14595. @end example
  14596. @item
  14597. Generate timestamps by counting samples:
  14598. @example
  14599. asetpts=N/SR/TB
  14600. @end example
  14601. @end itemize
  14602. @section setrange
  14603. Force color range for the output video frame.
  14604. The @code{setrange} filter marks the color range property for the
  14605. output frames. It does not change the input frame, but only sets the
  14606. corresponding property, which affects how the frame is treated by
  14607. following filters.
  14608. The filter accepts the following options:
  14609. @table @option
  14610. @item range
  14611. Available values are:
  14612. @table @samp
  14613. @item auto
  14614. Keep the same color range property.
  14615. @item unspecified, unknown
  14616. Set the color range as unspecified.
  14617. @item limited, tv, mpeg
  14618. Set the color range as limited.
  14619. @item full, pc, jpeg
  14620. Set the color range as full.
  14621. @end table
  14622. @end table
  14623. @section settb, asettb
  14624. Set the timebase to use for the output frames timestamps.
  14625. It is mainly useful for testing timebase configuration.
  14626. It accepts the following parameters:
  14627. @table @option
  14628. @item expr, tb
  14629. The expression which is evaluated into the output timebase.
  14630. @end table
  14631. The value for @option{tb} is an arithmetic expression representing a
  14632. rational. The expression can contain the constants "AVTB" (the default
  14633. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  14634. audio only). Default value is "intb".
  14635. @subsection Examples
  14636. @itemize
  14637. @item
  14638. Set the timebase to 1/25:
  14639. @example
  14640. settb=expr=1/25
  14641. @end example
  14642. @item
  14643. Set the timebase to 1/10:
  14644. @example
  14645. settb=expr=0.1
  14646. @end example
  14647. @item
  14648. Set the timebase to 1001/1000:
  14649. @example
  14650. settb=1+0.001
  14651. @end example
  14652. @item
  14653. Set the timebase to 2*intb:
  14654. @example
  14655. settb=2*intb
  14656. @end example
  14657. @item
  14658. Set the default timebase value:
  14659. @example
  14660. settb=AVTB
  14661. @end example
  14662. @end itemize
  14663. @section showcqt
  14664. Convert input audio to a video output representing frequency spectrum
  14665. logarithmically using Brown-Puckette constant Q transform algorithm with
  14666. direct frequency domain coefficient calculation (but the transform itself
  14667. is not really constant Q, instead the Q factor is actually variable/clamped),
  14668. with musical tone scale, from E0 to D#10.
  14669. The filter accepts the following options:
  14670. @table @option
  14671. @item size, s
  14672. Specify the video size for the output. It must be even. For the syntax of this option,
  14673. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14674. Default value is @code{1920x1080}.
  14675. @item fps, rate, r
  14676. Set the output frame rate. Default value is @code{25}.
  14677. @item bar_h
  14678. Set the bargraph height. It must be even. Default value is @code{-1} which
  14679. computes the bargraph height automatically.
  14680. @item axis_h
  14681. Set the axis height. It must be even. Default value is @code{-1} which computes
  14682. the axis height automatically.
  14683. @item sono_h
  14684. Set the sonogram height. It must be even. Default value is @code{-1} which
  14685. computes the sonogram height automatically.
  14686. @item fullhd
  14687. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  14688. instead. Default value is @code{1}.
  14689. @item sono_v, volume
  14690. Specify the sonogram volume expression. It can contain variables:
  14691. @table @option
  14692. @item bar_v
  14693. the @var{bar_v} evaluated expression
  14694. @item frequency, freq, f
  14695. the frequency where it is evaluated
  14696. @item timeclamp, tc
  14697. the value of @var{timeclamp} option
  14698. @end table
  14699. and functions:
  14700. @table @option
  14701. @item a_weighting(f)
  14702. A-weighting of equal loudness
  14703. @item b_weighting(f)
  14704. B-weighting of equal loudness
  14705. @item c_weighting(f)
  14706. C-weighting of equal loudness.
  14707. @end table
  14708. Default value is @code{16}.
  14709. @item bar_v, volume2
  14710. Specify the bargraph volume expression. It can contain variables:
  14711. @table @option
  14712. @item sono_v
  14713. the @var{sono_v} evaluated expression
  14714. @item frequency, freq, f
  14715. the frequency where it is evaluated
  14716. @item timeclamp, tc
  14717. the value of @var{timeclamp} option
  14718. @end table
  14719. and functions:
  14720. @table @option
  14721. @item a_weighting(f)
  14722. A-weighting of equal loudness
  14723. @item b_weighting(f)
  14724. B-weighting of equal loudness
  14725. @item c_weighting(f)
  14726. C-weighting of equal loudness.
  14727. @end table
  14728. Default value is @code{sono_v}.
  14729. @item sono_g, gamma
  14730. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  14731. higher gamma makes the spectrum having more range. Default value is @code{3}.
  14732. Acceptable range is @code{[1, 7]}.
  14733. @item bar_g, gamma2
  14734. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  14735. @code{[1, 7]}.
  14736. @item bar_t
  14737. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  14738. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  14739. @item timeclamp, tc
  14740. Specify the transform timeclamp. At low frequency, there is trade-off between
  14741. accuracy in time domain and frequency domain. If timeclamp is lower,
  14742. event in time domain is represented more accurately (such as fast bass drum),
  14743. otherwise event in frequency domain is represented more accurately
  14744. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  14745. @item attack
  14746. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  14747. limits future samples by applying asymmetric windowing in time domain, useful
  14748. when low latency is required. Accepted range is @code{[0, 1]}.
  14749. @item basefreq
  14750. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  14751. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  14752. @item endfreq
  14753. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  14754. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  14755. @item coeffclamp
  14756. This option is deprecated and ignored.
  14757. @item tlength
  14758. Specify the transform length in time domain. Use this option to control accuracy
  14759. trade-off between time domain and frequency domain at every frequency sample.
  14760. It can contain variables:
  14761. @table @option
  14762. @item frequency, freq, f
  14763. the frequency where it is evaluated
  14764. @item timeclamp, tc
  14765. the value of @var{timeclamp} option.
  14766. @end table
  14767. Default value is @code{384*tc/(384+tc*f)}.
  14768. @item count
  14769. Specify the transform count for every video frame. Default value is @code{6}.
  14770. Acceptable range is @code{[1, 30]}.
  14771. @item fcount
  14772. Specify the transform count for every single pixel. Default value is @code{0},
  14773. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  14774. @item fontfile
  14775. Specify font file for use with freetype to draw the axis. If not specified,
  14776. use embedded font. Note that drawing with font file or embedded font is not
  14777. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  14778. option instead.
  14779. @item font
  14780. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  14781. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  14782. @item fontcolor
  14783. Specify font color expression. This is arithmetic expression that should return
  14784. integer value 0xRRGGBB. It can contain variables:
  14785. @table @option
  14786. @item frequency, freq, f
  14787. the frequency where it is evaluated
  14788. @item timeclamp, tc
  14789. the value of @var{timeclamp} option
  14790. @end table
  14791. and functions:
  14792. @table @option
  14793. @item midi(f)
  14794. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  14795. @item r(x), g(x), b(x)
  14796. red, green, and blue value of intensity x.
  14797. @end table
  14798. Default value is @code{st(0, (midi(f)-59.5)/12);
  14799. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  14800. r(1-ld(1)) + b(ld(1))}.
  14801. @item axisfile
  14802. Specify image file to draw the axis. This option override @var{fontfile} and
  14803. @var{fontcolor} option.
  14804. @item axis, text
  14805. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  14806. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  14807. Default value is @code{1}.
  14808. @item csp
  14809. Set colorspace. The accepted values are:
  14810. @table @samp
  14811. @item unspecified
  14812. Unspecified (default)
  14813. @item bt709
  14814. BT.709
  14815. @item fcc
  14816. FCC
  14817. @item bt470bg
  14818. BT.470BG or BT.601-6 625
  14819. @item smpte170m
  14820. SMPTE-170M or BT.601-6 525
  14821. @item smpte240m
  14822. SMPTE-240M
  14823. @item bt2020ncl
  14824. BT.2020 with non-constant luminance
  14825. @end table
  14826. @item cscheme
  14827. Set spectrogram color scheme. This is list of floating point values with format
  14828. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  14829. The default is @code{1|0.5|0|0|0.5|1}.
  14830. @end table
  14831. @subsection Examples
  14832. @itemize
  14833. @item
  14834. Playing audio while showing the spectrum:
  14835. @example
  14836. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  14837. @end example
  14838. @item
  14839. Same as above, but with frame rate 30 fps:
  14840. @example
  14841. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  14842. @end example
  14843. @item
  14844. Playing at 1280x720:
  14845. @example
  14846. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  14847. @end example
  14848. @item
  14849. Disable sonogram display:
  14850. @example
  14851. sono_h=0
  14852. @end example
  14853. @item
  14854. A1 and its harmonics: A1, A2, (near)E3, A3:
  14855. @example
  14856. 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),
  14857. asplit[a][out1]; [a] showcqt [out0]'
  14858. @end example
  14859. @item
  14860. Same as above, but with more accuracy in frequency domain:
  14861. @example
  14862. 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),
  14863. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  14864. @end example
  14865. @item
  14866. Custom volume:
  14867. @example
  14868. bar_v=10:sono_v=bar_v*a_weighting(f)
  14869. @end example
  14870. @item
  14871. Custom gamma, now spectrum is linear to the amplitude.
  14872. @example
  14873. bar_g=2:sono_g=2
  14874. @end example
  14875. @item
  14876. Custom tlength equation:
  14877. @example
  14878. 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)))'
  14879. @end example
  14880. @item
  14881. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  14882. @example
  14883. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  14884. @end example
  14885. @item
  14886. Custom font using fontconfig:
  14887. @example
  14888. font='Courier New,Monospace,mono|bold'
  14889. @end example
  14890. @item
  14891. Custom frequency range with custom axis using image file:
  14892. @example
  14893. axisfile=myaxis.png:basefreq=40:endfreq=10000
  14894. @end example
  14895. @end itemize
  14896. @section showfreqs
  14897. Convert input audio to video output representing the audio power spectrum.
  14898. Audio amplitude is on Y-axis while frequency is on X-axis.
  14899. The filter accepts the following options:
  14900. @table @option
  14901. @item size, s
  14902. Specify size of video. For the syntax of this option, check the
  14903. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14904. Default is @code{1024x512}.
  14905. @item mode
  14906. Set display mode.
  14907. This set how each frequency bin will be represented.
  14908. It accepts the following values:
  14909. @table @samp
  14910. @item line
  14911. @item bar
  14912. @item dot
  14913. @end table
  14914. Default is @code{bar}.
  14915. @item ascale
  14916. Set amplitude scale.
  14917. It accepts the following values:
  14918. @table @samp
  14919. @item lin
  14920. Linear scale.
  14921. @item sqrt
  14922. Square root scale.
  14923. @item cbrt
  14924. Cubic root scale.
  14925. @item log
  14926. Logarithmic scale.
  14927. @end table
  14928. Default is @code{log}.
  14929. @item fscale
  14930. Set frequency scale.
  14931. It accepts the following values:
  14932. @table @samp
  14933. @item lin
  14934. Linear scale.
  14935. @item log
  14936. Logarithmic scale.
  14937. @item rlog
  14938. Reverse logarithmic scale.
  14939. @end table
  14940. Default is @code{lin}.
  14941. @item win_size
  14942. Set window size.
  14943. It accepts the following values:
  14944. @table @samp
  14945. @item w16
  14946. @item w32
  14947. @item w64
  14948. @item w128
  14949. @item w256
  14950. @item w512
  14951. @item w1024
  14952. @item w2048
  14953. @item w4096
  14954. @item w8192
  14955. @item w16384
  14956. @item w32768
  14957. @item w65536
  14958. @end table
  14959. Default is @code{w2048}
  14960. @item win_func
  14961. Set windowing function.
  14962. It accepts the following values:
  14963. @table @samp
  14964. @item rect
  14965. @item bartlett
  14966. @item hanning
  14967. @item hamming
  14968. @item blackman
  14969. @item welch
  14970. @item flattop
  14971. @item bharris
  14972. @item bnuttall
  14973. @item bhann
  14974. @item sine
  14975. @item nuttall
  14976. @item lanczos
  14977. @item gauss
  14978. @item tukey
  14979. @item dolph
  14980. @item cauchy
  14981. @item parzen
  14982. @item poisson
  14983. @end table
  14984. Default is @code{hanning}.
  14985. @item overlap
  14986. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  14987. which means optimal overlap for selected window function will be picked.
  14988. @item averaging
  14989. Set time averaging. Setting this to 0 will display current maximal peaks.
  14990. Default is @code{1}, which means time averaging is disabled.
  14991. @item colors
  14992. Specify list of colors separated by space or by '|' which will be used to
  14993. draw channel frequencies. Unrecognized or missing colors will be replaced
  14994. by white color.
  14995. @item cmode
  14996. Set channel display mode.
  14997. It accepts the following values:
  14998. @table @samp
  14999. @item combined
  15000. @item separate
  15001. @end table
  15002. Default is @code{combined}.
  15003. @item minamp
  15004. Set minimum amplitude used in @code{log} amplitude scaler.
  15005. @end table
  15006. @anchor{showspectrum}
  15007. @section showspectrum
  15008. Convert input audio to a video output, representing the audio frequency
  15009. spectrum.
  15010. The filter accepts the following options:
  15011. @table @option
  15012. @item size, s
  15013. Specify the video size for the output. For the syntax of this option, check the
  15014. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15015. Default value is @code{640x512}.
  15016. @item slide
  15017. Specify how the spectrum should slide along the window.
  15018. It accepts the following values:
  15019. @table @samp
  15020. @item replace
  15021. the samples start again on the left when they reach the right
  15022. @item scroll
  15023. the samples scroll from right to left
  15024. @item fullframe
  15025. frames are only produced when the samples reach the right
  15026. @item rscroll
  15027. the samples scroll from left to right
  15028. @end table
  15029. Default value is @code{replace}.
  15030. @item mode
  15031. Specify display mode.
  15032. It accepts the following values:
  15033. @table @samp
  15034. @item combined
  15035. all channels are displayed in the same row
  15036. @item separate
  15037. all channels are displayed in separate rows
  15038. @end table
  15039. Default value is @samp{combined}.
  15040. @item color
  15041. Specify display color mode.
  15042. It accepts the following values:
  15043. @table @samp
  15044. @item channel
  15045. each channel is displayed in a separate color
  15046. @item intensity
  15047. each channel is displayed using the same color scheme
  15048. @item rainbow
  15049. each channel is displayed using the rainbow color scheme
  15050. @item moreland
  15051. each channel is displayed using the moreland color scheme
  15052. @item nebulae
  15053. each channel is displayed using the nebulae color scheme
  15054. @item fire
  15055. each channel is displayed using the fire color scheme
  15056. @item fiery
  15057. each channel is displayed using the fiery color scheme
  15058. @item fruit
  15059. each channel is displayed using the fruit color scheme
  15060. @item cool
  15061. each channel is displayed using the cool color scheme
  15062. @end table
  15063. Default value is @samp{channel}.
  15064. @item scale
  15065. Specify scale used for calculating intensity color values.
  15066. It accepts the following values:
  15067. @table @samp
  15068. @item lin
  15069. linear
  15070. @item sqrt
  15071. square root, default
  15072. @item cbrt
  15073. cubic root
  15074. @item log
  15075. logarithmic
  15076. @item 4thrt
  15077. 4th root
  15078. @item 5thrt
  15079. 5th root
  15080. @end table
  15081. Default value is @samp{sqrt}.
  15082. @item saturation
  15083. Set saturation modifier for displayed colors. Negative values provide
  15084. alternative color scheme. @code{0} is no saturation at all.
  15085. Saturation must be in [-10.0, 10.0] range.
  15086. Default value is @code{1}.
  15087. @item win_func
  15088. Set window function.
  15089. It accepts the following values:
  15090. @table @samp
  15091. @item rect
  15092. @item bartlett
  15093. @item hann
  15094. @item hanning
  15095. @item hamming
  15096. @item blackman
  15097. @item welch
  15098. @item flattop
  15099. @item bharris
  15100. @item bnuttall
  15101. @item bhann
  15102. @item sine
  15103. @item nuttall
  15104. @item lanczos
  15105. @item gauss
  15106. @item tukey
  15107. @item dolph
  15108. @item cauchy
  15109. @item parzen
  15110. @item poisson
  15111. @end table
  15112. Default value is @code{hann}.
  15113. @item orientation
  15114. Set orientation of time vs frequency axis. Can be @code{vertical} or
  15115. @code{horizontal}. Default is @code{vertical}.
  15116. @item overlap
  15117. Set ratio of overlap window. Default value is @code{0}.
  15118. When value is @code{1} overlap is set to recommended size for specific
  15119. window function currently used.
  15120. @item gain
  15121. Set scale gain for calculating intensity color values.
  15122. Default value is @code{1}.
  15123. @item data
  15124. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  15125. @item rotation
  15126. Set color rotation, must be in [-1.0, 1.0] range.
  15127. Default value is @code{0}.
  15128. @end table
  15129. The usage is very similar to the showwaves filter; see the examples in that
  15130. section.
  15131. @subsection Examples
  15132. @itemize
  15133. @item
  15134. Large window with logarithmic color scaling:
  15135. @example
  15136. showspectrum=s=1280x480:scale=log
  15137. @end example
  15138. @item
  15139. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  15140. @example
  15141. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  15142. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  15143. @end example
  15144. @end itemize
  15145. @section showspectrumpic
  15146. Convert input audio to a single video frame, representing the audio frequency
  15147. spectrum.
  15148. The filter accepts the following options:
  15149. @table @option
  15150. @item size, s
  15151. Specify the video size for the output. For the syntax of this option, check the
  15152. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15153. Default value is @code{4096x2048}.
  15154. @item mode
  15155. Specify display mode.
  15156. It accepts the following values:
  15157. @table @samp
  15158. @item combined
  15159. all channels are displayed in the same row
  15160. @item separate
  15161. all channels are displayed in separate rows
  15162. @end table
  15163. Default value is @samp{combined}.
  15164. @item color
  15165. Specify display color mode.
  15166. It accepts the following values:
  15167. @table @samp
  15168. @item channel
  15169. each channel is displayed in a separate color
  15170. @item intensity
  15171. each channel is displayed using the same color scheme
  15172. @item rainbow
  15173. each channel is displayed using the rainbow color scheme
  15174. @item moreland
  15175. each channel is displayed using the moreland color scheme
  15176. @item nebulae
  15177. each channel is displayed using the nebulae color scheme
  15178. @item fire
  15179. each channel is displayed using the fire color scheme
  15180. @item fiery
  15181. each channel is displayed using the fiery color scheme
  15182. @item fruit
  15183. each channel is displayed using the fruit color scheme
  15184. @item cool
  15185. each channel is displayed using the cool color scheme
  15186. @end table
  15187. Default value is @samp{intensity}.
  15188. @item scale
  15189. Specify scale used for calculating intensity color values.
  15190. It accepts the following values:
  15191. @table @samp
  15192. @item lin
  15193. linear
  15194. @item sqrt
  15195. square root, default
  15196. @item cbrt
  15197. cubic root
  15198. @item log
  15199. logarithmic
  15200. @item 4thrt
  15201. 4th root
  15202. @item 5thrt
  15203. 5th root
  15204. @end table
  15205. Default value is @samp{log}.
  15206. @item saturation
  15207. Set saturation modifier for displayed colors. Negative values provide
  15208. alternative color scheme. @code{0} is no saturation at all.
  15209. Saturation must be in [-10.0, 10.0] range.
  15210. Default value is @code{1}.
  15211. @item win_func
  15212. Set window function.
  15213. It accepts the following values:
  15214. @table @samp
  15215. @item rect
  15216. @item bartlett
  15217. @item hann
  15218. @item hanning
  15219. @item hamming
  15220. @item blackman
  15221. @item welch
  15222. @item flattop
  15223. @item bharris
  15224. @item bnuttall
  15225. @item bhann
  15226. @item sine
  15227. @item nuttall
  15228. @item lanczos
  15229. @item gauss
  15230. @item tukey
  15231. @item dolph
  15232. @item cauchy
  15233. @item parzen
  15234. @item poisson
  15235. @end table
  15236. Default value is @code{hann}.
  15237. @item orientation
  15238. Set orientation of time vs frequency axis. Can be @code{vertical} or
  15239. @code{horizontal}. Default is @code{vertical}.
  15240. @item gain
  15241. Set scale gain for calculating intensity color values.
  15242. Default value is @code{1}.
  15243. @item legend
  15244. Draw time and frequency axes and legends. Default is enabled.
  15245. @item rotation
  15246. Set color rotation, must be in [-1.0, 1.0] range.
  15247. Default value is @code{0}.
  15248. @end table
  15249. @subsection Examples
  15250. @itemize
  15251. @item
  15252. Extract an audio spectrogram of a whole audio track
  15253. in a 1024x1024 picture using @command{ffmpeg}:
  15254. @example
  15255. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  15256. @end example
  15257. @end itemize
  15258. @section showvolume
  15259. Convert input audio volume to a video output.
  15260. The filter accepts the following options:
  15261. @table @option
  15262. @item rate, r
  15263. Set video rate.
  15264. @item b
  15265. Set border width, allowed range is [0, 5]. Default is 1.
  15266. @item w
  15267. Set channel width, allowed range is [80, 8192]. Default is 400.
  15268. @item h
  15269. Set channel height, allowed range is [1, 900]. Default is 20.
  15270. @item f
  15271. Set fade, allowed range is [0, 1]. Default is 0.95.
  15272. @item c
  15273. Set volume color expression.
  15274. The expression can use the following variables:
  15275. @table @option
  15276. @item VOLUME
  15277. Current max volume of channel in dB.
  15278. @item PEAK
  15279. Current peak.
  15280. @item CHANNEL
  15281. Current channel number, starting from 0.
  15282. @end table
  15283. @item t
  15284. If set, displays channel names. Default is enabled.
  15285. @item v
  15286. If set, displays volume values. Default is enabled.
  15287. @item o
  15288. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  15289. default is @code{h}.
  15290. @item s
  15291. Set step size, allowed range is [0, 5]. Default is 0, which means
  15292. step is disabled.
  15293. @item p
  15294. Set background opacity, allowed range is [0, 1]. Default is 0.
  15295. @item m
  15296. Set metering mode, can be peak: @code{p} or rms: @code{r},
  15297. default is @code{p}.
  15298. @item ds
  15299. Set display scale, can be linear: @code{lin} or log: @code{log},
  15300. default is @code{lin}.
  15301. @item dm
  15302. In second.
  15303. If set to > 0., display a line for the max level
  15304. in the previous seconds.
  15305. default is disabled: @code{0.}
  15306. @item dmc
  15307. The color of the max line. Use when @code{dm} option is set to > 0.
  15308. default is: @code{orange}
  15309. @end table
  15310. @section showwaves
  15311. Convert input audio to a video output, representing the samples waves.
  15312. The filter accepts the following options:
  15313. @table @option
  15314. @item size, s
  15315. Specify the video size for the output. For the syntax of this option, check the
  15316. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15317. Default value is @code{600x240}.
  15318. @item mode
  15319. Set display mode.
  15320. Available values are:
  15321. @table @samp
  15322. @item point
  15323. Draw a point for each sample.
  15324. @item line
  15325. Draw a vertical line for each sample.
  15326. @item p2p
  15327. Draw a point for each sample and a line between them.
  15328. @item cline
  15329. Draw a centered vertical line for each sample.
  15330. @end table
  15331. Default value is @code{point}.
  15332. @item n
  15333. Set the number of samples which are printed on the same column. A
  15334. larger value will decrease the frame rate. Must be a positive
  15335. integer. This option can be set only if the value for @var{rate}
  15336. is not explicitly specified.
  15337. @item rate, r
  15338. Set the (approximate) output frame rate. This is done by setting the
  15339. option @var{n}. Default value is "25".
  15340. @item split_channels
  15341. Set if channels should be drawn separately or overlap. Default value is 0.
  15342. @item colors
  15343. Set colors separated by '|' which are going to be used for drawing of each channel.
  15344. @item scale
  15345. Set amplitude scale.
  15346. Available values are:
  15347. @table @samp
  15348. @item lin
  15349. Linear.
  15350. @item log
  15351. Logarithmic.
  15352. @item sqrt
  15353. Square root.
  15354. @item cbrt
  15355. Cubic root.
  15356. @end table
  15357. Default is linear.
  15358. @item draw
  15359. Set the draw mode. This is mostly useful to set for high @var{n}.
  15360. Available values are:
  15361. @table @samp
  15362. @item scale
  15363. Scale pixel values for each drawn sample.
  15364. @item full
  15365. Draw every sample directly.
  15366. @end table
  15367. Default value is @code{scale}.
  15368. @end table
  15369. @subsection Examples
  15370. @itemize
  15371. @item
  15372. Output the input file audio and the corresponding video representation
  15373. at the same time:
  15374. @example
  15375. amovie=a.mp3,asplit[out0],showwaves[out1]
  15376. @end example
  15377. @item
  15378. Create a synthetic signal and show it with showwaves, forcing a
  15379. frame rate of 30 frames per second:
  15380. @example
  15381. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  15382. @end example
  15383. @end itemize
  15384. @section showwavespic
  15385. Convert input audio to a single video frame, representing the samples waves.
  15386. The filter accepts the following options:
  15387. @table @option
  15388. @item size, s
  15389. Specify the video size for the output. For the syntax of this option, check the
  15390. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15391. Default value is @code{600x240}.
  15392. @item split_channels
  15393. Set if channels should be drawn separately or overlap. Default value is 0.
  15394. @item colors
  15395. Set colors separated by '|' which are going to be used for drawing of each channel.
  15396. @item scale
  15397. Set amplitude scale.
  15398. Available values are:
  15399. @table @samp
  15400. @item lin
  15401. Linear.
  15402. @item log
  15403. Logarithmic.
  15404. @item sqrt
  15405. Square root.
  15406. @item cbrt
  15407. Cubic root.
  15408. @end table
  15409. Default is linear.
  15410. @end table
  15411. @subsection Examples
  15412. @itemize
  15413. @item
  15414. Extract a channel split representation of the wave form of a whole audio track
  15415. in a 1024x800 picture using @command{ffmpeg}:
  15416. @example
  15417. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  15418. @end example
  15419. @end itemize
  15420. @section sidedata, asidedata
  15421. Delete frame side data, or select frames based on it.
  15422. This filter accepts the following options:
  15423. @table @option
  15424. @item mode
  15425. Set mode of operation of the filter.
  15426. Can be one of the following:
  15427. @table @samp
  15428. @item select
  15429. Select every frame with side data of @code{type}.
  15430. @item delete
  15431. Delete side data of @code{type}. If @code{type} is not set, delete all side
  15432. data in the frame.
  15433. @end table
  15434. @item type
  15435. Set side data type used with all modes. Must be set for @code{select} mode. For
  15436. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  15437. in @file{libavutil/frame.h}. For example, to choose
  15438. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  15439. @end table
  15440. @section spectrumsynth
  15441. Sythesize audio from 2 input video spectrums, first input stream represents
  15442. magnitude across time and second represents phase across time.
  15443. The filter will transform from frequency domain as displayed in videos back
  15444. to time domain as presented in audio output.
  15445. This filter is primarily created for reversing processed @ref{showspectrum}
  15446. filter outputs, but can synthesize sound from other spectrograms too.
  15447. But in such case results are going to be poor if the phase data is not
  15448. available, because in such cases phase data need to be recreated, usually
  15449. its just recreated from random noise.
  15450. For best results use gray only output (@code{channel} color mode in
  15451. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  15452. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  15453. @code{data} option. Inputs videos should generally use @code{fullframe}
  15454. slide mode as that saves resources needed for decoding video.
  15455. The filter accepts the following options:
  15456. @table @option
  15457. @item sample_rate
  15458. Specify sample rate of output audio, the sample rate of audio from which
  15459. spectrum was generated may differ.
  15460. @item channels
  15461. Set number of channels represented in input video spectrums.
  15462. @item scale
  15463. Set scale which was used when generating magnitude input spectrum.
  15464. Can be @code{lin} or @code{log}. Default is @code{log}.
  15465. @item slide
  15466. Set slide which was used when generating inputs spectrums.
  15467. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  15468. Default is @code{fullframe}.
  15469. @item win_func
  15470. Set window function used for resynthesis.
  15471. @item overlap
  15472. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  15473. which means optimal overlap for selected window function will be picked.
  15474. @item orientation
  15475. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  15476. Default is @code{vertical}.
  15477. @end table
  15478. @subsection Examples
  15479. @itemize
  15480. @item
  15481. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  15482. then resynthesize videos back to audio with spectrumsynth:
  15483. @example
  15484. 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
  15485. 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
  15486. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  15487. @end example
  15488. @end itemize
  15489. @section split, asplit
  15490. Split input into several identical outputs.
  15491. @code{asplit} works with audio input, @code{split} with video.
  15492. The filter accepts a single parameter which specifies the number of outputs. If
  15493. unspecified, it defaults to 2.
  15494. @subsection Examples
  15495. @itemize
  15496. @item
  15497. Create two separate outputs from the same input:
  15498. @example
  15499. [in] split [out0][out1]
  15500. @end example
  15501. @item
  15502. To create 3 or more outputs, you need to specify the number of
  15503. outputs, like in:
  15504. @example
  15505. [in] asplit=3 [out0][out1][out2]
  15506. @end example
  15507. @item
  15508. Create two separate outputs from the same input, one cropped and
  15509. one padded:
  15510. @example
  15511. [in] split [splitout1][splitout2];
  15512. [splitout1] crop=100:100:0:0 [cropout];
  15513. [splitout2] pad=200:200:100:100 [padout];
  15514. @end example
  15515. @item
  15516. Create 5 copies of the input audio with @command{ffmpeg}:
  15517. @example
  15518. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  15519. @end example
  15520. @end itemize
  15521. @section zmq, azmq
  15522. Receive commands sent through a libzmq client, and forward them to
  15523. filters in the filtergraph.
  15524. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  15525. must be inserted between two video filters, @code{azmq} between two
  15526. audio filters. Both are capable to send messages to any filter type.
  15527. To enable these filters you need to install the libzmq library and
  15528. headers and configure FFmpeg with @code{--enable-libzmq}.
  15529. For more information about libzmq see:
  15530. @url{http://www.zeromq.org/}
  15531. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  15532. receives messages sent through a network interface defined by the
  15533. @option{bind_address} (or the abbreviation "@option{b}") option.
  15534. Default value of this option is @file{tcp://localhost:5555}. You may
  15535. want to alter this value to your needs, but do not forget to escape any
  15536. ':' signs (see @ref{filtergraph escaping}).
  15537. The received message must be in the form:
  15538. @example
  15539. @var{TARGET} @var{COMMAND} [@var{ARG}]
  15540. @end example
  15541. @var{TARGET} specifies the target of the command, usually the name of
  15542. the filter class or a specific filter instance name. The default
  15543. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  15544. but you can override this by using the @samp{filter_name@@id} syntax
  15545. (see @ref{Filtergraph syntax}).
  15546. @var{COMMAND} specifies the name of the command for the target filter.
  15547. @var{ARG} is optional and specifies the optional argument list for the
  15548. given @var{COMMAND}.
  15549. Upon reception, the message is processed and the corresponding command
  15550. is injected into the filtergraph. Depending on the result, the filter
  15551. will send a reply to the client, adopting the format:
  15552. @example
  15553. @var{ERROR_CODE} @var{ERROR_REASON}
  15554. @var{MESSAGE}
  15555. @end example
  15556. @var{MESSAGE} is optional.
  15557. @subsection Examples
  15558. Look at @file{tools/zmqsend} for an example of a zmq client which can
  15559. be used to send commands processed by these filters.
  15560. Consider the following filtergraph generated by @command{ffplay}.
  15561. In this example the last overlay filter has an instance name. All other
  15562. filters will have default instance names.
  15563. @example
  15564. ffplay -dumpgraph 1 -f lavfi "
  15565. color=s=100x100:c=red [l];
  15566. color=s=100x100:c=blue [r];
  15567. nullsrc=s=200x100, zmq [bg];
  15568. [bg][l] overlay [bg+l];
  15569. [bg+l][r] overlay@@my=x=100 "
  15570. @end example
  15571. To change the color of the left side of the video, the following
  15572. command can be used:
  15573. @example
  15574. echo Parsed_color_0 c yellow | tools/zmqsend
  15575. @end example
  15576. To change the right side:
  15577. @example
  15578. echo Parsed_color_1 c pink | tools/zmqsend
  15579. @end example
  15580. To change the position of the right side:
  15581. @example
  15582. echo overlay@@my x 150 | tools/zmqsend
  15583. @end example
  15584. @c man end MULTIMEDIA FILTERS
  15585. @chapter Multimedia Sources
  15586. @c man begin MULTIMEDIA SOURCES
  15587. Below is a description of the currently available multimedia sources.
  15588. @section amovie
  15589. This is the same as @ref{movie} source, except it selects an audio
  15590. stream by default.
  15591. @anchor{movie}
  15592. @section movie
  15593. Read audio and/or video stream(s) from a movie container.
  15594. It accepts the following parameters:
  15595. @table @option
  15596. @item filename
  15597. The name of the resource to read (not necessarily a file; it can also be a
  15598. device or a stream accessed through some protocol).
  15599. @item format_name, f
  15600. Specifies the format assumed for the movie to read, and can be either
  15601. the name of a container or an input device. If not specified, the
  15602. format is guessed from @var{movie_name} or by probing.
  15603. @item seek_point, sp
  15604. Specifies the seek point in seconds. The frames will be output
  15605. starting from this seek point. The parameter is evaluated with
  15606. @code{av_strtod}, so the numerical value may be suffixed by an IS
  15607. postfix. The default value is "0".
  15608. @item streams, s
  15609. Specifies the streams to read. Several streams can be specified,
  15610. separated by "+". The source will then have as many outputs, in the
  15611. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  15612. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  15613. respectively the default (best suited) video and audio stream. Default
  15614. is "dv", or "da" if the filter is called as "amovie".
  15615. @item stream_index, si
  15616. Specifies the index of the video stream to read. If the value is -1,
  15617. the most suitable video stream will be automatically selected. The default
  15618. value is "-1". Deprecated. If the filter is called "amovie", it will select
  15619. audio instead of video.
  15620. @item loop
  15621. Specifies how many times to read the stream in sequence.
  15622. If the value is 0, the stream will be looped infinitely.
  15623. Default value is "1".
  15624. Note that when the movie is looped the source timestamps are not
  15625. changed, so it will generate non monotonically increasing timestamps.
  15626. @item discontinuity
  15627. Specifies the time difference between frames above which the point is
  15628. considered a timestamp discontinuity which is removed by adjusting the later
  15629. timestamps.
  15630. @end table
  15631. It allows overlaying a second video on top of the main input of
  15632. a filtergraph, as shown in this graph:
  15633. @example
  15634. input -----------> deltapts0 --> overlay --> output
  15635. ^
  15636. |
  15637. movie --> scale--> deltapts1 -------+
  15638. @end example
  15639. @subsection Examples
  15640. @itemize
  15641. @item
  15642. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  15643. on top of the input labelled "in":
  15644. @example
  15645. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  15646. [in] setpts=PTS-STARTPTS [main];
  15647. [main][over] overlay=16:16 [out]
  15648. @end example
  15649. @item
  15650. Read from a video4linux2 device, and overlay it on top of the input
  15651. labelled "in":
  15652. @example
  15653. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  15654. [in] setpts=PTS-STARTPTS [main];
  15655. [main][over] overlay=16:16 [out]
  15656. @end example
  15657. @item
  15658. Read the first video stream and the audio stream with id 0x81 from
  15659. dvd.vob; the video is connected to the pad named "video" and the audio is
  15660. connected to the pad named "audio":
  15661. @example
  15662. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  15663. @end example
  15664. @end itemize
  15665. @subsection Commands
  15666. Both movie and amovie support the following commands:
  15667. @table @option
  15668. @item seek
  15669. Perform seek using "av_seek_frame".
  15670. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  15671. @itemize
  15672. @item
  15673. @var{stream_index}: If stream_index is -1, a default
  15674. stream is selected, and @var{timestamp} is automatically converted
  15675. from AV_TIME_BASE units to the stream specific time_base.
  15676. @item
  15677. @var{timestamp}: Timestamp in AVStream.time_base units
  15678. or, if no stream is specified, in AV_TIME_BASE units.
  15679. @item
  15680. @var{flags}: Flags which select direction and seeking mode.
  15681. @end itemize
  15682. @item get_duration
  15683. Get movie duration in AV_TIME_BASE units.
  15684. @end table
  15685. @c man end MULTIMEDIA SOURCES