filters.texi 581 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919
  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 acrossover
  392. Split audio stream into several bands.
  393. This filter splits audio stream into two or more frequency ranges.
  394. Summing all streams back will give flat output.
  395. The filter accepts the following options:
  396. @table @option
  397. @item split
  398. Set split frequencies. Those must be positive and increasing.
  399. @item order
  400. Set filter order, can be @var{2nd}, @var{4th} or @var{8th}.
  401. Default is @var{4th}.
  402. @end table
  403. @section acrusher
  404. Reduce audio bit resolution.
  405. This filter is bit crusher with enhanced functionality. A bit crusher
  406. is used to audibly reduce number of bits an audio signal is sampled
  407. with. This doesn't change the bit depth at all, it just produces the
  408. effect. Material reduced in bit depth sounds more harsh and "digital".
  409. This filter is able to even round to continuous values instead of discrete
  410. bit depths.
  411. Additionally it has a D/C offset which results in different crushing of
  412. the lower and the upper half of the signal.
  413. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  414. Another feature of this filter is the logarithmic mode.
  415. This setting switches from linear distances between bits to logarithmic ones.
  416. The result is a much more "natural" sounding crusher which doesn't gate low
  417. signals for example. The human ear has a logarithmic perception,
  418. so this kind of crushing is much more pleasant.
  419. Logarithmic crushing is also able to get anti-aliased.
  420. The filter accepts the following options:
  421. @table @option
  422. @item level_in
  423. Set level in.
  424. @item level_out
  425. Set level out.
  426. @item bits
  427. Set bit reduction.
  428. @item mix
  429. Set mixing amount.
  430. @item mode
  431. Can be linear: @code{lin} or logarithmic: @code{log}.
  432. @item dc
  433. Set DC.
  434. @item aa
  435. Set anti-aliasing.
  436. @item samples
  437. Set sample reduction.
  438. @item lfo
  439. Enable LFO. By default disabled.
  440. @item lforange
  441. Set LFO range.
  442. @item lforate
  443. Set LFO rate.
  444. @end table
  445. @section acue
  446. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  447. filter.
  448. @section adeclick
  449. Remove impulsive noise from input audio.
  450. Samples detected as impulsive noise are replaced by interpolated samples using
  451. autoregressive modelling.
  452. @table @option
  453. @item w
  454. Set window size, in milliseconds. Allowed range is from @code{10} to
  455. @code{100}. Default value is @code{55} milliseconds.
  456. This sets size of window which will be processed at once.
  457. @item o
  458. Set window overlap, in percentage of window size. Allowed range is from
  459. @code{50} to @code{95}. Default value is @code{75} percent.
  460. Setting this to a very high value increases impulsive noise removal but makes
  461. whole process much slower.
  462. @item a
  463. Set autoregression order, in percentage of window size. Allowed range is from
  464. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  465. controls quality of interpolated samples using neighbour good samples.
  466. @item t
  467. Set threshold value. Allowed range is from @code{1} to @code{100}.
  468. Default value is @code{2}.
  469. This controls the strength of impulsive noise which is going to be removed.
  470. The lower value, the more samples will be detected as impulsive noise.
  471. @item b
  472. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  473. @code{10}. Default value is @code{2}.
  474. If any two samples deteced as noise are spaced less than this value then any
  475. sample inbetween those two samples will be also detected as noise.
  476. @item m
  477. Set overlap method.
  478. It accepts the following values:
  479. @table @option
  480. @item a
  481. Select overlap-add method. Even not interpolated samples are slightly
  482. changed with this method.
  483. @item s
  484. Select overlap-save method. Not interpolated samples remain unchanged.
  485. @end table
  486. Default value is @code{a}.
  487. @end table
  488. @section adeclip
  489. Remove clipped samples from input audio.
  490. Samples detected as clipped are replaced by interpolated samples using
  491. autoregressive modelling.
  492. @table @option
  493. @item w
  494. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  495. Default value is @code{55} milliseconds.
  496. This sets size of window which will be processed at once.
  497. @item o
  498. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  499. to @code{95}. Default value is @code{75} percent.
  500. @item a
  501. Set autoregression order, in percentage of window size. Allowed range is from
  502. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  503. quality of interpolated samples using neighbour good samples.
  504. @item t
  505. Set threshold value. Allowed range is from @code{1} to @code{100}.
  506. Default value is @code{10}. Higher values make clip detection less aggressive.
  507. @item n
  508. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  509. Default value is @code{1000}. Higher values make clip detection less aggressive.
  510. @item m
  511. Set overlap method.
  512. It accepts the following values:
  513. @table @option
  514. @item a
  515. Select overlap-add method. Even not interpolated samples are slightly changed
  516. with this method.
  517. @item s
  518. Select overlap-save method. Not interpolated samples remain unchanged.
  519. @end table
  520. Default value is @code{a}.
  521. @end table
  522. @section adelay
  523. Delay one or more audio channels.
  524. Samples in delayed channel are filled with silence.
  525. The filter accepts the following option:
  526. @table @option
  527. @item delays
  528. Set list of delays in milliseconds for each channel separated by '|'.
  529. Unused delays will be silently ignored. If number of given delays is
  530. smaller than number of channels all remaining channels will not be delayed.
  531. If you want to delay exact number of samples, append 'S' to number.
  532. @end table
  533. @subsection Examples
  534. @itemize
  535. @item
  536. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  537. the second channel (and any other channels that may be present) unchanged.
  538. @example
  539. adelay=1500|0|500
  540. @end example
  541. @item
  542. Delay second channel by 500 samples, the third channel by 700 samples and leave
  543. the first channel (and any other channels that may be present) unchanged.
  544. @example
  545. adelay=0|500S|700S
  546. @end example
  547. @end itemize
  548. @section aderivative, aintegral
  549. Compute derivative/integral of audio stream.
  550. Applying both filters one after another produces original audio.
  551. @section aecho
  552. Apply echoing to the input audio.
  553. Echoes are reflected sound and can occur naturally amongst mountains
  554. (and sometimes large buildings) when talking or shouting; digital echo
  555. effects emulate this behaviour and are often used to help fill out the
  556. sound of a single instrument or vocal. The time difference between the
  557. original signal and the reflection is the @code{delay}, and the
  558. loudness of the reflected signal is the @code{decay}.
  559. Multiple echoes can have different delays and decays.
  560. A description of the accepted parameters follows.
  561. @table @option
  562. @item in_gain
  563. Set input gain of reflected signal. Default is @code{0.6}.
  564. @item out_gain
  565. Set output gain of reflected signal. Default is @code{0.3}.
  566. @item delays
  567. Set list of time intervals in milliseconds between original signal and reflections
  568. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  569. Default is @code{1000}.
  570. @item decays
  571. Set list of loudness of reflected signals separated by '|'.
  572. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  573. Default is @code{0.5}.
  574. @end table
  575. @subsection Examples
  576. @itemize
  577. @item
  578. Make it sound as if there are twice as many instruments as are actually playing:
  579. @example
  580. aecho=0.8:0.88:60:0.4
  581. @end example
  582. @item
  583. If delay is very short, then it sound like a (metallic) robot playing music:
  584. @example
  585. aecho=0.8:0.88:6:0.4
  586. @end example
  587. @item
  588. A longer delay will sound like an open air concert in the mountains:
  589. @example
  590. aecho=0.8:0.9:1000:0.3
  591. @end example
  592. @item
  593. Same as above but with one more mountain:
  594. @example
  595. aecho=0.8:0.9:1000|1800:0.3|0.25
  596. @end example
  597. @end itemize
  598. @section aemphasis
  599. Audio emphasis filter creates or restores material directly taken from LPs or
  600. emphased CDs with different filter curves. E.g. to store music on vinyl the
  601. signal has to be altered by a filter first to even out the disadvantages of
  602. this recording medium.
  603. Once the material is played back the inverse filter has to be applied to
  604. restore the distortion of the frequency response.
  605. The filter accepts the following options:
  606. @table @option
  607. @item level_in
  608. Set input gain.
  609. @item level_out
  610. Set output gain.
  611. @item mode
  612. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  613. use @code{production} mode. Default is @code{reproduction} mode.
  614. @item type
  615. Set filter type. Selects medium. Can be one of the following:
  616. @table @option
  617. @item col
  618. select Columbia.
  619. @item emi
  620. select EMI.
  621. @item bsi
  622. select BSI (78RPM).
  623. @item riaa
  624. select RIAA.
  625. @item cd
  626. select Compact Disc (CD).
  627. @item 50fm
  628. select 50µs (FM).
  629. @item 75fm
  630. select 75µs (FM).
  631. @item 50kf
  632. select 50µs (FM-KF).
  633. @item 75kf
  634. select 75µs (FM-KF).
  635. @end table
  636. @end table
  637. @section aeval
  638. Modify an audio signal according to the specified expressions.
  639. This filter accepts one or more expressions (one for each channel),
  640. which are evaluated and used to modify a corresponding audio signal.
  641. It accepts the following parameters:
  642. @table @option
  643. @item exprs
  644. Set the '|'-separated expressions list for each separate channel. If
  645. the number of input channels is greater than the number of
  646. expressions, the last specified expression is used for the remaining
  647. output channels.
  648. @item channel_layout, c
  649. Set output channel layout. If not specified, the channel layout is
  650. specified by the number of expressions. If set to @samp{same}, it will
  651. use by default the same input channel layout.
  652. @end table
  653. Each expression in @var{exprs} can contain the following constants and functions:
  654. @table @option
  655. @item ch
  656. channel number of the current expression
  657. @item n
  658. number of the evaluated sample, starting from 0
  659. @item s
  660. sample rate
  661. @item t
  662. time of the evaluated sample expressed in seconds
  663. @item nb_in_channels
  664. @item nb_out_channels
  665. input and output number of channels
  666. @item val(CH)
  667. the value of input channel with number @var{CH}
  668. @end table
  669. Note: this filter is slow. For faster processing you should use a
  670. dedicated filter.
  671. @subsection Examples
  672. @itemize
  673. @item
  674. Half volume:
  675. @example
  676. aeval=val(ch)/2:c=same
  677. @end example
  678. @item
  679. Invert phase of the second channel:
  680. @example
  681. aeval=val(0)|-val(1)
  682. @end example
  683. @end itemize
  684. @anchor{afade}
  685. @section afade
  686. Apply fade-in/out effect to input audio.
  687. A description of the accepted parameters follows.
  688. @table @option
  689. @item type, t
  690. Specify the effect type, can be either @code{in} for fade-in, or
  691. @code{out} for a fade-out effect. Default is @code{in}.
  692. @item start_sample, ss
  693. Specify the number of the start sample for starting to apply the fade
  694. effect. Default is 0.
  695. @item nb_samples, ns
  696. Specify the number of samples for which the fade effect has to last. At
  697. the end of the fade-in effect the output audio will have the same
  698. volume as the input audio, at the end of the fade-out transition
  699. the output audio will be silence. Default is 44100.
  700. @item start_time, st
  701. Specify the start time of the fade effect. Default is 0.
  702. The value must be specified as a time duration; see
  703. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  704. for the accepted syntax.
  705. If set this option is used instead of @var{start_sample}.
  706. @item duration, d
  707. Specify the duration of the fade effect. See
  708. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  709. for the accepted syntax.
  710. At the end of the fade-in effect the output audio will have the same
  711. volume as the input audio, at the end of the fade-out transition
  712. the output audio will be silence.
  713. By default the duration is determined by @var{nb_samples}.
  714. If set this option is used instead of @var{nb_samples}.
  715. @item curve
  716. Set curve for fade transition.
  717. It accepts the following values:
  718. @table @option
  719. @item tri
  720. select triangular, linear slope (default)
  721. @item qsin
  722. select quarter of sine wave
  723. @item hsin
  724. select half of sine wave
  725. @item esin
  726. select exponential sine wave
  727. @item log
  728. select logarithmic
  729. @item ipar
  730. select inverted parabola
  731. @item qua
  732. select quadratic
  733. @item cub
  734. select cubic
  735. @item squ
  736. select square root
  737. @item cbr
  738. select cubic root
  739. @item par
  740. select parabola
  741. @item exp
  742. select exponential
  743. @item iqsin
  744. select inverted quarter of sine wave
  745. @item ihsin
  746. select inverted half of sine wave
  747. @item dese
  748. select double-exponential seat
  749. @item desi
  750. select double-exponential sigmoid
  751. @item losi
  752. select logistic sigmoid
  753. @end table
  754. @end table
  755. @subsection Examples
  756. @itemize
  757. @item
  758. Fade in first 15 seconds of audio:
  759. @example
  760. afade=t=in:ss=0:d=15
  761. @end example
  762. @item
  763. Fade out last 25 seconds of a 900 seconds audio:
  764. @example
  765. afade=t=out:st=875:d=25
  766. @end example
  767. @end itemize
  768. @section afftdn
  769. Denoise audio samples with FFT.
  770. A description of the accepted parameters follows.
  771. @table @option
  772. @item nr
  773. Set the noise reduction in dB, allowed range is 0.01 to 97.
  774. Default value is 12 dB.
  775. @item nf
  776. Set the noise floor in dB, allowed range is -80 to -20.
  777. Default value is -50 dB.
  778. @item nt
  779. Set the noise type.
  780. It accepts the following values:
  781. @table @option
  782. @item w
  783. Select white noise.
  784. @item v
  785. Select vinyl noise.
  786. @item s
  787. Select shellac noise.
  788. @item c
  789. Select custom noise, defined in @code{bn} option.
  790. Default value is white noise.
  791. @end table
  792. @item bn
  793. Set custom band noise for every one of 15 bands.
  794. Bands are separated by ' ' or '|'.
  795. @item rf
  796. Set the residual floor in dB, allowed range is -80 to -20.
  797. Default value is -38 dB.
  798. @item tn
  799. Enable noise tracking. By default is disabled.
  800. With this enabled, noise floor is automatically adjusted.
  801. @item tr
  802. Enable residual tracking. By default is disabled.
  803. @item om
  804. Set the output mode.
  805. It accepts the following values:
  806. @table @option
  807. @item i
  808. Pass input unchanged.
  809. @item o
  810. Pass noise filtered out.
  811. @item n
  812. Pass only noise.
  813. Default value is @var{o}.
  814. @end table
  815. @end table
  816. @subsection Commands
  817. This filter supports the following commands:
  818. @table @option
  819. @item sample_noise, sn
  820. Start or stop measuring noise profile.
  821. Syntax for the command is : "start" or "stop" string.
  822. After measuring noise profile is stopped it will be
  823. automatically applied in filtering.
  824. @item noise_reduction, nr
  825. Change noise reduction. Argument is single float number.
  826. Syntax for the command is : "@var{noise_reduction}"
  827. @item noise_floor, nf
  828. Change noise floor. Argument is single float number.
  829. Syntax for the command is : "@var{noise_floor}"
  830. @item output_mode, om
  831. Change output mode operation.
  832. Syntax for the command is : "i", "o" or "n" string.
  833. @end table
  834. @section afftfilt
  835. Apply arbitrary expressions to samples in frequency domain.
  836. @table @option
  837. @item real
  838. Set frequency domain real expression for each separate channel separated
  839. by '|'. Default is "1".
  840. If the number of input channels is greater than the number of
  841. expressions, the last specified expression is used for the remaining
  842. output channels.
  843. @item imag
  844. Set frequency domain imaginary expression for each separate channel
  845. separated by '|'. If not set, @var{real} option is used.
  846. Each expression in @var{real} and @var{imag} can contain the following
  847. constants:
  848. @table @option
  849. @item sr
  850. sample rate
  851. @item b
  852. current frequency bin number
  853. @item nb
  854. number of available bins
  855. @item ch
  856. channel number of the current expression
  857. @item chs
  858. number of channels
  859. @item pts
  860. current frame pts
  861. @end table
  862. @item win_size
  863. Set window size.
  864. It accepts the following values:
  865. @table @samp
  866. @item w16
  867. @item w32
  868. @item w64
  869. @item w128
  870. @item w256
  871. @item w512
  872. @item w1024
  873. @item w2048
  874. @item w4096
  875. @item w8192
  876. @item w16384
  877. @item w32768
  878. @item w65536
  879. @end table
  880. Default is @code{w4096}
  881. @item win_func
  882. Set window function. Default is @code{hann}.
  883. @item overlap
  884. Set window overlap. If set to 1, the recommended overlap for selected
  885. window function will be picked. Default is @code{0.75}.
  886. @end table
  887. @subsection Examples
  888. @itemize
  889. @item
  890. Leave almost only low frequencies in audio:
  891. @example
  892. afftfilt="1-clip((b/nb)*b,0,1)"
  893. @end example
  894. @end itemize
  895. @anchor{afir}
  896. @section afir
  897. Apply an arbitrary Frequency Impulse Response filter.
  898. This filter is designed for applying long FIR filters,
  899. up to 60 seconds long.
  900. It can be used as component for digital crossover filters,
  901. room equalization, cross talk cancellation, wavefield synthesis,
  902. auralization, ambiophonics and ambisonics.
  903. This filter uses second stream as FIR coefficients.
  904. If second stream holds single channel, it will be used
  905. for all input channels in first stream, otherwise
  906. number of channels in second stream must be same as
  907. number of channels in first stream.
  908. It accepts the following parameters:
  909. @table @option
  910. @item dry
  911. Set dry gain. This sets input gain.
  912. @item wet
  913. Set wet gain. This sets final output gain.
  914. @item length
  915. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  916. @item gtype
  917. Enable applying gain measured from power of IR.
  918. Set which approach to use for auto gain measurement.
  919. @table @option
  920. @item none
  921. Do not apply any gain.
  922. @item peak
  923. select peak gain, very conservative approach. This is default value.
  924. @item dc
  925. select DC gain, limited application.
  926. @item gn
  927. select gain to noise approach, this is most popular one.
  928. @end table
  929. @item irgain
  930. Set gain to be applied to IR coefficients before filtering.
  931. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{gtype} option.
  932. @item irfmt
  933. Set format of IR stream. Can be @code{mono} or @code{input}.
  934. Default is @code{input}.
  935. @item maxir
  936. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  937. Allowed range is 0.1 to 60 seconds.
  938. @item response
  939. Show IR frequency reponse, magnitude(magenta) and phase(green) and group delay(yellow) in additional video stream.
  940. By default it is disabled.
  941. @item channel
  942. Set for which IR channel to display frequency response. By default is first channel
  943. displayed. This option is used only when @var{response} is enabled.
  944. @item size
  945. Set video stream size. This option is used only when @var{response} is enabled.
  946. @end table
  947. @subsection Examples
  948. @itemize
  949. @item
  950. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  951. @example
  952. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  953. @end example
  954. @end itemize
  955. @anchor{aformat}
  956. @section aformat
  957. Set output format constraints for the input audio. The framework will
  958. negotiate the most appropriate format to minimize conversions.
  959. It accepts the following parameters:
  960. @table @option
  961. @item sample_fmts
  962. A '|'-separated list of requested sample formats.
  963. @item sample_rates
  964. A '|'-separated list of requested sample rates.
  965. @item channel_layouts
  966. A '|'-separated list of requested channel layouts.
  967. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  968. for the required syntax.
  969. @end table
  970. If a parameter is omitted, all values are allowed.
  971. Force the output to either unsigned 8-bit or signed 16-bit stereo
  972. @example
  973. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  974. @end example
  975. @section agate
  976. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  977. processing reduces disturbing noise between useful signals.
  978. Gating is done by detecting the volume below a chosen level @var{threshold}
  979. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  980. floor is set via @var{range}. Because an exact manipulation of the signal
  981. would cause distortion of the waveform the reduction can be levelled over
  982. time. This is done by setting @var{attack} and @var{release}.
  983. @var{attack} determines how long the signal has to fall below the threshold
  984. before any reduction will occur and @var{release} sets the time the signal
  985. has to rise above the threshold to reduce the reduction again.
  986. Shorter signals than the chosen attack time will be left untouched.
  987. @table @option
  988. @item level_in
  989. Set input level before filtering.
  990. Default is 1. Allowed range is from 0.015625 to 64.
  991. @item range
  992. Set the level of gain reduction when the signal is below the threshold.
  993. Default is 0.06125. Allowed range is from 0 to 1.
  994. @item threshold
  995. If a signal rises above this level the gain reduction is released.
  996. Default is 0.125. Allowed range is from 0 to 1.
  997. @item ratio
  998. Set a ratio by which the signal is reduced.
  999. Default is 2. Allowed range is from 1 to 9000.
  1000. @item attack
  1001. Amount of milliseconds the signal has to rise above the threshold before gain
  1002. reduction stops.
  1003. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1004. @item release
  1005. Amount of milliseconds the signal has to fall below the threshold before the
  1006. reduction is increased again. Default is 250 milliseconds.
  1007. Allowed range is from 0.01 to 9000.
  1008. @item makeup
  1009. Set amount of amplification of signal after processing.
  1010. Default is 1. Allowed range is from 1 to 64.
  1011. @item knee
  1012. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1013. Default is 2.828427125. Allowed range is from 1 to 8.
  1014. @item detection
  1015. Choose if exact signal should be taken for detection or an RMS like one.
  1016. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1017. @item link
  1018. Choose if the average level between all channels or the louder channel affects
  1019. the reduction.
  1020. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1021. @end table
  1022. @section aiir
  1023. Apply an arbitrary Infinite Impulse Response filter.
  1024. It accepts the following parameters:
  1025. @table @option
  1026. @item z
  1027. Set numerator/zeros coefficients.
  1028. @item p
  1029. Set denominator/poles coefficients.
  1030. @item k
  1031. Set channels gains.
  1032. @item dry_gain
  1033. Set input gain.
  1034. @item wet_gain
  1035. Set output gain.
  1036. @item f
  1037. Set coefficients format.
  1038. @table @samp
  1039. @item tf
  1040. transfer function
  1041. @item zp
  1042. Z-plane zeros/poles, cartesian (default)
  1043. @item pr
  1044. Z-plane zeros/poles, polar radians
  1045. @item pd
  1046. Z-plane zeros/poles, polar degrees
  1047. @end table
  1048. @item r
  1049. Set kind of processing.
  1050. Can be @code{d} - direct or @code{s} - serial cascading. Defauls is @code{s}.
  1051. @item e
  1052. Set filtering precision.
  1053. @table @samp
  1054. @item dbl
  1055. double-precision floating-point (default)
  1056. @item flt
  1057. single-precision floating-point
  1058. @item i32
  1059. 32-bit integers
  1060. @item i16
  1061. 16-bit integers
  1062. @end table
  1063. @item response
  1064. Show IR frequency reponse, magnitude and phase in additional video stream.
  1065. By default it is disabled.
  1066. @item channel
  1067. Set for which IR channel to display frequency response. By default is first channel
  1068. displayed. This option is used only when @var{response} is enabled.
  1069. @item size
  1070. Set video stream size. This option is used only when @var{response} is enabled.
  1071. @end table
  1072. Coefficients in @code{tf} format are separated by spaces and are in ascending
  1073. order.
  1074. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1075. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1076. imaginary unit.
  1077. Different coefficients and gains can be provided for every channel, in such case
  1078. use '|' to separate coefficients or gains. Last provided coefficients will be
  1079. used for all remaining channels.
  1080. @subsection Examples
  1081. @itemize
  1082. @item
  1083. Apply 2 pole elliptic notch at arround 5000Hz for 48000 Hz sample rate:
  1084. @example
  1085. 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
  1086. @end example
  1087. @item
  1088. Same as above but in @code{zp} format:
  1089. @example
  1090. 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
  1091. @end example
  1092. @end itemize
  1093. @section alimiter
  1094. The limiter prevents an input signal from rising over a desired threshold.
  1095. This limiter uses lookahead technology to prevent your signal from distorting.
  1096. It means that there is a small delay after the signal is processed. Keep in mind
  1097. that the delay it produces is the attack time you set.
  1098. The filter accepts the following options:
  1099. @table @option
  1100. @item level_in
  1101. Set input gain. Default is 1.
  1102. @item level_out
  1103. Set output gain. Default is 1.
  1104. @item limit
  1105. Don't let signals above this level pass the limiter. Default is 1.
  1106. @item attack
  1107. The limiter will reach its attenuation level in this amount of time in
  1108. milliseconds. Default is 5 milliseconds.
  1109. @item release
  1110. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1111. Default is 50 milliseconds.
  1112. @item asc
  1113. When gain reduction is always needed ASC takes care of releasing to an
  1114. average reduction level rather than reaching a reduction of 0 in the release
  1115. time.
  1116. @item asc_level
  1117. Select how much the release time is affected by ASC, 0 means nearly no changes
  1118. in release time while 1 produces higher release times.
  1119. @item level
  1120. Auto level output signal. Default is enabled.
  1121. This normalizes audio back to 0dB if enabled.
  1122. @end table
  1123. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1124. with @ref{aresample} before applying this filter.
  1125. @section allpass
  1126. Apply a two-pole all-pass filter with central frequency (in Hz)
  1127. @var{frequency}, and filter-width @var{width}.
  1128. An all-pass filter changes the audio's frequency to phase relationship
  1129. without changing its frequency to amplitude relationship.
  1130. The filter accepts the following options:
  1131. @table @option
  1132. @item frequency, f
  1133. Set frequency in Hz.
  1134. @item width_type, t
  1135. Set method to specify band-width of filter.
  1136. @table @option
  1137. @item h
  1138. Hz
  1139. @item q
  1140. Q-Factor
  1141. @item o
  1142. octave
  1143. @item s
  1144. slope
  1145. @item k
  1146. kHz
  1147. @end table
  1148. @item width, w
  1149. Specify the band-width of a filter in width_type units.
  1150. @item channels, c
  1151. Specify which channels to filter, by default all available are filtered.
  1152. @end table
  1153. @subsection Commands
  1154. This filter supports the following commands:
  1155. @table @option
  1156. @item frequency, f
  1157. Change allpass frequency.
  1158. Syntax for the command is : "@var{frequency}"
  1159. @item width_type, t
  1160. Change allpass width_type.
  1161. Syntax for the command is : "@var{width_type}"
  1162. @item width, w
  1163. Change allpass width.
  1164. Syntax for the command is : "@var{width}"
  1165. @end table
  1166. @section aloop
  1167. Loop audio samples.
  1168. The filter accepts the following options:
  1169. @table @option
  1170. @item loop
  1171. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1172. Default is 0.
  1173. @item size
  1174. Set maximal number of samples. Default is 0.
  1175. @item start
  1176. Set first sample of loop. Default is 0.
  1177. @end table
  1178. @anchor{amerge}
  1179. @section amerge
  1180. Merge two or more audio streams into a single multi-channel stream.
  1181. The filter accepts the following options:
  1182. @table @option
  1183. @item inputs
  1184. Set the number of inputs. Default is 2.
  1185. @end table
  1186. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1187. the channel layout of the output will be set accordingly and the channels
  1188. will be reordered as necessary. If the channel layouts of the inputs are not
  1189. disjoint, the output will have all the channels of the first input then all
  1190. the channels of the second input, in that order, and the channel layout of
  1191. the output will be the default value corresponding to the total number of
  1192. channels.
  1193. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1194. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1195. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1196. first input, b1 is the first channel of the second input).
  1197. On the other hand, if both input are in stereo, the output channels will be
  1198. in the default order: a1, a2, b1, b2, and the channel layout will be
  1199. arbitrarily set to 4.0, which may or may not be the expected value.
  1200. All inputs must have the same sample rate, and format.
  1201. If inputs do not have the same duration, the output will stop with the
  1202. shortest.
  1203. @subsection Examples
  1204. @itemize
  1205. @item
  1206. Merge two mono files into a stereo stream:
  1207. @example
  1208. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1209. @end example
  1210. @item
  1211. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1212. @example
  1213. 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
  1214. @end example
  1215. @end itemize
  1216. @section amix
  1217. Mixes multiple audio inputs into a single output.
  1218. Note that this filter only supports float samples (the @var{amerge}
  1219. and @var{pan} audio filters support many formats). If the @var{amix}
  1220. input has integer samples then @ref{aresample} will be automatically
  1221. inserted to perform the conversion to float samples.
  1222. For example
  1223. @example
  1224. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1225. @end example
  1226. will mix 3 input audio streams to a single output with the same duration as the
  1227. first input and a dropout transition time of 3 seconds.
  1228. It accepts the following parameters:
  1229. @table @option
  1230. @item inputs
  1231. The number of inputs. If unspecified, it defaults to 2.
  1232. @item duration
  1233. How to determine the end-of-stream.
  1234. @table @option
  1235. @item longest
  1236. The duration of the longest input. (default)
  1237. @item shortest
  1238. The duration of the shortest input.
  1239. @item first
  1240. The duration of the first input.
  1241. @end table
  1242. @item dropout_transition
  1243. The transition time, in seconds, for volume renormalization when an input
  1244. stream ends. The default value is 2 seconds.
  1245. @item weights
  1246. Specify weight of each input audio stream as sequence.
  1247. Each weight is separated by space. By default all inputs have same weight.
  1248. @end table
  1249. @section amultiply
  1250. Multiply first audio stream with second audio stream and store result
  1251. in output audio stream. Multiplication is done by multiplying each
  1252. sample from first stream with sample at same position from second stream.
  1253. With this element-wise multiplication one can create amplitude fades and
  1254. amplitude modulations.
  1255. @section anequalizer
  1256. High-order parametric multiband equalizer for each channel.
  1257. It accepts the following parameters:
  1258. @table @option
  1259. @item params
  1260. This option string is in format:
  1261. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1262. Each equalizer band is separated by '|'.
  1263. @table @option
  1264. @item chn
  1265. Set channel number to which equalization will be applied.
  1266. If input doesn't have that channel the entry is ignored.
  1267. @item f
  1268. Set central frequency for band.
  1269. If input doesn't have that frequency the entry is ignored.
  1270. @item w
  1271. Set band width in hertz.
  1272. @item g
  1273. Set band gain in dB.
  1274. @item t
  1275. Set filter type for band, optional, can be:
  1276. @table @samp
  1277. @item 0
  1278. Butterworth, this is default.
  1279. @item 1
  1280. Chebyshev type 1.
  1281. @item 2
  1282. Chebyshev type 2.
  1283. @end table
  1284. @end table
  1285. @item curves
  1286. With this option activated frequency response of anequalizer is displayed
  1287. in video stream.
  1288. @item size
  1289. Set video stream size. Only useful if curves option is activated.
  1290. @item mgain
  1291. Set max gain that will be displayed. Only useful if curves option is activated.
  1292. Setting this to a reasonable value makes it possible to display gain which is derived from
  1293. neighbour bands which are too close to each other and thus produce higher gain
  1294. when both are activated.
  1295. @item fscale
  1296. Set frequency scale used to draw frequency response in video output.
  1297. Can be linear or logarithmic. Default is logarithmic.
  1298. @item colors
  1299. Set color for each channel curve which is going to be displayed in video stream.
  1300. This is list of color names separated by space or by '|'.
  1301. Unrecognised or missing colors will be replaced by white color.
  1302. @end table
  1303. @subsection Examples
  1304. @itemize
  1305. @item
  1306. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1307. for first 2 channels using Chebyshev type 1 filter:
  1308. @example
  1309. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1310. @end example
  1311. @end itemize
  1312. @subsection Commands
  1313. This filter supports the following commands:
  1314. @table @option
  1315. @item change
  1316. Alter existing filter parameters.
  1317. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1318. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1319. error is returned.
  1320. @var{freq} set new frequency parameter.
  1321. @var{width} set new width parameter in herz.
  1322. @var{gain} set new gain parameter in dB.
  1323. Full filter invocation with asendcmd may look like this:
  1324. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1325. @end table
  1326. @section anull
  1327. Pass the audio source unchanged to the output.
  1328. @section apad
  1329. Pad the end of an audio stream with silence.
  1330. This can be used together with @command{ffmpeg} @option{-shortest} to
  1331. extend audio streams to the same length as the video stream.
  1332. A description of the accepted options follows.
  1333. @table @option
  1334. @item packet_size
  1335. Set silence packet size. Default value is 4096.
  1336. @item pad_len
  1337. Set the number of samples of silence to add to the end. After the
  1338. value is reached, the stream is terminated. This option is mutually
  1339. exclusive with @option{whole_len}.
  1340. @item whole_len
  1341. Set the minimum total number of samples in the output audio stream. If
  1342. the value is longer than the input audio length, silence is added to
  1343. the end, until the value is reached. This option is mutually exclusive
  1344. with @option{pad_len}.
  1345. @end table
  1346. If neither the @option{pad_len} nor the @option{whole_len} option is
  1347. set, the filter will add silence to the end of the input stream
  1348. indefinitely.
  1349. @subsection Examples
  1350. @itemize
  1351. @item
  1352. Add 1024 samples of silence to the end of the input:
  1353. @example
  1354. apad=pad_len=1024
  1355. @end example
  1356. @item
  1357. Make sure the audio output will contain at least 10000 samples, pad
  1358. the input with silence if required:
  1359. @example
  1360. apad=whole_len=10000
  1361. @end example
  1362. @item
  1363. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1364. video stream will always result the shortest and will be converted
  1365. until the end in the output file when using the @option{shortest}
  1366. option:
  1367. @example
  1368. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1369. @end example
  1370. @end itemize
  1371. @section aphaser
  1372. Add a phasing effect to the input audio.
  1373. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1374. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1375. A description of the accepted parameters follows.
  1376. @table @option
  1377. @item in_gain
  1378. Set input gain. Default is 0.4.
  1379. @item out_gain
  1380. Set output gain. Default is 0.74
  1381. @item delay
  1382. Set delay in milliseconds. Default is 3.0.
  1383. @item decay
  1384. Set decay. Default is 0.4.
  1385. @item speed
  1386. Set modulation speed in Hz. Default is 0.5.
  1387. @item type
  1388. Set modulation type. Default is triangular.
  1389. It accepts the following values:
  1390. @table @samp
  1391. @item triangular, t
  1392. @item sinusoidal, s
  1393. @end table
  1394. @end table
  1395. @section apulsator
  1396. Audio pulsator is something between an autopanner and a tremolo.
  1397. But it can produce funny stereo effects as well. Pulsator changes the volume
  1398. of the left and right channel based on a LFO (low frequency oscillator) with
  1399. different waveforms and shifted phases.
  1400. This filter have the ability to define an offset between left and right
  1401. channel. An offset of 0 means that both LFO shapes match each other.
  1402. The left and right channel are altered equally - a conventional tremolo.
  1403. An offset of 50% means that the shape of the right channel is exactly shifted
  1404. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1405. an autopanner. At 1 both curves match again. Every setting in between moves the
  1406. phase shift gapless between all stages and produces some "bypassing" sounds with
  1407. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1408. the 0.5) the faster the signal passes from the left to the right speaker.
  1409. The filter accepts the following options:
  1410. @table @option
  1411. @item level_in
  1412. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1413. @item level_out
  1414. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1415. @item mode
  1416. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1417. sawup or sawdown. Default is sine.
  1418. @item amount
  1419. Set modulation. Define how much of original signal is affected by the LFO.
  1420. @item offset_l
  1421. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1422. @item offset_r
  1423. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1424. @item width
  1425. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1426. @item timing
  1427. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1428. @item bpm
  1429. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1430. is set to bpm.
  1431. @item ms
  1432. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1433. is set to ms.
  1434. @item hz
  1435. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1436. if timing is set to hz.
  1437. @end table
  1438. @anchor{aresample}
  1439. @section aresample
  1440. Resample the input audio to the specified parameters, using the
  1441. libswresample library. If none are specified then the filter will
  1442. automatically convert between its input and output.
  1443. This filter is also able to stretch/squeeze the audio data to make it match
  1444. the timestamps or to inject silence / cut out audio to make it match the
  1445. timestamps, do a combination of both or do neither.
  1446. The filter accepts the syntax
  1447. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1448. expresses a sample rate and @var{resampler_options} is a list of
  1449. @var{key}=@var{value} pairs, separated by ":". See the
  1450. @ref{Resampler Options,,"Resampler Options" section in the
  1451. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1452. for the complete list of supported options.
  1453. @subsection Examples
  1454. @itemize
  1455. @item
  1456. Resample the input audio to 44100Hz:
  1457. @example
  1458. aresample=44100
  1459. @end example
  1460. @item
  1461. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1462. samples per second compensation:
  1463. @example
  1464. aresample=async=1000
  1465. @end example
  1466. @end itemize
  1467. @section areverse
  1468. Reverse an audio clip.
  1469. Warning: This filter requires memory to buffer the entire clip, so trimming
  1470. is suggested.
  1471. @subsection Examples
  1472. @itemize
  1473. @item
  1474. Take the first 5 seconds of a clip, and reverse it.
  1475. @example
  1476. atrim=end=5,areverse
  1477. @end example
  1478. @end itemize
  1479. @section asetnsamples
  1480. Set the number of samples per each output audio frame.
  1481. The last output packet may contain a different number of samples, as
  1482. the filter will flush all the remaining samples when the input audio
  1483. signals its end.
  1484. The filter accepts the following options:
  1485. @table @option
  1486. @item nb_out_samples, n
  1487. Set the number of frames per each output audio frame. The number is
  1488. intended as the number of samples @emph{per each channel}.
  1489. Default value is 1024.
  1490. @item pad, p
  1491. If set to 1, the filter will pad the last audio frame with zeroes, so
  1492. that the last frame will contain the same number of samples as the
  1493. previous ones. Default value is 1.
  1494. @end table
  1495. For example, to set the number of per-frame samples to 1234 and
  1496. disable padding for the last frame, use:
  1497. @example
  1498. asetnsamples=n=1234:p=0
  1499. @end example
  1500. @section asetrate
  1501. Set the sample rate without altering the PCM data.
  1502. This will result in a change of speed and pitch.
  1503. The filter accepts the following options:
  1504. @table @option
  1505. @item sample_rate, r
  1506. Set the output sample rate. Default is 44100 Hz.
  1507. @end table
  1508. @section ashowinfo
  1509. Show a line containing various information for each input audio frame.
  1510. The input audio is not modified.
  1511. The shown line contains a sequence of key/value pairs of the form
  1512. @var{key}:@var{value}.
  1513. The following values are shown in the output:
  1514. @table @option
  1515. @item n
  1516. The (sequential) number of the input frame, starting from 0.
  1517. @item pts
  1518. The presentation timestamp of the input frame, in time base units; the time base
  1519. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1520. @item pts_time
  1521. The presentation timestamp of the input frame in seconds.
  1522. @item pos
  1523. position of the frame in the input stream, -1 if this information in
  1524. unavailable and/or meaningless (for example in case of synthetic audio)
  1525. @item fmt
  1526. The sample format.
  1527. @item chlayout
  1528. The channel layout.
  1529. @item rate
  1530. The sample rate for the audio frame.
  1531. @item nb_samples
  1532. The number of samples (per channel) in the frame.
  1533. @item checksum
  1534. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1535. audio, the data is treated as if all the planes were concatenated.
  1536. @item plane_checksums
  1537. A list of Adler-32 checksums for each data plane.
  1538. @end table
  1539. @anchor{astats}
  1540. @section astats
  1541. Display time domain statistical information about the audio channels.
  1542. Statistics are calculated and displayed for each audio channel and,
  1543. where applicable, an overall figure is also given.
  1544. It accepts the following option:
  1545. @table @option
  1546. @item length
  1547. Short window length in seconds, used for peak and trough RMS measurement.
  1548. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1549. @item metadata
  1550. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1551. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1552. disabled.
  1553. Available keys for each channel are:
  1554. DC_offset
  1555. Min_level
  1556. Max_level
  1557. Min_difference
  1558. Max_difference
  1559. Mean_difference
  1560. RMS_difference
  1561. Peak_level
  1562. RMS_peak
  1563. RMS_trough
  1564. Crest_factor
  1565. Flat_factor
  1566. Peak_count
  1567. Bit_depth
  1568. Dynamic_range
  1569. Zero_crossings
  1570. Zero_crossings_rate
  1571. and for Overall:
  1572. DC_offset
  1573. Min_level
  1574. Max_level
  1575. Min_difference
  1576. Max_difference
  1577. Mean_difference
  1578. RMS_difference
  1579. Peak_level
  1580. RMS_level
  1581. RMS_peak
  1582. RMS_trough
  1583. Flat_factor
  1584. Peak_count
  1585. Bit_depth
  1586. Number_of_samples
  1587. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1588. this @code{lavfi.astats.Overall.Peak_count}.
  1589. For description what each key means read below.
  1590. @item reset
  1591. Set number of frame after which stats are going to be recalculated.
  1592. Default is disabled.
  1593. @end table
  1594. A description of each shown parameter follows:
  1595. @table @option
  1596. @item DC offset
  1597. Mean amplitude displacement from zero.
  1598. @item Min level
  1599. Minimal sample level.
  1600. @item Max level
  1601. Maximal sample level.
  1602. @item Min difference
  1603. Minimal difference between two consecutive samples.
  1604. @item Max difference
  1605. Maximal difference between two consecutive samples.
  1606. @item Mean difference
  1607. Mean difference between two consecutive samples.
  1608. The average of each difference between two consecutive samples.
  1609. @item RMS difference
  1610. Root Mean Square difference between two consecutive samples.
  1611. @item Peak level dB
  1612. @item RMS level dB
  1613. Standard peak and RMS level measured in dBFS.
  1614. @item RMS peak dB
  1615. @item RMS trough dB
  1616. Peak and trough values for RMS level measured over a short window.
  1617. @item Crest factor
  1618. Standard ratio of peak to RMS level (note: not in dB).
  1619. @item Flat factor
  1620. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1621. (i.e. either @var{Min level} or @var{Max level}).
  1622. @item Peak count
  1623. Number of occasions (not the number of samples) that the signal attained either
  1624. @var{Min level} or @var{Max level}.
  1625. @item Bit depth
  1626. Overall bit depth of audio. Number of bits used for each sample.
  1627. @item Dynamic range
  1628. Measured dynamic range of audio in dB.
  1629. @item Zero crossings
  1630. Number of points where the waveform crosses the zero level axis.
  1631. @item Zero crossings rate
  1632. Rate of Zero crossings and number of audio samples.
  1633. @end table
  1634. @section atempo
  1635. Adjust audio tempo.
  1636. The filter accepts exactly one parameter, the audio tempo. If not
  1637. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1638. be in the [0.5, 100.0] range.
  1639. Note that tempo greater than 2 will skip some samples rather than
  1640. blend them in. If for any reason this is a concern it is always
  1641. possible to daisy-chain several instances of atempo to achieve the
  1642. desired product tempo.
  1643. @subsection Examples
  1644. @itemize
  1645. @item
  1646. Slow down audio to 80% tempo:
  1647. @example
  1648. atempo=0.8
  1649. @end example
  1650. @item
  1651. To speed up audio to 300% tempo:
  1652. @example
  1653. atempo=3
  1654. @end example
  1655. @item
  1656. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  1657. @example
  1658. atempo=sqrt(3),atempo=sqrt(3)
  1659. @end example
  1660. @end itemize
  1661. @section atrim
  1662. Trim the input so that the output contains one continuous subpart of the input.
  1663. It accepts the following parameters:
  1664. @table @option
  1665. @item start
  1666. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1667. sample with the timestamp @var{start} will be the first sample in the output.
  1668. @item end
  1669. Specify time of the first audio sample that will be dropped, i.e. the
  1670. audio sample immediately preceding the one with the timestamp @var{end} will be
  1671. the last sample in the output.
  1672. @item start_pts
  1673. Same as @var{start}, except this option sets the start timestamp in samples
  1674. instead of seconds.
  1675. @item end_pts
  1676. Same as @var{end}, except this option sets the end timestamp in samples instead
  1677. of seconds.
  1678. @item duration
  1679. The maximum duration of the output in seconds.
  1680. @item start_sample
  1681. The number of the first sample that should be output.
  1682. @item end_sample
  1683. The number of the first sample that should be dropped.
  1684. @end table
  1685. @option{start}, @option{end}, and @option{duration} are expressed as time
  1686. duration specifications; see
  1687. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1688. Note that the first two sets of the start/end options and the @option{duration}
  1689. option look at the frame timestamp, while the _sample options simply count the
  1690. samples that pass through the filter. So start/end_pts and start/end_sample will
  1691. give different results when the timestamps are wrong, inexact or do not start at
  1692. zero. Also note that this filter does not modify the timestamps. If you wish
  1693. to have the output timestamps start at zero, insert the asetpts filter after the
  1694. atrim filter.
  1695. If multiple start or end options are set, this filter tries to be greedy and
  1696. keep all samples that match at least one of the specified constraints. To keep
  1697. only the part that matches all the constraints at once, chain multiple atrim
  1698. filters.
  1699. The defaults are such that all the input is kept. So it is possible to set e.g.
  1700. just the end values to keep everything before the specified time.
  1701. Examples:
  1702. @itemize
  1703. @item
  1704. Drop everything except the second minute of input:
  1705. @example
  1706. ffmpeg -i INPUT -af atrim=60:120
  1707. @end example
  1708. @item
  1709. Keep only the first 1000 samples:
  1710. @example
  1711. ffmpeg -i INPUT -af atrim=end_sample=1000
  1712. @end example
  1713. @end itemize
  1714. @section bandpass
  1715. Apply a two-pole Butterworth band-pass filter with central
  1716. frequency @var{frequency}, and (3dB-point) band-width width.
  1717. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1718. instead of the default: constant 0dB peak gain.
  1719. The filter roll off at 6dB per octave (20dB per decade).
  1720. The filter accepts the following options:
  1721. @table @option
  1722. @item frequency, f
  1723. Set the filter's central frequency. Default is @code{3000}.
  1724. @item csg
  1725. Constant skirt gain if set to 1. Defaults to 0.
  1726. @item width_type, t
  1727. Set method to specify band-width of filter.
  1728. @table @option
  1729. @item h
  1730. Hz
  1731. @item q
  1732. Q-Factor
  1733. @item o
  1734. octave
  1735. @item s
  1736. slope
  1737. @item k
  1738. kHz
  1739. @end table
  1740. @item width, w
  1741. Specify the band-width of a filter in width_type units.
  1742. @item channels, c
  1743. Specify which channels to filter, by default all available are filtered.
  1744. @end table
  1745. @subsection Commands
  1746. This filter supports the following commands:
  1747. @table @option
  1748. @item frequency, f
  1749. Change bandpass frequency.
  1750. Syntax for the command is : "@var{frequency}"
  1751. @item width_type, t
  1752. Change bandpass width_type.
  1753. Syntax for the command is : "@var{width_type}"
  1754. @item width, w
  1755. Change bandpass width.
  1756. Syntax for the command is : "@var{width}"
  1757. @end table
  1758. @section bandreject
  1759. Apply a two-pole Butterworth band-reject filter with central
  1760. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1761. The filter roll off at 6dB per octave (20dB per decade).
  1762. The filter accepts the following options:
  1763. @table @option
  1764. @item frequency, f
  1765. Set the filter's central frequency. Default is @code{3000}.
  1766. @item width_type, t
  1767. Set method to specify band-width of filter.
  1768. @table @option
  1769. @item h
  1770. Hz
  1771. @item q
  1772. Q-Factor
  1773. @item o
  1774. octave
  1775. @item s
  1776. slope
  1777. @item k
  1778. kHz
  1779. @end table
  1780. @item width, w
  1781. Specify the band-width of a filter in width_type units.
  1782. @item channels, c
  1783. Specify which channels to filter, by default all available are filtered.
  1784. @end table
  1785. @subsection Commands
  1786. This filter supports the following commands:
  1787. @table @option
  1788. @item frequency, f
  1789. Change bandreject frequency.
  1790. Syntax for the command is : "@var{frequency}"
  1791. @item width_type, t
  1792. Change bandreject width_type.
  1793. Syntax for the command is : "@var{width_type}"
  1794. @item width, w
  1795. Change bandreject width.
  1796. Syntax for the command is : "@var{width}"
  1797. @end table
  1798. @section bass, lowshelf
  1799. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1800. shelving filter with a response similar to that of a standard
  1801. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1802. The filter accepts the following options:
  1803. @table @option
  1804. @item gain, g
  1805. Give the gain at 0 Hz. Its useful range is about -20
  1806. (for a large cut) to +20 (for a large boost).
  1807. Beware of clipping when using a positive gain.
  1808. @item frequency, f
  1809. Set the filter's central frequency and so can be used
  1810. to extend or reduce the frequency range to be boosted or cut.
  1811. The default value is @code{100} Hz.
  1812. @item width_type, t
  1813. Set method to specify band-width of filter.
  1814. @table @option
  1815. @item h
  1816. Hz
  1817. @item q
  1818. Q-Factor
  1819. @item o
  1820. octave
  1821. @item s
  1822. slope
  1823. @item k
  1824. kHz
  1825. @end table
  1826. @item width, w
  1827. Determine how steep is the filter's shelf transition.
  1828. @item channels, c
  1829. Specify which channels to filter, by default all available are filtered.
  1830. @end table
  1831. @subsection Commands
  1832. This filter supports the following commands:
  1833. @table @option
  1834. @item frequency, f
  1835. Change bass frequency.
  1836. Syntax for the command is : "@var{frequency}"
  1837. @item width_type, t
  1838. Change bass width_type.
  1839. Syntax for the command is : "@var{width_type}"
  1840. @item width, w
  1841. Change bass width.
  1842. Syntax for the command is : "@var{width}"
  1843. @item gain, g
  1844. Change bass gain.
  1845. Syntax for the command is : "@var{gain}"
  1846. @end table
  1847. @section biquad
  1848. Apply a biquad IIR filter with the given coefficients.
  1849. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1850. are the numerator and denominator coefficients respectively.
  1851. and @var{channels}, @var{c} specify which channels to filter, by default all
  1852. available are filtered.
  1853. @subsection Commands
  1854. This filter supports the following commands:
  1855. @table @option
  1856. @item a0
  1857. @item a1
  1858. @item a2
  1859. @item b0
  1860. @item b1
  1861. @item b2
  1862. Change biquad parameter.
  1863. Syntax for the command is : "@var{value}"
  1864. @end table
  1865. @section bs2b
  1866. Bauer stereo to binaural transformation, which improves headphone listening of
  1867. stereo audio records.
  1868. To enable compilation of this filter you need to configure FFmpeg with
  1869. @code{--enable-libbs2b}.
  1870. It accepts the following parameters:
  1871. @table @option
  1872. @item profile
  1873. Pre-defined crossfeed level.
  1874. @table @option
  1875. @item default
  1876. Default level (fcut=700, feed=50).
  1877. @item cmoy
  1878. Chu Moy circuit (fcut=700, feed=60).
  1879. @item jmeier
  1880. Jan Meier circuit (fcut=650, feed=95).
  1881. @end table
  1882. @item fcut
  1883. Cut frequency (in Hz).
  1884. @item feed
  1885. Feed level (in Hz).
  1886. @end table
  1887. @section channelmap
  1888. Remap input channels to new locations.
  1889. It accepts the following parameters:
  1890. @table @option
  1891. @item map
  1892. Map channels from input to output. The argument is a '|'-separated list of
  1893. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1894. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1895. channel (e.g. FL for front left) or its index in the input channel layout.
  1896. @var{out_channel} is the name of the output channel or its index in the output
  1897. channel layout. If @var{out_channel} is not given then it is implicitly an
  1898. index, starting with zero and increasing by one for each mapping.
  1899. @item channel_layout
  1900. The channel layout of the output stream.
  1901. @end table
  1902. If no mapping is present, the filter will implicitly map input channels to
  1903. output channels, preserving indices.
  1904. @subsection Examples
  1905. @itemize
  1906. @item
  1907. For example, assuming a 5.1+downmix input MOV file,
  1908. @example
  1909. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1910. @end example
  1911. will create an output WAV file tagged as stereo from the downmix channels of
  1912. the input.
  1913. @item
  1914. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1915. @example
  1916. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1917. @end example
  1918. @end itemize
  1919. @section channelsplit
  1920. Split each channel from an input audio stream into a separate output stream.
  1921. It accepts the following parameters:
  1922. @table @option
  1923. @item channel_layout
  1924. The channel layout of the input stream. The default is "stereo".
  1925. @item channels
  1926. A channel layout describing the channels to be extracted as separate output streams
  1927. or "all" to extract each input channel as a separate stream. The default is "all".
  1928. Choosing channels not present in channel layout in the input will result in an error.
  1929. @end table
  1930. @subsection Examples
  1931. @itemize
  1932. @item
  1933. For example, assuming a stereo input MP3 file,
  1934. @example
  1935. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1936. @end example
  1937. will create an output Matroska file with two audio streams, one containing only
  1938. the left channel and the other the right channel.
  1939. @item
  1940. Split a 5.1 WAV file into per-channel files:
  1941. @example
  1942. ffmpeg -i in.wav -filter_complex
  1943. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1944. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1945. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1946. side_right.wav
  1947. @end example
  1948. @item
  1949. Extract only LFE from a 5.1 WAV file:
  1950. @example
  1951. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  1952. -map '[LFE]' lfe.wav
  1953. @end example
  1954. @end itemize
  1955. @section chorus
  1956. Add a chorus effect to the audio.
  1957. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1958. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1959. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1960. The modulation depth defines the range the modulated delay is played before or after
  1961. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1962. sound tuned around the original one, like in a chorus where some vocals are slightly
  1963. off key.
  1964. It accepts the following parameters:
  1965. @table @option
  1966. @item in_gain
  1967. Set input gain. Default is 0.4.
  1968. @item out_gain
  1969. Set output gain. Default is 0.4.
  1970. @item delays
  1971. Set delays. A typical delay is around 40ms to 60ms.
  1972. @item decays
  1973. Set decays.
  1974. @item speeds
  1975. Set speeds.
  1976. @item depths
  1977. Set depths.
  1978. @end table
  1979. @subsection Examples
  1980. @itemize
  1981. @item
  1982. A single delay:
  1983. @example
  1984. chorus=0.7:0.9:55:0.4:0.25:2
  1985. @end example
  1986. @item
  1987. Two delays:
  1988. @example
  1989. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1990. @end example
  1991. @item
  1992. Fuller sounding chorus with three delays:
  1993. @example
  1994. 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
  1995. @end example
  1996. @end itemize
  1997. @section compand
  1998. Compress or expand the audio's dynamic range.
  1999. It accepts the following parameters:
  2000. @table @option
  2001. @item attacks
  2002. @item decays
  2003. A list of times in seconds for each channel over which the instantaneous level
  2004. of the input signal is averaged to determine its volume. @var{attacks} refers to
  2005. increase of volume and @var{decays} refers to decrease of volume. For most
  2006. situations, the attack time (response to the audio getting louder) should be
  2007. shorter than the decay time, because the human ear is more sensitive to sudden
  2008. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  2009. a typical value for decay is 0.8 seconds.
  2010. If specified number of attacks & decays is lower than number of channels, the last
  2011. set attack/decay will be used for all remaining channels.
  2012. @item points
  2013. A list of points for the transfer function, specified in dB relative to the
  2014. maximum possible signal amplitude. Each key points list must be defined using
  2015. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  2016. @code{x0/y0 x1/y1 x2/y2 ....}
  2017. The input values must be in strictly increasing order but the transfer function
  2018. does not have to be monotonically rising. The point @code{0/0} is assumed but
  2019. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  2020. function are @code{-70/-70|-60/-20|1/0}.
  2021. @item soft-knee
  2022. Set the curve radius in dB for all joints. It defaults to 0.01.
  2023. @item gain
  2024. Set the additional gain in dB to be applied at all points on the transfer
  2025. function. This allows for easy adjustment of the overall gain.
  2026. It defaults to 0.
  2027. @item volume
  2028. Set an initial volume, in dB, to be assumed for each channel when filtering
  2029. starts. This permits the user to supply a nominal level initially, so that, for
  2030. example, a very large gain is not applied to initial signal levels before the
  2031. companding has begun to operate. A typical value for audio which is initially
  2032. quiet is -90 dB. It defaults to 0.
  2033. @item delay
  2034. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  2035. delayed before being fed to the volume adjuster. Specifying a delay
  2036. approximately equal to the attack/decay times allows the filter to effectively
  2037. operate in predictive rather than reactive mode. It defaults to 0.
  2038. @end table
  2039. @subsection Examples
  2040. @itemize
  2041. @item
  2042. Make music with both quiet and loud passages suitable for listening to in a
  2043. noisy environment:
  2044. @example
  2045. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  2046. @end example
  2047. Another example for audio with whisper and explosion parts:
  2048. @example
  2049. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  2050. @end example
  2051. @item
  2052. A noise gate for when the noise is at a lower level than the signal:
  2053. @example
  2054. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  2055. @end example
  2056. @item
  2057. Here is another noise gate, this time for when the noise is at a higher level
  2058. than the signal (making it, in some ways, similar to squelch):
  2059. @example
  2060. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  2061. @end example
  2062. @item
  2063. 2:1 compression starting at -6dB:
  2064. @example
  2065. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  2066. @end example
  2067. @item
  2068. 2:1 compression starting at -9dB:
  2069. @example
  2070. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  2071. @end example
  2072. @item
  2073. 2:1 compression starting at -12dB:
  2074. @example
  2075. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  2076. @end example
  2077. @item
  2078. 2:1 compression starting at -18dB:
  2079. @example
  2080. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  2081. @end example
  2082. @item
  2083. 3:1 compression starting at -15dB:
  2084. @example
  2085. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  2086. @end example
  2087. @item
  2088. Compressor/Gate:
  2089. @example
  2090. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  2091. @end example
  2092. @item
  2093. Expander:
  2094. @example
  2095. 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
  2096. @end example
  2097. @item
  2098. Hard limiter at -6dB:
  2099. @example
  2100. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  2101. @end example
  2102. @item
  2103. Hard limiter at -12dB:
  2104. @example
  2105. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  2106. @end example
  2107. @item
  2108. Hard noise gate at -35 dB:
  2109. @example
  2110. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  2111. @end example
  2112. @item
  2113. Soft limiter:
  2114. @example
  2115. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  2116. @end example
  2117. @end itemize
  2118. @section compensationdelay
  2119. Compensation Delay Line is a metric based delay to compensate differing
  2120. positions of microphones or speakers.
  2121. For example, you have recorded guitar with two microphones placed in
  2122. different location. Because the front of sound wave has fixed speed in
  2123. normal conditions, the phasing of microphones can vary and depends on
  2124. their location and interposition. The best sound mix can be achieved when
  2125. these microphones are in phase (synchronized). Note that distance of
  2126. ~30 cm between microphones makes one microphone to capture signal in
  2127. antiphase to another microphone. That makes the final mix sounding moody.
  2128. This filter helps to solve phasing problems by adding different delays
  2129. to each microphone track and make them synchronized.
  2130. The best result can be reached when you take one track as base and
  2131. synchronize other tracks one by one with it.
  2132. Remember that synchronization/delay tolerance depends on sample rate, too.
  2133. Higher sample rates will give more tolerance.
  2134. It accepts the following parameters:
  2135. @table @option
  2136. @item mm
  2137. Set millimeters distance. This is compensation distance for fine tuning.
  2138. Default is 0.
  2139. @item cm
  2140. Set cm distance. This is compensation distance for tightening distance setup.
  2141. Default is 0.
  2142. @item m
  2143. Set meters distance. This is compensation distance for hard distance setup.
  2144. Default is 0.
  2145. @item dry
  2146. Set dry amount. Amount of unprocessed (dry) signal.
  2147. Default is 0.
  2148. @item wet
  2149. Set wet amount. Amount of processed (wet) signal.
  2150. Default is 1.
  2151. @item temp
  2152. Set temperature degree in Celsius. This is the temperature of the environment.
  2153. Default is 20.
  2154. @end table
  2155. @section crossfeed
  2156. Apply headphone crossfeed filter.
  2157. Crossfeed is the process of blending the left and right channels of stereo
  2158. audio recording.
  2159. It is mainly used to reduce extreme stereo separation of low frequencies.
  2160. The intent is to produce more speaker like sound to the listener.
  2161. The filter accepts the following options:
  2162. @table @option
  2163. @item strength
  2164. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  2165. This sets gain of low shelf filter for side part of stereo image.
  2166. Default is -6dB. Max allowed is -30db when strength is set to 1.
  2167. @item range
  2168. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  2169. This sets cut off frequency of low shelf filter. Default is cut off near
  2170. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  2171. @item level_in
  2172. Set input gain. Default is 0.9.
  2173. @item level_out
  2174. Set output gain. Default is 1.
  2175. @end table
  2176. @section crystalizer
  2177. Simple algorithm to expand audio dynamic range.
  2178. The filter accepts the following options:
  2179. @table @option
  2180. @item i
  2181. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  2182. (unchanged sound) to 10.0 (maximum effect).
  2183. @item c
  2184. Enable clipping. By default is enabled.
  2185. @end table
  2186. @section dcshift
  2187. Apply a DC shift to the audio.
  2188. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  2189. in the recording chain) from the audio. The effect of a DC offset is reduced
  2190. headroom and hence volume. The @ref{astats} filter can be used to determine if
  2191. a signal has a DC offset.
  2192. @table @option
  2193. @item shift
  2194. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  2195. the audio.
  2196. @item limitergain
  2197. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  2198. used to prevent clipping.
  2199. @end table
  2200. @section drmeter
  2201. Measure audio dynamic range.
  2202. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  2203. is found in transition material. And anything less that 8 have very poor dynamics
  2204. and is very compressed.
  2205. The filter accepts the following options:
  2206. @table @option
  2207. @item length
  2208. Set window length in seconds used to split audio into segments of equal length.
  2209. Default is 3 seconds.
  2210. @end table
  2211. @section dynaudnorm
  2212. Dynamic Audio Normalizer.
  2213. This filter applies a certain amount of gain to the input audio in order
  2214. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2215. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2216. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2217. This allows for applying extra gain to the "quiet" sections of the audio
  2218. while avoiding distortions or clipping the "loud" sections. In other words:
  2219. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2220. sections, in the sense that the volume of each section is brought to the
  2221. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2222. this goal *without* applying "dynamic range compressing". It will retain 100%
  2223. of the dynamic range *within* each section of the audio file.
  2224. @table @option
  2225. @item f
  2226. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2227. Default is 500 milliseconds.
  2228. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2229. referred to as frames. This is required, because a peak magnitude has no
  2230. meaning for just a single sample value. Instead, we need to determine the
  2231. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2232. normalizer would simply use the peak magnitude of the complete file, the
  2233. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2234. frame. The length of a frame is specified in milliseconds. By default, the
  2235. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2236. been found to give good results with most files.
  2237. Note that the exact frame length, in number of samples, will be determined
  2238. automatically, based on the sampling rate of the individual input audio file.
  2239. @item g
  2240. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2241. number. Default is 31.
  2242. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2243. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2244. is specified in frames, centered around the current frame. For the sake of
  2245. simplicity, this must be an odd number. Consequently, the default value of 31
  2246. takes into account the current frame, as well as the 15 preceding frames and
  2247. the 15 subsequent frames. Using a larger window results in a stronger
  2248. smoothing effect and thus in less gain variation, i.e. slower gain
  2249. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2250. effect and thus in more gain variation, i.e. faster gain adaptation.
  2251. In other words, the more you increase this value, the more the Dynamic Audio
  2252. Normalizer will behave like a "traditional" normalization filter. On the
  2253. contrary, the more you decrease this value, the more the Dynamic Audio
  2254. Normalizer will behave like a dynamic range compressor.
  2255. @item p
  2256. Set the target peak value. This specifies the highest permissible magnitude
  2257. level for the normalized audio input. This filter will try to approach the
  2258. target peak magnitude as closely as possible, but at the same time it also
  2259. makes sure that the normalized signal will never exceed the peak magnitude.
  2260. A frame's maximum local gain factor is imposed directly by the target peak
  2261. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2262. It is not recommended to go above this value.
  2263. @item m
  2264. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2265. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2266. factor for each input frame, i.e. the maximum gain factor that does not
  2267. result in clipping or distortion. The maximum gain factor is determined by
  2268. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2269. additionally bounds the frame's maximum gain factor by a predetermined
  2270. (global) maximum gain factor. This is done in order to avoid excessive gain
  2271. factors in "silent" or almost silent frames. By default, the maximum gain
  2272. factor is 10.0, For most inputs the default value should be sufficient and
  2273. it usually is not recommended to increase this value. Though, for input
  2274. with an extremely low overall volume level, it may be necessary to allow even
  2275. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2276. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2277. Instead, a "sigmoid" threshold function will be applied. This way, the
  2278. gain factors will smoothly approach the threshold value, but never exceed that
  2279. value.
  2280. @item r
  2281. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2282. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2283. This means that the maximum local gain factor for each frame is defined
  2284. (only) by the frame's highest magnitude sample. This way, the samples can
  2285. be amplified as much as possible without exceeding the maximum signal
  2286. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2287. Normalizer can also take into account the frame's root mean square,
  2288. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2289. determine the power of a time-varying signal. It is therefore considered
  2290. that the RMS is a better approximation of the "perceived loudness" than
  2291. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2292. frames to a constant RMS value, a uniform "perceived loudness" can be
  2293. established. If a target RMS value has been specified, a frame's local gain
  2294. factor is defined as the factor that would result in exactly that RMS value.
  2295. Note, however, that the maximum local gain factor is still restricted by the
  2296. frame's highest magnitude sample, in order to prevent clipping.
  2297. @item n
  2298. Enable channels coupling. By default is enabled.
  2299. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2300. amount. This means the same gain factor will be applied to all channels, i.e.
  2301. the maximum possible gain factor is determined by the "loudest" channel.
  2302. However, in some recordings, it may happen that the volume of the different
  2303. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2304. In this case, this option can be used to disable the channel coupling. This way,
  2305. the gain factor will be determined independently for each channel, depending
  2306. only on the individual channel's highest magnitude sample. This allows for
  2307. harmonizing the volume of the different channels.
  2308. @item c
  2309. Enable DC bias correction. By default is disabled.
  2310. An audio signal (in the time domain) is a sequence of sample values.
  2311. In the Dynamic Audio Normalizer these sample values are represented in the
  2312. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2313. audio signal, or "waveform", should be centered around the zero point.
  2314. That means if we calculate the mean value of all samples in a file, or in a
  2315. single frame, then the result should be 0.0 or at least very close to that
  2316. value. If, however, there is a significant deviation of the mean value from
  2317. 0.0, in either positive or negative direction, this is referred to as a
  2318. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2319. Audio Normalizer provides optional DC bias correction.
  2320. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2321. the mean value, or "DC correction" offset, of each input frame and subtract
  2322. that value from all of the frame's sample values which ensures those samples
  2323. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2324. boundaries, the DC correction offset values will be interpolated smoothly
  2325. between neighbouring frames.
  2326. @item b
  2327. Enable alternative boundary mode. By default is disabled.
  2328. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2329. around each frame. This includes the preceding frames as well as the
  2330. subsequent frames. However, for the "boundary" frames, located at the very
  2331. beginning and at the very end of the audio file, not all neighbouring
  2332. frames are available. In particular, for the first few frames in the audio
  2333. file, the preceding frames are not known. And, similarly, for the last few
  2334. frames in the audio file, the subsequent frames are not known. Thus, the
  2335. question arises which gain factors should be assumed for the missing frames
  2336. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2337. to deal with this situation. The default boundary mode assumes a gain factor
  2338. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2339. "fade out" at the beginning and at the end of the input, respectively.
  2340. @item s
  2341. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2342. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2343. compression. This means that signal peaks will not be pruned and thus the
  2344. full dynamic range will be retained within each local neighbourhood. However,
  2345. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2346. normalization algorithm with a more "traditional" compression.
  2347. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2348. (thresholding) function. If (and only if) the compression feature is enabled,
  2349. all input frames will be processed by a soft knee thresholding function prior
  2350. to the actual normalization process. Put simply, the thresholding function is
  2351. going to prune all samples whose magnitude exceeds a certain threshold value.
  2352. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2353. value. Instead, the threshold value will be adjusted for each individual
  2354. frame.
  2355. In general, smaller parameters result in stronger compression, and vice versa.
  2356. Values below 3.0 are not recommended, because audible distortion may appear.
  2357. @end table
  2358. @section earwax
  2359. Make audio easier to listen to on headphones.
  2360. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2361. so that when listened to on headphones the stereo image is moved from
  2362. inside your head (standard for headphones) to outside and in front of
  2363. the listener (standard for speakers).
  2364. Ported from SoX.
  2365. @section equalizer
  2366. Apply a two-pole peaking equalisation (EQ) filter. With this
  2367. filter, the signal-level at and around a selected frequency can
  2368. be increased or decreased, whilst (unlike bandpass and bandreject
  2369. filters) that at all other frequencies is unchanged.
  2370. In order to produce complex equalisation curves, this filter can
  2371. be given several times, each with a different central frequency.
  2372. The filter accepts the following options:
  2373. @table @option
  2374. @item frequency, f
  2375. Set the filter's central frequency in Hz.
  2376. @item width_type, t
  2377. Set method to specify band-width of filter.
  2378. @table @option
  2379. @item h
  2380. Hz
  2381. @item q
  2382. Q-Factor
  2383. @item o
  2384. octave
  2385. @item s
  2386. slope
  2387. @item k
  2388. kHz
  2389. @end table
  2390. @item width, w
  2391. Specify the band-width of a filter in width_type units.
  2392. @item gain, g
  2393. Set the required gain or attenuation in dB.
  2394. Beware of clipping when using a positive gain.
  2395. @item channels, c
  2396. Specify which channels to filter, by default all available are filtered.
  2397. @end table
  2398. @subsection Examples
  2399. @itemize
  2400. @item
  2401. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2402. @example
  2403. equalizer=f=1000:t=h:width=200:g=-10
  2404. @end example
  2405. @item
  2406. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2407. @example
  2408. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2409. @end example
  2410. @end itemize
  2411. @subsection Commands
  2412. This filter supports the following commands:
  2413. @table @option
  2414. @item frequency, f
  2415. Change equalizer frequency.
  2416. Syntax for the command is : "@var{frequency}"
  2417. @item width_type, t
  2418. Change equalizer width_type.
  2419. Syntax for the command is : "@var{width_type}"
  2420. @item width, w
  2421. Change equalizer width.
  2422. Syntax for the command is : "@var{width}"
  2423. @item gain, g
  2424. Change equalizer gain.
  2425. Syntax for the command is : "@var{gain}"
  2426. @end table
  2427. @section extrastereo
  2428. Linearly increases the difference between left and right channels which
  2429. adds some sort of "live" effect to playback.
  2430. The filter accepts the following options:
  2431. @table @option
  2432. @item m
  2433. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2434. (average of both channels), with 1.0 sound will be unchanged, with
  2435. -1.0 left and right channels will be swapped.
  2436. @item c
  2437. Enable clipping. By default is enabled.
  2438. @end table
  2439. @section firequalizer
  2440. Apply FIR Equalization using arbitrary frequency response.
  2441. The filter accepts the following option:
  2442. @table @option
  2443. @item gain
  2444. Set gain curve equation (in dB). The expression can contain variables:
  2445. @table @option
  2446. @item f
  2447. the evaluated frequency
  2448. @item sr
  2449. sample rate
  2450. @item ch
  2451. channel number, set to 0 when multichannels evaluation is disabled
  2452. @item chid
  2453. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2454. multichannels evaluation is disabled
  2455. @item chs
  2456. number of channels
  2457. @item chlayout
  2458. channel_layout, see libavutil/channel_layout.h
  2459. @end table
  2460. and functions:
  2461. @table @option
  2462. @item gain_interpolate(f)
  2463. interpolate gain on frequency f based on gain_entry
  2464. @item cubic_interpolate(f)
  2465. same as gain_interpolate, but smoother
  2466. @end table
  2467. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2468. @item gain_entry
  2469. Set gain entry for gain_interpolate function. The expression can
  2470. contain functions:
  2471. @table @option
  2472. @item entry(f, g)
  2473. store gain entry at frequency f with value g
  2474. @end table
  2475. This option is also available as command.
  2476. @item delay
  2477. Set filter delay in seconds. Higher value means more accurate.
  2478. Default is @code{0.01}.
  2479. @item accuracy
  2480. Set filter accuracy in Hz. Lower value means more accurate.
  2481. Default is @code{5}.
  2482. @item wfunc
  2483. Set window function. Acceptable values are:
  2484. @table @option
  2485. @item rectangular
  2486. rectangular window, useful when gain curve is already smooth
  2487. @item hann
  2488. hann window (default)
  2489. @item hamming
  2490. hamming window
  2491. @item blackman
  2492. blackman window
  2493. @item nuttall3
  2494. 3-terms continuous 1st derivative nuttall window
  2495. @item mnuttall3
  2496. minimum 3-terms discontinuous nuttall window
  2497. @item nuttall
  2498. 4-terms continuous 1st derivative nuttall window
  2499. @item bnuttall
  2500. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2501. @item bharris
  2502. blackman-harris window
  2503. @item tukey
  2504. tukey window
  2505. @end table
  2506. @item fixed
  2507. If enabled, use fixed number of audio samples. This improves speed when
  2508. filtering with large delay. Default is disabled.
  2509. @item multi
  2510. Enable multichannels evaluation on gain. Default is disabled.
  2511. @item zero_phase
  2512. Enable zero phase mode by subtracting timestamp to compensate delay.
  2513. Default is disabled.
  2514. @item scale
  2515. Set scale used by gain. Acceptable values are:
  2516. @table @option
  2517. @item linlin
  2518. linear frequency, linear gain
  2519. @item linlog
  2520. linear frequency, logarithmic (in dB) gain (default)
  2521. @item loglin
  2522. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2523. @item loglog
  2524. logarithmic frequency, logarithmic gain
  2525. @end table
  2526. @item dumpfile
  2527. Set file for dumping, suitable for gnuplot.
  2528. @item dumpscale
  2529. Set scale for dumpfile. Acceptable values are same with scale option.
  2530. Default is linlog.
  2531. @item fft2
  2532. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2533. Default is disabled.
  2534. @item min_phase
  2535. Enable minimum phase impulse response. Default is disabled.
  2536. @end table
  2537. @subsection Examples
  2538. @itemize
  2539. @item
  2540. lowpass at 1000 Hz:
  2541. @example
  2542. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2543. @end example
  2544. @item
  2545. lowpass at 1000 Hz with gain_entry:
  2546. @example
  2547. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2548. @end example
  2549. @item
  2550. custom equalization:
  2551. @example
  2552. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2553. @end example
  2554. @item
  2555. higher delay with zero phase to compensate delay:
  2556. @example
  2557. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2558. @end example
  2559. @item
  2560. lowpass on left channel, highpass on right channel:
  2561. @example
  2562. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2563. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2564. @end example
  2565. @end itemize
  2566. @section flanger
  2567. Apply a flanging effect to the audio.
  2568. The filter accepts the following options:
  2569. @table @option
  2570. @item delay
  2571. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2572. @item depth
  2573. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2574. @item regen
  2575. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2576. Default value is 0.
  2577. @item width
  2578. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2579. Default value is 71.
  2580. @item speed
  2581. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2582. @item shape
  2583. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2584. Default value is @var{sinusoidal}.
  2585. @item phase
  2586. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2587. Default value is 25.
  2588. @item interp
  2589. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2590. Default is @var{linear}.
  2591. @end table
  2592. @section haas
  2593. Apply Haas effect to audio.
  2594. Note that this makes most sense to apply on mono signals.
  2595. With this filter applied to mono signals it give some directionality and
  2596. stretches its stereo image.
  2597. The filter accepts the following options:
  2598. @table @option
  2599. @item level_in
  2600. Set input level. By default is @var{1}, or 0dB
  2601. @item level_out
  2602. Set output level. By default is @var{1}, or 0dB.
  2603. @item side_gain
  2604. Set gain applied to side part of signal. By default is @var{1}.
  2605. @item middle_source
  2606. Set kind of middle source. Can be one of the following:
  2607. @table @samp
  2608. @item left
  2609. Pick left channel.
  2610. @item right
  2611. Pick right channel.
  2612. @item mid
  2613. Pick middle part signal of stereo image.
  2614. @item side
  2615. Pick side part signal of stereo image.
  2616. @end table
  2617. @item middle_phase
  2618. Change middle phase. By default is disabled.
  2619. @item left_delay
  2620. Set left channel delay. By default is @var{2.05} milliseconds.
  2621. @item left_balance
  2622. Set left channel balance. By default is @var{-1}.
  2623. @item left_gain
  2624. Set left channel gain. By default is @var{1}.
  2625. @item left_phase
  2626. Change left phase. By default is disabled.
  2627. @item right_delay
  2628. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2629. @item right_balance
  2630. Set right channel balance. By default is @var{1}.
  2631. @item right_gain
  2632. Set right channel gain. By default is @var{1}.
  2633. @item right_phase
  2634. Change right phase. By default is enabled.
  2635. @end table
  2636. @section hdcd
  2637. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2638. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2639. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2640. of HDCD, and detects the Transient Filter flag.
  2641. @example
  2642. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2643. @end example
  2644. When using the filter with wav, note the default encoding for wav is 16-bit,
  2645. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2646. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2647. @example
  2648. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2649. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2650. @end example
  2651. The filter accepts the following options:
  2652. @table @option
  2653. @item disable_autoconvert
  2654. Disable any automatic format conversion or resampling in the filter graph.
  2655. @item process_stereo
  2656. Process the stereo channels together. If target_gain does not match between
  2657. channels, consider it invalid and use the last valid target_gain.
  2658. @item cdt_ms
  2659. Set the code detect timer period in ms.
  2660. @item force_pe
  2661. Always extend peaks above -3dBFS even if PE isn't signaled.
  2662. @item analyze_mode
  2663. Replace audio with a solid tone and adjust the amplitude to signal some
  2664. specific aspect of the decoding process. The output file can be loaded in
  2665. an audio editor alongside the original to aid analysis.
  2666. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2667. Modes are:
  2668. @table @samp
  2669. @item 0, off
  2670. Disabled
  2671. @item 1, lle
  2672. Gain adjustment level at each sample
  2673. @item 2, pe
  2674. Samples where peak extend occurs
  2675. @item 3, cdt
  2676. Samples where the code detect timer is active
  2677. @item 4, tgm
  2678. Samples where the target gain does not match between channels
  2679. @end table
  2680. @end table
  2681. @section headphone
  2682. Apply head-related transfer functions (HRTFs) to create virtual
  2683. loudspeakers around the user for binaural listening via headphones.
  2684. The HRIRs are provided via additional streams, for each channel
  2685. one stereo input stream is needed.
  2686. The filter accepts the following options:
  2687. @table @option
  2688. @item map
  2689. Set mapping of input streams for convolution.
  2690. The argument is a '|'-separated list of channel names in order as they
  2691. are given as additional stream inputs for filter.
  2692. This also specify number of input streams. Number of input streams
  2693. must be not less than number of channels in first stream plus one.
  2694. @item gain
  2695. Set gain applied to audio. Value is in dB. Default is 0.
  2696. @item type
  2697. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2698. processing audio in time domain which is slow.
  2699. @var{freq} is processing audio in frequency domain which is fast.
  2700. Default is @var{freq}.
  2701. @item lfe
  2702. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2703. @item size
  2704. Set size of frame in number of samples which will be processed at once.
  2705. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  2706. @item hrir
  2707. Set format of hrir stream.
  2708. Default value is @var{stereo}. Alternative value is @var{multich}.
  2709. If value is set to @var{stereo}, number of additional streams should
  2710. be greater or equal to number of input channels in first input stream.
  2711. Also each additional stream should have stereo number of channels.
  2712. If value is set to @var{multich}, number of additional streams should
  2713. be exactly one. Also number of input channels of additional stream
  2714. should be equal or greater than twice number of channels of first input
  2715. stream.
  2716. @end table
  2717. @subsection Examples
  2718. @itemize
  2719. @item
  2720. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2721. each amovie filter use stereo file with IR coefficients as input.
  2722. The files give coefficients for each position of virtual loudspeaker:
  2723. @example
  2724. 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"
  2725. output.wav
  2726. @end example
  2727. @item
  2728. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2729. but now in @var{multich} @var{hrir} format.
  2730. @example
  2731. 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"
  2732. output.wav
  2733. @end example
  2734. @end itemize
  2735. @section highpass
  2736. Apply a high-pass filter with 3dB point frequency.
  2737. The filter can be either single-pole, or double-pole (the default).
  2738. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2739. The filter accepts the following options:
  2740. @table @option
  2741. @item frequency, f
  2742. Set frequency in Hz. Default is 3000.
  2743. @item poles, p
  2744. Set number of poles. Default is 2.
  2745. @item width_type, t
  2746. Set method to specify band-width of filter.
  2747. @table @option
  2748. @item h
  2749. Hz
  2750. @item q
  2751. Q-Factor
  2752. @item o
  2753. octave
  2754. @item s
  2755. slope
  2756. @item k
  2757. kHz
  2758. @end table
  2759. @item width, w
  2760. Specify the band-width of a filter in width_type units.
  2761. Applies only to double-pole filter.
  2762. The default is 0.707q and gives a Butterworth response.
  2763. @item channels, c
  2764. Specify which channels to filter, by default all available are filtered.
  2765. @end table
  2766. @subsection Commands
  2767. This filter supports the following commands:
  2768. @table @option
  2769. @item frequency, f
  2770. Change highpass frequency.
  2771. Syntax for the command is : "@var{frequency}"
  2772. @item width_type, t
  2773. Change highpass width_type.
  2774. Syntax for the command is : "@var{width_type}"
  2775. @item width, w
  2776. Change highpass width.
  2777. Syntax for the command is : "@var{width}"
  2778. @end table
  2779. @section join
  2780. Join multiple input streams into one multi-channel stream.
  2781. It accepts the following parameters:
  2782. @table @option
  2783. @item inputs
  2784. The number of input streams. It defaults to 2.
  2785. @item channel_layout
  2786. The desired output channel layout. It defaults to stereo.
  2787. @item map
  2788. Map channels from inputs to output. The argument is a '|'-separated list of
  2789. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2790. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2791. can be either the name of the input channel (e.g. FL for front left) or its
  2792. index in the specified input stream. @var{out_channel} is the name of the output
  2793. channel.
  2794. @end table
  2795. The filter will attempt to guess the mappings when they are not specified
  2796. explicitly. It does so by first trying to find an unused matching input channel
  2797. and if that fails it picks the first unused input channel.
  2798. Join 3 inputs (with properly set channel layouts):
  2799. @example
  2800. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2801. @end example
  2802. Build a 5.1 output from 6 single-channel streams:
  2803. @example
  2804. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2805. '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'
  2806. out
  2807. @end example
  2808. @section ladspa
  2809. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2810. To enable compilation of this filter you need to configure FFmpeg with
  2811. @code{--enable-ladspa}.
  2812. @table @option
  2813. @item file, f
  2814. Specifies the name of LADSPA plugin library to load. If the environment
  2815. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2816. each one of the directories specified by the colon separated list in
  2817. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2818. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2819. @file{/usr/lib/ladspa/}.
  2820. @item plugin, p
  2821. Specifies the plugin within the library. Some libraries contain only
  2822. one plugin, but others contain many of them. If this is not set filter
  2823. will list all available plugins within the specified library.
  2824. @item controls, c
  2825. Set the '|' separated list of controls which are zero or more floating point
  2826. values that determine the behavior of the loaded plugin (for example delay,
  2827. threshold or gain).
  2828. Controls need to be defined using the following syntax:
  2829. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2830. @var{valuei} is the value set on the @var{i}-th control.
  2831. Alternatively they can be also defined using the following syntax:
  2832. @var{value0}|@var{value1}|@var{value2}|..., where
  2833. @var{valuei} is the value set on the @var{i}-th control.
  2834. If @option{controls} is set to @code{help}, all available controls and
  2835. their valid ranges are printed.
  2836. @item sample_rate, s
  2837. Specify the sample rate, default to 44100. Only used if plugin have
  2838. zero inputs.
  2839. @item nb_samples, n
  2840. Set the number of samples per channel per each output frame, default
  2841. is 1024. Only used if plugin have zero inputs.
  2842. @item duration, d
  2843. Set the minimum duration of the sourced audio. See
  2844. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2845. for the accepted syntax.
  2846. Note that the resulting duration may be greater than the specified duration,
  2847. as the generated audio is always cut at the end of a complete frame.
  2848. If not specified, or the expressed duration is negative, the audio is
  2849. supposed to be generated forever.
  2850. Only used if plugin have zero inputs.
  2851. @end table
  2852. @subsection Examples
  2853. @itemize
  2854. @item
  2855. List all available plugins within amp (LADSPA example plugin) library:
  2856. @example
  2857. ladspa=file=amp
  2858. @end example
  2859. @item
  2860. List all available controls and their valid ranges for @code{vcf_notch}
  2861. plugin from @code{VCF} library:
  2862. @example
  2863. ladspa=f=vcf:p=vcf_notch:c=help
  2864. @end example
  2865. @item
  2866. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2867. plugin library:
  2868. @example
  2869. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2870. @end example
  2871. @item
  2872. Add reverberation to the audio using TAP-plugins
  2873. (Tom's Audio Processing plugins):
  2874. @example
  2875. ladspa=file=tap_reverb:tap_reverb
  2876. @end example
  2877. @item
  2878. Generate white noise, with 0.2 amplitude:
  2879. @example
  2880. ladspa=file=cmt:noise_source_white:c=c0=.2
  2881. @end example
  2882. @item
  2883. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2884. @code{C* Audio Plugin Suite} (CAPS) library:
  2885. @example
  2886. ladspa=file=caps:Click:c=c1=20'
  2887. @end example
  2888. @item
  2889. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2890. @example
  2891. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2892. @end example
  2893. @item
  2894. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2895. @code{SWH Plugins} collection:
  2896. @example
  2897. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2898. @end example
  2899. @item
  2900. Attenuate low frequencies using Multiband EQ from Steve Harris
  2901. @code{SWH Plugins} collection:
  2902. @example
  2903. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2904. @end example
  2905. @item
  2906. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  2907. (CAPS) library:
  2908. @example
  2909. ladspa=caps:Narrower
  2910. @end example
  2911. @item
  2912. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  2913. @example
  2914. ladspa=caps:White:.2
  2915. @end example
  2916. @item
  2917. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  2918. @example
  2919. ladspa=caps:Fractal:c=c1=1
  2920. @end example
  2921. @item
  2922. Dynamic volume normalization using @code{VLevel} plugin:
  2923. @example
  2924. ladspa=vlevel-ladspa:vlevel_mono
  2925. @end example
  2926. @end itemize
  2927. @subsection Commands
  2928. This filter supports the following commands:
  2929. @table @option
  2930. @item cN
  2931. Modify the @var{N}-th control value.
  2932. If the specified value is not valid, it is ignored and prior one is kept.
  2933. @end table
  2934. @section loudnorm
  2935. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2936. Support for both single pass (livestreams, files) and double pass (files) modes.
  2937. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  2938. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  2939. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  2940. The filter accepts the following options:
  2941. @table @option
  2942. @item I, i
  2943. Set integrated loudness target.
  2944. Range is -70.0 - -5.0. Default value is -24.0.
  2945. @item LRA, lra
  2946. Set loudness range target.
  2947. Range is 1.0 - 20.0. Default value is 7.0.
  2948. @item TP, tp
  2949. Set maximum true peak.
  2950. Range is -9.0 - +0.0. Default value is -2.0.
  2951. @item measured_I, measured_i
  2952. Measured IL of input file.
  2953. Range is -99.0 - +0.0.
  2954. @item measured_LRA, measured_lra
  2955. Measured LRA of input file.
  2956. Range is 0.0 - 99.0.
  2957. @item measured_TP, measured_tp
  2958. Measured true peak of input file.
  2959. Range is -99.0 - +99.0.
  2960. @item measured_thresh
  2961. Measured threshold of input file.
  2962. Range is -99.0 - +0.0.
  2963. @item offset
  2964. Set offset gain. Gain is applied before the true-peak limiter.
  2965. Range is -99.0 - +99.0. Default is +0.0.
  2966. @item linear
  2967. Normalize linearly if possible.
  2968. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2969. to be specified in order to use this mode.
  2970. Options are true or false. Default is true.
  2971. @item dual_mono
  2972. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2973. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2974. If set to @code{true}, this option will compensate for this effect.
  2975. Multi-channel input files are not affected by this option.
  2976. Options are true or false. Default is false.
  2977. @item print_format
  2978. Set print format for stats. Options are summary, json, or none.
  2979. Default value is none.
  2980. @end table
  2981. @section lowpass
  2982. Apply a low-pass filter with 3dB point frequency.
  2983. The filter can be either single-pole or double-pole (the default).
  2984. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2985. The filter accepts the following options:
  2986. @table @option
  2987. @item frequency, f
  2988. Set frequency in Hz. Default is 500.
  2989. @item poles, p
  2990. Set number of poles. Default is 2.
  2991. @item width_type, t
  2992. Set method to specify band-width of filter.
  2993. @table @option
  2994. @item h
  2995. Hz
  2996. @item q
  2997. Q-Factor
  2998. @item o
  2999. octave
  3000. @item s
  3001. slope
  3002. @item k
  3003. kHz
  3004. @end table
  3005. @item width, w
  3006. Specify the band-width of a filter in width_type units.
  3007. Applies only to double-pole filter.
  3008. The default is 0.707q and gives a Butterworth response.
  3009. @item channels, c
  3010. Specify which channels to filter, by default all available are filtered.
  3011. @end table
  3012. @subsection Examples
  3013. @itemize
  3014. @item
  3015. Lowpass only LFE channel, it LFE is not present it does nothing:
  3016. @example
  3017. lowpass=c=LFE
  3018. @end example
  3019. @end itemize
  3020. @subsection Commands
  3021. This filter supports the following commands:
  3022. @table @option
  3023. @item frequency, f
  3024. Change lowpass frequency.
  3025. Syntax for the command is : "@var{frequency}"
  3026. @item width_type, t
  3027. Change lowpass width_type.
  3028. Syntax for the command is : "@var{width_type}"
  3029. @item width, w
  3030. Change lowpass width.
  3031. Syntax for the command is : "@var{width}"
  3032. @end table
  3033. @section lv2
  3034. Load a LV2 (LADSPA Version 2) plugin.
  3035. To enable compilation of this filter you need to configure FFmpeg with
  3036. @code{--enable-lv2}.
  3037. @table @option
  3038. @item plugin, p
  3039. Specifies the plugin URI. You may need to escape ':'.
  3040. @item controls, c
  3041. Set the '|' separated list of controls which are zero or more floating point
  3042. values that determine the behavior of the loaded plugin (for example delay,
  3043. threshold or gain).
  3044. If @option{controls} is set to @code{help}, all available controls and
  3045. their valid ranges are printed.
  3046. @item sample_rate, s
  3047. Specify the sample rate, default to 44100. Only used if plugin have
  3048. zero inputs.
  3049. @item nb_samples, n
  3050. Set the number of samples per channel per each output frame, default
  3051. is 1024. Only used if plugin have zero inputs.
  3052. @item duration, d
  3053. Set the minimum duration of the sourced audio. See
  3054. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3055. for the accepted syntax.
  3056. Note that the resulting duration may be greater than the specified duration,
  3057. as the generated audio is always cut at the end of a complete frame.
  3058. If not specified, or the expressed duration is negative, the audio is
  3059. supposed to be generated forever.
  3060. Only used if plugin have zero inputs.
  3061. @end table
  3062. @subsection Examples
  3063. @itemize
  3064. @item
  3065. Apply bass enhancer plugin from Calf:
  3066. @example
  3067. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  3068. @end example
  3069. @item
  3070. Apply vinyl plugin from Calf:
  3071. @example
  3072. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  3073. @end example
  3074. @item
  3075. Apply bit crusher plugin from ArtyFX:
  3076. @example
  3077. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  3078. @end example
  3079. @end itemize
  3080. @section mcompand
  3081. Multiband Compress or expand the audio's dynamic range.
  3082. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  3083. This is akin to the crossover of a loudspeaker, and results in flat frequency
  3084. response when absent compander action.
  3085. It accepts the following parameters:
  3086. @table @option
  3087. @item args
  3088. This option syntax is:
  3089. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  3090. For explanation of each item refer to compand filter documentation.
  3091. @end table
  3092. @anchor{pan}
  3093. @section pan
  3094. Mix channels with specific gain levels. The filter accepts the output
  3095. channel layout followed by a set of channels definitions.
  3096. This filter is also designed to efficiently remap the channels of an audio
  3097. stream.
  3098. The filter accepts parameters of the form:
  3099. "@var{l}|@var{outdef}|@var{outdef}|..."
  3100. @table @option
  3101. @item l
  3102. output channel layout or number of channels
  3103. @item outdef
  3104. output channel specification, of the form:
  3105. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  3106. @item out_name
  3107. output channel to define, either a channel name (FL, FR, etc.) or a channel
  3108. number (c0, c1, etc.)
  3109. @item gain
  3110. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  3111. @item in_name
  3112. input channel to use, see out_name for details; it is not possible to mix
  3113. named and numbered input channels
  3114. @end table
  3115. If the `=' in a channel specification is replaced by `<', then the gains for
  3116. that specification will be renormalized so that the total is 1, thus
  3117. avoiding clipping noise.
  3118. @subsection Mixing examples
  3119. For example, if you want to down-mix from stereo to mono, but with a bigger
  3120. factor for the left channel:
  3121. @example
  3122. pan=1c|c0=0.9*c0+0.1*c1
  3123. @end example
  3124. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  3125. 7-channels surround:
  3126. @example
  3127. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  3128. @end example
  3129. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  3130. that should be preferred (see "-ac" option) unless you have very specific
  3131. needs.
  3132. @subsection Remapping examples
  3133. The channel remapping will be effective if, and only if:
  3134. @itemize
  3135. @item gain coefficients are zeroes or ones,
  3136. @item only one input per channel output,
  3137. @end itemize
  3138. If all these conditions are satisfied, the filter will notify the user ("Pure
  3139. channel mapping detected"), and use an optimized and lossless method to do the
  3140. remapping.
  3141. For example, if you have a 5.1 source and want a stereo audio stream by
  3142. dropping the extra channels:
  3143. @example
  3144. pan="stereo| c0=FL | c1=FR"
  3145. @end example
  3146. Given the same source, you can also switch front left and front right channels
  3147. and keep the input channel layout:
  3148. @example
  3149. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  3150. @end example
  3151. If the input is a stereo audio stream, you can mute the front left channel (and
  3152. still keep the stereo channel layout) with:
  3153. @example
  3154. pan="stereo|c1=c1"
  3155. @end example
  3156. Still with a stereo audio stream input, you can copy the right channel in both
  3157. front left and right:
  3158. @example
  3159. pan="stereo| c0=FR | c1=FR"
  3160. @end example
  3161. @section replaygain
  3162. ReplayGain scanner filter. This filter takes an audio stream as an input and
  3163. outputs it unchanged.
  3164. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  3165. @section resample
  3166. Convert the audio sample format, sample rate and channel layout. It is
  3167. not meant to be used directly.
  3168. @section rubberband
  3169. Apply time-stretching and pitch-shifting with librubberband.
  3170. To enable compilation of this filter, you need to configure FFmpeg with
  3171. @code{--enable-librubberband}.
  3172. The filter accepts the following options:
  3173. @table @option
  3174. @item tempo
  3175. Set tempo scale factor.
  3176. @item pitch
  3177. Set pitch scale factor.
  3178. @item transients
  3179. Set transients detector.
  3180. Possible values are:
  3181. @table @var
  3182. @item crisp
  3183. @item mixed
  3184. @item smooth
  3185. @end table
  3186. @item detector
  3187. Set detector.
  3188. Possible values are:
  3189. @table @var
  3190. @item compound
  3191. @item percussive
  3192. @item soft
  3193. @end table
  3194. @item phase
  3195. Set phase.
  3196. Possible values are:
  3197. @table @var
  3198. @item laminar
  3199. @item independent
  3200. @end table
  3201. @item window
  3202. Set processing window size.
  3203. Possible values are:
  3204. @table @var
  3205. @item standard
  3206. @item short
  3207. @item long
  3208. @end table
  3209. @item smoothing
  3210. Set smoothing.
  3211. Possible values are:
  3212. @table @var
  3213. @item off
  3214. @item on
  3215. @end table
  3216. @item formant
  3217. Enable formant preservation when shift pitching.
  3218. Possible values are:
  3219. @table @var
  3220. @item shifted
  3221. @item preserved
  3222. @end table
  3223. @item pitchq
  3224. Set pitch quality.
  3225. Possible values are:
  3226. @table @var
  3227. @item quality
  3228. @item speed
  3229. @item consistency
  3230. @end table
  3231. @item channels
  3232. Set channels.
  3233. Possible values are:
  3234. @table @var
  3235. @item apart
  3236. @item together
  3237. @end table
  3238. @end table
  3239. @section sidechaincompress
  3240. This filter acts like normal compressor but has the ability to compress
  3241. detected signal using second input signal.
  3242. It needs two input streams and returns one output stream.
  3243. First input stream will be processed depending on second stream signal.
  3244. The filtered signal then can be filtered with other filters in later stages of
  3245. processing. See @ref{pan} and @ref{amerge} filter.
  3246. The filter accepts the following options:
  3247. @table @option
  3248. @item level_in
  3249. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3250. @item threshold
  3251. If a signal of second stream raises above this level it will affect the gain
  3252. reduction of first stream.
  3253. By default is 0.125. Range is between 0.00097563 and 1.
  3254. @item ratio
  3255. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3256. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3257. Default is 2. Range is between 1 and 20.
  3258. @item attack
  3259. Amount of milliseconds the signal has to rise above the threshold before gain
  3260. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3261. @item release
  3262. Amount of milliseconds the signal has to fall below the threshold before
  3263. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3264. @item makeup
  3265. Set the amount by how much signal will be amplified after processing.
  3266. Default is 1. Range is from 1 to 64.
  3267. @item knee
  3268. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3269. Default is 2.82843. Range is between 1 and 8.
  3270. @item link
  3271. Choose if the @code{average} level between all channels of side-chain stream
  3272. or the louder(@code{maximum}) channel of side-chain stream affects the
  3273. reduction. Default is @code{average}.
  3274. @item detection
  3275. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3276. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3277. @item level_sc
  3278. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3279. @item mix
  3280. How much to use compressed signal in output. Default is 1.
  3281. Range is between 0 and 1.
  3282. @end table
  3283. @subsection Examples
  3284. @itemize
  3285. @item
  3286. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3287. depending on the signal of 2nd input and later compressed signal to be
  3288. merged with 2nd input:
  3289. @example
  3290. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3291. @end example
  3292. @end itemize
  3293. @section sidechaingate
  3294. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3295. filter the detected signal before sending it to the gain reduction stage.
  3296. Normally a gate uses the full range signal to detect a level above the
  3297. threshold.
  3298. For example: If you cut all lower frequencies from your sidechain signal
  3299. the gate will decrease the volume of your track only if not enough highs
  3300. appear. With this technique you are able to reduce the resonation of a
  3301. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3302. guitar.
  3303. It needs two input streams and returns one output stream.
  3304. First input stream will be processed depending on second stream signal.
  3305. The filter accepts the following options:
  3306. @table @option
  3307. @item level_in
  3308. Set input level before filtering.
  3309. Default is 1. Allowed range is from 0.015625 to 64.
  3310. @item range
  3311. Set the level of gain reduction when the signal is below the threshold.
  3312. Default is 0.06125. Allowed range is from 0 to 1.
  3313. @item threshold
  3314. If a signal rises above this level the gain reduction is released.
  3315. Default is 0.125. Allowed range is from 0 to 1.
  3316. @item ratio
  3317. Set a ratio about which the signal is reduced.
  3318. Default is 2. Allowed range is from 1 to 9000.
  3319. @item attack
  3320. Amount of milliseconds the signal has to rise above the threshold before gain
  3321. reduction stops.
  3322. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3323. @item release
  3324. Amount of milliseconds the signal has to fall below the threshold before the
  3325. reduction is increased again. Default is 250 milliseconds.
  3326. Allowed range is from 0.01 to 9000.
  3327. @item makeup
  3328. Set amount of amplification of signal after processing.
  3329. Default is 1. Allowed range is from 1 to 64.
  3330. @item knee
  3331. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3332. Default is 2.828427125. Allowed range is from 1 to 8.
  3333. @item detection
  3334. Choose if exact signal should be taken for detection or an RMS like one.
  3335. Default is rms. Can be peak or rms.
  3336. @item link
  3337. Choose if the average level between all channels or the louder channel affects
  3338. the reduction.
  3339. Default is average. Can be average or maximum.
  3340. @item level_sc
  3341. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3342. @end table
  3343. @section silencedetect
  3344. Detect silence in an audio stream.
  3345. This filter logs a message when it detects that the input audio volume is less
  3346. or equal to a noise tolerance value for a duration greater or equal to the
  3347. minimum detected noise duration.
  3348. The printed times and duration are expressed in seconds.
  3349. The filter accepts the following options:
  3350. @table @option
  3351. @item noise, n
  3352. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3353. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3354. @item duration, d
  3355. Set silence duration until notification (default is 2 seconds).
  3356. @item mono, m
  3357. Process each channel separately, instead of combined. By default is disabled.
  3358. @end table
  3359. @subsection Examples
  3360. @itemize
  3361. @item
  3362. Detect 5 seconds of silence with -50dB noise tolerance:
  3363. @example
  3364. silencedetect=n=-50dB:d=5
  3365. @end example
  3366. @item
  3367. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3368. tolerance in @file{silence.mp3}:
  3369. @example
  3370. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3371. @end example
  3372. @end itemize
  3373. @section silenceremove
  3374. Remove silence from the beginning, middle or end of the audio.
  3375. The filter accepts the following options:
  3376. @table @option
  3377. @item start_periods
  3378. This value is used to indicate if audio should be trimmed at beginning of
  3379. the audio. A value of zero indicates no silence should be trimmed from the
  3380. beginning. When specifying a non-zero value, it trims audio up until it
  3381. finds non-silence. Normally, when trimming silence from beginning of audio
  3382. the @var{start_periods} will be @code{1} but it can be increased to higher
  3383. values to trim all audio up to specific count of non-silence periods.
  3384. Default value is @code{0}.
  3385. @item start_duration
  3386. Specify the amount of time that non-silence must be detected before it stops
  3387. trimming audio. By increasing the duration, bursts of noises can be treated
  3388. as silence and trimmed off. Default value is @code{0}.
  3389. @item start_threshold
  3390. This indicates what sample value should be treated as silence. For digital
  3391. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3392. you may wish to increase the value to account for background noise.
  3393. Can be specified in dB (in case "dB" is appended to the specified value)
  3394. or amplitude ratio. Default value is @code{0}.
  3395. @item start_silence
  3396. Specify max duration of silence at beginning that will be kept after
  3397. trimming. Default is 0, which is equal to trimming all samples detected
  3398. as silence.
  3399. @item start_mode
  3400. Specify mode of detection of silence end in start of multi-channel audio.
  3401. Can be @var{any} or @var{all}. Default is @var{any}.
  3402. With @var{any}, any sample that is detected as non-silence will cause
  3403. stopped trimming of silence.
  3404. With @var{all}, only if all channels are detected as non-silence will cause
  3405. stopped trimming of silence.
  3406. @item stop_periods
  3407. Set the count for trimming silence from the end of audio.
  3408. To remove silence from the middle of a file, specify a @var{stop_periods}
  3409. that is negative. This value is then treated as a positive value and is
  3410. used to indicate the effect should restart processing as specified by
  3411. @var{start_periods}, making it suitable for removing periods of silence
  3412. in the middle of the audio.
  3413. Default value is @code{0}.
  3414. @item stop_duration
  3415. Specify a duration of silence that must exist before audio is not copied any
  3416. more. By specifying a higher duration, silence that is wanted can be left in
  3417. the audio.
  3418. Default value is @code{0}.
  3419. @item stop_threshold
  3420. This is the same as @option{start_threshold} but for trimming silence from
  3421. the end of audio.
  3422. Can be specified in dB (in case "dB" is appended to the specified value)
  3423. or amplitude ratio. Default value is @code{0}.
  3424. @item stop_silence
  3425. Specify max duration of silence at end that will be kept after
  3426. trimming. Default is 0, which is equal to trimming all samples detected
  3427. as silence.
  3428. @item stop_mode
  3429. Specify mode of detection of silence start in end of multi-channel audio.
  3430. Can be @var{any} or @var{all}. Default is @var{any}.
  3431. With @var{any}, any sample that is detected as non-silence will cause
  3432. stopped trimming of silence.
  3433. With @var{all}, only if all channels are detected as non-silence will cause
  3434. stopped trimming of silence.
  3435. @item detection
  3436. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3437. and works better with digital silence which is exactly 0.
  3438. Default value is @code{rms}.
  3439. @item window
  3440. Set duration in number of seconds used to calculate size of window in number
  3441. of samples for detecting silence.
  3442. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3443. @end table
  3444. @subsection Examples
  3445. @itemize
  3446. @item
  3447. The following example shows how this filter can be used to start a recording
  3448. that does not contain the delay at the start which usually occurs between
  3449. pressing the record button and the start of the performance:
  3450. @example
  3451. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  3452. @end example
  3453. @item
  3454. Trim all silence encountered from beginning to end where there is more than 1
  3455. second of silence in audio:
  3456. @example
  3457. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  3458. @end example
  3459. @end itemize
  3460. @section sofalizer
  3461. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3462. loudspeakers around the user for binaural listening via headphones (audio
  3463. formats up to 9 channels supported).
  3464. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3465. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3466. Austrian Academy of Sciences.
  3467. To enable compilation of this filter you need to configure FFmpeg with
  3468. @code{--enable-libmysofa}.
  3469. The filter accepts the following options:
  3470. @table @option
  3471. @item sofa
  3472. Set the SOFA file used for rendering.
  3473. @item gain
  3474. Set gain applied to audio. Value is in dB. Default is 0.
  3475. @item rotation
  3476. Set rotation of virtual loudspeakers in deg. Default is 0.
  3477. @item elevation
  3478. Set elevation of virtual speakers in deg. Default is 0.
  3479. @item radius
  3480. Set distance in meters between loudspeakers and the listener with near-field
  3481. HRTFs. Default is 1.
  3482. @item type
  3483. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3484. processing audio in time domain which is slow.
  3485. @var{freq} is processing audio in frequency domain which is fast.
  3486. Default is @var{freq}.
  3487. @item speakers
  3488. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3489. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3490. Each virtual loudspeaker is described with short channel name following with
  3491. azimuth and elevation in degrees.
  3492. Each virtual loudspeaker description is separated by '|'.
  3493. For example to override front left and front right channel positions use:
  3494. 'speakers=FL 45 15|FR 345 15'.
  3495. Descriptions with unrecognised channel names are ignored.
  3496. @item lfegain
  3497. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3498. @end table
  3499. @subsection Examples
  3500. @itemize
  3501. @item
  3502. Using ClubFritz6 sofa file:
  3503. @example
  3504. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3505. @end example
  3506. @item
  3507. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3508. @example
  3509. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3510. @end example
  3511. @item
  3512. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3513. and also with custom gain:
  3514. @example
  3515. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3516. @end example
  3517. @end itemize
  3518. @section stereotools
  3519. This filter has some handy utilities to manage stereo signals, for converting
  3520. M/S stereo recordings to L/R signal while having control over the parameters
  3521. or spreading the stereo image of master track.
  3522. The filter accepts the following options:
  3523. @table @option
  3524. @item level_in
  3525. Set input level before filtering for both channels. Defaults is 1.
  3526. Allowed range is from 0.015625 to 64.
  3527. @item level_out
  3528. Set output level after filtering for both channels. Defaults is 1.
  3529. Allowed range is from 0.015625 to 64.
  3530. @item balance_in
  3531. Set input balance between both channels. Default is 0.
  3532. Allowed range is from -1 to 1.
  3533. @item balance_out
  3534. Set output balance between both channels. Default is 0.
  3535. Allowed range is from -1 to 1.
  3536. @item softclip
  3537. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3538. clipping. Disabled by default.
  3539. @item mutel
  3540. Mute the left channel. Disabled by default.
  3541. @item muter
  3542. Mute the right channel. Disabled by default.
  3543. @item phasel
  3544. Change the phase of the left channel. Disabled by default.
  3545. @item phaser
  3546. Change the phase of the right channel. Disabled by default.
  3547. @item mode
  3548. Set stereo mode. Available values are:
  3549. @table @samp
  3550. @item lr>lr
  3551. Left/Right to Left/Right, this is default.
  3552. @item lr>ms
  3553. Left/Right to Mid/Side.
  3554. @item ms>lr
  3555. Mid/Side to Left/Right.
  3556. @item lr>ll
  3557. Left/Right to Left/Left.
  3558. @item lr>rr
  3559. Left/Right to Right/Right.
  3560. @item lr>l+r
  3561. Left/Right to Left + Right.
  3562. @item lr>rl
  3563. Left/Right to Right/Left.
  3564. @item ms>ll
  3565. Mid/Side to Left/Left.
  3566. @item ms>rr
  3567. Mid/Side to Right/Right.
  3568. @end table
  3569. @item slev
  3570. Set level of side signal. Default is 1.
  3571. Allowed range is from 0.015625 to 64.
  3572. @item sbal
  3573. Set balance of side signal. Default is 0.
  3574. Allowed range is from -1 to 1.
  3575. @item mlev
  3576. Set level of the middle signal. Default is 1.
  3577. Allowed range is from 0.015625 to 64.
  3578. @item mpan
  3579. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3580. @item base
  3581. Set stereo base between mono and inversed channels. Default is 0.
  3582. Allowed range is from -1 to 1.
  3583. @item delay
  3584. Set delay in milliseconds how much to delay left from right channel and
  3585. vice versa. Default is 0. Allowed range is from -20 to 20.
  3586. @item sclevel
  3587. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3588. @item phase
  3589. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3590. @item bmode_in, bmode_out
  3591. Set balance mode for balance_in/balance_out option.
  3592. Can be one of the following:
  3593. @table @samp
  3594. @item balance
  3595. Classic balance mode. Attenuate one channel at time.
  3596. Gain is raised up to 1.
  3597. @item amplitude
  3598. Similar as classic mode above but gain is raised up to 2.
  3599. @item power
  3600. Equal power distribution, from -6dB to +6dB range.
  3601. @end table
  3602. @end table
  3603. @subsection Examples
  3604. @itemize
  3605. @item
  3606. Apply karaoke like effect:
  3607. @example
  3608. stereotools=mlev=0.015625
  3609. @end example
  3610. @item
  3611. Convert M/S signal to L/R:
  3612. @example
  3613. "stereotools=mode=ms>lr"
  3614. @end example
  3615. @end itemize
  3616. @section stereowiden
  3617. This filter enhance the stereo effect by suppressing signal common to both
  3618. channels and by delaying the signal of left into right and vice versa,
  3619. thereby widening the stereo effect.
  3620. The filter accepts the following options:
  3621. @table @option
  3622. @item delay
  3623. Time in milliseconds of the delay of left signal into right and vice versa.
  3624. Default is 20 milliseconds.
  3625. @item feedback
  3626. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3627. effect of left signal in right output and vice versa which gives widening
  3628. effect. Default is 0.3.
  3629. @item crossfeed
  3630. Cross feed of left into right with inverted phase. This helps in suppressing
  3631. the mono. If the value is 1 it will cancel all the signal common to both
  3632. channels. Default is 0.3.
  3633. @item drymix
  3634. Set level of input signal of original channel. Default is 0.8.
  3635. @end table
  3636. @section superequalizer
  3637. Apply 18 band equalizer.
  3638. The filter accepts the following options:
  3639. @table @option
  3640. @item 1b
  3641. Set 65Hz band gain.
  3642. @item 2b
  3643. Set 92Hz band gain.
  3644. @item 3b
  3645. Set 131Hz band gain.
  3646. @item 4b
  3647. Set 185Hz band gain.
  3648. @item 5b
  3649. Set 262Hz band gain.
  3650. @item 6b
  3651. Set 370Hz band gain.
  3652. @item 7b
  3653. Set 523Hz band gain.
  3654. @item 8b
  3655. Set 740Hz band gain.
  3656. @item 9b
  3657. Set 1047Hz band gain.
  3658. @item 10b
  3659. Set 1480Hz band gain.
  3660. @item 11b
  3661. Set 2093Hz band gain.
  3662. @item 12b
  3663. Set 2960Hz band gain.
  3664. @item 13b
  3665. Set 4186Hz band gain.
  3666. @item 14b
  3667. Set 5920Hz band gain.
  3668. @item 15b
  3669. Set 8372Hz band gain.
  3670. @item 16b
  3671. Set 11840Hz band gain.
  3672. @item 17b
  3673. Set 16744Hz band gain.
  3674. @item 18b
  3675. Set 20000Hz band gain.
  3676. @end table
  3677. @section surround
  3678. Apply audio surround upmix filter.
  3679. This filter allows to produce multichannel output from audio stream.
  3680. The filter accepts the following options:
  3681. @table @option
  3682. @item chl_out
  3683. Set output channel layout. By default, this is @var{5.1}.
  3684. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3685. for the required syntax.
  3686. @item chl_in
  3687. Set input channel layout. By default, this is @var{stereo}.
  3688. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3689. for the required syntax.
  3690. @item level_in
  3691. Set input volume level. By default, this is @var{1}.
  3692. @item level_out
  3693. Set output volume level. By default, this is @var{1}.
  3694. @item lfe
  3695. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3696. @item lfe_low
  3697. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3698. @item lfe_high
  3699. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3700. @item fc_in
  3701. Set front center input volume. By default, this is @var{1}.
  3702. @item fc_out
  3703. Set front center output volume. By default, this is @var{1}.
  3704. @item lfe_in
  3705. Set LFE input volume. By default, this is @var{1}.
  3706. @item lfe_out
  3707. Set LFE output volume. By default, this is @var{1}.
  3708. @end table
  3709. @section treble, highshelf
  3710. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3711. shelving filter with a response similar to that of a standard
  3712. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3713. The filter accepts the following options:
  3714. @table @option
  3715. @item gain, g
  3716. Give the gain at whichever is the lower of ~22 kHz and the
  3717. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3718. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3719. @item frequency, f
  3720. Set the filter's central frequency and so can be used
  3721. to extend or reduce the frequency range to be boosted or cut.
  3722. The default value is @code{3000} Hz.
  3723. @item width_type, t
  3724. Set method to specify band-width of filter.
  3725. @table @option
  3726. @item h
  3727. Hz
  3728. @item q
  3729. Q-Factor
  3730. @item o
  3731. octave
  3732. @item s
  3733. slope
  3734. @item k
  3735. kHz
  3736. @end table
  3737. @item width, w
  3738. Determine how steep is the filter's shelf transition.
  3739. @item channels, c
  3740. Specify which channels to filter, by default all available are filtered.
  3741. @end table
  3742. @subsection Commands
  3743. This filter supports the following commands:
  3744. @table @option
  3745. @item frequency, f
  3746. Change treble frequency.
  3747. Syntax for the command is : "@var{frequency}"
  3748. @item width_type, t
  3749. Change treble width_type.
  3750. Syntax for the command is : "@var{width_type}"
  3751. @item width, w
  3752. Change treble width.
  3753. Syntax for the command is : "@var{width}"
  3754. @item gain, g
  3755. Change treble gain.
  3756. Syntax for the command is : "@var{gain}"
  3757. @end table
  3758. @section tremolo
  3759. Sinusoidal amplitude modulation.
  3760. The filter accepts the following options:
  3761. @table @option
  3762. @item f
  3763. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3764. (20 Hz or lower) will result in a tremolo effect.
  3765. This filter may also be used as a ring modulator by specifying
  3766. a modulation frequency higher than 20 Hz.
  3767. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3768. @item d
  3769. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3770. Default value is 0.5.
  3771. @end table
  3772. @section vibrato
  3773. Sinusoidal phase modulation.
  3774. The filter accepts the following options:
  3775. @table @option
  3776. @item f
  3777. Modulation frequency in Hertz.
  3778. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3779. @item d
  3780. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3781. Default value is 0.5.
  3782. @end table
  3783. @section volume
  3784. Adjust the input audio volume.
  3785. It accepts the following parameters:
  3786. @table @option
  3787. @item volume
  3788. Set audio volume expression.
  3789. Output values are clipped to the maximum value.
  3790. The output audio volume is given by the relation:
  3791. @example
  3792. @var{output_volume} = @var{volume} * @var{input_volume}
  3793. @end example
  3794. The default value for @var{volume} is "1.0".
  3795. @item precision
  3796. This parameter represents the mathematical precision.
  3797. It determines which input sample formats will be allowed, which affects the
  3798. precision of the volume scaling.
  3799. @table @option
  3800. @item fixed
  3801. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  3802. @item float
  3803. 32-bit floating-point; this limits input sample format to FLT. (default)
  3804. @item double
  3805. 64-bit floating-point; this limits input sample format to DBL.
  3806. @end table
  3807. @item replaygain
  3808. Choose the behaviour on encountering ReplayGain side data in input frames.
  3809. @table @option
  3810. @item drop
  3811. Remove ReplayGain side data, ignoring its contents (the default).
  3812. @item ignore
  3813. Ignore ReplayGain side data, but leave it in the frame.
  3814. @item track
  3815. Prefer the track gain, if present.
  3816. @item album
  3817. Prefer the album gain, if present.
  3818. @end table
  3819. @item replaygain_preamp
  3820. Pre-amplification gain in dB to apply to the selected replaygain gain.
  3821. Default value for @var{replaygain_preamp} is 0.0.
  3822. @item eval
  3823. Set when the volume expression is evaluated.
  3824. It accepts the following values:
  3825. @table @samp
  3826. @item once
  3827. only evaluate expression once during the filter initialization, or
  3828. when the @samp{volume} command is sent
  3829. @item frame
  3830. evaluate expression for each incoming frame
  3831. @end table
  3832. Default value is @samp{once}.
  3833. @end table
  3834. The volume expression can contain the following parameters.
  3835. @table @option
  3836. @item n
  3837. frame number (starting at zero)
  3838. @item nb_channels
  3839. number of channels
  3840. @item nb_consumed_samples
  3841. number of samples consumed by the filter
  3842. @item nb_samples
  3843. number of samples in the current frame
  3844. @item pos
  3845. original frame position in the file
  3846. @item pts
  3847. frame PTS
  3848. @item sample_rate
  3849. sample rate
  3850. @item startpts
  3851. PTS at start of stream
  3852. @item startt
  3853. time at start of stream
  3854. @item t
  3855. frame time
  3856. @item tb
  3857. timestamp timebase
  3858. @item volume
  3859. last set volume value
  3860. @end table
  3861. Note that when @option{eval} is set to @samp{once} only the
  3862. @var{sample_rate} and @var{tb} variables are available, all other
  3863. variables will evaluate to NAN.
  3864. @subsection Commands
  3865. This filter supports the following commands:
  3866. @table @option
  3867. @item volume
  3868. Modify the volume expression.
  3869. The command accepts the same syntax of the corresponding option.
  3870. If the specified expression is not valid, it is kept at its current
  3871. value.
  3872. @item replaygain_noclip
  3873. Prevent clipping by limiting the gain applied.
  3874. Default value for @var{replaygain_noclip} is 1.
  3875. @end table
  3876. @subsection Examples
  3877. @itemize
  3878. @item
  3879. Halve the input audio volume:
  3880. @example
  3881. volume=volume=0.5
  3882. volume=volume=1/2
  3883. volume=volume=-6.0206dB
  3884. @end example
  3885. In all the above example the named key for @option{volume} can be
  3886. omitted, for example like in:
  3887. @example
  3888. volume=0.5
  3889. @end example
  3890. @item
  3891. Increase input audio power by 6 decibels using fixed-point precision:
  3892. @example
  3893. volume=volume=6dB:precision=fixed
  3894. @end example
  3895. @item
  3896. Fade volume after time 10 with an annihilation period of 5 seconds:
  3897. @example
  3898. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3899. @end example
  3900. @end itemize
  3901. @section volumedetect
  3902. Detect the volume of the input video.
  3903. The filter has no parameters. The input is not modified. Statistics about
  3904. the volume will be printed in the log when the input stream end is reached.
  3905. In particular it will show the mean volume (root mean square), maximum
  3906. volume (on a per-sample basis), and the beginning of a histogram of the
  3907. registered volume values (from the maximum value to a cumulated 1/1000 of
  3908. the samples).
  3909. All volumes are in decibels relative to the maximum PCM value.
  3910. @subsection Examples
  3911. Here is an excerpt of the output:
  3912. @example
  3913. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3914. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3915. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3916. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3917. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3918. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3919. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3920. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3921. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3922. @end example
  3923. It means that:
  3924. @itemize
  3925. @item
  3926. The mean square energy is approximately -27 dB, or 10^-2.7.
  3927. @item
  3928. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3929. @item
  3930. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3931. @end itemize
  3932. In other words, raising the volume by +4 dB does not cause any clipping,
  3933. raising it by +5 dB causes clipping for 6 samples, etc.
  3934. @c man end AUDIO FILTERS
  3935. @chapter Audio Sources
  3936. @c man begin AUDIO SOURCES
  3937. Below is a description of the currently available audio sources.
  3938. @section abuffer
  3939. Buffer audio frames, and make them available to the filter chain.
  3940. This source is mainly intended for a programmatic use, in particular
  3941. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3942. It accepts the following parameters:
  3943. @table @option
  3944. @item time_base
  3945. The timebase which will be used for timestamps of submitted frames. It must be
  3946. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3947. @item sample_rate
  3948. The sample rate of the incoming audio buffers.
  3949. @item sample_fmt
  3950. The sample format of the incoming audio buffers.
  3951. Either a sample format name or its corresponding integer representation from
  3952. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3953. @item channel_layout
  3954. The channel layout of the incoming audio buffers.
  3955. Either a channel layout name from channel_layout_map in
  3956. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3957. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3958. @item channels
  3959. The number of channels of the incoming audio buffers.
  3960. If both @var{channels} and @var{channel_layout} are specified, then they
  3961. must be consistent.
  3962. @end table
  3963. @subsection Examples
  3964. @example
  3965. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3966. @end example
  3967. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3968. Since the sample format with name "s16p" corresponds to the number
  3969. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3970. equivalent to:
  3971. @example
  3972. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3973. @end example
  3974. @section aevalsrc
  3975. Generate an audio signal specified by an expression.
  3976. This source accepts in input one or more expressions (one for each
  3977. channel), which are evaluated and used to generate a corresponding
  3978. audio signal.
  3979. This source accepts the following options:
  3980. @table @option
  3981. @item exprs
  3982. Set the '|'-separated expressions list for each separate channel. In case the
  3983. @option{channel_layout} option is not specified, the selected channel layout
  3984. depends on the number of provided expressions. Otherwise the last
  3985. specified expression is applied to the remaining output channels.
  3986. @item channel_layout, c
  3987. Set the channel layout. The number of channels in the specified layout
  3988. must be equal to the number of specified expressions.
  3989. @item duration, d
  3990. Set the minimum duration of the sourced audio. See
  3991. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3992. for the accepted syntax.
  3993. Note that the resulting duration may be greater than the specified
  3994. duration, as the generated audio is always cut at the end of a
  3995. complete frame.
  3996. If not specified, or the expressed duration is negative, the audio is
  3997. supposed to be generated forever.
  3998. @item nb_samples, n
  3999. Set the number of samples per channel per each output frame,
  4000. default to 1024.
  4001. @item sample_rate, s
  4002. Specify the sample rate, default to 44100.
  4003. @end table
  4004. Each expression in @var{exprs} can contain the following constants:
  4005. @table @option
  4006. @item n
  4007. number of the evaluated sample, starting from 0
  4008. @item t
  4009. time of the evaluated sample expressed in seconds, starting from 0
  4010. @item s
  4011. sample rate
  4012. @end table
  4013. @subsection Examples
  4014. @itemize
  4015. @item
  4016. Generate silence:
  4017. @example
  4018. aevalsrc=0
  4019. @end example
  4020. @item
  4021. Generate a sin signal with frequency of 440 Hz, set sample rate to
  4022. 8000 Hz:
  4023. @example
  4024. aevalsrc="sin(440*2*PI*t):s=8000"
  4025. @end example
  4026. @item
  4027. Generate a two channels signal, specify the channel layout (Front
  4028. Center + Back Center) explicitly:
  4029. @example
  4030. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  4031. @end example
  4032. @item
  4033. Generate white noise:
  4034. @example
  4035. aevalsrc="-2+random(0)"
  4036. @end example
  4037. @item
  4038. Generate an amplitude modulated signal:
  4039. @example
  4040. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  4041. @end example
  4042. @item
  4043. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  4044. @example
  4045. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  4046. @end example
  4047. @end itemize
  4048. @section anullsrc
  4049. The null audio source, return unprocessed audio frames. It is mainly useful
  4050. as a template and to be employed in analysis / debugging tools, or as
  4051. the source for filters which ignore the input data (for example the sox
  4052. synth filter).
  4053. This source accepts the following options:
  4054. @table @option
  4055. @item channel_layout, cl
  4056. Specifies the channel layout, and can be either an integer or a string
  4057. representing a channel layout. The default value of @var{channel_layout}
  4058. is "stereo".
  4059. Check the channel_layout_map definition in
  4060. @file{libavutil/channel_layout.c} for the mapping between strings and
  4061. channel layout values.
  4062. @item sample_rate, r
  4063. Specifies the sample rate, and defaults to 44100.
  4064. @item nb_samples, n
  4065. Set the number of samples per requested frames.
  4066. @end table
  4067. @subsection Examples
  4068. @itemize
  4069. @item
  4070. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  4071. @example
  4072. anullsrc=r=48000:cl=4
  4073. @end example
  4074. @item
  4075. Do the same operation with a more obvious syntax:
  4076. @example
  4077. anullsrc=r=48000:cl=mono
  4078. @end example
  4079. @end itemize
  4080. All the parameters need to be explicitly defined.
  4081. @section flite
  4082. Synthesize a voice utterance using the libflite library.
  4083. To enable compilation of this filter you need to configure FFmpeg with
  4084. @code{--enable-libflite}.
  4085. Note that versions of the flite library prior to 2.0 are not thread-safe.
  4086. The filter accepts the following options:
  4087. @table @option
  4088. @item list_voices
  4089. If set to 1, list the names of the available voices and exit
  4090. immediately. Default value is 0.
  4091. @item nb_samples, n
  4092. Set the maximum number of samples per frame. Default value is 512.
  4093. @item textfile
  4094. Set the filename containing the text to speak.
  4095. @item text
  4096. Set the text to speak.
  4097. @item voice, v
  4098. Set the voice to use for the speech synthesis. Default value is
  4099. @code{kal}. See also the @var{list_voices} option.
  4100. @end table
  4101. @subsection Examples
  4102. @itemize
  4103. @item
  4104. Read from file @file{speech.txt}, and synthesize the text using the
  4105. standard flite voice:
  4106. @example
  4107. flite=textfile=speech.txt
  4108. @end example
  4109. @item
  4110. Read the specified text selecting the @code{slt} voice:
  4111. @example
  4112. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4113. @end example
  4114. @item
  4115. Input text to ffmpeg:
  4116. @example
  4117. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  4118. @end example
  4119. @item
  4120. Make @file{ffplay} speak the specified text, using @code{flite} and
  4121. the @code{lavfi} device:
  4122. @example
  4123. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  4124. @end example
  4125. @end itemize
  4126. For more information about libflite, check:
  4127. @url{http://www.festvox.org/flite/}
  4128. @section anoisesrc
  4129. Generate a noise audio signal.
  4130. The filter accepts the following options:
  4131. @table @option
  4132. @item sample_rate, r
  4133. Specify the sample rate. Default value is 48000 Hz.
  4134. @item amplitude, a
  4135. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  4136. is 1.0.
  4137. @item duration, d
  4138. Specify the duration of the generated audio stream. Not specifying this option
  4139. results in noise with an infinite length.
  4140. @item color, colour, c
  4141. Specify the color of noise. Available noise colors are white, pink, brown,
  4142. blue and violet. Default color is white.
  4143. @item seed, s
  4144. Specify a value used to seed the PRNG.
  4145. @item nb_samples, n
  4146. Set the number of samples per each output frame, default is 1024.
  4147. @end table
  4148. @subsection Examples
  4149. @itemize
  4150. @item
  4151. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  4152. @example
  4153. anoisesrc=d=60:c=pink:r=44100:a=0.5
  4154. @end example
  4155. @end itemize
  4156. @section hilbert
  4157. Generate odd-tap Hilbert transform FIR coefficients.
  4158. The resulting stream can be used with @ref{afir} filter for phase-shifting
  4159. the signal by 90 degrees.
  4160. This is used in many matrix coding schemes and for analytic signal generation.
  4161. The process is often written as a multiplication by i (or j), the imaginary unit.
  4162. The filter accepts the following options:
  4163. @table @option
  4164. @item sample_rate, s
  4165. Set sample rate, default is 44100.
  4166. @item taps, t
  4167. Set length of FIR filter, default is 22051.
  4168. @item nb_samples, n
  4169. Set number of samples per each frame.
  4170. @item win_func, w
  4171. Set window function to be used when generating FIR coefficients.
  4172. @end table
  4173. @section sinc
  4174. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  4175. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  4176. The filter accepts the following options:
  4177. @table @option
  4178. @item sample_rate, r
  4179. Set sample rate, default is 44100.
  4180. @item nb_samples, n
  4181. Set number of samples per each frame. Default is 1024.
  4182. @item hp
  4183. Set high-pass frequency. Default is 0.
  4184. @item lp
  4185. Set low-pass frequency. Default is 0.
  4186. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  4187. is higher than 0 then filter will create band-pass filter coefficients,
  4188. otherwise band-reject filter coefficients.
  4189. @item phase
  4190. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  4191. @item beta
  4192. Set Kaiser window beta.
  4193. @item att
  4194. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  4195. @item round
  4196. Enable rounding, by default is disabled.
  4197. @item hptaps
  4198. Set number of taps for high-pass filter.
  4199. @item lptaps
  4200. Set number of taps for low-pass filter.
  4201. @end table
  4202. @section sine
  4203. Generate an audio signal made of a sine wave with amplitude 1/8.
  4204. The audio signal is bit-exact.
  4205. The filter accepts the following options:
  4206. @table @option
  4207. @item frequency, f
  4208. Set the carrier frequency. Default is 440 Hz.
  4209. @item beep_factor, b
  4210. Enable a periodic beep every second with frequency @var{beep_factor} times
  4211. the carrier frequency. Default is 0, meaning the beep is disabled.
  4212. @item sample_rate, r
  4213. Specify the sample rate, default is 44100.
  4214. @item duration, d
  4215. Specify the duration of the generated audio stream.
  4216. @item samples_per_frame
  4217. Set the number of samples per output frame.
  4218. The expression can contain the following constants:
  4219. @table @option
  4220. @item n
  4221. The (sequential) number of the output audio frame, starting from 0.
  4222. @item pts
  4223. The PTS (Presentation TimeStamp) of the output audio frame,
  4224. expressed in @var{TB} units.
  4225. @item t
  4226. The PTS of the output audio frame, expressed in seconds.
  4227. @item TB
  4228. The timebase of the output audio frames.
  4229. @end table
  4230. Default is @code{1024}.
  4231. @end table
  4232. @subsection Examples
  4233. @itemize
  4234. @item
  4235. Generate a simple 440 Hz sine wave:
  4236. @example
  4237. sine
  4238. @end example
  4239. @item
  4240. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  4241. @example
  4242. sine=220:4:d=5
  4243. sine=f=220:b=4:d=5
  4244. sine=frequency=220:beep_factor=4:duration=5
  4245. @end example
  4246. @item
  4247. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  4248. pattern:
  4249. @example
  4250. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  4251. @end example
  4252. @end itemize
  4253. @c man end AUDIO SOURCES
  4254. @chapter Audio Sinks
  4255. @c man begin AUDIO SINKS
  4256. Below is a description of the currently available audio sinks.
  4257. @section abuffersink
  4258. Buffer audio frames, and make them available to the end of filter chain.
  4259. This sink is mainly intended for programmatic use, in particular
  4260. through the interface defined in @file{libavfilter/buffersink.h}
  4261. or the options system.
  4262. It accepts a pointer to an AVABufferSinkContext structure, which
  4263. defines the incoming buffers' formats, to be passed as the opaque
  4264. parameter to @code{avfilter_init_filter} for initialization.
  4265. @section anullsink
  4266. Null audio sink; do absolutely nothing with the input audio. It is
  4267. mainly useful as a template and for use in analysis / debugging
  4268. tools.
  4269. @c man end AUDIO SINKS
  4270. @chapter Video Filters
  4271. @c man begin VIDEO FILTERS
  4272. When you configure your FFmpeg build, you can disable any of the
  4273. existing filters using @code{--disable-filters}.
  4274. The configure output will show the video filters included in your
  4275. build.
  4276. Below is a description of the currently available video filters.
  4277. @section alphaextract
  4278. Extract the alpha component from the input as a grayscale video. This
  4279. is especially useful with the @var{alphamerge} filter.
  4280. @section alphamerge
  4281. Add or replace the alpha component of the primary input with the
  4282. grayscale value of a second input. This is intended for use with
  4283. @var{alphaextract} to allow the transmission or storage of frame
  4284. sequences that have alpha in a format that doesn't support an alpha
  4285. channel.
  4286. For example, to reconstruct full frames from a normal YUV-encoded video
  4287. and a separate video created with @var{alphaextract}, you might use:
  4288. @example
  4289. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4290. @end example
  4291. Since this filter is designed for reconstruction, it operates on frame
  4292. sequences without considering timestamps, and terminates when either
  4293. input reaches end of stream. This will cause problems if your encoding
  4294. pipeline drops frames. If you're trying to apply an image as an
  4295. overlay to a video stream, consider the @var{overlay} filter instead.
  4296. @section amplify
  4297. Amplify differences between current pixel and pixels of adjacent frames in
  4298. same pixel location.
  4299. This filter accepts the following options:
  4300. @table @option
  4301. @item radius
  4302. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  4303. For example radius of 3 will instruct filter to calculate average of 7 frames.
  4304. @item factor
  4305. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  4306. @item threshold
  4307. Set threshold for difference amplification. Any differrence greater or equal to
  4308. this value will not alter source pixel. Default is 10.
  4309. Allowed range is from 0 to 65535.
  4310. @item low
  4311. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4312. This option controls maximum possible value that will decrease source pixel value.
  4313. @item high
  4314. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  4315. This option controls maximum possible value that will increase source pixel value.
  4316. @item planes
  4317. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  4318. @end table
  4319. @section ass
  4320. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4321. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4322. Substation Alpha) subtitles files.
  4323. This filter accepts the following option in addition to the common options from
  4324. the @ref{subtitles} filter:
  4325. @table @option
  4326. @item shaping
  4327. Set the shaping engine
  4328. Available values are:
  4329. @table @samp
  4330. @item auto
  4331. The default libass shaping engine, which is the best available.
  4332. @item simple
  4333. Fast, font-agnostic shaper that can do only substitutions
  4334. @item complex
  4335. Slower shaper using OpenType for substitutions and positioning
  4336. @end table
  4337. The default is @code{auto}.
  4338. @end table
  4339. @section atadenoise
  4340. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4341. The filter accepts the following options:
  4342. @table @option
  4343. @item 0a
  4344. Set threshold A for 1st plane. Default is 0.02.
  4345. Valid range is 0 to 0.3.
  4346. @item 0b
  4347. Set threshold B for 1st plane. Default is 0.04.
  4348. Valid range is 0 to 5.
  4349. @item 1a
  4350. Set threshold A for 2nd plane. Default is 0.02.
  4351. Valid range is 0 to 0.3.
  4352. @item 1b
  4353. Set threshold B for 2nd plane. Default is 0.04.
  4354. Valid range is 0 to 5.
  4355. @item 2a
  4356. Set threshold A for 3rd plane. Default is 0.02.
  4357. Valid range is 0 to 0.3.
  4358. @item 2b
  4359. Set threshold B for 3rd plane. Default is 0.04.
  4360. Valid range is 0 to 5.
  4361. Threshold A is designed to react on abrupt changes in the input signal and
  4362. threshold B is designed to react on continuous changes in the input signal.
  4363. @item s
  4364. Set number of frames filter will use for averaging. Default is 9. Must be odd
  4365. number in range [5, 129].
  4366. @item p
  4367. Set what planes of frame filter will use for averaging. Default is all.
  4368. @end table
  4369. @section avgblur
  4370. Apply average blur filter.
  4371. The filter accepts the following options:
  4372. @table @option
  4373. @item sizeX
  4374. Set horizontal radius size.
  4375. @item planes
  4376. Set which planes to filter. By default all planes are filtered.
  4377. @item sizeY
  4378. Set vertical radius size, if zero it will be same as @code{sizeX}.
  4379. Default is @code{0}.
  4380. @end table
  4381. @section bbox
  4382. Compute the bounding box for the non-black pixels in the input frame
  4383. luminance plane.
  4384. This filter computes the bounding box containing all the pixels with a
  4385. luminance value greater than the minimum allowed value.
  4386. The parameters describing the bounding box are printed on the filter
  4387. log.
  4388. The filter accepts the following option:
  4389. @table @option
  4390. @item min_val
  4391. Set the minimal luminance value. Default is @code{16}.
  4392. @end table
  4393. @section bitplanenoise
  4394. Show and measure bit plane noise.
  4395. The filter accepts the following options:
  4396. @table @option
  4397. @item bitplane
  4398. Set which plane to analyze. Default is @code{1}.
  4399. @item filter
  4400. Filter out noisy pixels from @code{bitplane} set above.
  4401. Default is disabled.
  4402. @end table
  4403. @section blackdetect
  4404. Detect video intervals that are (almost) completely black. Can be
  4405. useful to detect chapter transitions, commercials, or invalid
  4406. recordings. Output lines contains the time for the start, end and
  4407. duration of the detected black interval expressed in seconds.
  4408. In order to display the output lines, you need to set the loglevel at
  4409. least to the AV_LOG_INFO value.
  4410. The filter accepts the following options:
  4411. @table @option
  4412. @item black_min_duration, d
  4413. Set the minimum detected black duration expressed in seconds. It must
  4414. be a non-negative floating point number.
  4415. Default value is 2.0.
  4416. @item picture_black_ratio_th, pic_th
  4417. Set the threshold for considering a picture "black".
  4418. Express the minimum value for the ratio:
  4419. @example
  4420. @var{nb_black_pixels} / @var{nb_pixels}
  4421. @end example
  4422. for which a picture is considered black.
  4423. Default value is 0.98.
  4424. @item pixel_black_th, pix_th
  4425. Set the threshold for considering a pixel "black".
  4426. The threshold expresses the maximum pixel luminance value for which a
  4427. pixel is considered "black". The provided value is scaled according to
  4428. the following equation:
  4429. @example
  4430. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  4431. @end example
  4432. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  4433. the input video format, the range is [0-255] for YUV full-range
  4434. formats and [16-235] for YUV non full-range formats.
  4435. Default value is 0.10.
  4436. @end table
  4437. The following example sets the maximum pixel threshold to the minimum
  4438. value, and detects only black intervals of 2 or more seconds:
  4439. @example
  4440. blackdetect=d=2:pix_th=0.00
  4441. @end example
  4442. @section blackframe
  4443. Detect frames that are (almost) completely black. Can be useful to
  4444. detect chapter transitions or commercials. Output lines consist of
  4445. the frame number of the detected frame, the percentage of blackness,
  4446. the position in the file if known or -1 and the timestamp in seconds.
  4447. In order to display the output lines, you need to set the loglevel at
  4448. least to the AV_LOG_INFO value.
  4449. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  4450. The value represents the percentage of pixels in the picture that
  4451. are below the threshold value.
  4452. It accepts the following parameters:
  4453. @table @option
  4454. @item amount
  4455. The percentage of the pixels that have to be below the threshold; it defaults to
  4456. @code{98}.
  4457. @item threshold, thresh
  4458. The threshold below which a pixel value is considered black; it defaults to
  4459. @code{32}.
  4460. @end table
  4461. @section blend, tblend
  4462. Blend two video frames into each other.
  4463. The @code{blend} filter takes two input streams and outputs one
  4464. stream, the first input is the "top" layer and second input is
  4465. "bottom" layer. By default, the output terminates when the longest input terminates.
  4466. The @code{tblend} (time blend) filter takes two consecutive frames
  4467. from one single stream, and outputs the result obtained by blending
  4468. the new frame on top of the old frame.
  4469. A description of the accepted options follows.
  4470. @table @option
  4471. @item c0_mode
  4472. @item c1_mode
  4473. @item c2_mode
  4474. @item c3_mode
  4475. @item all_mode
  4476. Set blend mode for specific pixel component or all pixel components in case
  4477. of @var{all_mode}. Default value is @code{normal}.
  4478. Available values for component modes are:
  4479. @table @samp
  4480. @item addition
  4481. @item grainmerge
  4482. @item and
  4483. @item average
  4484. @item burn
  4485. @item darken
  4486. @item difference
  4487. @item grainextract
  4488. @item divide
  4489. @item dodge
  4490. @item freeze
  4491. @item exclusion
  4492. @item extremity
  4493. @item glow
  4494. @item hardlight
  4495. @item hardmix
  4496. @item heat
  4497. @item lighten
  4498. @item linearlight
  4499. @item multiply
  4500. @item multiply128
  4501. @item negation
  4502. @item normal
  4503. @item or
  4504. @item overlay
  4505. @item phoenix
  4506. @item pinlight
  4507. @item reflect
  4508. @item screen
  4509. @item softlight
  4510. @item subtract
  4511. @item vividlight
  4512. @item xor
  4513. @end table
  4514. @item c0_opacity
  4515. @item c1_opacity
  4516. @item c2_opacity
  4517. @item c3_opacity
  4518. @item all_opacity
  4519. Set blend opacity for specific pixel component or all pixel components in case
  4520. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  4521. @item c0_expr
  4522. @item c1_expr
  4523. @item c2_expr
  4524. @item c3_expr
  4525. @item all_expr
  4526. Set blend expression for specific pixel component or all pixel components in case
  4527. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  4528. The expressions can use the following variables:
  4529. @table @option
  4530. @item N
  4531. The sequential number of the filtered frame, starting from @code{0}.
  4532. @item X
  4533. @item Y
  4534. the coordinates of the current sample
  4535. @item W
  4536. @item H
  4537. the width and height of currently filtered plane
  4538. @item SW
  4539. @item SH
  4540. Width and height scale for the plane being filtered. It is the
  4541. ratio between the dimensions of the current plane to the luma plane,
  4542. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  4543. the luma plane and @code{0.5,0.5} for the chroma planes.
  4544. @item T
  4545. Time of the current frame, expressed in seconds.
  4546. @item TOP, A
  4547. Value of pixel component at current location for first video frame (top layer).
  4548. @item BOTTOM, B
  4549. Value of pixel component at current location for second video frame (bottom layer).
  4550. @end table
  4551. @end table
  4552. The @code{blend} filter also supports the @ref{framesync} options.
  4553. @subsection Examples
  4554. @itemize
  4555. @item
  4556. Apply transition from bottom layer to top layer in first 10 seconds:
  4557. @example
  4558. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  4559. @end example
  4560. @item
  4561. Apply linear horizontal transition from top layer to bottom layer:
  4562. @example
  4563. blend=all_expr='A*(X/W)+B*(1-X/W)'
  4564. @end example
  4565. @item
  4566. Apply 1x1 checkerboard effect:
  4567. @example
  4568. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  4569. @end example
  4570. @item
  4571. Apply uncover left effect:
  4572. @example
  4573. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  4574. @end example
  4575. @item
  4576. Apply uncover down effect:
  4577. @example
  4578. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  4579. @end example
  4580. @item
  4581. Apply uncover up-left effect:
  4582. @example
  4583. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  4584. @end example
  4585. @item
  4586. Split diagonally video and shows top and bottom layer on each side:
  4587. @example
  4588. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  4589. @end example
  4590. @item
  4591. Display differences between the current and the previous frame:
  4592. @example
  4593. tblend=all_mode=grainextract
  4594. @end example
  4595. @end itemize
  4596. @section bm3d
  4597. Denoise frames using Block-Matching 3D algorithm.
  4598. The filter accepts the following options.
  4599. @table @option
  4600. @item sigma
  4601. Set denoising strength. Default value is 1.
  4602. Allowed range is from 0 to 999.9.
  4603. The denoising algorith is very sensitive to sigma, so adjust it
  4604. according to the source.
  4605. @item block
  4606. Set local patch size. This sets dimensions in 2D.
  4607. @item bstep
  4608. Set sliding step for processing blocks. Default value is 4.
  4609. Allowed range is from 1 to 64.
  4610. Smaller values allows processing more reference blocks and is slower.
  4611. @item group
  4612. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  4613. When set to 1, no block matching is done. Larger values allows more blocks
  4614. in single group.
  4615. Allowed range is from 1 to 256.
  4616. @item range
  4617. Set radius for search block matching. Default is 9.
  4618. Allowed range is from 1 to INT32_MAX.
  4619. @item mstep
  4620. Set step between two search locations for block matching. Default is 1.
  4621. Allowed range is from 1 to 64. Smaller is slower.
  4622. @item thmse
  4623. Set threshold of mean square error for block matching. Valid range is 0 to
  4624. INT32_MAX.
  4625. @item hdthr
  4626. Set thresholding parameter for hard thresholding in 3D transformed domain.
  4627. Larger values results in stronger hard-thresholding filtering in frequency
  4628. domain.
  4629. @item estim
  4630. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  4631. Default is @code{basic}.
  4632. @item ref
  4633. If enabled, filter will use 2nd stream for block matching.
  4634. Default is disabled for @code{basic} value of @var{estim} option,
  4635. and always enabled if value of @var{estim} is @code{final}.
  4636. @item planes
  4637. Set planes to filter. Default is all available except alpha.
  4638. @end table
  4639. @subsection Examples
  4640. @itemize
  4641. @item
  4642. Basic filtering with bm3d:
  4643. @example
  4644. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  4645. @end example
  4646. @item
  4647. Same as above, but filtering only luma:
  4648. @example
  4649. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  4650. @end example
  4651. @item
  4652. Same as above, but with both estimation modes:
  4653. @example
  4654. split[a][b],[a]bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic[a],[b][a]bm3d=sigma=3:block=4:bstep=2:group=16:estim=final:ref=1
  4655. @end example
  4656. @item
  4657. Same as above, but prefilter with @ref{nlmeans} filter instead:
  4658. @example
  4659. split[a][b],[a]nlmeans=s=3:r=7:p=3[a],[b][a]bm3d=sigma=3:block=4:bstep=2:group=16:estim=final:ref=1
  4660. @end example
  4661. @end itemize
  4662. @section boxblur
  4663. Apply a boxblur algorithm to the input video.
  4664. It accepts the following parameters:
  4665. @table @option
  4666. @item luma_radius, lr
  4667. @item luma_power, lp
  4668. @item chroma_radius, cr
  4669. @item chroma_power, cp
  4670. @item alpha_radius, ar
  4671. @item alpha_power, ap
  4672. @end table
  4673. A description of the accepted options follows.
  4674. @table @option
  4675. @item luma_radius, lr
  4676. @item chroma_radius, cr
  4677. @item alpha_radius, ar
  4678. Set an expression for the box radius in pixels used for blurring the
  4679. corresponding input plane.
  4680. The radius value must be a non-negative number, and must not be
  4681. greater than the value of the expression @code{min(w,h)/2} for the
  4682. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  4683. planes.
  4684. Default value for @option{luma_radius} is "2". If not specified,
  4685. @option{chroma_radius} and @option{alpha_radius} default to the
  4686. corresponding value set for @option{luma_radius}.
  4687. The expressions can contain the following constants:
  4688. @table @option
  4689. @item w
  4690. @item h
  4691. The input width and height in pixels.
  4692. @item cw
  4693. @item ch
  4694. The input chroma image width and height in pixels.
  4695. @item hsub
  4696. @item vsub
  4697. The horizontal and vertical chroma subsample values. For example, for the
  4698. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  4699. @end table
  4700. @item luma_power, lp
  4701. @item chroma_power, cp
  4702. @item alpha_power, ap
  4703. Specify how many times the boxblur filter is applied to the
  4704. corresponding plane.
  4705. Default value for @option{luma_power} is 2. If not specified,
  4706. @option{chroma_power} and @option{alpha_power} default to the
  4707. corresponding value set for @option{luma_power}.
  4708. A value of 0 will disable the effect.
  4709. @end table
  4710. @subsection Examples
  4711. @itemize
  4712. @item
  4713. Apply a boxblur filter with the luma, chroma, and alpha radii
  4714. set to 2:
  4715. @example
  4716. boxblur=luma_radius=2:luma_power=1
  4717. boxblur=2:1
  4718. @end example
  4719. @item
  4720. Set the luma radius to 2, and alpha and chroma radius to 0:
  4721. @example
  4722. boxblur=2:1:cr=0:ar=0
  4723. @end example
  4724. @item
  4725. Set the luma and chroma radii to a fraction of the video dimension:
  4726. @example
  4727. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  4728. @end example
  4729. @end itemize
  4730. @section bwdif
  4731. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  4732. Deinterlacing Filter").
  4733. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  4734. interpolation algorithms.
  4735. It accepts the following parameters:
  4736. @table @option
  4737. @item mode
  4738. The interlacing mode to adopt. It accepts one of the following values:
  4739. @table @option
  4740. @item 0, send_frame
  4741. Output one frame for each frame.
  4742. @item 1, send_field
  4743. Output one frame for each field.
  4744. @end table
  4745. The default value is @code{send_field}.
  4746. @item parity
  4747. The picture field parity assumed for the input interlaced video. It accepts one
  4748. of the following values:
  4749. @table @option
  4750. @item 0, tff
  4751. Assume the top field is first.
  4752. @item 1, bff
  4753. Assume the bottom field is first.
  4754. @item -1, auto
  4755. Enable automatic detection of field parity.
  4756. @end table
  4757. The default value is @code{auto}.
  4758. If the interlacing is unknown or the decoder does not export this information,
  4759. top field first will be assumed.
  4760. @item deint
  4761. Specify which frames to deinterlace. Accept one of the following
  4762. values:
  4763. @table @option
  4764. @item 0, all
  4765. Deinterlace all frames.
  4766. @item 1, interlaced
  4767. Only deinterlace frames marked as interlaced.
  4768. @end table
  4769. The default value is @code{all}.
  4770. @end table
  4771. @section chromahold
  4772. Remove all color information for all colors except for certain one.
  4773. The filter accepts the following options:
  4774. @table @option
  4775. @item color
  4776. The color which will not be replaced with neutral chroma.
  4777. @item similarity
  4778. Similarity percentage with the above color.
  4779. 0.01 matches only the exact key color, while 1.0 matches everything.
  4780. @item yuv
  4781. Signals that the color passed is already in YUV instead of RGB.
  4782. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  4783. This can be used to pass exact YUV values as hexadecimal numbers.
  4784. @end table
  4785. @section chromakey
  4786. YUV colorspace color/chroma keying.
  4787. The filter accepts the following options:
  4788. @table @option
  4789. @item color
  4790. The color which will be replaced with transparency.
  4791. @item similarity
  4792. Similarity percentage with the key color.
  4793. 0.01 matches only the exact key color, while 1.0 matches everything.
  4794. @item blend
  4795. Blend percentage.
  4796. 0.0 makes pixels either fully transparent, or not transparent at all.
  4797. Higher values result in semi-transparent pixels, with a higher transparency
  4798. the more similar the pixels color is to the key color.
  4799. @item yuv
  4800. Signals that the color passed is already in YUV instead of RGB.
  4801. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  4802. This can be used to pass exact YUV values as hexadecimal numbers.
  4803. @end table
  4804. @subsection Examples
  4805. @itemize
  4806. @item
  4807. Make every green pixel in the input image transparent:
  4808. @example
  4809. ffmpeg -i input.png -vf chromakey=green out.png
  4810. @end example
  4811. @item
  4812. Overlay a greenscreen-video on top of a static black background.
  4813. @example
  4814. 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
  4815. @end example
  4816. @end itemize
  4817. @section ciescope
  4818. Display CIE color diagram with pixels overlaid onto it.
  4819. The filter accepts the following options:
  4820. @table @option
  4821. @item system
  4822. Set color system.
  4823. @table @samp
  4824. @item ntsc, 470m
  4825. @item ebu, 470bg
  4826. @item smpte
  4827. @item 240m
  4828. @item apple
  4829. @item widergb
  4830. @item cie1931
  4831. @item rec709, hdtv
  4832. @item uhdtv, rec2020
  4833. @end table
  4834. @item cie
  4835. Set CIE system.
  4836. @table @samp
  4837. @item xyy
  4838. @item ucs
  4839. @item luv
  4840. @end table
  4841. @item gamuts
  4842. Set what gamuts to draw.
  4843. See @code{system} option for available values.
  4844. @item size, s
  4845. Set ciescope size, by default set to 512.
  4846. @item intensity, i
  4847. Set intensity used to map input pixel values to CIE diagram.
  4848. @item contrast
  4849. Set contrast used to draw tongue colors that are out of active color system gamut.
  4850. @item corrgamma
  4851. Correct gamma displayed on scope, by default enabled.
  4852. @item showwhite
  4853. Show white point on CIE diagram, by default disabled.
  4854. @item gamma
  4855. Set input gamma. Used only with XYZ input color space.
  4856. @end table
  4857. @section codecview
  4858. Visualize information exported by some codecs.
  4859. Some codecs can export information through frames using side-data or other
  4860. means. For example, some MPEG based codecs export motion vectors through the
  4861. @var{export_mvs} flag in the codec @option{flags2} option.
  4862. The filter accepts the following option:
  4863. @table @option
  4864. @item mv
  4865. Set motion vectors to visualize.
  4866. Available flags for @var{mv} are:
  4867. @table @samp
  4868. @item pf
  4869. forward predicted MVs of P-frames
  4870. @item bf
  4871. forward predicted MVs of B-frames
  4872. @item bb
  4873. backward predicted MVs of B-frames
  4874. @end table
  4875. @item qp
  4876. Display quantization parameters using the chroma planes.
  4877. @item mv_type, mvt
  4878. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  4879. Available flags for @var{mv_type} are:
  4880. @table @samp
  4881. @item fp
  4882. forward predicted MVs
  4883. @item bp
  4884. backward predicted MVs
  4885. @end table
  4886. @item frame_type, ft
  4887. Set frame type to visualize motion vectors of.
  4888. Available flags for @var{frame_type} are:
  4889. @table @samp
  4890. @item if
  4891. intra-coded frames (I-frames)
  4892. @item pf
  4893. predicted frames (P-frames)
  4894. @item bf
  4895. bi-directionally predicted frames (B-frames)
  4896. @end table
  4897. @end table
  4898. @subsection Examples
  4899. @itemize
  4900. @item
  4901. Visualize forward predicted MVs of all frames using @command{ffplay}:
  4902. @example
  4903. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  4904. @end example
  4905. @item
  4906. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  4907. @example
  4908. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  4909. @end example
  4910. @end itemize
  4911. @section colorbalance
  4912. Modify intensity of primary colors (red, green and blue) of input frames.
  4913. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  4914. regions for the red-cyan, green-magenta or blue-yellow balance.
  4915. A positive adjustment value shifts the balance towards the primary color, a negative
  4916. value towards the complementary color.
  4917. The filter accepts the following options:
  4918. @table @option
  4919. @item rs
  4920. @item gs
  4921. @item bs
  4922. Adjust red, green and blue shadows (darkest pixels).
  4923. @item rm
  4924. @item gm
  4925. @item bm
  4926. Adjust red, green and blue midtones (medium pixels).
  4927. @item rh
  4928. @item gh
  4929. @item bh
  4930. Adjust red, green and blue highlights (brightest pixels).
  4931. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4932. @end table
  4933. @subsection Examples
  4934. @itemize
  4935. @item
  4936. Add red color cast to shadows:
  4937. @example
  4938. colorbalance=rs=.3
  4939. @end example
  4940. @end itemize
  4941. @section colorkey
  4942. RGB colorspace color keying.
  4943. The filter accepts the following options:
  4944. @table @option
  4945. @item color
  4946. The color which will be replaced with transparency.
  4947. @item similarity
  4948. Similarity percentage with the key color.
  4949. 0.01 matches only the exact key color, while 1.0 matches everything.
  4950. @item blend
  4951. Blend percentage.
  4952. 0.0 makes pixels either fully transparent, or not transparent at all.
  4953. Higher values result in semi-transparent pixels, with a higher transparency
  4954. the more similar the pixels color is to the key color.
  4955. @end table
  4956. @subsection Examples
  4957. @itemize
  4958. @item
  4959. Make every green pixel in the input image transparent:
  4960. @example
  4961. ffmpeg -i input.png -vf colorkey=green out.png
  4962. @end example
  4963. @item
  4964. Overlay a greenscreen-video on top of a static background image.
  4965. @example
  4966. 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
  4967. @end example
  4968. @end itemize
  4969. @section colorlevels
  4970. Adjust video input frames using levels.
  4971. The filter accepts the following options:
  4972. @table @option
  4973. @item rimin
  4974. @item gimin
  4975. @item bimin
  4976. @item aimin
  4977. Adjust red, green, blue and alpha input black point.
  4978. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4979. @item rimax
  4980. @item gimax
  4981. @item bimax
  4982. @item aimax
  4983. Adjust red, green, blue and alpha input white point.
  4984. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  4985. Input levels are used to lighten highlights (bright tones), darken shadows
  4986. (dark tones), change the balance of bright and dark tones.
  4987. @item romin
  4988. @item gomin
  4989. @item bomin
  4990. @item aomin
  4991. Adjust red, green, blue and alpha output black point.
  4992. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  4993. @item romax
  4994. @item gomax
  4995. @item bomax
  4996. @item aomax
  4997. Adjust red, green, blue and alpha output white point.
  4998. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  4999. Output levels allows manual selection of a constrained output level range.
  5000. @end table
  5001. @subsection Examples
  5002. @itemize
  5003. @item
  5004. Make video output darker:
  5005. @example
  5006. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  5007. @end example
  5008. @item
  5009. Increase contrast:
  5010. @example
  5011. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  5012. @end example
  5013. @item
  5014. Make video output lighter:
  5015. @example
  5016. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  5017. @end example
  5018. @item
  5019. Increase brightness:
  5020. @example
  5021. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  5022. @end example
  5023. @end itemize
  5024. @section colorchannelmixer
  5025. Adjust video input frames by re-mixing color channels.
  5026. This filter modifies a color channel by adding the values associated to
  5027. the other channels of the same pixels. For example if the value to
  5028. modify is red, the output value will be:
  5029. @example
  5030. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  5031. @end example
  5032. The filter accepts the following options:
  5033. @table @option
  5034. @item rr
  5035. @item rg
  5036. @item rb
  5037. @item ra
  5038. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  5039. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  5040. @item gr
  5041. @item gg
  5042. @item gb
  5043. @item ga
  5044. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  5045. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  5046. @item br
  5047. @item bg
  5048. @item bb
  5049. @item ba
  5050. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  5051. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  5052. @item ar
  5053. @item ag
  5054. @item ab
  5055. @item aa
  5056. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  5057. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  5058. Allowed ranges for options are @code{[-2.0, 2.0]}.
  5059. @end table
  5060. @subsection Examples
  5061. @itemize
  5062. @item
  5063. Convert source to grayscale:
  5064. @example
  5065. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  5066. @end example
  5067. @item
  5068. Simulate sepia tones:
  5069. @example
  5070. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  5071. @end example
  5072. @end itemize
  5073. @section colormatrix
  5074. Convert color matrix.
  5075. The filter accepts the following options:
  5076. @table @option
  5077. @item src
  5078. @item dst
  5079. Specify the source and destination color matrix. Both values must be
  5080. specified.
  5081. The accepted values are:
  5082. @table @samp
  5083. @item bt709
  5084. BT.709
  5085. @item fcc
  5086. FCC
  5087. @item bt601
  5088. BT.601
  5089. @item bt470
  5090. BT.470
  5091. @item bt470bg
  5092. BT.470BG
  5093. @item smpte170m
  5094. SMPTE-170M
  5095. @item smpte240m
  5096. SMPTE-240M
  5097. @item bt2020
  5098. BT.2020
  5099. @end table
  5100. @end table
  5101. For example to convert from BT.601 to SMPTE-240M, use the command:
  5102. @example
  5103. colormatrix=bt601:smpte240m
  5104. @end example
  5105. @section colorspace
  5106. Convert colorspace, transfer characteristics or color primaries.
  5107. Input video needs to have an even size.
  5108. The filter accepts the following options:
  5109. @table @option
  5110. @anchor{all}
  5111. @item all
  5112. Specify all color properties at once.
  5113. The accepted values are:
  5114. @table @samp
  5115. @item bt470m
  5116. BT.470M
  5117. @item bt470bg
  5118. BT.470BG
  5119. @item bt601-6-525
  5120. BT.601-6 525
  5121. @item bt601-6-625
  5122. BT.601-6 625
  5123. @item bt709
  5124. BT.709
  5125. @item smpte170m
  5126. SMPTE-170M
  5127. @item smpte240m
  5128. SMPTE-240M
  5129. @item bt2020
  5130. BT.2020
  5131. @end table
  5132. @anchor{space}
  5133. @item space
  5134. Specify output colorspace.
  5135. The accepted values are:
  5136. @table @samp
  5137. @item bt709
  5138. BT.709
  5139. @item fcc
  5140. FCC
  5141. @item bt470bg
  5142. BT.470BG or BT.601-6 625
  5143. @item smpte170m
  5144. SMPTE-170M or BT.601-6 525
  5145. @item smpte240m
  5146. SMPTE-240M
  5147. @item ycgco
  5148. YCgCo
  5149. @item bt2020ncl
  5150. BT.2020 with non-constant luminance
  5151. @end table
  5152. @anchor{trc}
  5153. @item trc
  5154. Specify output transfer characteristics.
  5155. The accepted values are:
  5156. @table @samp
  5157. @item bt709
  5158. BT.709
  5159. @item bt470m
  5160. BT.470M
  5161. @item bt470bg
  5162. BT.470BG
  5163. @item gamma22
  5164. Constant gamma of 2.2
  5165. @item gamma28
  5166. Constant gamma of 2.8
  5167. @item smpte170m
  5168. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  5169. @item smpte240m
  5170. SMPTE-240M
  5171. @item srgb
  5172. SRGB
  5173. @item iec61966-2-1
  5174. iec61966-2-1
  5175. @item iec61966-2-4
  5176. iec61966-2-4
  5177. @item xvycc
  5178. xvycc
  5179. @item bt2020-10
  5180. BT.2020 for 10-bits content
  5181. @item bt2020-12
  5182. BT.2020 for 12-bits content
  5183. @end table
  5184. @anchor{primaries}
  5185. @item primaries
  5186. Specify output color primaries.
  5187. The accepted values are:
  5188. @table @samp
  5189. @item bt709
  5190. BT.709
  5191. @item bt470m
  5192. BT.470M
  5193. @item bt470bg
  5194. BT.470BG or BT.601-6 625
  5195. @item smpte170m
  5196. SMPTE-170M or BT.601-6 525
  5197. @item smpte240m
  5198. SMPTE-240M
  5199. @item film
  5200. film
  5201. @item smpte431
  5202. SMPTE-431
  5203. @item smpte432
  5204. SMPTE-432
  5205. @item bt2020
  5206. BT.2020
  5207. @item jedec-p22
  5208. JEDEC P22 phosphors
  5209. @end table
  5210. @anchor{range}
  5211. @item range
  5212. Specify output color range.
  5213. The accepted values are:
  5214. @table @samp
  5215. @item tv
  5216. TV (restricted) range
  5217. @item mpeg
  5218. MPEG (restricted) range
  5219. @item pc
  5220. PC (full) range
  5221. @item jpeg
  5222. JPEG (full) range
  5223. @end table
  5224. @item format
  5225. Specify output color format.
  5226. The accepted values are:
  5227. @table @samp
  5228. @item yuv420p
  5229. YUV 4:2:0 planar 8-bits
  5230. @item yuv420p10
  5231. YUV 4:2:0 planar 10-bits
  5232. @item yuv420p12
  5233. YUV 4:2:0 planar 12-bits
  5234. @item yuv422p
  5235. YUV 4:2:2 planar 8-bits
  5236. @item yuv422p10
  5237. YUV 4:2:2 planar 10-bits
  5238. @item yuv422p12
  5239. YUV 4:2:2 planar 12-bits
  5240. @item yuv444p
  5241. YUV 4:4:4 planar 8-bits
  5242. @item yuv444p10
  5243. YUV 4:4:4 planar 10-bits
  5244. @item yuv444p12
  5245. YUV 4:4:4 planar 12-bits
  5246. @end table
  5247. @item fast
  5248. Do a fast conversion, which skips gamma/primary correction. This will take
  5249. significantly less CPU, but will be mathematically incorrect. To get output
  5250. compatible with that produced by the colormatrix filter, use fast=1.
  5251. @item dither
  5252. Specify dithering mode.
  5253. The accepted values are:
  5254. @table @samp
  5255. @item none
  5256. No dithering
  5257. @item fsb
  5258. Floyd-Steinberg dithering
  5259. @end table
  5260. @item wpadapt
  5261. Whitepoint adaptation mode.
  5262. The accepted values are:
  5263. @table @samp
  5264. @item bradford
  5265. Bradford whitepoint adaptation
  5266. @item vonkries
  5267. von Kries whitepoint adaptation
  5268. @item identity
  5269. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  5270. @end table
  5271. @item iall
  5272. Override all input properties at once. Same accepted values as @ref{all}.
  5273. @item ispace
  5274. Override input colorspace. Same accepted values as @ref{space}.
  5275. @item iprimaries
  5276. Override input color primaries. Same accepted values as @ref{primaries}.
  5277. @item itrc
  5278. Override input transfer characteristics. Same accepted values as @ref{trc}.
  5279. @item irange
  5280. Override input color range. Same accepted values as @ref{range}.
  5281. @end table
  5282. The filter converts the transfer characteristics, color space and color
  5283. primaries to the specified user values. The output value, if not specified,
  5284. is set to a default value based on the "all" property. If that property is
  5285. also not specified, the filter will log an error. The output color range and
  5286. format default to the same value as the input color range and format. The
  5287. input transfer characteristics, color space, color primaries and color range
  5288. should be set on the input data. If any of these are missing, the filter will
  5289. log an error and no conversion will take place.
  5290. For example to convert the input to SMPTE-240M, use the command:
  5291. @example
  5292. colorspace=smpte240m
  5293. @end example
  5294. @section convolution
  5295. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  5296. The filter accepts the following options:
  5297. @table @option
  5298. @item 0m
  5299. @item 1m
  5300. @item 2m
  5301. @item 3m
  5302. Set matrix for each plane.
  5303. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  5304. and from 1 to 49 odd number of signed integers in @var{row} mode.
  5305. @item 0rdiv
  5306. @item 1rdiv
  5307. @item 2rdiv
  5308. @item 3rdiv
  5309. Set multiplier for calculated value for each plane.
  5310. If unset or 0, it will be sum of all matrix elements.
  5311. @item 0bias
  5312. @item 1bias
  5313. @item 2bias
  5314. @item 3bias
  5315. Set bias for each plane. This value is added to the result of the multiplication.
  5316. Useful for making the overall image brighter or darker. Default is 0.0.
  5317. @item 0mode
  5318. @item 1mode
  5319. @item 2mode
  5320. @item 3mode
  5321. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  5322. Default is @var{square}.
  5323. @end table
  5324. @subsection Examples
  5325. @itemize
  5326. @item
  5327. Apply sharpen:
  5328. @example
  5329. 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"
  5330. @end example
  5331. @item
  5332. Apply blur:
  5333. @example
  5334. 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"
  5335. @end example
  5336. @item
  5337. Apply edge enhance:
  5338. @example
  5339. 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"
  5340. @end example
  5341. @item
  5342. Apply edge detect:
  5343. @example
  5344. 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"
  5345. @end example
  5346. @item
  5347. Apply laplacian edge detector which includes diagonals:
  5348. @example
  5349. 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"
  5350. @end example
  5351. @item
  5352. Apply emboss:
  5353. @example
  5354. 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"
  5355. @end example
  5356. @end itemize
  5357. @section convolve
  5358. Apply 2D convolution of video stream in frequency domain using second stream
  5359. as impulse.
  5360. The filter accepts the following options:
  5361. @table @option
  5362. @item planes
  5363. Set which planes to process.
  5364. @item impulse
  5365. Set which impulse video frames will be processed, can be @var{first}
  5366. or @var{all}. Default is @var{all}.
  5367. @end table
  5368. The @code{convolve} filter also supports the @ref{framesync} options.
  5369. @section copy
  5370. Copy the input video source unchanged to the output. This is mainly useful for
  5371. testing purposes.
  5372. @anchor{coreimage}
  5373. @section coreimage
  5374. Video filtering on GPU using Apple's CoreImage API on OSX.
  5375. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  5376. processed by video hardware. However, software-based OpenGL implementations
  5377. exist which means there is no guarantee for hardware processing. It depends on
  5378. the respective OSX.
  5379. There are many filters and image generators provided by Apple that come with a
  5380. large variety of options. The filter has to be referenced by its name along
  5381. with its options.
  5382. The coreimage filter accepts the following options:
  5383. @table @option
  5384. @item list_filters
  5385. List all available filters and generators along with all their respective
  5386. options as well as possible minimum and maximum values along with the default
  5387. values.
  5388. @example
  5389. list_filters=true
  5390. @end example
  5391. @item filter
  5392. Specify all filters by their respective name and options.
  5393. Use @var{list_filters} to determine all valid filter names and options.
  5394. Numerical options are specified by a float value and are automatically clamped
  5395. to their respective value range. Vector and color options have to be specified
  5396. by a list of space separated float values. Character escaping has to be done.
  5397. A special option name @code{default} is available to use default options for a
  5398. filter.
  5399. It is required to specify either @code{default} or at least one of the filter options.
  5400. All omitted options are used with their default values.
  5401. The syntax of the filter string is as follows:
  5402. @example
  5403. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  5404. @end example
  5405. @item output_rect
  5406. Specify a rectangle where the output of the filter chain is copied into the
  5407. input image. It is given by a list of space separated float values:
  5408. @example
  5409. output_rect=x\ y\ width\ height
  5410. @end example
  5411. If not given, the output rectangle equals the dimensions of the input image.
  5412. The output rectangle is automatically cropped at the borders of the input
  5413. image. Negative values are valid for each component.
  5414. @example
  5415. output_rect=25\ 25\ 100\ 100
  5416. @end example
  5417. @end table
  5418. Several filters can be chained for successive processing without GPU-HOST
  5419. transfers allowing for fast processing of complex filter chains.
  5420. Currently, only filters with zero (generators) or exactly one (filters) input
  5421. image and one output image are supported. Also, transition filters are not yet
  5422. usable as intended.
  5423. Some filters generate output images with additional padding depending on the
  5424. respective filter kernel. The padding is automatically removed to ensure the
  5425. filter output has the same size as the input image.
  5426. For image generators, the size of the output image is determined by the
  5427. previous output image of the filter chain or the input image of the whole
  5428. filterchain, respectively. The generators do not use the pixel information of
  5429. this image to generate their output. However, the generated output is
  5430. blended onto this image, resulting in partial or complete coverage of the
  5431. output image.
  5432. The @ref{coreimagesrc} video source can be used for generating input images
  5433. which are directly fed into the filter chain. By using it, providing input
  5434. images by another video source or an input video is not required.
  5435. @subsection Examples
  5436. @itemize
  5437. @item
  5438. List all filters available:
  5439. @example
  5440. coreimage=list_filters=true
  5441. @end example
  5442. @item
  5443. Use the CIBoxBlur filter with default options to blur an image:
  5444. @example
  5445. coreimage=filter=CIBoxBlur@@default
  5446. @end example
  5447. @item
  5448. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  5449. its center at 100x100 and a radius of 50 pixels:
  5450. @example
  5451. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  5452. @end example
  5453. @item
  5454. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  5455. given as complete and escaped command-line for Apple's standard bash shell:
  5456. @example
  5457. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  5458. @end example
  5459. @end itemize
  5460. @section crop
  5461. Crop the input video to given dimensions.
  5462. It accepts the following parameters:
  5463. @table @option
  5464. @item w, out_w
  5465. The width of the output video. It defaults to @code{iw}.
  5466. This expression is evaluated only once during the filter
  5467. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  5468. @item h, out_h
  5469. The height of the output video. It defaults to @code{ih}.
  5470. This expression is evaluated only once during the filter
  5471. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  5472. @item x
  5473. The horizontal position, in the input video, of the left edge of the output
  5474. video. It defaults to @code{(in_w-out_w)/2}.
  5475. This expression is evaluated per-frame.
  5476. @item y
  5477. The vertical position, in the input video, of the top edge of the output video.
  5478. It defaults to @code{(in_h-out_h)/2}.
  5479. This expression is evaluated per-frame.
  5480. @item keep_aspect
  5481. If set to 1 will force the output display aspect ratio
  5482. to be the same of the input, by changing the output sample aspect
  5483. ratio. It defaults to 0.
  5484. @item exact
  5485. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  5486. width/height/x/y as specified and will not be rounded to nearest smaller value.
  5487. It defaults to 0.
  5488. @end table
  5489. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  5490. expressions containing the following constants:
  5491. @table @option
  5492. @item x
  5493. @item y
  5494. The computed values for @var{x} and @var{y}. They are evaluated for
  5495. each new frame.
  5496. @item in_w
  5497. @item in_h
  5498. The input width and height.
  5499. @item iw
  5500. @item ih
  5501. These are the same as @var{in_w} and @var{in_h}.
  5502. @item out_w
  5503. @item out_h
  5504. The output (cropped) width and height.
  5505. @item ow
  5506. @item oh
  5507. These are the same as @var{out_w} and @var{out_h}.
  5508. @item a
  5509. same as @var{iw} / @var{ih}
  5510. @item sar
  5511. input sample aspect ratio
  5512. @item dar
  5513. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  5514. @item hsub
  5515. @item vsub
  5516. horizontal and vertical chroma subsample values. For example for the
  5517. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5518. @item n
  5519. The number of the input frame, starting from 0.
  5520. @item pos
  5521. the position in the file of the input frame, NAN if unknown
  5522. @item t
  5523. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  5524. @end table
  5525. The expression for @var{out_w} may depend on the value of @var{out_h},
  5526. and the expression for @var{out_h} may depend on @var{out_w}, but they
  5527. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  5528. evaluated after @var{out_w} and @var{out_h}.
  5529. The @var{x} and @var{y} parameters specify the expressions for the
  5530. position of the top-left corner of the output (non-cropped) area. They
  5531. are evaluated for each frame. If the evaluated value is not valid, it
  5532. is approximated to the nearest valid value.
  5533. The expression for @var{x} may depend on @var{y}, and the expression
  5534. for @var{y} may depend on @var{x}.
  5535. @subsection Examples
  5536. @itemize
  5537. @item
  5538. Crop area with size 100x100 at position (12,34).
  5539. @example
  5540. crop=100:100:12:34
  5541. @end example
  5542. Using named options, the example above becomes:
  5543. @example
  5544. crop=w=100:h=100:x=12:y=34
  5545. @end example
  5546. @item
  5547. Crop the central input area with size 100x100:
  5548. @example
  5549. crop=100:100
  5550. @end example
  5551. @item
  5552. Crop the central input area with size 2/3 of the input video:
  5553. @example
  5554. crop=2/3*in_w:2/3*in_h
  5555. @end example
  5556. @item
  5557. Crop the input video central square:
  5558. @example
  5559. crop=out_w=in_h
  5560. crop=in_h
  5561. @end example
  5562. @item
  5563. Delimit the rectangle with the top-left corner placed at position
  5564. 100:100 and the right-bottom corner corresponding to the right-bottom
  5565. corner of the input image.
  5566. @example
  5567. crop=in_w-100:in_h-100:100:100
  5568. @end example
  5569. @item
  5570. Crop 10 pixels from the left and right borders, and 20 pixels from
  5571. the top and bottom borders
  5572. @example
  5573. crop=in_w-2*10:in_h-2*20
  5574. @end example
  5575. @item
  5576. Keep only the bottom right quarter of the input image:
  5577. @example
  5578. crop=in_w/2:in_h/2:in_w/2:in_h/2
  5579. @end example
  5580. @item
  5581. Crop height for getting Greek harmony:
  5582. @example
  5583. crop=in_w:1/PHI*in_w
  5584. @end example
  5585. @item
  5586. Apply trembling effect:
  5587. @example
  5588. 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)
  5589. @end example
  5590. @item
  5591. Apply erratic camera effect depending on timestamp:
  5592. @example
  5593. 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)"
  5594. @end example
  5595. @item
  5596. Set x depending on the value of y:
  5597. @example
  5598. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  5599. @end example
  5600. @end itemize
  5601. @subsection Commands
  5602. This filter supports the following commands:
  5603. @table @option
  5604. @item w, out_w
  5605. @item h, out_h
  5606. @item x
  5607. @item y
  5608. Set width/height of the output video and the horizontal/vertical position
  5609. in the input video.
  5610. The command accepts the same syntax of the corresponding option.
  5611. If the specified expression is not valid, it is kept at its current
  5612. value.
  5613. @end table
  5614. @section cropdetect
  5615. Auto-detect the crop size.
  5616. It calculates the necessary cropping parameters and prints the
  5617. recommended parameters via the logging system. The detected dimensions
  5618. correspond to the non-black area of the input video.
  5619. It accepts the following parameters:
  5620. @table @option
  5621. @item limit
  5622. Set higher black value threshold, which can be optionally specified
  5623. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  5624. value greater to the set value is considered non-black. It defaults to 24.
  5625. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  5626. on the bitdepth of the pixel format.
  5627. @item round
  5628. The value which the width/height should be divisible by. It defaults to
  5629. 16. The offset is automatically adjusted to center the video. Use 2 to
  5630. get only even dimensions (needed for 4:2:2 video). 16 is best when
  5631. encoding to most video codecs.
  5632. @item reset_count, reset
  5633. Set the counter that determines after how many frames cropdetect will
  5634. reset the previously detected largest video area and start over to
  5635. detect the current optimal crop area. Default value is 0.
  5636. This can be useful when channel logos distort the video area. 0
  5637. indicates 'never reset', and returns the largest area encountered during
  5638. playback.
  5639. @end table
  5640. @anchor{cue}
  5641. @section cue
  5642. Delay video filtering until a given wallclock timestamp. The filter first
  5643. passes on @option{preroll} amount of frames, then it buffers at most
  5644. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  5645. it forwards the buffered frames and also any subsequent frames coming in its
  5646. input.
  5647. The filter can be used synchronize the output of multiple ffmpeg processes for
  5648. realtime output devices like decklink. By putting the delay in the filtering
  5649. chain and pre-buffering frames the process can pass on data to output almost
  5650. immediately after the target wallclock timestamp is reached.
  5651. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  5652. some use cases.
  5653. @table @option
  5654. @item cue
  5655. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  5656. @item preroll
  5657. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  5658. @item buffer
  5659. The maximum duration of content to buffer before waiting for the cue expressed
  5660. in seconds. Default is 0.
  5661. @end table
  5662. @anchor{curves}
  5663. @section curves
  5664. Apply color adjustments using curves.
  5665. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  5666. component (red, green and blue) has its values defined by @var{N} key points
  5667. tied from each other using a smooth curve. The x-axis represents the pixel
  5668. values from the input frame, and the y-axis the new pixel values to be set for
  5669. the output frame.
  5670. By default, a component curve is defined by the two points @var{(0;0)} and
  5671. @var{(1;1)}. This creates a straight line where each original pixel value is
  5672. "adjusted" to its own value, which means no change to the image.
  5673. The filter allows you to redefine these two points and add some more. A new
  5674. curve (using a natural cubic spline interpolation) will be define to pass
  5675. smoothly through all these new coordinates. The new defined points needs to be
  5676. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  5677. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  5678. the vector spaces, the values will be clipped accordingly.
  5679. The filter accepts the following options:
  5680. @table @option
  5681. @item preset
  5682. Select one of the available color presets. This option can be used in addition
  5683. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  5684. options takes priority on the preset values.
  5685. Available presets are:
  5686. @table @samp
  5687. @item none
  5688. @item color_negative
  5689. @item cross_process
  5690. @item darker
  5691. @item increase_contrast
  5692. @item lighter
  5693. @item linear_contrast
  5694. @item medium_contrast
  5695. @item negative
  5696. @item strong_contrast
  5697. @item vintage
  5698. @end table
  5699. Default is @code{none}.
  5700. @item master, m
  5701. Set the master key points. These points will define a second pass mapping. It
  5702. is sometimes called a "luminance" or "value" mapping. It can be used with
  5703. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  5704. post-processing LUT.
  5705. @item red, r
  5706. Set the key points for the red component.
  5707. @item green, g
  5708. Set the key points for the green component.
  5709. @item blue, b
  5710. Set the key points for the blue component.
  5711. @item all
  5712. Set the key points for all components (not including master).
  5713. Can be used in addition to the other key points component
  5714. options. In this case, the unset component(s) will fallback on this
  5715. @option{all} setting.
  5716. @item psfile
  5717. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  5718. @item plot
  5719. Save Gnuplot script of the curves in specified file.
  5720. @end table
  5721. To avoid some filtergraph syntax conflicts, each key points list need to be
  5722. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  5723. @subsection Examples
  5724. @itemize
  5725. @item
  5726. Increase slightly the middle level of blue:
  5727. @example
  5728. curves=blue='0/0 0.5/0.58 1/1'
  5729. @end example
  5730. @item
  5731. Vintage effect:
  5732. @example
  5733. 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'
  5734. @end example
  5735. Here we obtain the following coordinates for each components:
  5736. @table @var
  5737. @item red
  5738. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  5739. @item green
  5740. @code{(0;0) (0.50;0.48) (1;1)}
  5741. @item blue
  5742. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  5743. @end table
  5744. @item
  5745. The previous example can also be achieved with the associated built-in preset:
  5746. @example
  5747. curves=preset=vintage
  5748. @end example
  5749. @item
  5750. Or simply:
  5751. @example
  5752. curves=vintage
  5753. @end example
  5754. @item
  5755. Use a Photoshop preset and redefine the points of the green component:
  5756. @example
  5757. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  5758. @end example
  5759. @item
  5760. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  5761. and @command{gnuplot}:
  5762. @example
  5763. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  5764. gnuplot -p /tmp/curves.plt
  5765. @end example
  5766. @end itemize
  5767. @section datascope
  5768. Video data analysis filter.
  5769. This filter shows hexadecimal pixel values of part of video.
  5770. The filter accepts the following options:
  5771. @table @option
  5772. @item size, s
  5773. Set output video size.
  5774. @item x
  5775. Set x offset from where to pick pixels.
  5776. @item y
  5777. Set y offset from where to pick pixels.
  5778. @item mode
  5779. Set scope mode, can be one of the following:
  5780. @table @samp
  5781. @item mono
  5782. Draw hexadecimal pixel values with white color on black background.
  5783. @item color
  5784. Draw hexadecimal pixel values with input video pixel color on black
  5785. background.
  5786. @item color2
  5787. Draw hexadecimal pixel values on color background picked from input video,
  5788. the text color is picked in such way so its always visible.
  5789. @end table
  5790. @item axis
  5791. Draw rows and columns numbers on left and top of video.
  5792. @item opacity
  5793. Set background opacity.
  5794. @end table
  5795. @section dctdnoiz
  5796. Denoise frames using 2D DCT (frequency domain filtering).
  5797. This filter is not designed for real time.
  5798. The filter accepts the following options:
  5799. @table @option
  5800. @item sigma, s
  5801. Set the noise sigma constant.
  5802. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  5803. coefficient (absolute value) below this threshold with be dropped.
  5804. If you need a more advanced filtering, see @option{expr}.
  5805. Default is @code{0}.
  5806. @item overlap
  5807. Set number overlapping pixels for each block. Since the filter can be slow, you
  5808. may want to reduce this value, at the cost of a less effective filter and the
  5809. risk of various artefacts.
  5810. If the overlapping value doesn't permit processing the whole input width or
  5811. height, a warning will be displayed and according borders won't be denoised.
  5812. Default value is @var{blocksize}-1, which is the best possible setting.
  5813. @item expr, e
  5814. Set the coefficient factor expression.
  5815. For each coefficient of a DCT block, this expression will be evaluated as a
  5816. multiplier value for the coefficient.
  5817. If this is option is set, the @option{sigma} option will be ignored.
  5818. The absolute value of the coefficient can be accessed through the @var{c}
  5819. variable.
  5820. @item n
  5821. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  5822. @var{blocksize}, which is the width and height of the processed blocks.
  5823. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  5824. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  5825. on the speed processing. Also, a larger block size does not necessarily means a
  5826. better de-noising.
  5827. @end table
  5828. @subsection Examples
  5829. Apply a denoise with a @option{sigma} of @code{4.5}:
  5830. @example
  5831. dctdnoiz=4.5
  5832. @end example
  5833. The same operation can be achieved using the expression system:
  5834. @example
  5835. dctdnoiz=e='gte(c, 4.5*3)'
  5836. @end example
  5837. Violent denoise using a block size of @code{16x16}:
  5838. @example
  5839. dctdnoiz=15:n=4
  5840. @end example
  5841. @section deband
  5842. Remove banding artifacts from input video.
  5843. It works by replacing banded pixels with average value of referenced pixels.
  5844. The filter accepts the following options:
  5845. @table @option
  5846. @item 1thr
  5847. @item 2thr
  5848. @item 3thr
  5849. @item 4thr
  5850. Set banding detection threshold for each plane. Default is 0.02.
  5851. Valid range is 0.00003 to 0.5.
  5852. If difference between current pixel and reference pixel is less than threshold,
  5853. it will be considered as banded.
  5854. @item range, r
  5855. Banding detection range in pixels. Default is 16. If positive, random number
  5856. in range 0 to set value will be used. If negative, exact absolute value
  5857. will be used.
  5858. The range defines square of four pixels around current pixel.
  5859. @item direction, d
  5860. Set direction in radians from which four pixel will be compared. If positive,
  5861. random direction from 0 to set direction will be picked. If negative, exact of
  5862. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  5863. will pick only pixels on same row and -PI/2 will pick only pixels on same
  5864. column.
  5865. @item blur, b
  5866. If enabled, current pixel is compared with average value of all four
  5867. surrounding pixels. The default is enabled. If disabled current pixel is
  5868. compared with all four surrounding pixels. The pixel is considered banded
  5869. if only all four differences with surrounding pixels are less than threshold.
  5870. @item coupling, c
  5871. If enabled, current pixel is changed if and only if all pixel components are banded,
  5872. e.g. banding detection threshold is triggered for all color components.
  5873. The default is disabled.
  5874. @end table
  5875. @section deblock
  5876. Remove blocking artifacts from input video.
  5877. The filter accepts the following options:
  5878. @table @option
  5879. @item filter
  5880. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  5881. This controls what kind of deblocking is applied.
  5882. @item block
  5883. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  5884. @item alpha
  5885. @item beta
  5886. @item gamma
  5887. @item delta
  5888. Set blocking detection thresholds. Allowed range is 0 to 1.
  5889. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  5890. Using higher threshold gives more deblocking strength.
  5891. Setting @var{alpha} controls threshold detection at exact edge of block.
  5892. Remaining options controls threshold detection near the edge. Each one for
  5893. below/above or left/right. Setting any of those to @var{0} disables
  5894. deblocking.
  5895. @item planes
  5896. Set planes to filter. Default is to filter all available planes.
  5897. @end table
  5898. @subsection Examples
  5899. @itemize
  5900. @item
  5901. Deblock using weak filter and block size of 4 pixels.
  5902. @example
  5903. deblock=filter=weak:block=4
  5904. @end example
  5905. @item
  5906. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  5907. deblocking more edges.
  5908. @example
  5909. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  5910. @end example
  5911. @item
  5912. Similar as above, but filter only first plane.
  5913. @example
  5914. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  5915. @end example
  5916. @item
  5917. Similar as above, but filter only second and third plane.
  5918. @example
  5919. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  5920. @end example
  5921. @end itemize
  5922. @anchor{decimate}
  5923. @section decimate
  5924. Drop duplicated frames at regular intervals.
  5925. The filter accepts the following options:
  5926. @table @option
  5927. @item cycle
  5928. Set the number of frames from which one will be dropped. Setting this to
  5929. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  5930. Default is @code{5}.
  5931. @item dupthresh
  5932. Set the threshold for duplicate detection. If the difference metric for a frame
  5933. is less than or equal to this value, then it is declared as duplicate. Default
  5934. is @code{1.1}
  5935. @item scthresh
  5936. Set scene change threshold. Default is @code{15}.
  5937. @item blockx
  5938. @item blocky
  5939. Set the size of the x and y-axis blocks used during metric calculations.
  5940. Larger blocks give better noise suppression, but also give worse detection of
  5941. small movements. Must be a power of two. Default is @code{32}.
  5942. @item ppsrc
  5943. Mark main input as a pre-processed input and activate clean source input
  5944. stream. This allows the input to be pre-processed with various filters to help
  5945. the metrics calculation while keeping the frame selection lossless. When set to
  5946. @code{1}, the first stream is for the pre-processed input, and the second
  5947. stream is the clean source from where the kept frames are chosen. Default is
  5948. @code{0}.
  5949. @item chroma
  5950. Set whether or not chroma is considered in the metric calculations. Default is
  5951. @code{1}.
  5952. @end table
  5953. @section deconvolve
  5954. Apply 2D deconvolution of video stream in frequency domain using second stream
  5955. as impulse.
  5956. The filter accepts the following options:
  5957. @table @option
  5958. @item planes
  5959. Set which planes to process.
  5960. @item impulse
  5961. Set which impulse video frames will be processed, can be @var{first}
  5962. or @var{all}. Default is @var{all}.
  5963. @item noise
  5964. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  5965. and height are not same and not power of 2 or if stream prior to convolving
  5966. had noise.
  5967. @end table
  5968. The @code{deconvolve} filter also supports the @ref{framesync} options.
  5969. @section deflate
  5970. Apply deflate effect to the video.
  5971. This filter replaces the pixel by the local(3x3) average by taking into account
  5972. only values lower than the pixel.
  5973. It accepts the following options:
  5974. @table @option
  5975. @item threshold0
  5976. @item threshold1
  5977. @item threshold2
  5978. @item threshold3
  5979. Limit the maximum change for each plane, default is 65535.
  5980. If 0, plane will remain unchanged.
  5981. @end table
  5982. @section deflicker
  5983. Remove temporal frame luminance variations.
  5984. It accepts the following options:
  5985. @table @option
  5986. @item size, s
  5987. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  5988. @item mode, m
  5989. Set averaging mode to smooth temporal luminance variations.
  5990. Available values are:
  5991. @table @samp
  5992. @item am
  5993. Arithmetic mean
  5994. @item gm
  5995. Geometric mean
  5996. @item hm
  5997. Harmonic mean
  5998. @item qm
  5999. Quadratic mean
  6000. @item cm
  6001. Cubic mean
  6002. @item pm
  6003. Power mean
  6004. @item median
  6005. Median
  6006. @end table
  6007. @item bypass
  6008. Do not actually modify frame. Useful when one only wants metadata.
  6009. @end table
  6010. @section dejudder
  6011. Remove judder produced by partially interlaced telecined content.
  6012. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  6013. source was partially telecined content then the output of @code{pullup,dejudder}
  6014. will have a variable frame rate. May change the recorded frame rate of the
  6015. container. Aside from that change, this filter will not affect constant frame
  6016. rate video.
  6017. The option available in this filter is:
  6018. @table @option
  6019. @item cycle
  6020. Specify the length of the window over which the judder repeats.
  6021. Accepts any integer greater than 1. Useful values are:
  6022. @table @samp
  6023. @item 4
  6024. If the original was telecined from 24 to 30 fps (Film to NTSC).
  6025. @item 5
  6026. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  6027. @item 20
  6028. If a mixture of the two.
  6029. @end table
  6030. The default is @samp{4}.
  6031. @end table
  6032. @section delogo
  6033. Suppress a TV station logo by a simple interpolation of the surrounding
  6034. pixels. Just set a rectangle covering the logo and watch it disappear
  6035. (and sometimes something even uglier appear - your mileage may vary).
  6036. It accepts the following parameters:
  6037. @table @option
  6038. @item x
  6039. @item y
  6040. Specify the top left corner coordinates of the logo. They must be
  6041. specified.
  6042. @item w
  6043. @item h
  6044. Specify the width and height of the logo to clear. They must be
  6045. specified.
  6046. @item band, t
  6047. Specify the thickness of the fuzzy edge of the rectangle (added to
  6048. @var{w} and @var{h}). The default value is 1. This option is
  6049. deprecated, setting higher values should no longer be necessary and
  6050. is not recommended.
  6051. @item show
  6052. When set to 1, a green rectangle is drawn on the screen to simplify
  6053. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  6054. The default value is 0.
  6055. The rectangle is drawn on the outermost pixels which will be (partly)
  6056. replaced with interpolated values. The values of the next pixels
  6057. immediately outside this rectangle in each direction will be used to
  6058. compute the interpolated pixel values inside the rectangle.
  6059. @end table
  6060. @subsection Examples
  6061. @itemize
  6062. @item
  6063. Set a rectangle covering the area with top left corner coordinates 0,0
  6064. and size 100x77, and a band of size 10:
  6065. @example
  6066. delogo=x=0:y=0:w=100:h=77:band=10
  6067. @end example
  6068. @end itemize
  6069. @section deshake
  6070. Attempt to fix small changes in horizontal and/or vertical shift. This
  6071. filter helps remove camera shake from hand-holding a camera, bumping a
  6072. tripod, moving on a vehicle, etc.
  6073. The filter accepts the following options:
  6074. @table @option
  6075. @item x
  6076. @item y
  6077. @item w
  6078. @item h
  6079. Specify a rectangular area where to limit the search for motion
  6080. vectors.
  6081. If desired the search for motion vectors can be limited to a
  6082. rectangular area of the frame defined by its top left corner, width
  6083. and height. These parameters have the same meaning as the drawbox
  6084. filter which can be used to visualise the position of the bounding
  6085. box.
  6086. This is useful when simultaneous movement of subjects within the frame
  6087. might be confused for camera motion by the motion vector search.
  6088. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  6089. then the full frame is used. This allows later options to be set
  6090. without specifying the bounding box for the motion vector search.
  6091. Default - search the whole frame.
  6092. @item rx
  6093. @item ry
  6094. Specify the maximum extent of movement in x and y directions in the
  6095. range 0-64 pixels. Default 16.
  6096. @item edge
  6097. Specify how to generate pixels to fill blanks at the edge of the
  6098. frame. Available values are:
  6099. @table @samp
  6100. @item blank, 0
  6101. Fill zeroes at blank locations
  6102. @item original, 1
  6103. Original image at blank locations
  6104. @item clamp, 2
  6105. Extruded edge value at blank locations
  6106. @item mirror, 3
  6107. Mirrored edge at blank locations
  6108. @end table
  6109. Default value is @samp{mirror}.
  6110. @item blocksize
  6111. Specify the blocksize to use for motion search. Range 4-128 pixels,
  6112. default 8.
  6113. @item contrast
  6114. Specify the contrast threshold for blocks. Only blocks with more than
  6115. the specified contrast (difference between darkest and lightest
  6116. pixels) will be considered. Range 1-255, default 125.
  6117. @item search
  6118. Specify the search strategy. Available values are:
  6119. @table @samp
  6120. @item exhaustive, 0
  6121. Set exhaustive search
  6122. @item less, 1
  6123. Set less exhaustive search.
  6124. @end table
  6125. Default value is @samp{exhaustive}.
  6126. @item filename
  6127. If set then a detailed log of the motion search is written to the
  6128. specified file.
  6129. @end table
  6130. @section despill
  6131. Remove unwanted contamination of foreground colors, caused by reflected color of
  6132. greenscreen or bluescreen.
  6133. This filter accepts the following options:
  6134. @table @option
  6135. @item type
  6136. Set what type of despill to use.
  6137. @item mix
  6138. Set how spillmap will be generated.
  6139. @item expand
  6140. Set how much to get rid of still remaining spill.
  6141. @item red
  6142. Controls amount of red in spill area.
  6143. @item green
  6144. Controls amount of green in spill area.
  6145. Should be -1 for greenscreen.
  6146. @item blue
  6147. Controls amount of blue in spill area.
  6148. Should be -1 for bluescreen.
  6149. @item brightness
  6150. Controls brightness of spill area, preserving colors.
  6151. @item alpha
  6152. Modify alpha from generated spillmap.
  6153. @end table
  6154. @section detelecine
  6155. Apply an exact inverse of the telecine operation. It requires a predefined
  6156. pattern specified using the pattern option which must be the same as that passed
  6157. to the telecine filter.
  6158. This filter accepts the following options:
  6159. @table @option
  6160. @item first_field
  6161. @table @samp
  6162. @item top, t
  6163. top field first
  6164. @item bottom, b
  6165. bottom field first
  6166. The default value is @code{top}.
  6167. @end table
  6168. @item pattern
  6169. A string of numbers representing the pulldown pattern you wish to apply.
  6170. The default value is @code{23}.
  6171. @item start_frame
  6172. A number representing position of the first frame with respect to the telecine
  6173. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  6174. @end table
  6175. @section dilation
  6176. Apply dilation effect to the video.
  6177. This filter replaces the pixel by the local(3x3) maximum.
  6178. It accepts the following options:
  6179. @table @option
  6180. @item threshold0
  6181. @item threshold1
  6182. @item threshold2
  6183. @item threshold3
  6184. Limit the maximum change for each plane, default is 65535.
  6185. If 0, plane will remain unchanged.
  6186. @item coordinates
  6187. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6188. pixels are used.
  6189. Flags to local 3x3 coordinates maps like this:
  6190. 1 2 3
  6191. 4 5
  6192. 6 7 8
  6193. @end table
  6194. @section displace
  6195. Displace pixels as indicated by second and third input stream.
  6196. It takes three input streams and outputs one stream, the first input is the
  6197. source, and second and third input are displacement maps.
  6198. The second input specifies how much to displace pixels along the
  6199. x-axis, while the third input specifies how much to displace pixels
  6200. along the y-axis.
  6201. If one of displacement map streams terminates, last frame from that
  6202. displacement map will be used.
  6203. Note that once generated, displacements maps can be reused over and over again.
  6204. A description of the accepted options follows.
  6205. @table @option
  6206. @item edge
  6207. Set displace behavior for pixels that are out of range.
  6208. Available values are:
  6209. @table @samp
  6210. @item blank
  6211. Missing pixels are replaced by black pixels.
  6212. @item smear
  6213. Adjacent pixels will spread out to replace missing pixels.
  6214. @item wrap
  6215. Out of range pixels are wrapped so they point to pixels of other side.
  6216. @item mirror
  6217. Out of range pixels will be replaced with mirrored pixels.
  6218. @end table
  6219. Default is @samp{smear}.
  6220. @end table
  6221. @subsection Examples
  6222. @itemize
  6223. @item
  6224. Add ripple effect to rgb input of video size hd720:
  6225. @example
  6226. 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
  6227. @end example
  6228. @item
  6229. Add wave effect to rgb input of video size hd720:
  6230. @example
  6231. 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
  6232. @end example
  6233. @end itemize
  6234. @section drawbox
  6235. Draw a colored box on the input image.
  6236. It accepts the following parameters:
  6237. @table @option
  6238. @item x
  6239. @item y
  6240. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  6241. @item width, w
  6242. @item height, h
  6243. The expressions which specify the width and height of the box; if 0 they are interpreted as
  6244. the input width and height. It defaults to 0.
  6245. @item color, c
  6246. Specify the color of the box to write. For the general syntax of this option,
  6247. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6248. value @code{invert} is used, the box edge color is the same as the
  6249. video with inverted luma.
  6250. @item thickness, t
  6251. The expression which sets the thickness of the box edge.
  6252. A value of @code{fill} will create a filled box. Default value is @code{3}.
  6253. See below for the list of accepted constants.
  6254. @item replace
  6255. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  6256. will overwrite the video's color and alpha pixels.
  6257. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  6258. @end table
  6259. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6260. following constants:
  6261. @table @option
  6262. @item dar
  6263. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6264. @item hsub
  6265. @item vsub
  6266. horizontal and vertical chroma subsample values. For example for the
  6267. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6268. @item in_h, ih
  6269. @item in_w, iw
  6270. The input width and height.
  6271. @item sar
  6272. The input sample aspect ratio.
  6273. @item x
  6274. @item y
  6275. The x and y offset coordinates where the box is drawn.
  6276. @item w
  6277. @item h
  6278. The width and height of the drawn box.
  6279. @item t
  6280. The thickness of the drawn box.
  6281. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6282. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6283. @end table
  6284. @subsection Examples
  6285. @itemize
  6286. @item
  6287. Draw a black box around the edge of the input image:
  6288. @example
  6289. drawbox
  6290. @end example
  6291. @item
  6292. Draw a box with color red and an opacity of 50%:
  6293. @example
  6294. drawbox=10:20:200:60:red@@0.5
  6295. @end example
  6296. The previous example can be specified as:
  6297. @example
  6298. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  6299. @end example
  6300. @item
  6301. Fill the box with pink color:
  6302. @example
  6303. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  6304. @end example
  6305. @item
  6306. Draw a 2-pixel red 2.40:1 mask:
  6307. @example
  6308. 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
  6309. @end example
  6310. @end itemize
  6311. @section drawgrid
  6312. Draw a grid on the input image.
  6313. It accepts the following parameters:
  6314. @table @option
  6315. @item x
  6316. @item y
  6317. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  6318. @item width, w
  6319. @item height, h
  6320. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  6321. input width and height, respectively, minus @code{thickness}, so image gets
  6322. framed. Default to 0.
  6323. @item color, c
  6324. Specify the color of the grid. For the general syntax of this option,
  6325. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  6326. value @code{invert} is used, the grid color is the same as the
  6327. video with inverted luma.
  6328. @item thickness, t
  6329. The expression which sets the thickness of the grid line. Default value is @code{1}.
  6330. See below for the list of accepted constants.
  6331. @item replace
  6332. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  6333. will overwrite the video's color and alpha pixels.
  6334. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  6335. @end table
  6336. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  6337. following constants:
  6338. @table @option
  6339. @item dar
  6340. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  6341. @item hsub
  6342. @item vsub
  6343. horizontal and vertical chroma subsample values. For example for the
  6344. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6345. @item in_h, ih
  6346. @item in_w, iw
  6347. The input grid cell width and height.
  6348. @item sar
  6349. The input sample aspect ratio.
  6350. @item x
  6351. @item y
  6352. The x and y coordinates of some point of grid intersection (meant to configure offset).
  6353. @item w
  6354. @item h
  6355. The width and height of the drawn cell.
  6356. @item t
  6357. The thickness of the drawn cell.
  6358. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  6359. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  6360. @end table
  6361. @subsection Examples
  6362. @itemize
  6363. @item
  6364. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  6365. @example
  6366. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  6367. @end example
  6368. @item
  6369. Draw a white 3x3 grid with an opacity of 50%:
  6370. @example
  6371. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  6372. @end example
  6373. @end itemize
  6374. @anchor{drawtext}
  6375. @section drawtext
  6376. Draw a text string or text from a specified file on top of a video, using the
  6377. libfreetype library.
  6378. To enable compilation of this filter, you need to configure FFmpeg with
  6379. @code{--enable-libfreetype}.
  6380. To enable default font fallback and the @var{font} option you need to
  6381. configure FFmpeg with @code{--enable-libfontconfig}.
  6382. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  6383. @code{--enable-libfribidi}.
  6384. @subsection Syntax
  6385. It accepts the following parameters:
  6386. @table @option
  6387. @item box
  6388. Used to draw a box around text using the background color.
  6389. The value must be either 1 (enable) or 0 (disable).
  6390. The default value of @var{box} is 0.
  6391. @item boxborderw
  6392. Set the width of the border to be drawn around the box using @var{boxcolor}.
  6393. The default value of @var{boxborderw} is 0.
  6394. @item boxcolor
  6395. The color to be used for drawing box around text. For the syntax of this
  6396. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6397. The default value of @var{boxcolor} is "white".
  6398. @item line_spacing
  6399. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  6400. The default value of @var{line_spacing} is 0.
  6401. @item borderw
  6402. Set the width of the border to be drawn around the text using @var{bordercolor}.
  6403. The default value of @var{borderw} is 0.
  6404. @item bordercolor
  6405. Set the color to be used for drawing border around text. For the syntax of this
  6406. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6407. The default value of @var{bordercolor} is "black".
  6408. @item expansion
  6409. Select how the @var{text} is expanded. Can be either @code{none},
  6410. @code{strftime} (deprecated) or
  6411. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  6412. below for details.
  6413. @item basetime
  6414. Set a start time for the count. Value is in microseconds. Only applied
  6415. in the deprecated strftime expansion mode. To emulate in normal expansion
  6416. mode use the @code{pts} function, supplying the start time (in seconds)
  6417. as the second argument.
  6418. @item fix_bounds
  6419. If true, check and fix text coords to avoid clipping.
  6420. @item fontcolor
  6421. The color to be used for drawing fonts. For the syntax of this option, check
  6422. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6423. The default value of @var{fontcolor} is "black".
  6424. @item fontcolor_expr
  6425. String which is expanded the same way as @var{text} to obtain dynamic
  6426. @var{fontcolor} value. By default this option has empty value and is not
  6427. processed. When this option is set, it overrides @var{fontcolor} option.
  6428. @item font
  6429. The font family to be used for drawing text. By default Sans.
  6430. @item fontfile
  6431. The font file to be used for drawing text. The path must be included.
  6432. This parameter is mandatory if the fontconfig support is disabled.
  6433. @item alpha
  6434. Draw the text applying alpha blending. The value can
  6435. be a number between 0.0 and 1.0.
  6436. The expression accepts the same variables @var{x, y} as well.
  6437. The default value is 1.
  6438. Please see @var{fontcolor_expr}.
  6439. @item fontsize
  6440. The font size to be used for drawing text.
  6441. The default value of @var{fontsize} is 16.
  6442. @item text_shaping
  6443. If set to 1, attempt to shape the text (for example, reverse the order of
  6444. right-to-left text and join Arabic characters) before drawing it.
  6445. Otherwise, just draw the text exactly as given.
  6446. By default 1 (if supported).
  6447. @item ft_load_flags
  6448. The flags to be used for loading the fonts.
  6449. The flags map the corresponding flags supported by libfreetype, and are
  6450. a combination of the following values:
  6451. @table @var
  6452. @item default
  6453. @item no_scale
  6454. @item no_hinting
  6455. @item render
  6456. @item no_bitmap
  6457. @item vertical_layout
  6458. @item force_autohint
  6459. @item crop_bitmap
  6460. @item pedantic
  6461. @item ignore_global_advance_width
  6462. @item no_recurse
  6463. @item ignore_transform
  6464. @item monochrome
  6465. @item linear_design
  6466. @item no_autohint
  6467. @end table
  6468. Default value is "default".
  6469. For more information consult the documentation for the FT_LOAD_*
  6470. libfreetype flags.
  6471. @item shadowcolor
  6472. The color to be used for drawing a shadow behind the drawn text. For the
  6473. syntax of this option, check the @ref{color syntax,,"Color" section in the
  6474. ffmpeg-utils manual,ffmpeg-utils}.
  6475. The default value of @var{shadowcolor} is "black".
  6476. @item shadowx
  6477. @item shadowy
  6478. The x and y offsets for the text shadow position with respect to the
  6479. position of the text. They can be either positive or negative
  6480. values. The default value for both is "0".
  6481. @item start_number
  6482. The starting frame number for the n/frame_num variable. The default value
  6483. is "0".
  6484. @item tabsize
  6485. The size in number of spaces to use for rendering the tab.
  6486. Default value is 4.
  6487. @item timecode
  6488. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  6489. format. It can be used with or without text parameter. @var{timecode_rate}
  6490. option must be specified.
  6491. @item timecode_rate, rate, r
  6492. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  6493. integer. Minimum value is "1".
  6494. Drop-frame timecode is supported for frame rates 30 & 60.
  6495. @item tc24hmax
  6496. If set to 1, the output of the timecode option will wrap around at 24 hours.
  6497. Default is 0 (disabled).
  6498. @item text
  6499. The text string to be drawn. The text must be a sequence of UTF-8
  6500. encoded characters.
  6501. This parameter is mandatory if no file is specified with the parameter
  6502. @var{textfile}.
  6503. @item textfile
  6504. A text file containing text to be drawn. The text must be a sequence
  6505. of UTF-8 encoded characters.
  6506. This parameter is mandatory if no text string is specified with the
  6507. parameter @var{text}.
  6508. If both @var{text} and @var{textfile} are specified, an error is thrown.
  6509. @item reload
  6510. If set to 1, the @var{textfile} will be reloaded before each frame.
  6511. Be sure to update it atomically, or it may be read partially, or even fail.
  6512. @item x
  6513. @item y
  6514. The expressions which specify the offsets where text will be drawn
  6515. within the video frame. They are relative to the top/left border of the
  6516. output image.
  6517. The default value of @var{x} and @var{y} is "0".
  6518. See below for the list of accepted constants and functions.
  6519. @end table
  6520. The parameters for @var{x} and @var{y} are expressions containing the
  6521. following constants and functions:
  6522. @table @option
  6523. @item dar
  6524. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  6525. @item hsub
  6526. @item vsub
  6527. horizontal and vertical chroma subsample values. For example for the
  6528. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6529. @item line_h, lh
  6530. the height of each text line
  6531. @item main_h, h, H
  6532. the input height
  6533. @item main_w, w, W
  6534. the input width
  6535. @item max_glyph_a, ascent
  6536. the maximum distance from the baseline to the highest/upper grid
  6537. coordinate used to place a glyph outline point, for all the rendered
  6538. glyphs.
  6539. It is a positive value, due to the grid's orientation with the Y axis
  6540. upwards.
  6541. @item max_glyph_d, descent
  6542. the maximum distance from the baseline to the lowest grid coordinate
  6543. used to place a glyph outline point, for all the rendered glyphs.
  6544. This is a negative value, due to the grid's orientation, with the Y axis
  6545. upwards.
  6546. @item max_glyph_h
  6547. maximum glyph height, that is the maximum height for all the glyphs
  6548. contained in the rendered text, it is equivalent to @var{ascent} -
  6549. @var{descent}.
  6550. @item max_glyph_w
  6551. maximum glyph width, that is the maximum width for all the glyphs
  6552. contained in the rendered text
  6553. @item n
  6554. the number of input frame, starting from 0
  6555. @item rand(min, max)
  6556. return a random number included between @var{min} and @var{max}
  6557. @item sar
  6558. The input sample aspect ratio.
  6559. @item t
  6560. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6561. @item text_h, th
  6562. the height of the rendered text
  6563. @item text_w, tw
  6564. the width of the rendered text
  6565. @item x
  6566. @item y
  6567. the x and y offset coordinates where the text is drawn.
  6568. These parameters allow the @var{x} and @var{y} expressions to refer
  6569. each other, so you can for example specify @code{y=x/dar}.
  6570. @end table
  6571. @anchor{drawtext_expansion}
  6572. @subsection Text expansion
  6573. If @option{expansion} is set to @code{strftime},
  6574. the filter recognizes strftime() sequences in the provided text and
  6575. expands them accordingly. Check the documentation of strftime(). This
  6576. feature is deprecated.
  6577. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  6578. If @option{expansion} is set to @code{normal} (which is the default),
  6579. the following expansion mechanism is used.
  6580. The backslash character @samp{\}, followed by any character, always expands to
  6581. the second character.
  6582. Sequences of the form @code{%@{...@}} are expanded. The text between the
  6583. braces is a function name, possibly followed by arguments separated by ':'.
  6584. If the arguments contain special characters or delimiters (':' or '@}'),
  6585. they should be escaped.
  6586. Note that they probably must also be escaped as the value for the
  6587. @option{text} option in the filter argument string and as the filter
  6588. argument in the filtergraph description, and possibly also for the shell,
  6589. that makes up to four levels of escaping; using a text file avoids these
  6590. problems.
  6591. The following functions are available:
  6592. @table @command
  6593. @item expr, e
  6594. The expression evaluation result.
  6595. It must take one argument specifying the expression to be evaluated,
  6596. which accepts the same constants and functions as the @var{x} and
  6597. @var{y} values. Note that not all constants should be used, for
  6598. example the text size is not known when evaluating the expression, so
  6599. the constants @var{text_w} and @var{text_h} will have an undefined
  6600. value.
  6601. @item expr_int_format, eif
  6602. Evaluate the expression's value and output as formatted integer.
  6603. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  6604. The second argument specifies the output format. Allowed values are @samp{x},
  6605. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  6606. @code{printf} function.
  6607. The third parameter is optional and sets the number of positions taken by the output.
  6608. It can be used to add padding with zeros from the left.
  6609. @item gmtime
  6610. The time at which the filter is running, expressed in UTC.
  6611. It can accept an argument: a strftime() format string.
  6612. @item localtime
  6613. The time at which the filter is running, expressed in the local time zone.
  6614. It can accept an argument: a strftime() format string.
  6615. @item metadata
  6616. Frame metadata. Takes one or two arguments.
  6617. The first argument is mandatory and specifies the metadata key.
  6618. The second argument is optional and specifies a default value, used when the
  6619. metadata key is not found or empty.
  6620. @item n, frame_num
  6621. The frame number, starting from 0.
  6622. @item pict_type
  6623. A 1 character description of the current picture type.
  6624. @item pts
  6625. The timestamp of the current frame.
  6626. It can take up to three arguments.
  6627. The first argument is the format of the timestamp; it defaults to @code{flt}
  6628. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  6629. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  6630. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  6631. @code{localtime} stands for the timestamp of the frame formatted as
  6632. local time zone time.
  6633. The second argument is an offset added to the timestamp.
  6634. If the format is set to @code{hms}, a third argument @code{24HH} may be
  6635. supplied to present the hour part of the formatted timestamp in 24h format
  6636. (00-23).
  6637. If the format is set to @code{localtime} or @code{gmtime},
  6638. a third argument may be supplied: a strftime() format string.
  6639. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  6640. @end table
  6641. @subsection Examples
  6642. @itemize
  6643. @item
  6644. Draw "Test Text" with font FreeSerif, using the default values for the
  6645. optional parameters.
  6646. @example
  6647. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  6648. @end example
  6649. @item
  6650. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  6651. and y=50 (counting from the top-left corner of the screen), text is
  6652. yellow with a red box around it. Both the text and the box have an
  6653. opacity of 20%.
  6654. @example
  6655. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  6656. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  6657. @end example
  6658. Note that the double quotes are not necessary if spaces are not used
  6659. within the parameter list.
  6660. @item
  6661. Show the text at the center of the video frame:
  6662. @example
  6663. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  6664. @end example
  6665. @item
  6666. Show the text at a random position, switching to a new position every 30 seconds:
  6667. @example
  6668. 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)"
  6669. @end example
  6670. @item
  6671. Show a text line sliding from right to left in the last row of the video
  6672. frame. The file @file{LONG_LINE} is assumed to contain a single line
  6673. with no newlines.
  6674. @example
  6675. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  6676. @end example
  6677. @item
  6678. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  6679. @example
  6680. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  6681. @end example
  6682. @item
  6683. Draw a single green letter "g", at the center of the input video.
  6684. The glyph baseline is placed at half screen height.
  6685. @example
  6686. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  6687. @end example
  6688. @item
  6689. Show text for 1 second every 3 seconds:
  6690. @example
  6691. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  6692. @end example
  6693. @item
  6694. Use fontconfig to set the font. Note that the colons need to be escaped.
  6695. @example
  6696. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  6697. @end example
  6698. @item
  6699. Print the date of a real-time encoding (see strftime(3)):
  6700. @example
  6701. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  6702. @end example
  6703. @item
  6704. Show text fading in and out (appearing/disappearing):
  6705. @example
  6706. #!/bin/sh
  6707. DS=1.0 # display start
  6708. DE=10.0 # display end
  6709. FID=1.5 # fade in duration
  6710. FOD=5 # fade out duration
  6711. 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 @}"
  6712. @end example
  6713. @item
  6714. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  6715. and the @option{fontsize} value are included in the @option{y} offset.
  6716. @example
  6717. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  6718. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  6719. @end example
  6720. @end itemize
  6721. For more information about libfreetype, check:
  6722. @url{http://www.freetype.org/}.
  6723. For more information about fontconfig, check:
  6724. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  6725. For more information about libfribidi, check:
  6726. @url{http://fribidi.org/}.
  6727. @section edgedetect
  6728. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  6729. The filter accepts the following options:
  6730. @table @option
  6731. @item low
  6732. @item high
  6733. Set low and high threshold values used by the Canny thresholding
  6734. algorithm.
  6735. The high threshold selects the "strong" edge pixels, which are then
  6736. connected through 8-connectivity with the "weak" edge pixels selected
  6737. by the low threshold.
  6738. @var{low} and @var{high} threshold values must be chosen in the range
  6739. [0,1], and @var{low} should be lesser or equal to @var{high}.
  6740. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  6741. is @code{50/255}.
  6742. @item mode
  6743. Define the drawing mode.
  6744. @table @samp
  6745. @item wires
  6746. Draw white/gray wires on black background.
  6747. @item colormix
  6748. Mix the colors to create a paint/cartoon effect.
  6749. @item canny
  6750. Apply Canny edge detector on all selected planes.
  6751. @end table
  6752. Default value is @var{wires}.
  6753. @item planes
  6754. Select planes for filtering. By default all available planes are filtered.
  6755. @end table
  6756. @subsection Examples
  6757. @itemize
  6758. @item
  6759. Standard edge detection with custom values for the hysteresis thresholding:
  6760. @example
  6761. edgedetect=low=0.1:high=0.4
  6762. @end example
  6763. @item
  6764. Painting effect without thresholding:
  6765. @example
  6766. edgedetect=mode=colormix:high=0
  6767. @end example
  6768. @end itemize
  6769. @section eq
  6770. Set brightness, contrast, saturation and approximate gamma adjustment.
  6771. The filter accepts the following options:
  6772. @table @option
  6773. @item contrast
  6774. Set the contrast expression. The value must be a float value in range
  6775. @code{-2.0} to @code{2.0}. The default value is "1".
  6776. @item brightness
  6777. Set the brightness expression. The value must be a float value in
  6778. range @code{-1.0} to @code{1.0}. The default value is "0".
  6779. @item saturation
  6780. Set the saturation expression. The value must be a float in
  6781. range @code{0.0} to @code{3.0}. The default value is "1".
  6782. @item gamma
  6783. Set the gamma expression. The value must be a float in range
  6784. @code{0.1} to @code{10.0}. The default value is "1".
  6785. @item gamma_r
  6786. Set the gamma expression for red. The value must be a float in
  6787. range @code{0.1} to @code{10.0}. The default value is "1".
  6788. @item gamma_g
  6789. Set the gamma expression for green. The value must be a float in range
  6790. @code{0.1} to @code{10.0}. The default value is "1".
  6791. @item gamma_b
  6792. Set the gamma expression for blue. The value must be a float in range
  6793. @code{0.1} to @code{10.0}. The default value is "1".
  6794. @item gamma_weight
  6795. Set the gamma weight expression. It can be used to reduce the effect
  6796. of a high gamma value on bright image areas, e.g. keep them from
  6797. getting overamplified and just plain white. The value must be a float
  6798. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  6799. gamma correction all the way down while @code{1.0} leaves it at its
  6800. full strength. Default is "1".
  6801. @item eval
  6802. Set when the expressions for brightness, contrast, saturation and
  6803. gamma expressions are evaluated.
  6804. It accepts the following values:
  6805. @table @samp
  6806. @item init
  6807. only evaluate expressions once during the filter initialization or
  6808. when a command is processed
  6809. @item frame
  6810. evaluate expressions for each incoming frame
  6811. @end table
  6812. Default value is @samp{init}.
  6813. @end table
  6814. The expressions accept the following parameters:
  6815. @table @option
  6816. @item n
  6817. frame count of the input frame starting from 0
  6818. @item pos
  6819. byte position of the corresponding packet in the input file, NAN if
  6820. unspecified
  6821. @item r
  6822. frame rate of the input video, NAN if the input frame rate is unknown
  6823. @item t
  6824. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6825. @end table
  6826. @subsection Commands
  6827. The filter supports the following commands:
  6828. @table @option
  6829. @item contrast
  6830. Set the contrast expression.
  6831. @item brightness
  6832. Set the brightness expression.
  6833. @item saturation
  6834. Set the saturation expression.
  6835. @item gamma
  6836. Set the gamma expression.
  6837. @item gamma_r
  6838. Set the gamma_r expression.
  6839. @item gamma_g
  6840. Set gamma_g expression.
  6841. @item gamma_b
  6842. Set gamma_b expression.
  6843. @item gamma_weight
  6844. Set gamma_weight expression.
  6845. The command accepts the same syntax of the corresponding option.
  6846. If the specified expression is not valid, it is kept at its current
  6847. value.
  6848. @end table
  6849. @section erosion
  6850. Apply erosion effect to the video.
  6851. This filter replaces the pixel by the local(3x3) minimum.
  6852. It accepts the following options:
  6853. @table @option
  6854. @item threshold0
  6855. @item threshold1
  6856. @item threshold2
  6857. @item threshold3
  6858. Limit the maximum change for each plane, default is 65535.
  6859. If 0, plane will remain unchanged.
  6860. @item coordinates
  6861. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6862. pixels are used.
  6863. Flags to local 3x3 coordinates maps like this:
  6864. 1 2 3
  6865. 4 5
  6866. 6 7 8
  6867. @end table
  6868. @section extractplanes
  6869. Extract color channel components from input video stream into
  6870. separate grayscale video streams.
  6871. The filter accepts the following option:
  6872. @table @option
  6873. @item planes
  6874. Set plane(s) to extract.
  6875. Available values for planes are:
  6876. @table @samp
  6877. @item y
  6878. @item u
  6879. @item v
  6880. @item a
  6881. @item r
  6882. @item g
  6883. @item b
  6884. @end table
  6885. Choosing planes not available in the input will result in an error.
  6886. That means you cannot select @code{r}, @code{g}, @code{b} planes
  6887. with @code{y}, @code{u}, @code{v} planes at same time.
  6888. @end table
  6889. @subsection Examples
  6890. @itemize
  6891. @item
  6892. Extract luma, u and v color channel component from input video frame
  6893. into 3 grayscale outputs:
  6894. @example
  6895. 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
  6896. @end example
  6897. @end itemize
  6898. @section elbg
  6899. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  6900. For each input image, the filter will compute the optimal mapping from
  6901. the input to the output given the codebook length, that is the number
  6902. of distinct output colors.
  6903. This filter accepts the following options.
  6904. @table @option
  6905. @item codebook_length, l
  6906. Set codebook length. The value must be a positive integer, and
  6907. represents the number of distinct output colors. Default value is 256.
  6908. @item nb_steps, n
  6909. Set the maximum number of iterations to apply for computing the optimal
  6910. mapping. The higher the value the better the result and the higher the
  6911. computation time. Default value is 1.
  6912. @item seed, s
  6913. Set a random seed, must be an integer included between 0 and
  6914. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  6915. will try to use a good random seed on a best effort basis.
  6916. @item pal8
  6917. Set pal8 output pixel format. This option does not work with codebook
  6918. length greater than 256.
  6919. @end table
  6920. @section entropy
  6921. Measure graylevel entropy in histogram of color channels of video frames.
  6922. It accepts the following parameters:
  6923. @table @option
  6924. @item mode
  6925. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  6926. @var{diff} mode measures entropy of histogram delta values, absolute differences
  6927. between neighbour histogram values.
  6928. @end table
  6929. @section fade
  6930. Apply a fade-in/out effect to the input video.
  6931. It accepts the following parameters:
  6932. @table @option
  6933. @item type, t
  6934. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  6935. effect.
  6936. Default is @code{in}.
  6937. @item start_frame, s
  6938. Specify the number of the frame to start applying the fade
  6939. effect at. Default is 0.
  6940. @item nb_frames, n
  6941. The number of frames that the fade effect lasts. At the end of the
  6942. fade-in effect, the output video will have the same intensity as the input video.
  6943. At the end of the fade-out transition, the output video will be filled with the
  6944. selected @option{color}.
  6945. Default is 25.
  6946. @item alpha
  6947. If set to 1, fade only alpha channel, if one exists on the input.
  6948. Default value is 0.
  6949. @item start_time, st
  6950. Specify the timestamp (in seconds) of the frame to start to apply the fade
  6951. effect. If both start_frame and start_time are specified, the fade will start at
  6952. whichever comes last. Default is 0.
  6953. @item duration, d
  6954. The number of seconds for which the fade effect has to last. At the end of the
  6955. fade-in effect the output video will have the same intensity as the input video,
  6956. at the end of the fade-out transition the output video will be filled with the
  6957. selected @option{color}.
  6958. If both duration and nb_frames are specified, duration is used. Default is 0
  6959. (nb_frames is used by default).
  6960. @item color, c
  6961. Specify the color of the fade. Default is "black".
  6962. @end table
  6963. @subsection Examples
  6964. @itemize
  6965. @item
  6966. Fade in the first 30 frames of video:
  6967. @example
  6968. fade=in:0:30
  6969. @end example
  6970. The command above is equivalent to:
  6971. @example
  6972. fade=t=in:s=0:n=30
  6973. @end example
  6974. @item
  6975. Fade out the last 45 frames of a 200-frame video:
  6976. @example
  6977. fade=out:155:45
  6978. fade=type=out:start_frame=155:nb_frames=45
  6979. @end example
  6980. @item
  6981. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  6982. @example
  6983. fade=in:0:25, fade=out:975:25
  6984. @end example
  6985. @item
  6986. Make the first 5 frames yellow, then fade in from frame 5-24:
  6987. @example
  6988. fade=in:5:20:color=yellow
  6989. @end example
  6990. @item
  6991. Fade in alpha over first 25 frames of video:
  6992. @example
  6993. fade=in:0:25:alpha=1
  6994. @end example
  6995. @item
  6996. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  6997. @example
  6998. fade=t=in:st=5.5:d=0.5
  6999. @end example
  7000. @end itemize
  7001. @section fftfilt
  7002. Apply arbitrary expressions to samples in frequency domain
  7003. @table @option
  7004. @item dc_Y
  7005. Adjust the dc value (gain) of the luma plane of the image. The filter
  7006. accepts an integer value in range @code{0} to @code{1000}. The default
  7007. value is set to @code{0}.
  7008. @item dc_U
  7009. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  7010. filter accepts an integer value in range @code{0} to @code{1000}. The
  7011. default value is set to @code{0}.
  7012. @item dc_V
  7013. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  7014. filter accepts an integer value in range @code{0} to @code{1000}. The
  7015. default value is set to @code{0}.
  7016. @item weight_Y
  7017. Set the frequency domain weight expression for the luma plane.
  7018. @item weight_U
  7019. Set the frequency domain weight expression for the 1st chroma plane.
  7020. @item weight_V
  7021. Set the frequency domain weight expression for the 2nd chroma plane.
  7022. @item eval
  7023. Set when the expressions are evaluated.
  7024. It accepts the following values:
  7025. @table @samp
  7026. @item init
  7027. Only evaluate expressions once during the filter initialization.
  7028. @item frame
  7029. Evaluate expressions for each incoming frame.
  7030. @end table
  7031. Default value is @samp{init}.
  7032. The filter accepts the following variables:
  7033. @item X
  7034. @item Y
  7035. The coordinates of the current sample.
  7036. @item W
  7037. @item H
  7038. The width and height of the image.
  7039. @item N
  7040. The number of input frame, starting from 0.
  7041. @end table
  7042. @subsection Examples
  7043. @itemize
  7044. @item
  7045. High-pass:
  7046. @example
  7047. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  7048. @end example
  7049. @item
  7050. Low-pass:
  7051. @example
  7052. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  7053. @end example
  7054. @item
  7055. Sharpen:
  7056. @example
  7057. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  7058. @end example
  7059. @item
  7060. Blur:
  7061. @example
  7062. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  7063. @end example
  7064. @end itemize
  7065. @section fftdnoiz
  7066. Denoise frames using 3D FFT (frequency domain filtering).
  7067. The filter accepts the following options:
  7068. @table @option
  7069. @item sigma
  7070. Set the noise sigma constant. This sets denoising strength.
  7071. Default value is 1. Allowed range is from 0 to 30.
  7072. Using very high sigma with low overlap may give blocking artifacts.
  7073. @item amount
  7074. Set amount of denoising. By default all detected noise is reduced.
  7075. Default value is 1. Allowed range is from 0 to 1.
  7076. @item block
  7077. Set size of block, Default is 4, can be 3, 4, 5 or 6.
  7078. Actual size of block in pixels is 2 to power of @var{block}, so by default
  7079. block size in pixels is 2^4 which is 16.
  7080. @item overlap
  7081. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  7082. @item prev
  7083. Set number of previous frames to use for denoising. By default is set to 0.
  7084. @item next
  7085. Set number of next frames to to use for denoising. By default is set to 0.
  7086. @item planes
  7087. Set planes which will be filtered, by default are all available filtered
  7088. except alpha.
  7089. @end table
  7090. @section field
  7091. Extract a single field from an interlaced image using stride
  7092. arithmetic to avoid wasting CPU time. The output frames are marked as
  7093. non-interlaced.
  7094. The filter accepts the following options:
  7095. @table @option
  7096. @item type
  7097. Specify whether to extract the top (if the value is @code{0} or
  7098. @code{top}) or the bottom field (if the value is @code{1} or
  7099. @code{bottom}).
  7100. @end table
  7101. @section fieldhint
  7102. Create new frames by copying the top and bottom fields from surrounding frames
  7103. supplied as numbers by the hint file.
  7104. @table @option
  7105. @item hint
  7106. Set file containing hints: absolute/relative frame numbers.
  7107. There must be one line for each frame in a clip. Each line must contain two
  7108. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  7109. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  7110. is current frame number for @code{absolute} mode or out of [-1, 1] range
  7111. for @code{relative} mode. First number tells from which frame to pick up top
  7112. field and second number tells from which frame to pick up bottom field.
  7113. If optionally followed by @code{+} output frame will be marked as interlaced,
  7114. else if followed by @code{-} output frame will be marked as progressive, else
  7115. it will be marked same as input frame.
  7116. If line starts with @code{#} or @code{;} that line is skipped.
  7117. @item mode
  7118. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  7119. @end table
  7120. Example of first several lines of @code{hint} file for @code{relative} mode:
  7121. @example
  7122. 0,0 - # first frame
  7123. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  7124. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  7125. 1,0 -
  7126. 0,0 -
  7127. 0,0 -
  7128. 1,0 -
  7129. 1,0 -
  7130. 1,0 -
  7131. 0,0 -
  7132. 0,0 -
  7133. 1,0 -
  7134. 1,0 -
  7135. 1,0 -
  7136. 0,0 -
  7137. @end example
  7138. @section fieldmatch
  7139. Field matching filter for inverse telecine. It is meant to reconstruct the
  7140. progressive frames from a telecined stream. The filter does not drop duplicated
  7141. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  7142. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  7143. The separation of the field matching and the decimation is notably motivated by
  7144. the possibility of inserting a de-interlacing filter fallback between the two.
  7145. If the source has mixed telecined and real interlaced content,
  7146. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  7147. But these remaining combed frames will be marked as interlaced, and thus can be
  7148. de-interlaced by a later filter such as @ref{yadif} before decimation.
  7149. In addition to the various configuration options, @code{fieldmatch} can take an
  7150. optional second stream, activated through the @option{ppsrc} option. If
  7151. enabled, the frames reconstruction will be based on the fields and frames from
  7152. this second stream. This allows the first input to be pre-processed in order to
  7153. help the various algorithms of the filter, while keeping the output lossless
  7154. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  7155. or brightness/contrast adjustments can help.
  7156. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  7157. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  7158. which @code{fieldmatch} is based on. While the semantic and usage are very
  7159. close, some behaviour and options names can differ.
  7160. The @ref{decimate} filter currently only works for constant frame rate input.
  7161. If your input has mixed telecined (30fps) and progressive content with a lower
  7162. framerate like 24fps use the following filterchain to produce the necessary cfr
  7163. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  7164. The filter accepts the following options:
  7165. @table @option
  7166. @item order
  7167. Specify the assumed field order of the input stream. Available values are:
  7168. @table @samp
  7169. @item auto
  7170. Auto detect parity (use FFmpeg's internal parity value).
  7171. @item bff
  7172. Assume bottom field first.
  7173. @item tff
  7174. Assume top field first.
  7175. @end table
  7176. Note that it is sometimes recommended not to trust the parity announced by the
  7177. stream.
  7178. Default value is @var{auto}.
  7179. @item mode
  7180. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  7181. sense that it won't risk creating jerkiness due to duplicate frames when
  7182. possible, but if there are bad edits or blended fields it will end up
  7183. outputting combed frames when a good match might actually exist. On the other
  7184. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  7185. but will almost always find a good frame if there is one. The other values are
  7186. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  7187. jerkiness and creating duplicate frames versus finding good matches in sections
  7188. with bad edits, orphaned fields, blended fields, etc.
  7189. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  7190. Available values are:
  7191. @table @samp
  7192. @item pc
  7193. 2-way matching (p/c)
  7194. @item pc_n
  7195. 2-way matching, and trying 3rd match if still combed (p/c + n)
  7196. @item pc_u
  7197. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  7198. @item pc_n_ub
  7199. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  7200. still combed (p/c + n + u/b)
  7201. @item pcn
  7202. 3-way matching (p/c/n)
  7203. @item pcn_ub
  7204. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  7205. detected as combed (p/c/n + u/b)
  7206. @end table
  7207. The parenthesis at the end indicate the matches that would be used for that
  7208. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  7209. @var{top}).
  7210. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  7211. the slowest.
  7212. Default value is @var{pc_n}.
  7213. @item ppsrc
  7214. Mark the main input stream as a pre-processed input, and enable the secondary
  7215. input stream as the clean source to pick the fields from. See the filter
  7216. introduction for more details. It is similar to the @option{clip2} feature from
  7217. VFM/TFM.
  7218. Default value is @code{0} (disabled).
  7219. @item field
  7220. Set the field to match from. It is recommended to set this to the same value as
  7221. @option{order} unless you experience matching failures with that setting. In
  7222. certain circumstances changing the field that is used to match from can have a
  7223. large impact on matching performance. Available values are:
  7224. @table @samp
  7225. @item auto
  7226. Automatic (same value as @option{order}).
  7227. @item bottom
  7228. Match from the bottom field.
  7229. @item top
  7230. Match from the top field.
  7231. @end table
  7232. Default value is @var{auto}.
  7233. @item mchroma
  7234. Set whether or not chroma is included during the match comparisons. In most
  7235. cases it is recommended to leave this enabled. You should set this to @code{0}
  7236. only if your clip has bad chroma problems such as heavy rainbowing or other
  7237. artifacts. Setting this to @code{0} could also be used to speed things up at
  7238. the cost of some accuracy.
  7239. Default value is @code{1}.
  7240. @item y0
  7241. @item y1
  7242. These define an exclusion band which excludes the lines between @option{y0} and
  7243. @option{y1} from being included in the field matching decision. An exclusion
  7244. band can be used to ignore subtitles, a logo, or other things that may
  7245. interfere with the matching. @option{y0} sets the starting scan line and
  7246. @option{y1} sets the ending line; all lines in between @option{y0} and
  7247. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  7248. @option{y0} and @option{y1} to the same value will disable the feature.
  7249. @option{y0} and @option{y1} defaults to @code{0}.
  7250. @item scthresh
  7251. Set the scene change detection threshold as a percentage of maximum change on
  7252. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  7253. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  7254. @option{scthresh} is @code{[0.0, 100.0]}.
  7255. Default value is @code{12.0}.
  7256. @item combmatch
  7257. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  7258. account the combed scores of matches when deciding what match to use as the
  7259. final match. Available values are:
  7260. @table @samp
  7261. @item none
  7262. No final matching based on combed scores.
  7263. @item sc
  7264. Combed scores are only used when a scene change is detected.
  7265. @item full
  7266. Use combed scores all the time.
  7267. @end table
  7268. Default is @var{sc}.
  7269. @item combdbg
  7270. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  7271. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  7272. Available values are:
  7273. @table @samp
  7274. @item none
  7275. No forced calculation.
  7276. @item pcn
  7277. Force p/c/n calculations.
  7278. @item pcnub
  7279. Force p/c/n/u/b calculations.
  7280. @end table
  7281. Default value is @var{none}.
  7282. @item cthresh
  7283. This is the area combing threshold used for combed frame detection. This
  7284. essentially controls how "strong" or "visible" combing must be to be detected.
  7285. Larger values mean combing must be more visible and smaller values mean combing
  7286. can be less visible or strong and still be detected. Valid settings are from
  7287. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  7288. be detected as combed). This is basically a pixel difference value. A good
  7289. range is @code{[8, 12]}.
  7290. Default value is @code{9}.
  7291. @item chroma
  7292. Sets whether or not chroma is considered in the combed frame decision. Only
  7293. disable this if your source has chroma problems (rainbowing, etc.) that are
  7294. causing problems for the combed frame detection with chroma enabled. Actually,
  7295. using @option{chroma}=@var{0} is usually more reliable, except for the case
  7296. where there is chroma only combing in the source.
  7297. Default value is @code{0}.
  7298. @item blockx
  7299. @item blocky
  7300. Respectively set the x-axis and y-axis size of the window used during combed
  7301. frame detection. This has to do with the size of the area in which
  7302. @option{combpel} pixels are required to be detected as combed for a frame to be
  7303. declared combed. See the @option{combpel} parameter description for more info.
  7304. Possible values are any number that is a power of 2 starting at 4 and going up
  7305. to 512.
  7306. Default value is @code{16}.
  7307. @item combpel
  7308. The number of combed pixels inside any of the @option{blocky} by
  7309. @option{blockx} size blocks on the frame for the frame to be detected as
  7310. combed. While @option{cthresh} controls how "visible" the combing must be, this
  7311. setting controls "how much" combing there must be in any localized area (a
  7312. window defined by the @option{blockx} and @option{blocky} settings) on the
  7313. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  7314. which point no frames will ever be detected as combed). This setting is known
  7315. as @option{MI} in TFM/VFM vocabulary.
  7316. Default value is @code{80}.
  7317. @end table
  7318. @anchor{p/c/n/u/b meaning}
  7319. @subsection p/c/n/u/b meaning
  7320. @subsubsection p/c/n
  7321. We assume the following telecined stream:
  7322. @example
  7323. Top fields: 1 2 2 3 4
  7324. Bottom fields: 1 2 3 4 4
  7325. @end example
  7326. The numbers correspond to the progressive frame the fields relate to. Here, the
  7327. first two frames are progressive, the 3rd and 4th are combed, and so on.
  7328. When @code{fieldmatch} is configured to run a matching from bottom
  7329. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  7330. @example
  7331. Input stream:
  7332. T 1 2 2 3 4
  7333. B 1 2 3 4 4 <-- matching reference
  7334. Matches: c c n n c
  7335. Output stream:
  7336. T 1 2 3 4 4
  7337. B 1 2 3 4 4
  7338. @end example
  7339. As a result of the field matching, we can see that some frames get duplicated.
  7340. To perform a complete inverse telecine, you need to rely on a decimation filter
  7341. after this operation. See for instance the @ref{decimate} filter.
  7342. The same operation now matching from top fields (@option{field}=@var{top})
  7343. looks like this:
  7344. @example
  7345. Input stream:
  7346. T 1 2 2 3 4 <-- matching reference
  7347. B 1 2 3 4 4
  7348. Matches: c c p p c
  7349. Output stream:
  7350. T 1 2 2 3 4
  7351. B 1 2 2 3 4
  7352. @end example
  7353. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  7354. basically, they refer to the frame and field of the opposite parity:
  7355. @itemize
  7356. @item @var{p} matches the field of the opposite parity in the previous frame
  7357. @item @var{c} matches the field of the opposite parity in the current frame
  7358. @item @var{n} matches the field of the opposite parity in the next frame
  7359. @end itemize
  7360. @subsubsection u/b
  7361. The @var{u} and @var{b} matching are a bit special in the sense that they match
  7362. from the opposite parity flag. In the following examples, we assume that we are
  7363. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  7364. 'x' is placed above and below each matched fields.
  7365. With bottom matching (@option{field}=@var{bottom}):
  7366. @example
  7367. Match: c p n b u
  7368. x x x x x
  7369. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7370. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7371. x x x x x
  7372. Output frames:
  7373. 2 1 2 2 2
  7374. 2 2 2 1 3
  7375. @end example
  7376. With top matching (@option{field}=@var{top}):
  7377. @example
  7378. Match: c p n b u
  7379. x x x x x
  7380. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  7381. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  7382. x x x x x
  7383. Output frames:
  7384. 2 2 2 1 2
  7385. 2 1 3 2 2
  7386. @end example
  7387. @subsection Examples
  7388. Simple IVTC of a top field first telecined stream:
  7389. @example
  7390. fieldmatch=order=tff:combmatch=none, decimate
  7391. @end example
  7392. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  7393. @example
  7394. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  7395. @end example
  7396. @section fieldorder
  7397. Transform the field order of the input video.
  7398. It accepts the following parameters:
  7399. @table @option
  7400. @item order
  7401. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  7402. for bottom field first.
  7403. @end table
  7404. The default value is @samp{tff}.
  7405. The transformation is done by shifting the picture content up or down
  7406. by one line, and filling the remaining line with appropriate picture content.
  7407. This method is consistent with most broadcast field order converters.
  7408. If the input video is not flagged as being interlaced, or it is already
  7409. flagged as being of the required output field order, then this filter does
  7410. not alter the incoming video.
  7411. It is very useful when converting to or from PAL DV material,
  7412. which is bottom field first.
  7413. For example:
  7414. @example
  7415. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  7416. @end example
  7417. @section fifo, afifo
  7418. Buffer input images and send them when they are requested.
  7419. It is mainly useful when auto-inserted by the libavfilter
  7420. framework.
  7421. It does not take parameters.
  7422. @section fillborders
  7423. Fill borders of the input video, without changing video stream dimensions.
  7424. Sometimes video can have garbage at the four edges and you may not want to
  7425. crop video input to keep size multiple of some number.
  7426. This filter accepts the following options:
  7427. @table @option
  7428. @item left
  7429. Number of pixels to fill from left border.
  7430. @item right
  7431. Number of pixels to fill from right border.
  7432. @item top
  7433. Number of pixels to fill from top border.
  7434. @item bottom
  7435. Number of pixels to fill from bottom border.
  7436. @item mode
  7437. Set fill mode.
  7438. It accepts the following values:
  7439. @table @samp
  7440. @item smear
  7441. fill pixels using outermost pixels
  7442. @item mirror
  7443. fill pixels using mirroring
  7444. @item fixed
  7445. fill pixels with constant value
  7446. @end table
  7447. Default is @var{smear}.
  7448. @item color
  7449. Set color for pixels in fixed mode. Default is @var{black}.
  7450. @end table
  7451. @section find_rect
  7452. Find a rectangular object
  7453. It accepts the following options:
  7454. @table @option
  7455. @item object
  7456. Filepath of the object image, needs to be in gray8.
  7457. @item threshold
  7458. Detection threshold, default is 0.5.
  7459. @item mipmaps
  7460. Number of mipmaps, default is 3.
  7461. @item xmin, ymin, xmax, ymax
  7462. Specifies the rectangle in which to search.
  7463. @end table
  7464. @subsection Examples
  7465. @itemize
  7466. @item
  7467. Generate a representative palette of a given video using @command{ffmpeg}:
  7468. @example
  7469. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7470. @end example
  7471. @end itemize
  7472. @section cover_rect
  7473. Cover a rectangular object
  7474. It accepts the following options:
  7475. @table @option
  7476. @item cover
  7477. Filepath of the optional cover image, needs to be in yuv420.
  7478. @item mode
  7479. Set covering mode.
  7480. It accepts the following values:
  7481. @table @samp
  7482. @item cover
  7483. cover it by the supplied image
  7484. @item blur
  7485. cover it by interpolating the surrounding pixels
  7486. @end table
  7487. Default value is @var{blur}.
  7488. @end table
  7489. @subsection Examples
  7490. @itemize
  7491. @item
  7492. Generate a representative palette of a given video using @command{ffmpeg}:
  7493. @example
  7494. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7495. @end example
  7496. @end itemize
  7497. @section floodfill
  7498. Flood area with values of same pixel components with another values.
  7499. It accepts the following options:
  7500. @table @option
  7501. @item x
  7502. Set pixel x coordinate.
  7503. @item y
  7504. Set pixel y coordinate.
  7505. @item s0
  7506. Set source #0 component value.
  7507. @item s1
  7508. Set source #1 component value.
  7509. @item s2
  7510. Set source #2 component value.
  7511. @item s3
  7512. Set source #3 component value.
  7513. @item d0
  7514. Set destination #0 component value.
  7515. @item d1
  7516. Set destination #1 component value.
  7517. @item d2
  7518. Set destination #2 component value.
  7519. @item d3
  7520. Set destination #3 component value.
  7521. @end table
  7522. @anchor{format}
  7523. @section format
  7524. Convert the input video to one of the specified pixel formats.
  7525. Libavfilter will try to pick one that is suitable as input to
  7526. the next filter.
  7527. It accepts the following parameters:
  7528. @table @option
  7529. @item pix_fmts
  7530. A '|'-separated list of pixel format names, such as
  7531. "pix_fmts=yuv420p|monow|rgb24".
  7532. @end table
  7533. @subsection Examples
  7534. @itemize
  7535. @item
  7536. Convert the input video to the @var{yuv420p} format
  7537. @example
  7538. format=pix_fmts=yuv420p
  7539. @end example
  7540. Convert the input video to any of the formats in the list
  7541. @example
  7542. format=pix_fmts=yuv420p|yuv444p|yuv410p
  7543. @end example
  7544. @end itemize
  7545. @anchor{fps}
  7546. @section fps
  7547. Convert the video to specified constant frame rate by duplicating or dropping
  7548. frames as necessary.
  7549. It accepts the following parameters:
  7550. @table @option
  7551. @item fps
  7552. The desired output frame rate. The default is @code{25}.
  7553. @item start_time
  7554. Assume the first PTS should be the given value, in seconds. This allows for
  7555. padding/trimming at the start of stream. By default, no assumption is made
  7556. about the first frame's expected PTS, so no padding or trimming is done.
  7557. For example, this could be set to 0 to pad the beginning with duplicates of
  7558. the first frame if a video stream starts after the audio stream or to trim any
  7559. frames with a negative PTS.
  7560. @item round
  7561. Timestamp (PTS) rounding method.
  7562. Possible values are:
  7563. @table @option
  7564. @item zero
  7565. round towards 0
  7566. @item inf
  7567. round away from 0
  7568. @item down
  7569. round towards -infinity
  7570. @item up
  7571. round towards +infinity
  7572. @item near
  7573. round to nearest
  7574. @end table
  7575. The default is @code{near}.
  7576. @item eof_action
  7577. Action performed when reading the last frame.
  7578. Possible values are:
  7579. @table @option
  7580. @item round
  7581. Use same timestamp rounding method as used for other frames.
  7582. @item pass
  7583. Pass through last frame if input duration has not been reached yet.
  7584. @end table
  7585. The default is @code{round}.
  7586. @end table
  7587. Alternatively, the options can be specified as a flat string:
  7588. @var{fps}[:@var{start_time}[:@var{round}]].
  7589. See also the @ref{setpts} filter.
  7590. @subsection Examples
  7591. @itemize
  7592. @item
  7593. A typical usage in order to set the fps to 25:
  7594. @example
  7595. fps=fps=25
  7596. @end example
  7597. @item
  7598. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  7599. @example
  7600. fps=fps=film:round=near
  7601. @end example
  7602. @end itemize
  7603. @section framepack
  7604. Pack two different video streams into a stereoscopic video, setting proper
  7605. metadata on supported codecs. The two views should have the same size and
  7606. framerate and processing will stop when the shorter video ends. Please note
  7607. that you may conveniently adjust view properties with the @ref{scale} and
  7608. @ref{fps} filters.
  7609. It accepts the following parameters:
  7610. @table @option
  7611. @item format
  7612. The desired packing format. Supported values are:
  7613. @table @option
  7614. @item sbs
  7615. The views are next to each other (default).
  7616. @item tab
  7617. The views are on top of each other.
  7618. @item lines
  7619. The views are packed by line.
  7620. @item columns
  7621. The views are packed by column.
  7622. @item frameseq
  7623. The views are temporally interleaved.
  7624. @end table
  7625. @end table
  7626. Some examples:
  7627. @example
  7628. # Convert left and right views into a frame-sequential video
  7629. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  7630. # Convert views into a side-by-side video with the same output resolution as the input
  7631. 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
  7632. @end example
  7633. @section framerate
  7634. Change the frame rate by interpolating new video output frames from the source
  7635. frames.
  7636. This filter is not designed to function correctly with interlaced media. If
  7637. you wish to change the frame rate of interlaced media then you are required
  7638. to deinterlace before this filter and re-interlace after this filter.
  7639. A description of the accepted options follows.
  7640. @table @option
  7641. @item fps
  7642. Specify the output frames per second. This option can also be specified
  7643. as a value alone. The default is @code{50}.
  7644. @item interp_start
  7645. Specify the start of a range where the output frame will be created as a
  7646. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7647. the default is @code{15}.
  7648. @item interp_end
  7649. Specify the end of a range where the output frame will be created as a
  7650. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7651. the default is @code{240}.
  7652. @item scene
  7653. Specify the level at which a scene change is detected as a value between
  7654. 0 and 100 to indicate a new scene; a low value reflects a low
  7655. probability for the current frame to introduce a new scene, while a higher
  7656. value means the current frame is more likely to be one.
  7657. The default is @code{8.2}.
  7658. @item flags
  7659. Specify flags influencing the filter process.
  7660. Available value for @var{flags} is:
  7661. @table @option
  7662. @item scene_change_detect, scd
  7663. Enable scene change detection using the value of the option @var{scene}.
  7664. This flag is enabled by default.
  7665. @end table
  7666. @end table
  7667. @section framestep
  7668. Select one frame every N-th frame.
  7669. This filter accepts the following option:
  7670. @table @option
  7671. @item step
  7672. Select frame after every @code{step} frames.
  7673. Allowed values are positive integers higher than 0. Default value is @code{1}.
  7674. @end table
  7675. @anchor{frei0r}
  7676. @section frei0r
  7677. Apply a frei0r effect to the input video.
  7678. To enable the compilation of this filter, you need to install the frei0r
  7679. header and configure FFmpeg with @code{--enable-frei0r}.
  7680. It accepts the following parameters:
  7681. @table @option
  7682. @item filter_name
  7683. The name of the frei0r effect to load. If the environment variable
  7684. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  7685. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  7686. Otherwise, the standard frei0r paths are searched, in this order:
  7687. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  7688. @file{/usr/lib/frei0r-1/}.
  7689. @item filter_params
  7690. A '|'-separated list of parameters to pass to the frei0r effect.
  7691. @end table
  7692. A frei0r effect parameter can be a boolean (its value is either
  7693. "y" or "n"), a double, a color (specified as
  7694. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  7695. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  7696. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  7697. a position (specified as @var{X}/@var{Y}, where
  7698. @var{X} and @var{Y} are floating point numbers) and/or a string.
  7699. The number and types of parameters depend on the loaded effect. If an
  7700. effect parameter is not specified, the default value is set.
  7701. @subsection Examples
  7702. @itemize
  7703. @item
  7704. Apply the distort0r effect, setting the first two double parameters:
  7705. @example
  7706. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  7707. @end example
  7708. @item
  7709. Apply the colordistance effect, taking a color as the first parameter:
  7710. @example
  7711. frei0r=colordistance:0.2/0.3/0.4
  7712. frei0r=colordistance:violet
  7713. frei0r=colordistance:0x112233
  7714. @end example
  7715. @item
  7716. Apply the perspective effect, specifying the top left and top right image
  7717. positions:
  7718. @example
  7719. frei0r=perspective:0.2/0.2|0.8/0.2
  7720. @end example
  7721. @end itemize
  7722. For more information, see
  7723. @url{http://frei0r.dyne.org}
  7724. @section fspp
  7725. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  7726. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  7727. processing filter, one of them is performed once per block, not per pixel.
  7728. This allows for much higher speed.
  7729. The filter accepts the following options:
  7730. @table @option
  7731. @item quality
  7732. Set quality. This option defines the number of levels for averaging. It accepts
  7733. an integer in the range 4-5. Default value is @code{4}.
  7734. @item qp
  7735. Force a constant quantization parameter. It accepts an integer in range 0-63.
  7736. If not set, the filter will use the QP from the video stream (if available).
  7737. @item strength
  7738. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  7739. more details but also more artifacts, while higher values make the image smoother
  7740. but also blurrier. Default value is @code{0} − PSNR optimal.
  7741. @item use_bframe_qp
  7742. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  7743. option may cause flicker since the B-Frames have often larger QP. Default is
  7744. @code{0} (not enabled).
  7745. @end table
  7746. @section gblur
  7747. Apply Gaussian blur filter.
  7748. The filter accepts the following options:
  7749. @table @option
  7750. @item sigma
  7751. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  7752. @item steps
  7753. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  7754. @item planes
  7755. Set which planes to filter. By default all planes are filtered.
  7756. @item sigmaV
  7757. Set vertical sigma, if negative it will be same as @code{sigma}.
  7758. Default is @code{-1}.
  7759. @end table
  7760. @section geq
  7761. Apply generic equation to each pixel.
  7762. The filter accepts the following options:
  7763. @table @option
  7764. @item lum_expr, lum
  7765. Set the luminance expression.
  7766. @item cb_expr, cb
  7767. Set the chrominance blue expression.
  7768. @item cr_expr, cr
  7769. Set the chrominance red expression.
  7770. @item alpha_expr, a
  7771. Set the alpha expression.
  7772. @item red_expr, r
  7773. Set the red expression.
  7774. @item green_expr, g
  7775. Set the green expression.
  7776. @item blue_expr, b
  7777. Set the blue expression.
  7778. @end table
  7779. The colorspace is selected according to the specified options. If one
  7780. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  7781. options is specified, the filter will automatically select a YCbCr
  7782. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  7783. @option{blue_expr} options is specified, it will select an RGB
  7784. colorspace.
  7785. If one of the chrominance expression is not defined, it falls back on the other
  7786. one. If no alpha expression is specified it will evaluate to opaque value.
  7787. If none of chrominance expressions are specified, they will evaluate
  7788. to the luminance expression.
  7789. The expressions can use the following variables and functions:
  7790. @table @option
  7791. @item N
  7792. The sequential number of the filtered frame, starting from @code{0}.
  7793. @item X
  7794. @item Y
  7795. The coordinates of the current sample.
  7796. @item W
  7797. @item H
  7798. The width and height of the image.
  7799. @item SW
  7800. @item SH
  7801. Width and height scale depending on the currently filtered plane. It is the
  7802. ratio between the corresponding luma plane number of pixels and the current
  7803. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  7804. @code{0.5,0.5} for chroma planes.
  7805. @item T
  7806. Time of the current frame, expressed in seconds.
  7807. @item p(x, y)
  7808. Return the value of the pixel at location (@var{x},@var{y}) of the current
  7809. plane.
  7810. @item lum(x, y)
  7811. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  7812. plane.
  7813. @item cb(x, y)
  7814. Return the value of the pixel at location (@var{x},@var{y}) of the
  7815. blue-difference chroma plane. Return 0 if there is no such plane.
  7816. @item cr(x, y)
  7817. Return the value of the pixel at location (@var{x},@var{y}) of the
  7818. red-difference chroma plane. Return 0 if there is no such plane.
  7819. @item r(x, y)
  7820. @item g(x, y)
  7821. @item b(x, y)
  7822. Return the value of the pixel at location (@var{x},@var{y}) of the
  7823. red/green/blue component. Return 0 if there is no such component.
  7824. @item alpha(x, y)
  7825. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  7826. plane. Return 0 if there is no such plane.
  7827. @end table
  7828. For functions, if @var{x} and @var{y} are outside the area, the value will be
  7829. automatically clipped to the closer edge.
  7830. @subsection Examples
  7831. @itemize
  7832. @item
  7833. Flip the image horizontally:
  7834. @example
  7835. geq=p(W-X\,Y)
  7836. @end example
  7837. @item
  7838. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  7839. wavelength of 100 pixels:
  7840. @example
  7841. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  7842. @end example
  7843. @item
  7844. Generate a fancy enigmatic moving light:
  7845. @example
  7846. 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
  7847. @end example
  7848. @item
  7849. Generate a quick emboss effect:
  7850. @example
  7851. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  7852. @end example
  7853. @item
  7854. Modify RGB components depending on pixel position:
  7855. @example
  7856. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  7857. @end example
  7858. @item
  7859. Create a radial gradient that is the same size as the input (also see
  7860. the @ref{vignette} filter):
  7861. @example
  7862. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  7863. @end example
  7864. @end itemize
  7865. @section gradfun
  7866. Fix the banding artifacts that are sometimes introduced into nearly flat
  7867. regions by truncation to 8-bit color depth.
  7868. Interpolate the gradients that should go where the bands are, and
  7869. dither them.
  7870. It is designed for playback only. Do not use it prior to
  7871. lossy compression, because compression tends to lose the dither and
  7872. bring back the bands.
  7873. It accepts the following parameters:
  7874. @table @option
  7875. @item strength
  7876. The maximum amount by which the filter will change any one pixel. This is also
  7877. the threshold for detecting nearly flat regions. Acceptable values range from
  7878. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  7879. valid range.
  7880. @item radius
  7881. The neighborhood to fit the gradient to. A larger radius makes for smoother
  7882. gradients, but also prevents the filter from modifying the pixels near detailed
  7883. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  7884. values will be clipped to the valid range.
  7885. @end table
  7886. Alternatively, the options can be specified as a flat string:
  7887. @var{strength}[:@var{radius}]
  7888. @subsection Examples
  7889. @itemize
  7890. @item
  7891. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  7892. @example
  7893. gradfun=3.5:8
  7894. @end example
  7895. @item
  7896. Specify radius, omitting the strength (which will fall-back to the default
  7897. value):
  7898. @example
  7899. gradfun=radius=8
  7900. @end example
  7901. @end itemize
  7902. @section graphmonitor, agraphmonitor
  7903. Show various filtergraph stats.
  7904. With this filter one can debug complete filtergraph.
  7905. Especially issues with links filling with queued frames.
  7906. The filter accepts the following options:
  7907. @table @option
  7908. @item size, s
  7909. Set video output size. Default is @var{hd720}.
  7910. @item opacity, o
  7911. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  7912. @item mode, m
  7913. Set output mode, can be @var{fulll} or @var{compact}.
  7914. In @var{compact} mode only filters with some queued frames have displayed stats.
  7915. @item flags, f
  7916. Set flags which enable which stats are shown in video.
  7917. Available values for flags are:
  7918. @table @samp
  7919. @item queue
  7920. Display number of queued frames in each link.
  7921. @item frame_count_in
  7922. Display number of frames taken from filter.
  7923. @item frame_count_out
  7924. Display number of frames given out from filter.
  7925. @item pts
  7926. Display current filtered frame pts.
  7927. @item time
  7928. Display current filtered frame time.
  7929. @item timebase
  7930. Display time base for filter link.
  7931. @item format
  7932. Display used format for filter link.
  7933. @item size
  7934. Display video size or number of audio channels in case of audio used by filter link.
  7935. @item rate
  7936. Display video frame rate or sample rate in case of audio used by filter link.
  7937. @end table
  7938. @item rate, r
  7939. Set upper limit for video rate of output stream, Default value is @var{25}.
  7940. This guarantee that output video frame rate will not be higher than this value.
  7941. @end table
  7942. @section greyedge
  7943. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  7944. and corrects the scene colors accordingly.
  7945. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  7946. The filter accepts the following options:
  7947. @table @option
  7948. @item difford
  7949. The order of differentiation to be applied on the scene. Must be chosen in the range
  7950. [0,2] and default value is 1.
  7951. @item minknorm
  7952. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  7953. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  7954. max value instead of calculating Minkowski distance.
  7955. @item sigma
  7956. The standard deviation of Gaussian blur to be applied on the scene. Must be
  7957. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  7958. can't be euqal to 0 if @var{difford} is greater than 0.
  7959. @end table
  7960. @subsection Examples
  7961. @itemize
  7962. @item
  7963. Grey Edge:
  7964. @example
  7965. greyedge=difford=1:minknorm=5:sigma=2
  7966. @end example
  7967. @item
  7968. Max Edge:
  7969. @example
  7970. greyedge=difford=1:minknorm=0:sigma=2
  7971. @end example
  7972. @end itemize
  7973. @anchor{haldclut}
  7974. @section haldclut
  7975. Apply a Hald CLUT to a video stream.
  7976. First input is the video stream to process, and second one is the Hald CLUT.
  7977. The Hald CLUT input can be a simple picture or a complete video stream.
  7978. The filter accepts the following options:
  7979. @table @option
  7980. @item shortest
  7981. Force termination when the shortest input terminates. Default is @code{0}.
  7982. @item repeatlast
  7983. Continue applying the last CLUT after the end of the stream. A value of
  7984. @code{0} disable the filter after the last frame of the CLUT is reached.
  7985. Default is @code{1}.
  7986. @end table
  7987. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  7988. filters share the same internals).
  7989. More information about the Hald CLUT can be found on Eskil Steenberg's website
  7990. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  7991. @subsection Workflow examples
  7992. @subsubsection Hald CLUT video stream
  7993. Generate an identity Hald CLUT stream altered with various effects:
  7994. @example
  7995. 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
  7996. @end example
  7997. Note: make sure you use a lossless codec.
  7998. Then use it with @code{haldclut} to apply it on some random stream:
  7999. @example
  8000. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  8001. @end example
  8002. The Hald CLUT will be applied to the 10 first seconds (duration of
  8003. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  8004. to the remaining frames of the @code{mandelbrot} stream.
  8005. @subsubsection Hald CLUT with preview
  8006. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  8007. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  8008. biggest possible square starting at the top left of the picture. The remaining
  8009. padding pixels (bottom or right) will be ignored. This area can be used to add
  8010. a preview of the Hald CLUT.
  8011. Typically, the following generated Hald CLUT will be supported by the
  8012. @code{haldclut} filter:
  8013. @example
  8014. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  8015. pad=iw+320 [padded_clut];
  8016. smptebars=s=320x256, split [a][b];
  8017. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  8018. [main][b] overlay=W-320" -frames:v 1 clut.png
  8019. @end example
  8020. It contains the original and a preview of the effect of the CLUT: SMPTE color
  8021. bars are displayed on the right-top, and below the same color bars processed by
  8022. the color changes.
  8023. Then, the effect of this Hald CLUT can be visualized with:
  8024. @example
  8025. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  8026. @end example
  8027. @section hflip
  8028. Flip the input video horizontally.
  8029. For example, to horizontally flip the input video with @command{ffmpeg}:
  8030. @example
  8031. ffmpeg -i in.avi -vf "hflip" out.avi
  8032. @end example
  8033. @section histeq
  8034. This filter applies a global color histogram equalization on a
  8035. per-frame basis.
  8036. It can be used to correct video that has a compressed range of pixel
  8037. intensities. The filter redistributes the pixel intensities to
  8038. equalize their distribution across the intensity range. It may be
  8039. viewed as an "automatically adjusting contrast filter". This filter is
  8040. useful only for correcting degraded or poorly captured source
  8041. video.
  8042. The filter accepts the following options:
  8043. @table @option
  8044. @item strength
  8045. Determine the amount of equalization to be applied. As the strength
  8046. is reduced, the distribution of pixel intensities more-and-more
  8047. approaches that of the input frame. The value must be a float number
  8048. in the range [0,1] and defaults to 0.200.
  8049. @item intensity
  8050. Set the maximum intensity that can generated and scale the output
  8051. values appropriately. The strength should be set as desired and then
  8052. the intensity can be limited if needed to avoid washing-out. The value
  8053. must be a float number in the range [0,1] and defaults to 0.210.
  8054. @item antibanding
  8055. Set the antibanding level. If enabled the filter will randomly vary
  8056. the luminance of output pixels by a small amount to avoid banding of
  8057. the histogram. Possible values are @code{none}, @code{weak} or
  8058. @code{strong}. It defaults to @code{none}.
  8059. @end table
  8060. @section histogram
  8061. Compute and draw a color distribution histogram for the input video.
  8062. The computed histogram is a representation of the color component
  8063. distribution in an image.
  8064. Standard histogram displays the color components distribution in an image.
  8065. Displays color graph for each color component. Shows distribution of
  8066. the Y, U, V, A or R, G, B components, depending on input format, in the
  8067. current frame. Below each graph a color component scale meter is shown.
  8068. The filter accepts the following options:
  8069. @table @option
  8070. @item level_height
  8071. Set height of level. Default value is @code{200}.
  8072. Allowed range is [50, 2048].
  8073. @item scale_height
  8074. Set height of color scale. Default value is @code{12}.
  8075. Allowed range is [0, 40].
  8076. @item display_mode
  8077. Set display mode.
  8078. It accepts the following values:
  8079. @table @samp
  8080. @item stack
  8081. Per color component graphs are placed below each other.
  8082. @item parade
  8083. Per color component graphs are placed side by side.
  8084. @item overlay
  8085. Presents information identical to that in the @code{parade}, except
  8086. that the graphs representing color components are superimposed directly
  8087. over one another.
  8088. @end table
  8089. Default is @code{stack}.
  8090. @item levels_mode
  8091. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  8092. Default is @code{linear}.
  8093. @item components
  8094. Set what color components to display.
  8095. Default is @code{7}.
  8096. @item fgopacity
  8097. Set foreground opacity. Default is @code{0.7}.
  8098. @item bgopacity
  8099. Set background opacity. Default is @code{0.5}.
  8100. @end table
  8101. @subsection Examples
  8102. @itemize
  8103. @item
  8104. Calculate and draw histogram:
  8105. @example
  8106. ffplay -i input -vf histogram
  8107. @end example
  8108. @end itemize
  8109. @anchor{hqdn3d}
  8110. @section hqdn3d
  8111. This is a high precision/quality 3d denoise filter. It aims to reduce
  8112. image noise, producing smooth images and making still images really
  8113. still. It should enhance compressibility.
  8114. It accepts the following optional parameters:
  8115. @table @option
  8116. @item luma_spatial
  8117. A non-negative floating point number which specifies spatial luma strength.
  8118. It defaults to 4.0.
  8119. @item chroma_spatial
  8120. A non-negative floating point number which specifies spatial chroma strength.
  8121. It defaults to 3.0*@var{luma_spatial}/4.0.
  8122. @item luma_tmp
  8123. A floating point number which specifies luma temporal strength. It defaults to
  8124. 6.0*@var{luma_spatial}/4.0.
  8125. @item chroma_tmp
  8126. A floating point number which specifies chroma temporal strength. It defaults to
  8127. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  8128. @end table
  8129. @section hwdownload
  8130. Download hardware frames to system memory.
  8131. The input must be in hardware frames, and the output a non-hardware format.
  8132. Not all formats will be supported on the output - it may be necessary to insert
  8133. an additional @option{format} filter immediately following in the graph to get
  8134. the output in a supported format.
  8135. @section hwmap
  8136. Map hardware frames to system memory or to another device.
  8137. This filter has several different modes of operation; which one is used depends
  8138. on the input and output formats:
  8139. @itemize
  8140. @item
  8141. Hardware frame input, normal frame output
  8142. Map the input frames to system memory and pass them to the output. If the
  8143. original hardware frame is later required (for example, after overlaying
  8144. something else on part of it), the @option{hwmap} filter can be used again
  8145. in the next mode to retrieve it.
  8146. @item
  8147. Normal frame input, hardware frame output
  8148. If the input is actually a software-mapped hardware frame, then unmap it -
  8149. that is, return the original hardware frame.
  8150. Otherwise, a device must be provided. Create new hardware surfaces on that
  8151. device for the output, then map them back to the software format at the input
  8152. and give those frames to the preceding filter. This will then act like the
  8153. @option{hwupload} filter, but may be able to avoid an additional copy when
  8154. the input is already in a compatible format.
  8155. @item
  8156. Hardware frame input and output
  8157. A device must be supplied for the output, either directly or with the
  8158. @option{derive_device} option. The input and output devices must be of
  8159. different types and compatible - the exact meaning of this is
  8160. system-dependent, but typically it means that they must refer to the same
  8161. underlying hardware context (for example, refer to the same graphics card).
  8162. If the input frames were originally created on the output device, then unmap
  8163. to retrieve the original frames.
  8164. Otherwise, map the frames to the output device - create new hardware frames
  8165. on the output corresponding to the frames on the input.
  8166. @end itemize
  8167. The following additional parameters are accepted:
  8168. @table @option
  8169. @item mode
  8170. Set the frame mapping mode. Some combination of:
  8171. @table @var
  8172. @item read
  8173. The mapped frame should be readable.
  8174. @item write
  8175. The mapped frame should be writeable.
  8176. @item overwrite
  8177. The mapping will always overwrite the entire frame.
  8178. This may improve performance in some cases, as the original contents of the
  8179. frame need not be loaded.
  8180. @item direct
  8181. The mapping must not involve any copying.
  8182. Indirect mappings to copies of frames are created in some cases where either
  8183. direct mapping is not possible or it would have unexpected properties.
  8184. Setting this flag ensures that the mapping is direct and will fail if that is
  8185. not possible.
  8186. @end table
  8187. Defaults to @var{read+write} if not specified.
  8188. @item derive_device @var{type}
  8189. Rather than using the device supplied at initialisation, instead derive a new
  8190. device of type @var{type} from the device the input frames exist on.
  8191. @item reverse
  8192. In a hardware to hardware mapping, map in reverse - create frames in the sink
  8193. and map them back to the source. This may be necessary in some cases where
  8194. a mapping in one direction is required but only the opposite direction is
  8195. supported by the devices being used.
  8196. This option is dangerous - it may break the preceding filter in undefined
  8197. ways if there are any additional constraints on that filter's output.
  8198. Do not use it without fully understanding the implications of its use.
  8199. @end table
  8200. @section hwupload
  8201. Upload system memory frames to hardware surfaces.
  8202. The device to upload to must be supplied when the filter is initialised. If
  8203. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  8204. option.
  8205. @anchor{hwupload_cuda}
  8206. @section hwupload_cuda
  8207. Upload system memory frames to a CUDA device.
  8208. It accepts the following optional parameters:
  8209. @table @option
  8210. @item device
  8211. The number of the CUDA device to use
  8212. @end table
  8213. @section hqx
  8214. Apply a high-quality magnification filter designed for pixel art. This filter
  8215. was originally created by Maxim Stepin.
  8216. It accepts the following option:
  8217. @table @option
  8218. @item n
  8219. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  8220. @code{hq3x} and @code{4} for @code{hq4x}.
  8221. Default is @code{3}.
  8222. @end table
  8223. @section hstack
  8224. Stack input videos horizontally.
  8225. All streams must be of same pixel format and of same height.
  8226. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  8227. to create same output.
  8228. The filter accept the following option:
  8229. @table @option
  8230. @item inputs
  8231. Set number of input streams. Default is 2.
  8232. @item shortest
  8233. If set to 1, force the output to terminate when the shortest input
  8234. terminates. Default value is 0.
  8235. @end table
  8236. @section hue
  8237. Modify the hue and/or the saturation of the input.
  8238. It accepts the following parameters:
  8239. @table @option
  8240. @item h
  8241. Specify the hue angle as a number of degrees. It accepts an expression,
  8242. and defaults to "0".
  8243. @item s
  8244. Specify the saturation in the [-10,10] range. It accepts an expression and
  8245. defaults to "1".
  8246. @item H
  8247. Specify the hue angle as a number of radians. It accepts an
  8248. expression, and defaults to "0".
  8249. @item b
  8250. Specify the brightness in the [-10,10] range. It accepts an expression and
  8251. defaults to "0".
  8252. @end table
  8253. @option{h} and @option{H} are mutually exclusive, and can't be
  8254. specified at the same time.
  8255. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  8256. expressions containing the following constants:
  8257. @table @option
  8258. @item n
  8259. frame count of the input frame starting from 0
  8260. @item pts
  8261. presentation timestamp of the input frame expressed in time base units
  8262. @item r
  8263. frame rate of the input video, NAN if the input frame rate is unknown
  8264. @item t
  8265. timestamp expressed in seconds, NAN if the input timestamp is unknown
  8266. @item tb
  8267. time base of the input video
  8268. @end table
  8269. @subsection Examples
  8270. @itemize
  8271. @item
  8272. Set the hue to 90 degrees and the saturation to 1.0:
  8273. @example
  8274. hue=h=90:s=1
  8275. @end example
  8276. @item
  8277. Same command but expressing the hue in radians:
  8278. @example
  8279. hue=H=PI/2:s=1
  8280. @end example
  8281. @item
  8282. Rotate hue and make the saturation swing between 0
  8283. and 2 over a period of 1 second:
  8284. @example
  8285. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  8286. @end example
  8287. @item
  8288. Apply a 3 seconds saturation fade-in effect starting at 0:
  8289. @example
  8290. hue="s=min(t/3\,1)"
  8291. @end example
  8292. The general fade-in expression can be written as:
  8293. @example
  8294. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  8295. @end example
  8296. @item
  8297. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  8298. @example
  8299. hue="s=max(0\, min(1\, (8-t)/3))"
  8300. @end example
  8301. The general fade-out expression can be written as:
  8302. @example
  8303. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  8304. @end example
  8305. @end itemize
  8306. @subsection Commands
  8307. This filter supports the following commands:
  8308. @table @option
  8309. @item b
  8310. @item s
  8311. @item h
  8312. @item H
  8313. Modify the hue and/or the saturation and/or brightness of the input video.
  8314. The command accepts the same syntax of the corresponding option.
  8315. If the specified expression is not valid, it is kept at its current
  8316. value.
  8317. @end table
  8318. @section hysteresis
  8319. Grow first stream into second stream by connecting components.
  8320. This makes it possible to build more robust edge masks.
  8321. This filter accepts the following options:
  8322. @table @option
  8323. @item planes
  8324. Set which planes will be processed as bitmap, unprocessed planes will be
  8325. copied from first stream.
  8326. By default value 0xf, all planes will be processed.
  8327. @item threshold
  8328. Set threshold which is used in filtering. If pixel component value is higher than
  8329. this value filter algorithm for connecting components is activated.
  8330. By default value is 0.
  8331. @end table
  8332. @section idet
  8333. Detect video interlacing type.
  8334. This filter tries to detect if the input frames are interlaced, progressive,
  8335. top or bottom field first. It will also try to detect fields that are
  8336. repeated between adjacent frames (a sign of telecine).
  8337. Single frame detection considers only immediately adjacent frames when classifying each frame.
  8338. Multiple frame detection incorporates the classification history of previous frames.
  8339. The filter will log these metadata values:
  8340. @table @option
  8341. @item single.current_frame
  8342. Detected type of current frame using single-frame detection. One of:
  8343. ``tff'' (top field first), ``bff'' (bottom field first),
  8344. ``progressive'', or ``undetermined''
  8345. @item single.tff
  8346. Cumulative number of frames detected as top field first using single-frame detection.
  8347. @item multiple.tff
  8348. Cumulative number of frames detected as top field first using multiple-frame detection.
  8349. @item single.bff
  8350. Cumulative number of frames detected as bottom field first using single-frame detection.
  8351. @item multiple.current_frame
  8352. Detected type of current frame using multiple-frame detection. One of:
  8353. ``tff'' (top field first), ``bff'' (bottom field first),
  8354. ``progressive'', or ``undetermined''
  8355. @item multiple.bff
  8356. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  8357. @item single.progressive
  8358. Cumulative number of frames detected as progressive using single-frame detection.
  8359. @item multiple.progressive
  8360. Cumulative number of frames detected as progressive using multiple-frame detection.
  8361. @item single.undetermined
  8362. Cumulative number of frames that could not be classified using single-frame detection.
  8363. @item multiple.undetermined
  8364. Cumulative number of frames that could not be classified using multiple-frame detection.
  8365. @item repeated.current_frame
  8366. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  8367. @item repeated.neither
  8368. Cumulative number of frames with no repeated field.
  8369. @item repeated.top
  8370. Cumulative number of frames with the top field repeated from the previous frame's top field.
  8371. @item repeated.bottom
  8372. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  8373. @end table
  8374. The filter accepts the following options:
  8375. @table @option
  8376. @item intl_thres
  8377. Set interlacing threshold.
  8378. @item prog_thres
  8379. Set progressive threshold.
  8380. @item rep_thres
  8381. Threshold for repeated field detection.
  8382. @item half_life
  8383. Number of frames after which a given frame's contribution to the
  8384. statistics is halved (i.e., it contributes only 0.5 to its
  8385. classification). The default of 0 means that all frames seen are given
  8386. full weight of 1.0 forever.
  8387. @item analyze_interlaced_flag
  8388. When this is not 0 then idet will use the specified number of frames to determine
  8389. if the interlaced flag is accurate, it will not count undetermined frames.
  8390. If the flag is found to be accurate it will be used without any further
  8391. computations, if it is found to be inaccurate it will be cleared without any
  8392. further computations. This allows inserting the idet filter as a low computational
  8393. method to clean up the interlaced flag
  8394. @end table
  8395. @section il
  8396. Deinterleave or interleave fields.
  8397. This filter allows one to process interlaced images fields without
  8398. deinterlacing them. Deinterleaving splits the input frame into 2
  8399. fields (so called half pictures). Odd lines are moved to the top
  8400. half of the output image, even lines to the bottom half.
  8401. You can process (filter) them independently and then re-interleave them.
  8402. The filter accepts the following options:
  8403. @table @option
  8404. @item luma_mode, l
  8405. @item chroma_mode, c
  8406. @item alpha_mode, a
  8407. Available values for @var{luma_mode}, @var{chroma_mode} and
  8408. @var{alpha_mode} are:
  8409. @table @samp
  8410. @item none
  8411. Do nothing.
  8412. @item deinterleave, d
  8413. Deinterleave fields, placing one above the other.
  8414. @item interleave, i
  8415. Interleave fields. Reverse the effect of deinterleaving.
  8416. @end table
  8417. Default value is @code{none}.
  8418. @item luma_swap, ls
  8419. @item chroma_swap, cs
  8420. @item alpha_swap, as
  8421. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  8422. @end table
  8423. @section inflate
  8424. Apply inflate effect to the video.
  8425. This filter replaces the pixel by the local(3x3) average by taking into account
  8426. only values higher than the pixel.
  8427. It accepts the following options:
  8428. @table @option
  8429. @item threshold0
  8430. @item threshold1
  8431. @item threshold2
  8432. @item threshold3
  8433. Limit the maximum change for each plane, default is 65535.
  8434. If 0, plane will remain unchanged.
  8435. @end table
  8436. @section interlace
  8437. Simple interlacing filter from progressive contents. This interleaves upper (or
  8438. lower) lines from odd frames with lower (or upper) lines from even frames,
  8439. halving the frame rate and preserving image height.
  8440. @example
  8441. Original Original New Frame
  8442. Frame 'j' Frame 'j+1' (tff)
  8443. ========== =========== ==================
  8444. Line 0 --------------------> Frame 'j' Line 0
  8445. Line 1 Line 1 ----> Frame 'j+1' Line 1
  8446. Line 2 ---------------------> Frame 'j' Line 2
  8447. Line 3 Line 3 ----> Frame 'j+1' Line 3
  8448. ... ... ...
  8449. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  8450. @end example
  8451. It accepts the following optional parameters:
  8452. @table @option
  8453. @item scan
  8454. This determines whether the interlaced frame is taken from the even
  8455. (tff - default) or odd (bff) lines of the progressive frame.
  8456. @item lowpass
  8457. Vertical lowpass filter to avoid twitter interlacing and
  8458. reduce moire patterns.
  8459. @table @samp
  8460. @item 0, off
  8461. Disable vertical lowpass filter
  8462. @item 1, linear
  8463. Enable linear filter (default)
  8464. @item 2, complex
  8465. Enable complex filter. This will slightly less reduce twitter and moire
  8466. but better retain detail and subjective sharpness impression.
  8467. @end table
  8468. @end table
  8469. @section kerndeint
  8470. Deinterlace input video by applying Donald Graft's adaptive kernel
  8471. deinterling. Work on interlaced parts of a video to produce
  8472. progressive frames.
  8473. The description of the accepted parameters follows.
  8474. @table @option
  8475. @item thresh
  8476. Set the threshold which affects the filter's tolerance when
  8477. determining if a pixel line must be processed. It must be an integer
  8478. in the range [0,255] and defaults to 10. A value of 0 will result in
  8479. applying the process on every pixels.
  8480. @item map
  8481. Paint pixels exceeding the threshold value to white if set to 1.
  8482. Default is 0.
  8483. @item order
  8484. Set the fields order. Swap fields if set to 1, leave fields alone if
  8485. 0. Default is 0.
  8486. @item sharp
  8487. Enable additional sharpening if set to 1. Default is 0.
  8488. @item twoway
  8489. Enable twoway sharpening if set to 1. Default is 0.
  8490. @end table
  8491. @subsection Examples
  8492. @itemize
  8493. @item
  8494. Apply default values:
  8495. @example
  8496. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  8497. @end example
  8498. @item
  8499. Enable additional sharpening:
  8500. @example
  8501. kerndeint=sharp=1
  8502. @end example
  8503. @item
  8504. Paint processed pixels in white:
  8505. @example
  8506. kerndeint=map=1
  8507. @end example
  8508. @end itemize
  8509. @section lenscorrection
  8510. Correct radial lens distortion
  8511. This filter can be used to correct for radial distortion as can result from the use
  8512. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  8513. one can use tools available for example as part of opencv or simply trial-and-error.
  8514. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  8515. and extract the k1 and k2 coefficients from the resulting matrix.
  8516. Note that effectively the same filter is available in the open-source tools Krita and
  8517. Digikam from the KDE project.
  8518. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  8519. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  8520. brightness distribution, so you may want to use both filters together in certain
  8521. cases, though you will have to take care of ordering, i.e. whether vignetting should
  8522. be applied before or after lens correction.
  8523. @subsection Options
  8524. The filter accepts the following options:
  8525. @table @option
  8526. @item cx
  8527. Relative x-coordinate of the focal point of the image, and thereby the center of the
  8528. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8529. width. Default is 0.5.
  8530. @item cy
  8531. Relative y-coordinate of the focal point of the image, and thereby the center of the
  8532. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8533. height. Default is 0.5.
  8534. @item k1
  8535. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  8536. no correction. Default is 0.
  8537. @item k2
  8538. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  8539. 0 means no correction. Default is 0.
  8540. @end table
  8541. The formula that generates the correction is:
  8542. @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)
  8543. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  8544. distances from the focal point in the source and target images, respectively.
  8545. @section lensfun
  8546. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  8547. The @code{lensfun} filter requires the camera make, camera model, and lens model
  8548. to apply the lens correction. The filter will load the lensfun database and
  8549. query it to find the corresponding camera and lens entries in the database. As
  8550. long as these entries can be found with the given options, the filter can
  8551. perform corrections on frames. Note that incomplete strings will result in the
  8552. filter choosing the best match with the given options, and the filter will
  8553. output the chosen camera and lens models (logged with level "info"). You must
  8554. provide the make, camera model, and lens model as they are required.
  8555. The filter accepts the following options:
  8556. @table @option
  8557. @item make
  8558. The make of the camera (for example, "Canon"). This option is required.
  8559. @item model
  8560. The model of the camera (for example, "Canon EOS 100D"). This option is
  8561. required.
  8562. @item lens_model
  8563. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  8564. option is required.
  8565. @item mode
  8566. The type of correction to apply. The following values are valid options:
  8567. @table @samp
  8568. @item vignetting
  8569. Enables fixing lens vignetting.
  8570. @item geometry
  8571. Enables fixing lens geometry. This is the default.
  8572. @item subpixel
  8573. Enables fixing chromatic aberrations.
  8574. @item vig_geo
  8575. Enables fixing lens vignetting and lens geometry.
  8576. @item vig_subpixel
  8577. Enables fixing lens vignetting and chromatic aberrations.
  8578. @item distortion
  8579. Enables fixing both lens geometry and chromatic aberrations.
  8580. @item all
  8581. Enables all possible corrections.
  8582. @end table
  8583. @item focal_length
  8584. The focal length of the image/video (zoom; expected constant for video). For
  8585. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  8586. range should be chosen when using that lens. Default 18.
  8587. @item aperture
  8588. The aperture of the image/video (expected constant for video). Note that
  8589. aperture is only used for vignetting correction. Default 3.5.
  8590. @item focus_distance
  8591. The focus distance of the image/video (expected constant for video). Note that
  8592. focus distance is only used for vignetting and only slightly affects the
  8593. vignetting correction process. If unknown, leave it at the default value (which
  8594. is 1000).
  8595. @item target_geometry
  8596. The target geometry of the output image/video. The following values are valid
  8597. options:
  8598. @table @samp
  8599. @item rectilinear (default)
  8600. @item fisheye
  8601. @item panoramic
  8602. @item equirectangular
  8603. @item fisheye_orthographic
  8604. @item fisheye_stereographic
  8605. @item fisheye_equisolid
  8606. @item fisheye_thoby
  8607. @end table
  8608. @item reverse
  8609. Apply the reverse of image correction (instead of correcting distortion, apply
  8610. it).
  8611. @item interpolation
  8612. The type of interpolation used when correcting distortion. The following values
  8613. are valid options:
  8614. @table @samp
  8615. @item nearest
  8616. @item linear (default)
  8617. @item lanczos
  8618. @end table
  8619. @end table
  8620. @subsection Examples
  8621. @itemize
  8622. @item
  8623. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  8624. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  8625. aperture of "8.0".
  8626. @example
  8627. ffmpeg -i input.mov -vf lensfun=make=Canon:model="Canon EOS 100D":lens_model="Canon EF-S 18-55mm f/3.5-5.6 IS STM":focal_length=18:aperture=8 -c:v h264 -b:v 8000k output.mov
  8628. @end example
  8629. @item
  8630. Apply the same as before, but only for the first 5 seconds of video.
  8631. @example
  8632. ffmpeg -i input.mov -vf lensfun=make=Canon:model="Canon EOS 100D":lens_model="Canon EF-S 18-55mm f/3.5-5.6 IS STM":focal_length=18:aperture=8:enable='lte(t\,5)' -c:v h264 -b:v 8000k output.mov
  8633. @end example
  8634. @end itemize
  8635. @section libvmaf
  8636. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  8637. score between two input videos.
  8638. The obtained VMAF score is printed through the logging system.
  8639. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  8640. After installing the library it can be enabled using:
  8641. @code{./configure --enable-libvmaf --enable-version3}.
  8642. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  8643. The filter has following options:
  8644. @table @option
  8645. @item model_path
  8646. Set the model path which is to be used for SVM.
  8647. Default value: @code{"vmaf_v0.6.1.pkl"}
  8648. @item log_path
  8649. Set the file path to be used to store logs.
  8650. @item log_fmt
  8651. Set the format of the log file (xml or json).
  8652. @item enable_transform
  8653. Enables transform for computing vmaf.
  8654. @item phone_model
  8655. Invokes the phone model which will generate VMAF scores higher than in the
  8656. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  8657. @item psnr
  8658. Enables computing psnr along with vmaf.
  8659. @item ssim
  8660. Enables computing ssim along with vmaf.
  8661. @item ms_ssim
  8662. Enables computing ms_ssim along with vmaf.
  8663. @item pool
  8664. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  8665. @item n_threads
  8666. Set number of threads to be used when computing vmaf.
  8667. @item n_subsample
  8668. Set interval for frame subsampling used when computing vmaf.
  8669. @item enable_conf_interval
  8670. Enables confidence interval.
  8671. @end table
  8672. This filter also supports the @ref{framesync} options.
  8673. On the below examples the input file @file{main.mpg} being processed is
  8674. compared with the reference file @file{ref.mpg}.
  8675. @example
  8676. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  8677. @end example
  8678. Example with options:
  8679. @example
  8680. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:enable-transform=1" -f null -
  8681. @end example
  8682. @section limiter
  8683. Limits the pixel components values to the specified range [min, max].
  8684. The filter accepts the following options:
  8685. @table @option
  8686. @item min
  8687. Lower bound. Defaults to the lowest allowed value for the input.
  8688. @item max
  8689. Upper bound. Defaults to the highest allowed value for the input.
  8690. @item planes
  8691. Specify which planes will be processed. Defaults to all available.
  8692. @end table
  8693. @section loop
  8694. Loop video frames.
  8695. The filter accepts the following options:
  8696. @table @option
  8697. @item loop
  8698. Set the number of loops. Setting this value to -1 will result in infinite loops.
  8699. Default is 0.
  8700. @item size
  8701. Set maximal size in number of frames. Default is 0.
  8702. @item start
  8703. Set first frame of loop. Default is 0.
  8704. @end table
  8705. @subsection Examples
  8706. @itemize
  8707. @item
  8708. Loop single first frame infinitely:
  8709. @example
  8710. loop=loop=-1:size=1:start=0
  8711. @end example
  8712. @item
  8713. Loop single first frame 10 times:
  8714. @example
  8715. loop=loop=10:size=1:start=0
  8716. @end example
  8717. @item
  8718. Loop 10 first frames 5 times:
  8719. @example
  8720. loop=loop=5:size=10:start=0
  8721. @end example
  8722. @end itemize
  8723. @section lut1d
  8724. Apply a 1D LUT to an input video.
  8725. The filter accepts the following options:
  8726. @table @option
  8727. @item file
  8728. Set the 1D LUT file name.
  8729. Currently supported formats:
  8730. @table @samp
  8731. @item cube
  8732. Iridas
  8733. @end table
  8734. @item interp
  8735. Select interpolation mode.
  8736. Available values are:
  8737. @table @samp
  8738. @item nearest
  8739. Use values from the nearest defined point.
  8740. @item linear
  8741. Interpolate values using the linear interpolation.
  8742. @item cubic
  8743. Interpolate values using the cubic interpolation.
  8744. @end table
  8745. @end table
  8746. @anchor{lut3d}
  8747. @section lut3d
  8748. Apply a 3D LUT to an input video.
  8749. The filter accepts the following options:
  8750. @table @option
  8751. @item file
  8752. Set the 3D LUT file name.
  8753. Currently supported formats:
  8754. @table @samp
  8755. @item 3dl
  8756. AfterEffects
  8757. @item cube
  8758. Iridas
  8759. @item dat
  8760. DaVinci
  8761. @item m3d
  8762. Pandora
  8763. @end table
  8764. @item interp
  8765. Select interpolation mode.
  8766. Available values are:
  8767. @table @samp
  8768. @item nearest
  8769. Use values from the nearest defined point.
  8770. @item trilinear
  8771. Interpolate values using the 8 points defining a cube.
  8772. @item tetrahedral
  8773. Interpolate values using a tetrahedron.
  8774. @end table
  8775. @end table
  8776. This filter also supports the @ref{framesync} options.
  8777. @section lumakey
  8778. Turn certain luma values into transparency.
  8779. The filter accepts the following options:
  8780. @table @option
  8781. @item threshold
  8782. Set the luma which will be used as base for transparency.
  8783. Default value is @code{0}.
  8784. @item tolerance
  8785. Set the range of luma values to be keyed out.
  8786. Default value is @code{0}.
  8787. @item softness
  8788. Set the range of softness. Default value is @code{0}.
  8789. Use this to control gradual transition from zero to full transparency.
  8790. @end table
  8791. @section lut, lutrgb, lutyuv
  8792. Compute a look-up table for binding each pixel component input value
  8793. to an output value, and apply it to the input video.
  8794. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  8795. to an RGB input video.
  8796. These filters accept the following parameters:
  8797. @table @option
  8798. @item c0
  8799. set first pixel component expression
  8800. @item c1
  8801. set second pixel component expression
  8802. @item c2
  8803. set third pixel component expression
  8804. @item c3
  8805. set fourth pixel component expression, corresponds to the alpha component
  8806. @item r
  8807. set red component expression
  8808. @item g
  8809. set green component expression
  8810. @item b
  8811. set blue component expression
  8812. @item a
  8813. alpha component expression
  8814. @item y
  8815. set Y/luminance component expression
  8816. @item u
  8817. set U/Cb component expression
  8818. @item v
  8819. set V/Cr component expression
  8820. @end table
  8821. Each of them specifies the expression to use for computing the lookup table for
  8822. the corresponding pixel component values.
  8823. The exact component associated to each of the @var{c*} options depends on the
  8824. format in input.
  8825. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  8826. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  8827. The expressions can contain the following constants and functions:
  8828. @table @option
  8829. @item w
  8830. @item h
  8831. The input width and height.
  8832. @item val
  8833. The input value for the pixel component.
  8834. @item clipval
  8835. The input value, clipped to the @var{minval}-@var{maxval} range.
  8836. @item maxval
  8837. The maximum value for the pixel component.
  8838. @item minval
  8839. The minimum value for the pixel component.
  8840. @item negval
  8841. The negated value for the pixel component value, clipped to the
  8842. @var{minval}-@var{maxval} range; it corresponds to the expression
  8843. "maxval-clipval+minval".
  8844. @item clip(val)
  8845. The computed value in @var{val}, clipped to the
  8846. @var{minval}-@var{maxval} range.
  8847. @item gammaval(gamma)
  8848. The computed gamma correction value of the pixel component value,
  8849. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  8850. expression
  8851. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  8852. @end table
  8853. All expressions default to "val".
  8854. @subsection Examples
  8855. @itemize
  8856. @item
  8857. Negate input video:
  8858. @example
  8859. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  8860. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  8861. @end example
  8862. The above is the same as:
  8863. @example
  8864. lutrgb="r=negval:g=negval:b=negval"
  8865. lutyuv="y=negval:u=negval:v=negval"
  8866. @end example
  8867. @item
  8868. Negate luminance:
  8869. @example
  8870. lutyuv=y=negval
  8871. @end example
  8872. @item
  8873. Remove chroma components, turning the video into a graytone image:
  8874. @example
  8875. lutyuv="u=128:v=128"
  8876. @end example
  8877. @item
  8878. Apply a luma burning effect:
  8879. @example
  8880. lutyuv="y=2*val"
  8881. @end example
  8882. @item
  8883. Remove green and blue components:
  8884. @example
  8885. lutrgb="g=0:b=0"
  8886. @end example
  8887. @item
  8888. Set a constant alpha channel value on input:
  8889. @example
  8890. format=rgba,lutrgb=a="maxval-minval/2"
  8891. @end example
  8892. @item
  8893. Correct luminance gamma by a factor of 0.5:
  8894. @example
  8895. lutyuv=y=gammaval(0.5)
  8896. @end example
  8897. @item
  8898. Discard least significant bits of luma:
  8899. @example
  8900. lutyuv=y='bitand(val, 128+64+32)'
  8901. @end example
  8902. @item
  8903. Technicolor like effect:
  8904. @example
  8905. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  8906. @end example
  8907. @end itemize
  8908. @section lut2, tlut2
  8909. The @code{lut2} filter takes two input streams and outputs one
  8910. stream.
  8911. The @code{tlut2} (time lut2) filter takes two consecutive frames
  8912. from one single stream.
  8913. This filter accepts the following parameters:
  8914. @table @option
  8915. @item c0
  8916. set first pixel component expression
  8917. @item c1
  8918. set second pixel component expression
  8919. @item c2
  8920. set third pixel component expression
  8921. @item c3
  8922. set fourth pixel component expression, corresponds to the alpha component
  8923. @end table
  8924. Each of them specifies the expression to use for computing the lookup table for
  8925. the corresponding pixel component values.
  8926. The exact component associated to each of the @var{c*} options depends on the
  8927. format in inputs.
  8928. The expressions can contain the following constants:
  8929. @table @option
  8930. @item w
  8931. @item h
  8932. The input width and height.
  8933. @item x
  8934. The first input value for the pixel component.
  8935. @item y
  8936. The second input value for the pixel component.
  8937. @item bdx
  8938. The first input video bit depth.
  8939. @item bdy
  8940. The second input video bit depth.
  8941. @end table
  8942. All expressions default to "x".
  8943. @subsection Examples
  8944. @itemize
  8945. @item
  8946. Highlight differences between two RGB video streams:
  8947. @example
  8948. 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)'
  8949. @end example
  8950. @item
  8951. Highlight differences between two YUV video streams:
  8952. @example
  8953. 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)'
  8954. @end example
  8955. @item
  8956. Show max difference between two video streams:
  8957. @example
  8958. 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)))'
  8959. @end example
  8960. @end itemize
  8961. @section maskedclamp
  8962. Clamp the first input stream with the second input and third input stream.
  8963. Returns the value of first stream to be between second input
  8964. stream - @code{undershoot} and third input stream + @code{overshoot}.
  8965. This filter accepts the following options:
  8966. @table @option
  8967. @item undershoot
  8968. Default value is @code{0}.
  8969. @item overshoot
  8970. Default value is @code{0}.
  8971. @item planes
  8972. Set which planes will be processed as bitmap, unprocessed planes will be
  8973. copied from first stream.
  8974. By default value 0xf, all planes will be processed.
  8975. @end table
  8976. @section maskedmerge
  8977. Merge the first input stream with the second input stream using per pixel
  8978. weights in the third input stream.
  8979. A value of 0 in the third stream pixel component means that pixel component
  8980. from first stream is returned unchanged, while maximum value (eg. 255 for
  8981. 8-bit videos) means that pixel component from second stream is returned
  8982. unchanged. Intermediate values define the amount of merging between both
  8983. input stream's pixel components.
  8984. This filter accepts the following options:
  8985. @table @option
  8986. @item planes
  8987. Set which planes will be processed as bitmap, unprocessed planes will be
  8988. copied from first stream.
  8989. By default value 0xf, all planes will be processed.
  8990. @end table
  8991. @section mcdeint
  8992. Apply motion-compensation deinterlacing.
  8993. It needs one field per frame as input and must thus be used together
  8994. with yadif=1/3 or equivalent.
  8995. This filter accepts the following options:
  8996. @table @option
  8997. @item mode
  8998. Set the deinterlacing mode.
  8999. It accepts one of the following values:
  9000. @table @samp
  9001. @item fast
  9002. @item medium
  9003. @item slow
  9004. use iterative motion estimation
  9005. @item extra_slow
  9006. like @samp{slow}, but use multiple reference frames.
  9007. @end table
  9008. Default value is @samp{fast}.
  9009. @item parity
  9010. Set the picture field parity assumed for the input video. It must be
  9011. one of the following values:
  9012. @table @samp
  9013. @item 0, tff
  9014. assume top field first
  9015. @item 1, bff
  9016. assume bottom field first
  9017. @end table
  9018. Default value is @samp{bff}.
  9019. @item qp
  9020. Set per-block quantization parameter (QP) used by the internal
  9021. encoder.
  9022. Higher values should result in a smoother motion vector field but less
  9023. optimal individual vectors. Default value is 1.
  9024. @end table
  9025. @section mergeplanes
  9026. Merge color channel components from several video streams.
  9027. The filter accepts up to 4 input streams, and merge selected input
  9028. planes to the output video.
  9029. This filter accepts the following options:
  9030. @table @option
  9031. @item mapping
  9032. Set input to output plane mapping. Default is @code{0}.
  9033. The mappings is specified as a bitmap. It should be specified as a
  9034. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  9035. mapping for the first plane of the output stream. 'A' sets the number of
  9036. the input stream to use (from 0 to 3), and 'a' the plane number of the
  9037. corresponding input to use (from 0 to 3). The rest of the mappings is
  9038. similar, 'Bb' describes the mapping for the output stream second
  9039. plane, 'Cc' describes the mapping for the output stream third plane and
  9040. 'Dd' describes the mapping for the output stream fourth plane.
  9041. @item format
  9042. Set output pixel format. Default is @code{yuva444p}.
  9043. @end table
  9044. @subsection Examples
  9045. @itemize
  9046. @item
  9047. Merge three gray video streams of same width and height into single video stream:
  9048. @example
  9049. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  9050. @end example
  9051. @item
  9052. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  9053. @example
  9054. [a0][a1]mergeplanes=0x00010210:yuva444p
  9055. @end example
  9056. @item
  9057. Swap Y and A plane in yuva444p stream:
  9058. @example
  9059. format=yuva444p,mergeplanes=0x03010200:yuva444p
  9060. @end example
  9061. @item
  9062. Swap U and V plane in yuv420p stream:
  9063. @example
  9064. format=yuv420p,mergeplanes=0x000201:yuv420p
  9065. @end example
  9066. @item
  9067. Cast a rgb24 clip to yuv444p:
  9068. @example
  9069. format=rgb24,mergeplanes=0x000102:yuv444p
  9070. @end example
  9071. @end itemize
  9072. @section mestimate
  9073. Estimate and export motion vectors using block matching algorithms.
  9074. Motion vectors are stored in frame side data to be used by other filters.
  9075. This filter accepts the following options:
  9076. @table @option
  9077. @item method
  9078. Specify the motion estimation method. Accepts one of the following values:
  9079. @table @samp
  9080. @item esa
  9081. Exhaustive search algorithm.
  9082. @item tss
  9083. Three step search algorithm.
  9084. @item tdls
  9085. Two dimensional logarithmic search algorithm.
  9086. @item ntss
  9087. New three step search algorithm.
  9088. @item fss
  9089. Four step search algorithm.
  9090. @item ds
  9091. Diamond search algorithm.
  9092. @item hexbs
  9093. Hexagon-based search algorithm.
  9094. @item epzs
  9095. Enhanced predictive zonal search algorithm.
  9096. @item umh
  9097. Uneven multi-hexagon search algorithm.
  9098. @end table
  9099. Default value is @samp{esa}.
  9100. @item mb_size
  9101. Macroblock size. Default @code{16}.
  9102. @item search_param
  9103. Search parameter. Default @code{7}.
  9104. @end table
  9105. @section midequalizer
  9106. Apply Midway Image Equalization effect using two video streams.
  9107. Midway Image Equalization adjusts a pair of images to have the same
  9108. histogram, while maintaining their dynamics as much as possible. It's
  9109. useful for e.g. matching exposures from a pair of stereo cameras.
  9110. This filter has two inputs and one output, which must be of same pixel format, but
  9111. may be of different sizes. The output of filter is first input adjusted with
  9112. midway histogram of both inputs.
  9113. This filter accepts the following option:
  9114. @table @option
  9115. @item planes
  9116. Set which planes to process. Default is @code{15}, which is all available planes.
  9117. @end table
  9118. @section minterpolate
  9119. Convert the video to specified frame rate using motion interpolation.
  9120. This filter accepts the following options:
  9121. @table @option
  9122. @item fps
  9123. 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}.
  9124. @item mi_mode
  9125. Motion interpolation mode. Following values are accepted:
  9126. @table @samp
  9127. @item dup
  9128. Duplicate previous or next frame for interpolating new ones.
  9129. @item blend
  9130. Blend source frames. Interpolated frame is mean of previous and next frames.
  9131. @item mci
  9132. Motion compensated interpolation. Following options are effective when this mode is selected:
  9133. @table @samp
  9134. @item mc_mode
  9135. Motion compensation mode. Following values are accepted:
  9136. @table @samp
  9137. @item obmc
  9138. Overlapped block motion compensation.
  9139. @item aobmc
  9140. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  9141. @end table
  9142. Default mode is @samp{obmc}.
  9143. @item me_mode
  9144. Motion estimation mode. Following values are accepted:
  9145. @table @samp
  9146. @item bidir
  9147. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  9148. @item bilat
  9149. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  9150. @end table
  9151. Default mode is @samp{bilat}.
  9152. @item me
  9153. The algorithm to be used for motion estimation. Following values are accepted:
  9154. @table @samp
  9155. @item esa
  9156. Exhaustive search algorithm.
  9157. @item tss
  9158. Three step search algorithm.
  9159. @item tdls
  9160. Two dimensional logarithmic search algorithm.
  9161. @item ntss
  9162. New three step search algorithm.
  9163. @item fss
  9164. Four step search algorithm.
  9165. @item ds
  9166. Diamond search algorithm.
  9167. @item hexbs
  9168. Hexagon-based search algorithm.
  9169. @item epzs
  9170. Enhanced predictive zonal search algorithm.
  9171. @item umh
  9172. Uneven multi-hexagon search algorithm.
  9173. @end table
  9174. Default algorithm is @samp{epzs}.
  9175. @item mb_size
  9176. Macroblock size. Default @code{16}.
  9177. @item search_param
  9178. Motion estimation search parameter. Default @code{32}.
  9179. @item vsbmc
  9180. 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).
  9181. @end table
  9182. @end table
  9183. @item scd
  9184. 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:
  9185. @table @samp
  9186. @item none
  9187. Disable scene change detection.
  9188. @item fdiff
  9189. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  9190. @end table
  9191. Default method is @samp{fdiff}.
  9192. @item scd_threshold
  9193. Scene change detection threshold. Default is @code{5.0}.
  9194. @end table
  9195. @section mix
  9196. Mix several video input streams into one video stream.
  9197. A description of the accepted options follows.
  9198. @table @option
  9199. @item nb_inputs
  9200. The number of inputs. If unspecified, it defaults to 2.
  9201. @item weights
  9202. Specify weight of each input video stream as sequence.
  9203. Each weight is separated by space. If number of weights
  9204. is smaller than number of @var{frames} last specified
  9205. weight will be used for all remaining unset weights.
  9206. @item scale
  9207. Specify scale, if it is set it will be multiplied with sum
  9208. of each weight multiplied with pixel values to give final destination
  9209. pixel value. By default @var{scale} is auto scaled to sum of weights.
  9210. @item duration
  9211. Specify how end of stream is determined.
  9212. @table @samp
  9213. @item longest
  9214. The duration of the longest input. (default)
  9215. @item shortest
  9216. The duration of the shortest input.
  9217. @item first
  9218. The duration of the first input.
  9219. @end table
  9220. @end table
  9221. @section mpdecimate
  9222. Drop frames that do not differ greatly from the previous frame in
  9223. order to reduce frame rate.
  9224. The main use of this filter is for very-low-bitrate encoding
  9225. (e.g. streaming over dialup modem), but it could in theory be used for
  9226. fixing movies that were inverse-telecined incorrectly.
  9227. A description of the accepted options follows.
  9228. @table @option
  9229. @item max
  9230. Set the maximum number of consecutive frames which can be dropped (if
  9231. positive), or the minimum interval between dropped frames (if
  9232. negative). If the value is 0, the frame is dropped disregarding the
  9233. number of previous sequentially dropped frames.
  9234. Default value is 0.
  9235. @item hi
  9236. @item lo
  9237. @item frac
  9238. Set the dropping threshold values.
  9239. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  9240. represent actual pixel value differences, so a threshold of 64
  9241. corresponds to 1 unit of difference for each pixel, or the same spread
  9242. out differently over the block.
  9243. A frame is a candidate for dropping if no 8x8 blocks differ by more
  9244. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  9245. meaning the whole image) differ by more than a threshold of @option{lo}.
  9246. Default value for @option{hi} is 64*12, default value for @option{lo} is
  9247. 64*5, and default value for @option{frac} is 0.33.
  9248. @end table
  9249. @section negate
  9250. Negate (invert) the input video.
  9251. It accepts the following option:
  9252. @table @option
  9253. @item negate_alpha
  9254. With value 1, it negates the alpha component, if present. Default value is 0.
  9255. @end table
  9256. @anchor{nlmeans}
  9257. @section nlmeans
  9258. Denoise frames using Non-Local Means algorithm.
  9259. Each pixel is adjusted by looking for other pixels with similar contexts. This
  9260. context similarity is defined by comparing their surrounding patches of size
  9261. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  9262. around the pixel.
  9263. Note that the research area defines centers for patches, which means some
  9264. patches will be made of pixels outside that research area.
  9265. The filter accepts the following options.
  9266. @table @option
  9267. @item s
  9268. Set denoising strength.
  9269. @item p
  9270. Set patch size.
  9271. @item pc
  9272. Same as @option{p} but for chroma planes.
  9273. The default value is @var{0} and means automatic.
  9274. @item r
  9275. Set research size.
  9276. @item rc
  9277. Same as @option{r} but for chroma planes.
  9278. The default value is @var{0} and means automatic.
  9279. @end table
  9280. @section nnedi
  9281. Deinterlace video using neural network edge directed interpolation.
  9282. This filter accepts the following options:
  9283. @table @option
  9284. @item weights
  9285. Mandatory option, without binary file filter can not work.
  9286. Currently file can be found here:
  9287. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  9288. @item deint
  9289. Set which frames to deinterlace, by default it is @code{all}.
  9290. Can be @code{all} or @code{interlaced}.
  9291. @item field
  9292. Set mode of operation.
  9293. Can be one of the following:
  9294. @table @samp
  9295. @item af
  9296. Use frame flags, both fields.
  9297. @item a
  9298. Use frame flags, single field.
  9299. @item t
  9300. Use top field only.
  9301. @item b
  9302. Use bottom field only.
  9303. @item tf
  9304. Use both fields, top first.
  9305. @item bf
  9306. Use both fields, bottom first.
  9307. @end table
  9308. @item planes
  9309. Set which planes to process, by default filter process all frames.
  9310. @item nsize
  9311. Set size of local neighborhood around each pixel, used by the predictor neural
  9312. network.
  9313. Can be one of the following:
  9314. @table @samp
  9315. @item s8x6
  9316. @item s16x6
  9317. @item s32x6
  9318. @item s48x6
  9319. @item s8x4
  9320. @item s16x4
  9321. @item s32x4
  9322. @end table
  9323. @item nns
  9324. Set the number of neurons in predictor neural network.
  9325. Can be one of the following:
  9326. @table @samp
  9327. @item n16
  9328. @item n32
  9329. @item n64
  9330. @item n128
  9331. @item n256
  9332. @end table
  9333. @item qual
  9334. Controls the number of different neural network predictions that are blended
  9335. together to compute the final output value. Can be @code{fast}, default or
  9336. @code{slow}.
  9337. @item etype
  9338. Set which set of weights to use in the predictor.
  9339. Can be one of the following:
  9340. @table @samp
  9341. @item a
  9342. weights trained to minimize absolute error
  9343. @item s
  9344. weights trained to minimize squared error
  9345. @end table
  9346. @item pscrn
  9347. Controls whether or not the prescreener neural network is used to decide
  9348. which pixels should be processed by the predictor neural network and which
  9349. can be handled by simple cubic interpolation.
  9350. The prescreener is trained to know whether cubic interpolation will be
  9351. sufficient for a pixel or whether it should be predicted by the predictor nn.
  9352. The computational complexity of the prescreener nn is much less than that of
  9353. the predictor nn. Since most pixels can be handled by cubic interpolation,
  9354. using the prescreener generally results in much faster processing.
  9355. The prescreener is pretty accurate, so the difference between using it and not
  9356. using it is almost always unnoticeable.
  9357. Can be one of the following:
  9358. @table @samp
  9359. @item none
  9360. @item original
  9361. @item new
  9362. @end table
  9363. Default is @code{new}.
  9364. @item fapprox
  9365. Set various debugging flags.
  9366. @end table
  9367. @section noformat
  9368. Force libavfilter not to use any of the specified pixel formats for the
  9369. input to the next filter.
  9370. It accepts the following parameters:
  9371. @table @option
  9372. @item pix_fmts
  9373. A '|'-separated list of pixel format names, such as
  9374. pix_fmts=yuv420p|monow|rgb24".
  9375. @end table
  9376. @subsection Examples
  9377. @itemize
  9378. @item
  9379. Force libavfilter to use a format different from @var{yuv420p} for the
  9380. input to the vflip filter:
  9381. @example
  9382. noformat=pix_fmts=yuv420p,vflip
  9383. @end example
  9384. @item
  9385. Convert the input video to any of the formats not contained in the list:
  9386. @example
  9387. noformat=yuv420p|yuv444p|yuv410p
  9388. @end example
  9389. @end itemize
  9390. @section noise
  9391. Add noise on video input frame.
  9392. The filter accepts the following options:
  9393. @table @option
  9394. @item all_seed
  9395. @item c0_seed
  9396. @item c1_seed
  9397. @item c2_seed
  9398. @item c3_seed
  9399. Set noise seed for specific pixel component or all pixel components in case
  9400. of @var{all_seed}. Default value is @code{123457}.
  9401. @item all_strength, alls
  9402. @item c0_strength, c0s
  9403. @item c1_strength, c1s
  9404. @item c2_strength, c2s
  9405. @item c3_strength, c3s
  9406. Set noise strength for specific pixel component or all pixel components in case
  9407. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  9408. @item all_flags, allf
  9409. @item c0_flags, c0f
  9410. @item c1_flags, c1f
  9411. @item c2_flags, c2f
  9412. @item c3_flags, c3f
  9413. Set pixel component flags or set flags for all components if @var{all_flags}.
  9414. Available values for component flags are:
  9415. @table @samp
  9416. @item a
  9417. averaged temporal noise (smoother)
  9418. @item p
  9419. mix random noise with a (semi)regular pattern
  9420. @item t
  9421. temporal noise (noise pattern changes between frames)
  9422. @item u
  9423. uniform noise (gaussian otherwise)
  9424. @end table
  9425. @end table
  9426. @subsection Examples
  9427. Add temporal and uniform noise to input video:
  9428. @example
  9429. noise=alls=20:allf=t+u
  9430. @end example
  9431. @section normalize
  9432. Normalize RGB video (aka histogram stretching, contrast stretching).
  9433. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  9434. For each channel of each frame, the filter computes the input range and maps
  9435. it linearly to the user-specified output range. The output range defaults
  9436. to the full dynamic range from pure black to pure white.
  9437. Temporal smoothing can be used on the input range to reduce flickering (rapid
  9438. changes in brightness) caused when small dark or bright objects enter or leave
  9439. the scene. This is similar to the auto-exposure (automatic gain control) on a
  9440. video camera, and, like a video camera, it may cause a period of over- or
  9441. under-exposure of the video.
  9442. The R,G,B channels can be normalized independently, which may cause some
  9443. color shifting, or linked together as a single channel, which prevents
  9444. color shifting. Linked normalization preserves hue. Independent normalization
  9445. does not, so it can be used to remove some color casts. Independent and linked
  9446. normalization can be combined in any ratio.
  9447. The normalize filter accepts the following options:
  9448. @table @option
  9449. @item blackpt
  9450. @item whitept
  9451. Colors which define the output range. The minimum input value is mapped to
  9452. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  9453. The defaults are black and white respectively. Specifying white for
  9454. @var{blackpt} and black for @var{whitept} will give color-inverted,
  9455. normalized video. Shades of grey can be used to reduce the dynamic range
  9456. (contrast). Specifying saturated colors here can create some interesting
  9457. effects.
  9458. @item smoothing
  9459. The number of previous frames to use for temporal smoothing. The input range
  9460. of each channel is smoothed using a rolling average over the current frame
  9461. and the @var{smoothing} previous frames. The default is 0 (no temporal
  9462. smoothing).
  9463. @item independence
  9464. Controls the ratio of independent (color shifting) channel normalization to
  9465. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  9466. independent. Defaults to 1.0 (fully independent).
  9467. @item strength
  9468. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  9469. expensive no-op. Defaults to 1.0 (full strength).
  9470. @end table
  9471. @subsection Examples
  9472. Stretch video contrast to use the full dynamic range, with no temporal
  9473. smoothing; may flicker depending on the source content:
  9474. @example
  9475. normalize=blackpt=black:whitept=white:smoothing=0
  9476. @end example
  9477. As above, but with 50 frames of temporal smoothing; flicker should be
  9478. reduced, depending on the source content:
  9479. @example
  9480. normalize=blackpt=black:whitept=white:smoothing=50
  9481. @end example
  9482. As above, but with hue-preserving linked channel normalization:
  9483. @example
  9484. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  9485. @end example
  9486. As above, but with half strength:
  9487. @example
  9488. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  9489. @end example
  9490. Map the darkest input color to red, the brightest input color to cyan:
  9491. @example
  9492. normalize=blackpt=red:whitept=cyan
  9493. @end example
  9494. @section null
  9495. Pass the video source unchanged to the output.
  9496. @section ocr
  9497. Optical Character Recognition
  9498. This filter uses Tesseract for optical character recognition. To enable
  9499. compilation of this filter, you need to configure FFmpeg with
  9500. @code{--enable-libtesseract}.
  9501. It accepts the following options:
  9502. @table @option
  9503. @item datapath
  9504. Set datapath to tesseract data. Default is to use whatever was
  9505. set at installation.
  9506. @item language
  9507. Set language, default is "eng".
  9508. @item whitelist
  9509. Set character whitelist.
  9510. @item blacklist
  9511. Set character blacklist.
  9512. @end table
  9513. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  9514. @section ocv
  9515. Apply a video transform using libopencv.
  9516. To enable this filter, install the libopencv library and headers and
  9517. configure FFmpeg with @code{--enable-libopencv}.
  9518. It accepts the following parameters:
  9519. @table @option
  9520. @item filter_name
  9521. The name of the libopencv filter to apply.
  9522. @item filter_params
  9523. The parameters to pass to the libopencv filter. If not specified, the default
  9524. values are assumed.
  9525. @end table
  9526. Refer to the official libopencv documentation for more precise
  9527. information:
  9528. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  9529. Several libopencv filters are supported; see the following subsections.
  9530. @anchor{dilate}
  9531. @subsection dilate
  9532. Dilate an image by using a specific structuring element.
  9533. It corresponds to the libopencv function @code{cvDilate}.
  9534. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  9535. @var{struct_el} represents a structuring element, and has the syntax:
  9536. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  9537. @var{cols} and @var{rows} represent the number of columns and rows of
  9538. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  9539. point, and @var{shape} the shape for the structuring element. @var{shape}
  9540. must be "rect", "cross", "ellipse", or "custom".
  9541. If the value for @var{shape} is "custom", it must be followed by a
  9542. string of the form "=@var{filename}". The file with name
  9543. @var{filename} is assumed to represent a binary image, with each
  9544. printable character corresponding to a bright pixel. When a custom
  9545. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  9546. or columns and rows of the read file are assumed instead.
  9547. The default value for @var{struct_el} is "3x3+0x0/rect".
  9548. @var{nb_iterations} specifies the number of times the transform is
  9549. applied to the image, and defaults to 1.
  9550. Some examples:
  9551. @example
  9552. # Use the default values
  9553. ocv=dilate
  9554. # Dilate using a structuring element with a 5x5 cross, iterating two times
  9555. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  9556. # Read the shape from the file diamond.shape, iterating two times.
  9557. # The file diamond.shape may contain a pattern of characters like this
  9558. # *
  9559. # ***
  9560. # *****
  9561. # ***
  9562. # *
  9563. # The specified columns and rows are ignored
  9564. # but the anchor point coordinates are not
  9565. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  9566. @end example
  9567. @subsection erode
  9568. Erode an image by using a specific structuring element.
  9569. It corresponds to the libopencv function @code{cvErode}.
  9570. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  9571. with the same syntax and semantics as the @ref{dilate} filter.
  9572. @subsection smooth
  9573. Smooth the input video.
  9574. The filter takes the following parameters:
  9575. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  9576. @var{type} is the type of smooth filter to apply, and must be one of
  9577. the following values: "blur", "blur_no_scale", "median", "gaussian",
  9578. or "bilateral". The default value is "gaussian".
  9579. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  9580. depend on the smooth type. @var{param1} and
  9581. @var{param2} accept integer positive values or 0. @var{param3} and
  9582. @var{param4} accept floating point values.
  9583. The default value for @var{param1} is 3. The default value for the
  9584. other parameters is 0.
  9585. These parameters correspond to the parameters assigned to the
  9586. libopencv function @code{cvSmooth}.
  9587. @section oscilloscope
  9588. 2D Video Oscilloscope.
  9589. Useful to measure spatial impulse, step responses, chroma delays, etc.
  9590. It accepts the following parameters:
  9591. @table @option
  9592. @item x
  9593. Set scope center x position.
  9594. @item y
  9595. Set scope center y position.
  9596. @item s
  9597. Set scope size, relative to frame diagonal.
  9598. @item t
  9599. Set scope tilt/rotation.
  9600. @item o
  9601. Set trace opacity.
  9602. @item tx
  9603. Set trace center x position.
  9604. @item ty
  9605. Set trace center y position.
  9606. @item tw
  9607. Set trace width, relative to width of frame.
  9608. @item th
  9609. Set trace height, relative to height of frame.
  9610. @item c
  9611. Set which components to trace. By default it traces first three components.
  9612. @item g
  9613. Draw trace grid. By default is enabled.
  9614. @item st
  9615. Draw some statistics. By default is enabled.
  9616. @item sc
  9617. Draw scope. By default is enabled.
  9618. @end table
  9619. @subsection Examples
  9620. @itemize
  9621. @item
  9622. Inspect full first row of video frame.
  9623. @example
  9624. oscilloscope=x=0.5:y=0:s=1
  9625. @end example
  9626. @item
  9627. Inspect full last row of video frame.
  9628. @example
  9629. oscilloscope=x=0.5:y=1:s=1
  9630. @end example
  9631. @item
  9632. Inspect full 5th line of video frame of height 1080.
  9633. @example
  9634. oscilloscope=x=0.5:y=5/1080:s=1
  9635. @end example
  9636. @item
  9637. Inspect full last column of video frame.
  9638. @example
  9639. oscilloscope=x=1:y=0.5:s=1:t=1
  9640. @end example
  9641. @end itemize
  9642. @anchor{overlay}
  9643. @section overlay
  9644. Overlay one video on top of another.
  9645. It takes two inputs and has one output. The first input is the "main"
  9646. video on which the second input is overlaid.
  9647. It accepts the following parameters:
  9648. A description of the accepted options follows.
  9649. @table @option
  9650. @item x
  9651. @item y
  9652. Set the expression for the x and y coordinates of the overlaid video
  9653. on the main video. Default value is "0" for both expressions. In case
  9654. the expression is invalid, it is set to a huge value (meaning that the
  9655. overlay will not be displayed within the output visible area).
  9656. @item eof_action
  9657. See @ref{framesync}.
  9658. @item eval
  9659. Set when the expressions for @option{x}, and @option{y} are evaluated.
  9660. It accepts the following values:
  9661. @table @samp
  9662. @item init
  9663. only evaluate expressions once during the filter initialization or
  9664. when a command is processed
  9665. @item frame
  9666. evaluate expressions for each incoming frame
  9667. @end table
  9668. Default value is @samp{frame}.
  9669. @item shortest
  9670. See @ref{framesync}.
  9671. @item format
  9672. Set the format for the output video.
  9673. It accepts the following values:
  9674. @table @samp
  9675. @item yuv420
  9676. force YUV420 output
  9677. @item yuv422
  9678. force YUV422 output
  9679. @item yuv444
  9680. force YUV444 output
  9681. @item rgb
  9682. force packed RGB output
  9683. @item gbrp
  9684. force planar RGB output
  9685. @item auto
  9686. automatically pick format
  9687. @end table
  9688. Default value is @samp{yuv420}.
  9689. @item repeatlast
  9690. See @ref{framesync}.
  9691. @item alpha
  9692. Set format of alpha of the overlaid video, it can be @var{straight} or
  9693. @var{premultiplied}. Default is @var{straight}.
  9694. @end table
  9695. The @option{x}, and @option{y} expressions can contain the following
  9696. parameters.
  9697. @table @option
  9698. @item main_w, W
  9699. @item main_h, H
  9700. The main input width and height.
  9701. @item overlay_w, w
  9702. @item overlay_h, h
  9703. The overlay input width and height.
  9704. @item x
  9705. @item y
  9706. The computed values for @var{x} and @var{y}. They are evaluated for
  9707. each new frame.
  9708. @item hsub
  9709. @item vsub
  9710. horizontal and vertical chroma subsample values of the output
  9711. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  9712. @var{vsub} is 1.
  9713. @item n
  9714. the number of input frame, starting from 0
  9715. @item pos
  9716. the position in the file of the input frame, NAN if unknown
  9717. @item t
  9718. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  9719. @end table
  9720. This filter also supports the @ref{framesync} options.
  9721. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  9722. when evaluation is done @emph{per frame}, and will evaluate to NAN
  9723. when @option{eval} is set to @samp{init}.
  9724. Be aware that frames are taken from each input video in timestamp
  9725. order, hence, if their initial timestamps differ, it is a good idea
  9726. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  9727. have them begin in the same zero timestamp, as the example for
  9728. the @var{movie} filter does.
  9729. You can chain together more overlays but you should test the
  9730. efficiency of such approach.
  9731. @subsection Commands
  9732. This filter supports the following commands:
  9733. @table @option
  9734. @item x
  9735. @item y
  9736. Modify the x and y of the overlay input.
  9737. The command accepts the same syntax of the corresponding option.
  9738. If the specified expression is not valid, it is kept at its current
  9739. value.
  9740. @end table
  9741. @subsection Examples
  9742. @itemize
  9743. @item
  9744. Draw the overlay at 10 pixels from the bottom right corner of the main
  9745. video:
  9746. @example
  9747. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  9748. @end example
  9749. Using named options the example above becomes:
  9750. @example
  9751. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  9752. @end example
  9753. @item
  9754. Insert a transparent PNG logo in the bottom left corner of the input,
  9755. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  9756. @example
  9757. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  9758. @end example
  9759. @item
  9760. Insert 2 different transparent PNG logos (second logo on bottom
  9761. right corner) using the @command{ffmpeg} tool:
  9762. @example
  9763. 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
  9764. @end example
  9765. @item
  9766. Add a transparent color layer on top of the main video; @code{WxH}
  9767. must specify the size of the main input to the overlay filter:
  9768. @example
  9769. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  9770. @end example
  9771. @item
  9772. Play an original video and a filtered version (here with the deshake
  9773. filter) side by side using the @command{ffplay} tool:
  9774. @example
  9775. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  9776. @end example
  9777. The above command is the same as:
  9778. @example
  9779. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  9780. @end example
  9781. @item
  9782. Make a sliding overlay appearing from the left to the right top part of the
  9783. screen starting since time 2:
  9784. @example
  9785. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  9786. @end example
  9787. @item
  9788. Compose output by putting two input videos side to side:
  9789. @example
  9790. ffmpeg -i left.avi -i right.avi -filter_complex "
  9791. nullsrc=size=200x100 [background];
  9792. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  9793. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  9794. [background][left] overlay=shortest=1 [background+left];
  9795. [background+left][right] overlay=shortest=1:x=100 [left+right]
  9796. "
  9797. @end example
  9798. @item
  9799. Mask 10-20 seconds of a video by applying the delogo filter to a section
  9800. @example
  9801. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  9802. -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]'
  9803. masked.avi
  9804. @end example
  9805. @item
  9806. Chain several overlays in cascade:
  9807. @example
  9808. nullsrc=s=200x200 [bg];
  9809. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  9810. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  9811. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  9812. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  9813. [in3] null, [mid2] overlay=100:100 [out0]
  9814. @end example
  9815. @end itemize
  9816. @section owdenoise
  9817. Apply Overcomplete Wavelet denoiser.
  9818. The filter accepts the following options:
  9819. @table @option
  9820. @item depth
  9821. Set depth.
  9822. Larger depth values will denoise lower frequency components more, but
  9823. slow down filtering.
  9824. Must be an int in the range 8-16, default is @code{8}.
  9825. @item luma_strength, ls
  9826. Set luma strength.
  9827. Must be a double value in the range 0-1000, default is @code{1.0}.
  9828. @item chroma_strength, cs
  9829. Set chroma strength.
  9830. Must be a double value in the range 0-1000, default is @code{1.0}.
  9831. @end table
  9832. @anchor{pad}
  9833. @section pad
  9834. Add paddings to the input image, and place the original input at the
  9835. provided @var{x}, @var{y} coordinates.
  9836. It accepts the following parameters:
  9837. @table @option
  9838. @item width, w
  9839. @item height, h
  9840. Specify an expression for the size of the output image with the
  9841. paddings added. If the value for @var{width} or @var{height} is 0, the
  9842. corresponding input size is used for the output.
  9843. The @var{width} expression can reference the value set by the
  9844. @var{height} expression, and vice versa.
  9845. The default value of @var{width} and @var{height} is 0.
  9846. @item x
  9847. @item y
  9848. Specify the offsets to place the input image at within the padded area,
  9849. with respect to the top/left border of the output image.
  9850. The @var{x} expression can reference the value set by the @var{y}
  9851. expression, and vice versa.
  9852. The default value of @var{x} and @var{y} is 0.
  9853. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  9854. so the input image is centered on the padded area.
  9855. @item color
  9856. Specify the color of the padded area. For the syntax of this option,
  9857. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  9858. manual,ffmpeg-utils}.
  9859. The default value of @var{color} is "black".
  9860. @item eval
  9861. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  9862. It accepts the following values:
  9863. @table @samp
  9864. @item init
  9865. Only evaluate expressions once during the filter initialization or when
  9866. a command is processed.
  9867. @item frame
  9868. Evaluate expressions for each incoming frame.
  9869. @end table
  9870. Default value is @samp{init}.
  9871. @item aspect
  9872. Pad to aspect instead to a resolution.
  9873. @end table
  9874. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  9875. options are expressions containing the following constants:
  9876. @table @option
  9877. @item in_w
  9878. @item in_h
  9879. The input video width and height.
  9880. @item iw
  9881. @item ih
  9882. These are the same as @var{in_w} and @var{in_h}.
  9883. @item out_w
  9884. @item out_h
  9885. The output width and height (the size of the padded area), as
  9886. specified by the @var{width} and @var{height} expressions.
  9887. @item ow
  9888. @item oh
  9889. These are the same as @var{out_w} and @var{out_h}.
  9890. @item x
  9891. @item y
  9892. The x and y offsets as specified by the @var{x} and @var{y}
  9893. expressions, or NAN if not yet specified.
  9894. @item a
  9895. same as @var{iw} / @var{ih}
  9896. @item sar
  9897. input sample aspect ratio
  9898. @item dar
  9899. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  9900. @item hsub
  9901. @item vsub
  9902. The horizontal and vertical chroma subsample values. For example for the
  9903. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9904. @end table
  9905. @subsection Examples
  9906. @itemize
  9907. @item
  9908. Add paddings with the color "violet" to the input video. The output video
  9909. size is 640x480, and the top-left corner of the input video is placed at
  9910. column 0, row 40
  9911. @example
  9912. pad=640:480:0:40:violet
  9913. @end example
  9914. The example above is equivalent to the following command:
  9915. @example
  9916. pad=width=640:height=480:x=0:y=40:color=violet
  9917. @end example
  9918. @item
  9919. Pad the input to get an output with dimensions increased by 3/2,
  9920. and put the input video at the center of the padded area:
  9921. @example
  9922. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  9923. @end example
  9924. @item
  9925. Pad the input to get a squared output with size equal to the maximum
  9926. value between the input width and height, and put the input video at
  9927. the center of the padded area:
  9928. @example
  9929. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  9930. @end example
  9931. @item
  9932. Pad the input to get a final w/h ratio of 16:9:
  9933. @example
  9934. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  9935. @end example
  9936. @item
  9937. In case of anamorphic video, in order to set the output display aspect
  9938. correctly, it is necessary to use @var{sar} in the expression,
  9939. according to the relation:
  9940. @example
  9941. (ih * X / ih) * sar = output_dar
  9942. X = output_dar / sar
  9943. @end example
  9944. Thus the previous example needs to be modified to:
  9945. @example
  9946. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  9947. @end example
  9948. @item
  9949. Double the output size and put the input video in the bottom-right
  9950. corner of the output padded area:
  9951. @example
  9952. pad="2*iw:2*ih:ow-iw:oh-ih"
  9953. @end example
  9954. @end itemize
  9955. @anchor{palettegen}
  9956. @section palettegen
  9957. Generate one palette for a whole video stream.
  9958. It accepts the following options:
  9959. @table @option
  9960. @item max_colors
  9961. Set the maximum number of colors to quantize in the palette.
  9962. Note: the palette will still contain 256 colors; the unused palette entries
  9963. will be black.
  9964. @item reserve_transparent
  9965. Create a palette of 255 colors maximum and reserve the last one for
  9966. transparency. Reserving the transparency color is useful for GIF optimization.
  9967. If not set, the maximum of colors in the palette will be 256. You probably want
  9968. to disable this option for a standalone image.
  9969. Set by default.
  9970. @item transparency_color
  9971. Set the color that will be used as background for transparency.
  9972. @item stats_mode
  9973. Set statistics mode.
  9974. It accepts the following values:
  9975. @table @samp
  9976. @item full
  9977. Compute full frame histograms.
  9978. @item diff
  9979. Compute histograms only for the part that differs from previous frame. This
  9980. might be relevant to give more importance to the moving part of your input if
  9981. the background is static.
  9982. @item single
  9983. Compute new histogram for each frame.
  9984. @end table
  9985. Default value is @var{full}.
  9986. @end table
  9987. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  9988. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  9989. color quantization of the palette. This information is also visible at
  9990. @var{info} logging level.
  9991. @subsection Examples
  9992. @itemize
  9993. @item
  9994. Generate a representative palette of a given video using @command{ffmpeg}:
  9995. @example
  9996. ffmpeg -i input.mkv -vf palettegen palette.png
  9997. @end example
  9998. @end itemize
  9999. @section paletteuse
  10000. Use a palette to downsample an input video stream.
  10001. The filter takes two inputs: one video stream and a palette. The palette must
  10002. be a 256 pixels image.
  10003. It accepts the following options:
  10004. @table @option
  10005. @item dither
  10006. Select dithering mode. Available algorithms are:
  10007. @table @samp
  10008. @item bayer
  10009. Ordered 8x8 bayer dithering (deterministic)
  10010. @item heckbert
  10011. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  10012. Note: this dithering is sometimes considered "wrong" and is included as a
  10013. reference.
  10014. @item floyd_steinberg
  10015. Floyd and Steingberg dithering (error diffusion)
  10016. @item sierra2
  10017. Frankie Sierra dithering v2 (error diffusion)
  10018. @item sierra2_4a
  10019. Frankie Sierra dithering v2 "Lite" (error diffusion)
  10020. @end table
  10021. Default is @var{sierra2_4a}.
  10022. @item bayer_scale
  10023. When @var{bayer} dithering is selected, this option defines the scale of the
  10024. pattern (how much the crosshatch pattern is visible). A low value means more
  10025. visible pattern for less banding, and higher value means less visible pattern
  10026. at the cost of more banding.
  10027. The option must be an integer value in the range [0,5]. Default is @var{2}.
  10028. @item diff_mode
  10029. If set, define the zone to process
  10030. @table @samp
  10031. @item rectangle
  10032. Only the changing rectangle will be reprocessed. This is similar to GIF
  10033. cropping/offsetting compression mechanism. This option can be useful for speed
  10034. if only a part of the image is changing, and has use cases such as limiting the
  10035. scope of the error diffusal @option{dither} to the rectangle that bounds the
  10036. moving scene (it leads to more deterministic output if the scene doesn't change
  10037. much, and as a result less moving noise and better GIF compression).
  10038. @end table
  10039. Default is @var{none}.
  10040. @item new
  10041. Take new palette for each output frame.
  10042. @item alpha_threshold
  10043. Sets the alpha threshold for transparency. Alpha values above this threshold
  10044. will be treated as completely opaque, and values below this threshold will be
  10045. treated as completely transparent.
  10046. The option must be an integer value in the range [0,255]. Default is @var{128}.
  10047. @end table
  10048. @subsection Examples
  10049. @itemize
  10050. @item
  10051. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  10052. using @command{ffmpeg}:
  10053. @example
  10054. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  10055. @end example
  10056. @end itemize
  10057. @section perspective
  10058. Correct perspective of video not recorded perpendicular to the screen.
  10059. A description of the accepted parameters follows.
  10060. @table @option
  10061. @item x0
  10062. @item y0
  10063. @item x1
  10064. @item y1
  10065. @item x2
  10066. @item y2
  10067. @item x3
  10068. @item y3
  10069. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  10070. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  10071. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  10072. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  10073. then the corners of the source will be sent to the specified coordinates.
  10074. The expressions can use the following variables:
  10075. @table @option
  10076. @item W
  10077. @item H
  10078. the width and height of video frame.
  10079. @item in
  10080. Input frame count.
  10081. @item on
  10082. Output frame count.
  10083. @end table
  10084. @item interpolation
  10085. Set interpolation for perspective correction.
  10086. It accepts the following values:
  10087. @table @samp
  10088. @item linear
  10089. @item cubic
  10090. @end table
  10091. Default value is @samp{linear}.
  10092. @item sense
  10093. Set interpretation of coordinate options.
  10094. It accepts the following values:
  10095. @table @samp
  10096. @item 0, source
  10097. Send point in the source specified by the given coordinates to
  10098. the corners of the destination.
  10099. @item 1, destination
  10100. Send the corners of the source to the point in the destination specified
  10101. by the given coordinates.
  10102. Default value is @samp{source}.
  10103. @end table
  10104. @item eval
  10105. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  10106. It accepts the following values:
  10107. @table @samp
  10108. @item init
  10109. only evaluate expressions once during the filter initialization or
  10110. when a command is processed
  10111. @item frame
  10112. evaluate expressions for each incoming frame
  10113. @end table
  10114. Default value is @samp{init}.
  10115. @end table
  10116. @section phase
  10117. Delay interlaced video by one field time so that the field order changes.
  10118. The intended use is to fix PAL movies that have been captured with the
  10119. opposite field order to the film-to-video transfer.
  10120. A description of the accepted parameters follows.
  10121. @table @option
  10122. @item mode
  10123. Set phase mode.
  10124. It accepts the following values:
  10125. @table @samp
  10126. @item t
  10127. Capture field order top-first, transfer bottom-first.
  10128. Filter will delay the bottom field.
  10129. @item b
  10130. Capture field order bottom-first, transfer top-first.
  10131. Filter will delay the top field.
  10132. @item p
  10133. Capture and transfer with the same field order. This mode only exists
  10134. for the documentation of the other options to refer to, but if you
  10135. actually select it, the filter will faithfully do nothing.
  10136. @item a
  10137. Capture field order determined automatically by field flags, transfer
  10138. opposite.
  10139. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  10140. basis using field flags. If no field information is available,
  10141. then this works just like @samp{u}.
  10142. @item u
  10143. Capture unknown or varying, transfer opposite.
  10144. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  10145. analyzing the images and selecting the alternative that produces best
  10146. match between the fields.
  10147. @item T
  10148. Capture top-first, transfer unknown or varying.
  10149. Filter selects among @samp{t} and @samp{p} using image analysis.
  10150. @item B
  10151. Capture bottom-first, transfer unknown or varying.
  10152. Filter selects among @samp{b} and @samp{p} using image analysis.
  10153. @item A
  10154. Capture determined by field flags, transfer unknown or varying.
  10155. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  10156. image analysis. If no field information is available, then this works just
  10157. like @samp{U}. This is the default mode.
  10158. @item U
  10159. Both capture and transfer unknown or varying.
  10160. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  10161. @end table
  10162. @end table
  10163. @section pixdesctest
  10164. Pixel format descriptor test filter, mainly useful for internal
  10165. testing. The output video should be equal to the input video.
  10166. For example:
  10167. @example
  10168. format=monow, pixdesctest
  10169. @end example
  10170. can be used to test the monowhite pixel format descriptor definition.
  10171. @section pixscope
  10172. Display sample values of color channels. Mainly useful for checking color
  10173. and levels. Minimum supported resolution is 640x480.
  10174. The filters accept the following options:
  10175. @table @option
  10176. @item x
  10177. Set scope X position, relative offset on X axis.
  10178. @item y
  10179. Set scope Y position, relative offset on Y axis.
  10180. @item w
  10181. Set scope width.
  10182. @item h
  10183. Set scope height.
  10184. @item o
  10185. Set window opacity. This window also holds statistics about pixel area.
  10186. @item wx
  10187. Set window X position, relative offset on X axis.
  10188. @item wy
  10189. Set window Y position, relative offset on Y axis.
  10190. @end table
  10191. @section pp
  10192. Enable the specified chain of postprocessing subfilters using libpostproc. This
  10193. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  10194. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  10195. Each subfilter and some options have a short and a long name that can be used
  10196. interchangeably, i.e. dr/dering are the same.
  10197. The filters accept the following options:
  10198. @table @option
  10199. @item subfilters
  10200. Set postprocessing subfilters string.
  10201. @end table
  10202. All subfilters share common options to determine their scope:
  10203. @table @option
  10204. @item a/autoq
  10205. Honor the quality commands for this subfilter.
  10206. @item c/chrom
  10207. Do chrominance filtering, too (default).
  10208. @item y/nochrom
  10209. Do luminance filtering only (no chrominance).
  10210. @item n/noluma
  10211. Do chrominance filtering only (no luminance).
  10212. @end table
  10213. These options can be appended after the subfilter name, separated by a '|'.
  10214. Available subfilters are:
  10215. @table @option
  10216. @item hb/hdeblock[|difference[|flatness]]
  10217. Horizontal deblocking filter
  10218. @table @option
  10219. @item difference
  10220. Difference factor where higher values mean more deblocking (default: @code{32}).
  10221. @item flatness
  10222. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10223. @end table
  10224. @item vb/vdeblock[|difference[|flatness]]
  10225. Vertical deblocking filter
  10226. @table @option
  10227. @item difference
  10228. Difference factor where higher values mean more deblocking (default: @code{32}).
  10229. @item flatness
  10230. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10231. @end table
  10232. @item ha/hadeblock[|difference[|flatness]]
  10233. Accurate horizontal deblocking filter
  10234. @table @option
  10235. @item difference
  10236. Difference factor where higher values mean more deblocking (default: @code{32}).
  10237. @item flatness
  10238. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10239. @end table
  10240. @item va/vadeblock[|difference[|flatness]]
  10241. Accurate vertical deblocking filter
  10242. @table @option
  10243. @item difference
  10244. Difference factor where higher values mean more deblocking (default: @code{32}).
  10245. @item flatness
  10246. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  10247. @end table
  10248. @end table
  10249. The horizontal and vertical deblocking filters share the difference and
  10250. flatness values so you cannot set different horizontal and vertical
  10251. thresholds.
  10252. @table @option
  10253. @item h1/x1hdeblock
  10254. Experimental horizontal deblocking filter
  10255. @item v1/x1vdeblock
  10256. Experimental vertical deblocking filter
  10257. @item dr/dering
  10258. Deringing filter
  10259. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  10260. @table @option
  10261. @item threshold1
  10262. larger -> stronger filtering
  10263. @item threshold2
  10264. larger -> stronger filtering
  10265. @item threshold3
  10266. larger -> stronger filtering
  10267. @end table
  10268. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  10269. @table @option
  10270. @item f/fullyrange
  10271. Stretch luminance to @code{0-255}.
  10272. @end table
  10273. @item lb/linblenddeint
  10274. Linear blend deinterlacing filter that deinterlaces the given block by
  10275. filtering all lines with a @code{(1 2 1)} filter.
  10276. @item li/linipoldeint
  10277. Linear interpolating deinterlacing filter that deinterlaces the given block by
  10278. linearly interpolating every second line.
  10279. @item ci/cubicipoldeint
  10280. Cubic interpolating deinterlacing filter deinterlaces the given block by
  10281. cubically interpolating every second line.
  10282. @item md/mediandeint
  10283. Median deinterlacing filter that deinterlaces the given block by applying a
  10284. median filter to every second line.
  10285. @item fd/ffmpegdeint
  10286. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  10287. second line with a @code{(-1 4 2 4 -1)} filter.
  10288. @item l5/lowpass5
  10289. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  10290. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  10291. @item fq/forceQuant[|quantizer]
  10292. Overrides the quantizer table from the input with the constant quantizer you
  10293. specify.
  10294. @table @option
  10295. @item quantizer
  10296. Quantizer to use
  10297. @end table
  10298. @item de/default
  10299. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  10300. @item fa/fast
  10301. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  10302. @item ac
  10303. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  10304. @end table
  10305. @subsection Examples
  10306. @itemize
  10307. @item
  10308. Apply horizontal and vertical deblocking, deringing and automatic
  10309. brightness/contrast:
  10310. @example
  10311. pp=hb/vb/dr/al
  10312. @end example
  10313. @item
  10314. Apply default filters without brightness/contrast correction:
  10315. @example
  10316. pp=de/-al
  10317. @end example
  10318. @item
  10319. Apply default filters and temporal denoiser:
  10320. @example
  10321. pp=default/tmpnoise|1|2|3
  10322. @end example
  10323. @item
  10324. Apply deblocking on luminance only, and switch vertical deblocking on or off
  10325. automatically depending on available CPU time:
  10326. @example
  10327. pp=hb|y/vb|a
  10328. @end example
  10329. @end itemize
  10330. @section pp7
  10331. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  10332. similar to spp = 6 with 7 point DCT, where only the center sample is
  10333. used after IDCT.
  10334. The filter accepts the following options:
  10335. @table @option
  10336. @item qp
  10337. Force a constant quantization parameter. It accepts an integer in range
  10338. 0 to 63. If not set, the filter will use the QP from the video stream
  10339. (if available).
  10340. @item mode
  10341. Set thresholding mode. Available modes are:
  10342. @table @samp
  10343. @item hard
  10344. Set hard thresholding.
  10345. @item soft
  10346. Set soft thresholding (better de-ringing effect, but likely blurrier).
  10347. @item medium
  10348. Set medium thresholding (good results, default).
  10349. @end table
  10350. @end table
  10351. @section premultiply
  10352. Apply alpha premultiply effect to input video stream using first plane
  10353. of second stream as alpha.
  10354. Both streams must have same dimensions and same pixel format.
  10355. The filter accepts the following option:
  10356. @table @option
  10357. @item planes
  10358. Set which planes will be processed, unprocessed planes will be copied.
  10359. By default value 0xf, all planes will be processed.
  10360. @item inplace
  10361. Do not require 2nd input for processing, instead use alpha plane from input stream.
  10362. @end table
  10363. @section prewitt
  10364. Apply prewitt operator to input video stream.
  10365. The filter accepts the following option:
  10366. @table @option
  10367. @item planes
  10368. Set which planes will be processed, unprocessed planes will be copied.
  10369. By default value 0xf, all planes will be processed.
  10370. @item scale
  10371. Set value which will be multiplied with filtered result.
  10372. @item delta
  10373. Set value which will be added to filtered result.
  10374. @end table
  10375. @anchor{program_opencl}
  10376. @section program_opencl
  10377. Filter video using an OpenCL program.
  10378. @table @option
  10379. @item source
  10380. OpenCL program source file.
  10381. @item kernel
  10382. Kernel name in program.
  10383. @item inputs
  10384. Number of inputs to the filter. Defaults to 1.
  10385. @item size, s
  10386. Size of output frames. Defaults to the same as the first input.
  10387. @end table
  10388. The program source file must contain a kernel function with the given name,
  10389. which will be run once for each plane of the output. Each run on a plane
  10390. gets enqueued as a separate 2D global NDRange with one work-item for each
  10391. pixel to be generated. The global ID offset for each work-item is therefore
  10392. the coordinates of a pixel in the destination image.
  10393. The kernel function needs to take the following arguments:
  10394. @itemize
  10395. @item
  10396. Destination image, @var{__write_only image2d_t}.
  10397. This image will become the output; the kernel should write all of it.
  10398. @item
  10399. Frame index, @var{unsigned int}.
  10400. This is a counter starting from zero and increasing by one for each frame.
  10401. @item
  10402. Source images, @var{__read_only image2d_t}.
  10403. These are the most recent images on each input. The kernel may read from
  10404. them to generate the output, but they can't be written to.
  10405. @end itemize
  10406. Example programs:
  10407. @itemize
  10408. @item
  10409. Copy the input to the output (output must be the same size as the input).
  10410. @verbatim
  10411. __kernel void copy(__write_only image2d_t destination,
  10412. unsigned int index,
  10413. __read_only image2d_t source)
  10414. {
  10415. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  10416. int2 location = (int2)(get_global_id(0), get_global_id(1));
  10417. float4 value = read_imagef(source, sampler, location);
  10418. write_imagef(destination, location, value);
  10419. }
  10420. @end verbatim
  10421. @item
  10422. Apply a simple transformation, rotating the input by an amount increasing
  10423. with the index counter. Pixel values are linearly interpolated by the
  10424. sampler, and the output need not have the same dimensions as the input.
  10425. @verbatim
  10426. __kernel void rotate_image(__write_only image2d_t dst,
  10427. unsigned int index,
  10428. __read_only image2d_t src)
  10429. {
  10430. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  10431. CLK_FILTER_LINEAR);
  10432. float angle = (float)index / 100.0f;
  10433. float2 dst_dim = convert_float2(get_image_dim(dst));
  10434. float2 src_dim = convert_float2(get_image_dim(src));
  10435. float2 dst_cen = dst_dim / 2.0f;
  10436. float2 src_cen = src_dim / 2.0f;
  10437. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  10438. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  10439. float2 src_pos = {
  10440. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  10441. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  10442. };
  10443. src_pos = src_pos * src_dim / dst_dim;
  10444. float2 src_loc = src_pos + src_cen;
  10445. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  10446. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  10447. write_imagef(dst, dst_loc, 0.5f);
  10448. else
  10449. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  10450. }
  10451. @end verbatim
  10452. @item
  10453. Blend two inputs together, with the amount of each input used varying
  10454. with the index counter.
  10455. @verbatim
  10456. __kernel void blend_images(__write_only image2d_t dst,
  10457. unsigned int index,
  10458. __read_only image2d_t src1,
  10459. __read_only image2d_t src2)
  10460. {
  10461. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  10462. CLK_FILTER_LINEAR);
  10463. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  10464. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  10465. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  10466. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  10467. float4 val1 = read_imagef(src1, sampler, src1_loc);
  10468. float4 val2 = read_imagef(src2, sampler, src2_loc);
  10469. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  10470. }
  10471. @end verbatim
  10472. @end itemize
  10473. @section pseudocolor
  10474. Alter frame colors in video with pseudocolors.
  10475. This filter accept the following options:
  10476. @table @option
  10477. @item c0
  10478. set pixel first component expression
  10479. @item c1
  10480. set pixel second component expression
  10481. @item c2
  10482. set pixel third component expression
  10483. @item c3
  10484. set pixel fourth component expression, corresponds to the alpha component
  10485. @item i
  10486. set component to use as base for altering colors
  10487. @end table
  10488. Each of them specifies the expression to use for computing the lookup table for
  10489. the corresponding pixel component values.
  10490. The expressions can contain the following constants and functions:
  10491. @table @option
  10492. @item w
  10493. @item h
  10494. The input width and height.
  10495. @item val
  10496. The input value for the pixel component.
  10497. @item ymin, umin, vmin, amin
  10498. The minimum allowed component value.
  10499. @item ymax, umax, vmax, amax
  10500. The maximum allowed component value.
  10501. @end table
  10502. All expressions default to "val".
  10503. @subsection Examples
  10504. @itemize
  10505. @item
  10506. Change too high luma values to gradient:
  10507. @example
  10508. 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'"
  10509. @end example
  10510. @end itemize
  10511. @section psnr
  10512. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  10513. Ratio) between two input videos.
  10514. This filter takes in input two input videos, the first input is
  10515. considered the "main" source and is passed unchanged to the
  10516. output. The second input is used as a "reference" video for computing
  10517. the PSNR.
  10518. Both video inputs must have the same resolution and pixel format for
  10519. this filter to work correctly. Also it assumes that both inputs
  10520. have the same number of frames, which are compared one by one.
  10521. The obtained average PSNR is printed through the logging system.
  10522. The filter stores the accumulated MSE (mean squared error) of each
  10523. frame, and at the end of the processing it is averaged across all frames
  10524. equally, and the following formula is applied to obtain the PSNR:
  10525. @example
  10526. PSNR = 10*log10(MAX^2/MSE)
  10527. @end example
  10528. Where MAX is the average of the maximum values of each component of the
  10529. image.
  10530. The description of the accepted parameters follows.
  10531. @table @option
  10532. @item stats_file, f
  10533. If specified the filter will use the named file to save the PSNR of
  10534. each individual frame. When filename equals "-" the data is sent to
  10535. standard output.
  10536. @item stats_version
  10537. Specifies which version of the stats file format to use. Details of
  10538. each format are written below.
  10539. Default value is 1.
  10540. @item stats_add_max
  10541. Determines whether the max value is output to the stats log.
  10542. Default value is 0.
  10543. Requires stats_version >= 2. If this is set and stats_version < 2,
  10544. the filter will return an error.
  10545. @end table
  10546. This filter also supports the @ref{framesync} options.
  10547. The file printed if @var{stats_file} is selected, contains a sequence of
  10548. key/value pairs of the form @var{key}:@var{value} for each compared
  10549. couple of frames.
  10550. If a @var{stats_version} greater than 1 is specified, a header line precedes
  10551. the list of per-frame-pair stats, with key value pairs following the frame
  10552. format with the following parameters:
  10553. @table @option
  10554. @item psnr_log_version
  10555. The version of the log file format. Will match @var{stats_version}.
  10556. @item fields
  10557. A comma separated list of the per-frame-pair parameters included in
  10558. the log.
  10559. @end table
  10560. A description of each shown per-frame-pair parameter follows:
  10561. @table @option
  10562. @item n
  10563. sequential number of the input frame, starting from 1
  10564. @item mse_avg
  10565. Mean Square Error pixel-by-pixel average difference of the compared
  10566. frames, averaged over all the image components.
  10567. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  10568. Mean Square Error pixel-by-pixel average difference of the compared
  10569. frames for the component specified by the suffix.
  10570. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  10571. Peak Signal to Noise ratio of the compared frames for the component
  10572. specified by the suffix.
  10573. @item max_avg, max_y, max_u, max_v
  10574. Maximum allowed value for each channel, and average over all
  10575. channels.
  10576. @end table
  10577. For example:
  10578. @example
  10579. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  10580. [main][ref] psnr="stats_file=stats.log" [out]
  10581. @end example
  10582. On this example the input file being processed is compared with the
  10583. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  10584. is stored in @file{stats.log}.
  10585. @anchor{pullup}
  10586. @section pullup
  10587. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  10588. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  10589. content.
  10590. The pullup filter is designed to take advantage of future context in making
  10591. its decisions. This filter is stateless in the sense that it does not lock
  10592. onto a pattern to follow, but it instead looks forward to the following
  10593. fields in order to identify matches and rebuild progressive frames.
  10594. To produce content with an even framerate, insert the fps filter after
  10595. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  10596. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  10597. The filter accepts the following options:
  10598. @table @option
  10599. @item jl
  10600. @item jr
  10601. @item jt
  10602. @item jb
  10603. These options set the amount of "junk" to ignore at the left, right, top, and
  10604. bottom of the image, respectively. Left and right are in units of 8 pixels,
  10605. while top and bottom are in units of 2 lines.
  10606. The default is 8 pixels on each side.
  10607. @item sb
  10608. Set the strict breaks. Setting this option to 1 will reduce the chances of
  10609. filter generating an occasional mismatched frame, but it may also cause an
  10610. excessive number of frames to be dropped during high motion sequences.
  10611. Conversely, setting it to -1 will make filter match fields more easily.
  10612. This may help processing of video where there is slight blurring between
  10613. the fields, but may also cause there to be interlaced frames in the output.
  10614. Default value is @code{0}.
  10615. @item mp
  10616. Set the metric plane to use. It accepts the following values:
  10617. @table @samp
  10618. @item l
  10619. Use luma plane.
  10620. @item u
  10621. Use chroma blue plane.
  10622. @item v
  10623. Use chroma red plane.
  10624. @end table
  10625. This option may be set to use chroma plane instead of the default luma plane
  10626. for doing filter's computations. This may improve accuracy on very clean
  10627. source material, but more likely will decrease accuracy, especially if there
  10628. is chroma noise (rainbow effect) or any grayscale video.
  10629. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  10630. load and make pullup usable in realtime on slow machines.
  10631. @end table
  10632. For best results (without duplicated frames in the output file) it is
  10633. necessary to change the output frame rate. For example, to inverse
  10634. telecine NTSC input:
  10635. @example
  10636. ffmpeg -i input -vf pullup -r 24000/1001 ...
  10637. @end example
  10638. @section qp
  10639. Change video quantization parameters (QP).
  10640. The filter accepts the following option:
  10641. @table @option
  10642. @item qp
  10643. Set expression for quantization parameter.
  10644. @end table
  10645. The expression is evaluated through the eval API and can contain, among others,
  10646. the following constants:
  10647. @table @var
  10648. @item known
  10649. 1 if index is not 129, 0 otherwise.
  10650. @item qp
  10651. Sequential index starting from -129 to 128.
  10652. @end table
  10653. @subsection Examples
  10654. @itemize
  10655. @item
  10656. Some equation like:
  10657. @example
  10658. qp=2+2*sin(PI*qp)
  10659. @end example
  10660. @end itemize
  10661. @section random
  10662. Flush video frames from internal cache of frames into a random order.
  10663. No frame is discarded.
  10664. Inspired by @ref{frei0r} nervous filter.
  10665. @table @option
  10666. @item frames
  10667. Set size in number of frames of internal cache, in range from @code{2} to
  10668. @code{512}. Default is @code{30}.
  10669. @item seed
  10670. Set seed for random number generator, must be an integer included between
  10671. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  10672. less than @code{0}, the filter will try to use a good random seed on a
  10673. best effort basis.
  10674. @end table
  10675. @section readeia608
  10676. Read closed captioning (EIA-608) information from the top lines of a video frame.
  10677. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  10678. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  10679. with EIA-608 data (starting from 0). A description of each metadata value follows:
  10680. @table @option
  10681. @item lavfi.readeia608.X.cc
  10682. The two bytes stored as EIA-608 data (printed in hexadecimal).
  10683. @item lavfi.readeia608.X.line
  10684. The number of the line on which the EIA-608 data was identified and read.
  10685. @end table
  10686. This filter accepts the following options:
  10687. @table @option
  10688. @item scan_min
  10689. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  10690. @item scan_max
  10691. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  10692. @item mac
  10693. Set minimal acceptable amplitude change for sync codes detection.
  10694. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  10695. @item spw
  10696. Set the ratio of width reserved for sync code detection.
  10697. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  10698. @item mhd
  10699. Set the max peaks height difference for sync code detection.
  10700. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  10701. @item mpd
  10702. Set max peaks period difference for sync code detection.
  10703. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  10704. @item msd
  10705. Set the first two max start code bits differences.
  10706. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  10707. @item bhd
  10708. Set the minimum ratio of bits height compared to 3rd start code bit.
  10709. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  10710. @item th_w
  10711. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  10712. @item th_b
  10713. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  10714. @item chp
  10715. Enable checking the parity bit. In the event of a parity error, the filter will output
  10716. @code{0x00} for that character. Default is false.
  10717. @end table
  10718. @subsection Examples
  10719. @itemize
  10720. @item
  10721. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  10722. @example
  10723. 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
  10724. @end example
  10725. @end itemize
  10726. @section readvitc
  10727. Read vertical interval timecode (VITC) information from the top lines of a
  10728. video frame.
  10729. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  10730. timecode value, if a valid timecode has been detected. Further metadata key
  10731. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  10732. timecode data has been found or not.
  10733. This filter accepts the following options:
  10734. @table @option
  10735. @item scan_max
  10736. Set the maximum number of lines to scan for VITC data. If the value is set to
  10737. @code{-1} the full video frame is scanned. Default is @code{45}.
  10738. @item thr_b
  10739. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  10740. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  10741. @item thr_w
  10742. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  10743. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  10744. @end table
  10745. @subsection Examples
  10746. @itemize
  10747. @item
  10748. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  10749. draw @code{--:--:--:--} as a placeholder:
  10750. @example
  10751. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  10752. @end example
  10753. @end itemize
  10754. @section remap
  10755. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  10756. Destination pixel at position (X, Y) will be picked from source (x, y) position
  10757. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  10758. value for pixel will be used for destination pixel.
  10759. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  10760. will have Xmap/Ymap video stream dimensions.
  10761. Xmap and Ymap input video streams are 16bit depth, single channel.
  10762. @section removegrain
  10763. The removegrain filter is a spatial denoiser for progressive video.
  10764. @table @option
  10765. @item m0
  10766. Set mode for the first plane.
  10767. @item m1
  10768. Set mode for the second plane.
  10769. @item m2
  10770. Set mode for the third plane.
  10771. @item m3
  10772. Set mode for the fourth plane.
  10773. @end table
  10774. Range of mode is from 0 to 24. Description of each mode follows:
  10775. @table @var
  10776. @item 0
  10777. Leave input plane unchanged. Default.
  10778. @item 1
  10779. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  10780. @item 2
  10781. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  10782. @item 3
  10783. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  10784. @item 4
  10785. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  10786. This is equivalent to a median filter.
  10787. @item 5
  10788. Line-sensitive clipping giving the minimal change.
  10789. @item 6
  10790. Line-sensitive clipping, intermediate.
  10791. @item 7
  10792. Line-sensitive clipping, intermediate.
  10793. @item 8
  10794. Line-sensitive clipping, intermediate.
  10795. @item 9
  10796. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  10797. @item 10
  10798. Replaces the target pixel with the closest neighbour.
  10799. @item 11
  10800. [1 2 1] horizontal and vertical kernel blur.
  10801. @item 12
  10802. Same as mode 11.
  10803. @item 13
  10804. Bob mode, interpolates top field from the line where the neighbours
  10805. pixels are the closest.
  10806. @item 14
  10807. Bob mode, interpolates bottom field from the line where the neighbours
  10808. pixels are the closest.
  10809. @item 15
  10810. Bob mode, interpolates top field. Same as 13 but with a more complicated
  10811. interpolation formula.
  10812. @item 16
  10813. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  10814. interpolation formula.
  10815. @item 17
  10816. Clips the pixel with the minimum and maximum of respectively the maximum and
  10817. minimum of each pair of opposite neighbour pixels.
  10818. @item 18
  10819. Line-sensitive clipping using opposite neighbours whose greatest distance from
  10820. the current pixel is minimal.
  10821. @item 19
  10822. Replaces the pixel with the average of its 8 neighbours.
  10823. @item 20
  10824. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  10825. @item 21
  10826. Clips pixels using the averages of opposite neighbour.
  10827. @item 22
  10828. Same as mode 21 but simpler and faster.
  10829. @item 23
  10830. Small edge and halo removal, but reputed useless.
  10831. @item 24
  10832. Similar as 23.
  10833. @end table
  10834. @section removelogo
  10835. Suppress a TV station logo, using an image file to determine which
  10836. pixels comprise the logo. It works by filling in the pixels that
  10837. comprise the logo with neighboring pixels.
  10838. The filter accepts the following options:
  10839. @table @option
  10840. @item filename, f
  10841. Set the filter bitmap file, which can be any image format supported by
  10842. libavformat. The width and height of the image file must match those of the
  10843. video stream being processed.
  10844. @end table
  10845. Pixels in the provided bitmap image with a value of zero are not
  10846. considered part of the logo, non-zero pixels are considered part of
  10847. the logo. If you use white (255) for the logo and black (0) for the
  10848. rest, you will be safe. For making the filter bitmap, it is
  10849. recommended to take a screen capture of a black frame with the logo
  10850. visible, and then using a threshold filter followed by the erode
  10851. filter once or twice.
  10852. If needed, little splotches can be fixed manually. Remember that if
  10853. logo pixels are not covered, the filter quality will be much
  10854. reduced. Marking too many pixels as part of the logo does not hurt as
  10855. much, but it will increase the amount of blurring needed to cover over
  10856. the image and will destroy more information than necessary, and extra
  10857. pixels will slow things down on a large logo.
  10858. @section repeatfields
  10859. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  10860. fields based on its value.
  10861. @section reverse
  10862. Reverse a video clip.
  10863. Warning: This filter requires memory to buffer the entire clip, so trimming
  10864. is suggested.
  10865. @subsection Examples
  10866. @itemize
  10867. @item
  10868. Take the first 5 seconds of a clip, and reverse it.
  10869. @example
  10870. trim=end=5,reverse
  10871. @end example
  10872. @end itemize
  10873. @section roberts
  10874. Apply roberts cross operator to input video stream.
  10875. The filter accepts the following option:
  10876. @table @option
  10877. @item planes
  10878. Set which planes will be processed, unprocessed planes will be copied.
  10879. By default value 0xf, all planes will be processed.
  10880. @item scale
  10881. Set value which will be multiplied with filtered result.
  10882. @item delta
  10883. Set value which will be added to filtered result.
  10884. @end table
  10885. @section rotate
  10886. Rotate video by an arbitrary angle expressed in radians.
  10887. The filter accepts the following options:
  10888. A description of the optional parameters follows.
  10889. @table @option
  10890. @item angle, a
  10891. Set an expression for the angle by which to rotate the input video
  10892. clockwise, expressed as a number of radians. A negative value will
  10893. result in a counter-clockwise rotation. By default it is set to "0".
  10894. This expression is evaluated for each frame.
  10895. @item out_w, ow
  10896. Set the output width expression, default value is "iw".
  10897. This expression is evaluated just once during configuration.
  10898. @item out_h, oh
  10899. Set the output height expression, default value is "ih".
  10900. This expression is evaluated just once during configuration.
  10901. @item bilinear
  10902. Enable bilinear interpolation if set to 1, a value of 0 disables
  10903. it. Default value is 1.
  10904. @item fillcolor, c
  10905. Set the color used to fill the output area not covered by the rotated
  10906. image. For the general syntax of this option, check the
  10907. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10908. If the special value "none" is selected then no
  10909. background is printed (useful for example if the background is never shown).
  10910. Default value is "black".
  10911. @end table
  10912. The expressions for the angle and the output size can contain the
  10913. following constants and functions:
  10914. @table @option
  10915. @item n
  10916. sequential number of the input frame, starting from 0. It is always NAN
  10917. before the first frame is filtered.
  10918. @item t
  10919. time in seconds of the input frame, it is set to 0 when the filter is
  10920. configured. It is always NAN before the first frame is filtered.
  10921. @item hsub
  10922. @item vsub
  10923. horizontal and vertical chroma subsample values. For example for the
  10924. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10925. @item in_w, iw
  10926. @item in_h, ih
  10927. the input video width and height
  10928. @item out_w, ow
  10929. @item out_h, oh
  10930. the output width and height, that is the size of the padded area as
  10931. specified by the @var{width} and @var{height} expressions
  10932. @item rotw(a)
  10933. @item roth(a)
  10934. the minimal width/height required for completely containing the input
  10935. video rotated by @var{a} radians.
  10936. These are only available when computing the @option{out_w} and
  10937. @option{out_h} expressions.
  10938. @end table
  10939. @subsection Examples
  10940. @itemize
  10941. @item
  10942. Rotate the input by PI/6 radians clockwise:
  10943. @example
  10944. rotate=PI/6
  10945. @end example
  10946. @item
  10947. Rotate the input by PI/6 radians counter-clockwise:
  10948. @example
  10949. rotate=-PI/6
  10950. @end example
  10951. @item
  10952. Rotate the input by 45 degrees clockwise:
  10953. @example
  10954. rotate=45*PI/180
  10955. @end example
  10956. @item
  10957. Apply a constant rotation with period T, starting from an angle of PI/3:
  10958. @example
  10959. rotate=PI/3+2*PI*t/T
  10960. @end example
  10961. @item
  10962. Make the input video rotation oscillating with a period of T
  10963. seconds and an amplitude of A radians:
  10964. @example
  10965. rotate=A*sin(2*PI/T*t)
  10966. @end example
  10967. @item
  10968. Rotate the video, output size is chosen so that the whole rotating
  10969. input video is always completely contained in the output:
  10970. @example
  10971. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  10972. @end example
  10973. @item
  10974. Rotate the video, reduce the output size so that no background is ever
  10975. shown:
  10976. @example
  10977. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  10978. @end example
  10979. @end itemize
  10980. @subsection Commands
  10981. The filter supports the following commands:
  10982. @table @option
  10983. @item a, angle
  10984. Set the angle expression.
  10985. The command accepts the same syntax of the corresponding option.
  10986. If the specified expression is not valid, it is kept at its current
  10987. value.
  10988. @end table
  10989. @section sab
  10990. Apply Shape Adaptive Blur.
  10991. The filter accepts the following options:
  10992. @table @option
  10993. @item luma_radius, lr
  10994. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  10995. value is 1.0. A greater value will result in a more blurred image, and
  10996. in slower processing.
  10997. @item luma_pre_filter_radius, lpfr
  10998. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  10999. value is 1.0.
  11000. @item luma_strength, ls
  11001. Set luma maximum difference between pixels to still be considered, must
  11002. be a value in the 0.1-100.0 range, default value is 1.0.
  11003. @item chroma_radius, cr
  11004. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  11005. greater value will result in a more blurred image, and in slower
  11006. processing.
  11007. @item chroma_pre_filter_radius, cpfr
  11008. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  11009. @item chroma_strength, cs
  11010. Set chroma maximum difference between pixels to still be considered,
  11011. must be a value in the -0.9-100.0 range.
  11012. @end table
  11013. Each chroma option value, if not explicitly specified, is set to the
  11014. corresponding luma option value.
  11015. @anchor{scale}
  11016. @section scale
  11017. Scale (resize) the input video, using the libswscale library.
  11018. The scale filter forces the output display aspect ratio to be the same
  11019. of the input, by changing the output sample aspect ratio.
  11020. If the input image format is different from the format requested by
  11021. the next filter, the scale filter will convert the input to the
  11022. requested format.
  11023. @subsection Options
  11024. The filter accepts the following options, or any of the options
  11025. supported by the libswscale scaler.
  11026. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  11027. the complete list of scaler options.
  11028. @table @option
  11029. @item width, w
  11030. @item height, h
  11031. Set the output video dimension expression. Default value is the input
  11032. dimension.
  11033. If the @var{width} or @var{w} value is 0, the input width is used for
  11034. the output. If the @var{height} or @var{h} value is 0, the input height
  11035. is used for the output.
  11036. If one and only one of the values is -n with n >= 1, the scale filter
  11037. will use a value that maintains the aspect ratio of the input image,
  11038. calculated from the other specified dimension. After that it will,
  11039. however, make sure that the calculated dimension is divisible by n and
  11040. adjust the value if necessary.
  11041. If both values are -n with n >= 1, the behavior will be identical to
  11042. both values being set to 0 as previously detailed.
  11043. See below for the list of accepted constants for use in the dimension
  11044. expression.
  11045. @item eval
  11046. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  11047. @table @samp
  11048. @item init
  11049. Only evaluate expressions once during the filter initialization or when a command is processed.
  11050. @item frame
  11051. Evaluate expressions for each incoming frame.
  11052. @end table
  11053. Default value is @samp{init}.
  11054. @item interl
  11055. Set the interlacing mode. It accepts the following values:
  11056. @table @samp
  11057. @item 1
  11058. Force interlaced aware scaling.
  11059. @item 0
  11060. Do not apply interlaced scaling.
  11061. @item -1
  11062. Select interlaced aware scaling depending on whether the source frames
  11063. are flagged as interlaced or not.
  11064. @end table
  11065. Default value is @samp{0}.
  11066. @item flags
  11067. Set libswscale scaling flags. See
  11068. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11069. complete list of values. If not explicitly specified the filter applies
  11070. the default flags.
  11071. @item param0, param1
  11072. Set libswscale input parameters for scaling algorithms that need them. See
  11073. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  11074. complete documentation. If not explicitly specified the filter applies
  11075. empty parameters.
  11076. @item size, s
  11077. Set the video size. For the syntax of this option, check the
  11078. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11079. @item in_color_matrix
  11080. @item out_color_matrix
  11081. Set in/output YCbCr color space type.
  11082. This allows the autodetected value to be overridden as well as allows forcing
  11083. a specific value used for the output and encoder.
  11084. If not specified, the color space type depends on the pixel format.
  11085. Possible values:
  11086. @table @samp
  11087. @item auto
  11088. Choose automatically.
  11089. @item bt709
  11090. Format conforming to International Telecommunication Union (ITU)
  11091. Recommendation BT.709.
  11092. @item fcc
  11093. Set color space conforming to the United States Federal Communications
  11094. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  11095. @item bt601
  11096. Set color space conforming to:
  11097. @itemize
  11098. @item
  11099. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  11100. @item
  11101. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  11102. @item
  11103. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  11104. @end itemize
  11105. @item smpte240m
  11106. Set color space conforming to SMPTE ST 240:1999.
  11107. @end table
  11108. @item in_range
  11109. @item out_range
  11110. Set in/output YCbCr sample range.
  11111. This allows the autodetected value to be overridden as well as allows forcing
  11112. a specific value used for the output and encoder. If not specified, the
  11113. range depends on the pixel format. Possible values:
  11114. @table @samp
  11115. @item auto/unknown
  11116. Choose automatically.
  11117. @item jpeg/full/pc
  11118. Set full range (0-255 in case of 8-bit luma).
  11119. @item mpeg/limited/tv
  11120. Set "MPEG" range (16-235 in case of 8-bit luma).
  11121. @end table
  11122. @item force_original_aspect_ratio
  11123. Enable decreasing or increasing output video width or height if necessary to
  11124. keep the original aspect ratio. Possible values:
  11125. @table @samp
  11126. @item disable
  11127. Scale the video as specified and disable this feature.
  11128. @item decrease
  11129. The output video dimensions will automatically be decreased if needed.
  11130. @item increase
  11131. The output video dimensions will automatically be increased if needed.
  11132. @end table
  11133. One useful instance of this option is that when you know a specific device's
  11134. maximum allowed resolution, you can use this to limit the output video to
  11135. that, while retaining the aspect ratio. For example, device A allows
  11136. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  11137. decrease) and specifying 1280x720 to the command line makes the output
  11138. 1280x533.
  11139. Please note that this is a different thing than specifying -1 for @option{w}
  11140. or @option{h}, you still need to specify the output resolution for this option
  11141. to work.
  11142. @end table
  11143. The values of the @option{w} and @option{h} options are expressions
  11144. containing the following constants:
  11145. @table @var
  11146. @item in_w
  11147. @item in_h
  11148. The input width and height
  11149. @item iw
  11150. @item ih
  11151. These are the same as @var{in_w} and @var{in_h}.
  11152. @item out_w
  11153. @item out_h
  11154. The output (scaled) width and height
  11155. @item ow
  11156. @item oh
  11157. These are the same as @var{out_w} and @var{out_h}
  11158. @item a
  11159. The same as @var{iw} / @var{ih}
  11160. @item sar
  11161. input sample aspect ratio
  11162. @item dar
  11163. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  11164. @item hsub
  11165. @item vsub
  11166. horizontal and vertical input chroma subsample values. For example for the
  11167. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11168. @item ohsub
  11169. @item ovsub
  11170. horizontal and vertical output chroma subsample values. For example for the
  11171. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11172. @end table
  11173. @subsection Examples
  11174. @itemize
  11175. @item
  11176. Scale the input video to a size of 200x100
  11177. @example
  11178. scale=w=200:h=100
  11179. @end example
  11180. This is equivalent to:
  11181. @example
  11182. scale=200:100
  11183. @end example
  11184. or:
  11185. @example
  11186. scale=200x100
  11187. @end example
  11188. @item
  11189. Specify a size abbreviation for the output size:
  11190. @example
  11191. scale=qcif
  11192. @end example
  11193. which can also be written as:
  11194. @example
  11195. scale=size=qcif
  11196. @end example
  11197. @item
  11198. Scale the input to 2x:
  11199. @example
  11200. scale=w=2*iw:h=2*ih
  11201. @end example
  11202. @item
  11203. The above is the same as:
  11204. @example
  11205. scale=2*in_w:2*in_h
  11206. @end example
  11207. @item
  11208. Scale the input to 2x with forced interlaced scaling:
  11209. @example
  11210. scale=2*iw:2*ih:interl=1
  11211. @end example
  11212. @item
  11213. Scale the input to half size:
  11214. @example
  11215. scale=w=iw/2:h=ih/2
  11216. @end example
  11217. @item
  11218. Increase the width, and set the height to the same size:
  11219. @example
  11220. scale=3/2*iw:ow
  11221. @end example
  11222. @item
  11223. Seek Greek harmony:
  11224. @example
  11225. scale=iw:1/PHI*iw
  11226. scale=ih*PHI:ih
  11227. @end example
  11228. @item
  11229. Increase the height, and set the width to 3/2 of the height:
  11230. @example
  11231. scale=w=3/2*oh:h=3/5*ih
  11232. @end example
  11233. @item
  11234. Increase the size, making the size a multiple of the chroma
  11235. subsample values:
  11236. @example
  11237. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  11238. @end example
  11239. @item
  11240. Increase the width to a maximum of 500 pixels,
  11241. keeping the same aspect ratio as the input:
  11242. @example
  11243. scale=w='min(500\, iw*3/2):h=-1'
  11244. @end example
  11245. @item
  11246. Make pixels square by combining scale and setsar:
  11247. @example
  11248. scale='trunc(ih*dar):ih',setsar=1/1
  11249. @end example
  11250. @item
  11251. Make pixels square by combining scale and setsar,
  11252. making sure the resulting resolution is even (required by some codecs):
  11253. @example
  11254. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  11255. @end example
  11256. @end itemize
  11257. @subsection Commands
  11258. This filter supports the following commands:
  11259. @table @option
  11260. @item width, w
  11261. @item height, h
  11262. Set the output video dimension expression.
  11263. The command accepts the same syntax of the corresponding option.
  11264. If the specified expression is not valid, it is kept at its current
  11265. value.
  11266. @end table
  11267. @section scale_npp
  11268. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  11269. format conversion on CUDA video frames. Setting the output width and height
  11270. works in the same way as for the @var{scale} filter.
  11271. The following additional options are accepted:
  11272. @table @option
  11273. @item format
  11274. The pixel format of the output CUDA frames. If set to the string "same" (the
  11275. default), the input format will be kept. Note that automatic format negotiation
  11276. and conversion is not yet supported for hardware frames
  11277. @item interp_algo
  11278. The interpolation algorithm used for resizing. One of the following:
  11279. @table @option
  11280. @item nn
  11281. Nearest neighbour.
  11282. @item linear
  11283. @item cubic
  11284. @item cubic2p_bspline
  11285. 2-parameter cubic (B=1, C=0)
  11286. @item cubic2p_catmullrom
  11287. 2-parameter cubic (B=0, C=1/2)
  11288. @item cubic2p_b05c03
  11289. 2-parameter cubic (B=1/2, C=3/10)
  11290. @item super
  11291. Supersampling
  11292. @item lanczos
  11293. @end table
  11294. @end table
  11295. @section scale2ref
  11296. Scale (resize) the input video, based on a reference video.
  11297. See the scale filter for available options, scale2ref supports the same but
  11298. uses the reference video instead of the main input as basis. scale2ref also
  11299. supports the following additional constants for the @option{w} and
  11300. @option{h} options:
  11301. @table @var
  11302. @item main_w
  11303. @item main_h
  11304. The main input video's width and height
  11305. @item main_a
  11306. The same as @var{main_w} / @var{main_h}
  11307. @item main_sar
  11308. The main input video's sample aspect ratio
  11309. @item main_dar, mdar
  11310. The main input video's display aspect ratio. Calculated from
  11311. @code{(main_w / main_h) * main_sar}.
  11312. @item main_hsub
  11313. @item main_vsub
  11314. The main input video's horizontal and vertical chroma subsample values.
  11315. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  11316. is 1.
  11317. @end table
  11318. @subsection Examples
  11319. @itemize
  11320. @item
  11321. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  11322. @example
  11323. 'scale2ref[b][a];[a][b]overlay'
  11324. @end example
  11325. @end itemize
  11326. @anchor{selectivecolor}
  11327. @section selectivecolor
  11328. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  11329. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  11330. by the "purity" of the color (that is, how saturated it already is).
  11331. This filter is similar to the Adobe Photoshop Selective Color tool.
  11332. The filter accepts the following options:
  11333. @table @option
  11334. @item correction_method
  11335. Select color correction method.
  11336. Available values are:
  11337. @table @samp
  11338. @item absolute
  11339. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  11340. component value).
  11341. @item relative
  11342. Specified adjustments are relative to the original component value.
  11343. @end table
  11344. Default is @code{absolute}.
  11345. @item reds
  11346. Adjustments for red pixels (pixels where the red component is the maximum)
  11347. @item yellows
  11348. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  11349. @item greens
  11350. Adjustments for green pixels (pixels where the green component is the maximum)
  11351. @item cyans
  11352. Adjustments for cyan pixels (pixels where the red component is the minimum)
  11353. @item blues
  11354. Adjustments for blue pixels (pixels where the blue component is the maximum)
  11355. @item magentas
  11356. Adjustments for magenta pixels (pixels where the green component is the minimum)
  11357. @item whites
  11358. Adjustments for white pixels (pixels where all components are greater than 128)
  11359. @item neutrals
  11360. Adjustments for all pixels except pure black and pure white
  11361. @item blacks
  11362. Adjustments for black pixels (pixels where all components are lesser than 128)
  11363. @item psfile
  11364. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  11365. @end table
  11366. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  11367. 4 space separated floating point adjustment values in the [-1,1] range,
  11368. respectively to adjust the amount of cyan, magenta, yellow and black for the
  11369. pixels of its range.
  11370. @subsection Examples
  11371. @itemize
  11372. @item
  11373. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  11374. increase magenta by 27% in blue areas:
  11375. @example
  11376. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  11377. @end example
  11378. @item
  11379. Use a Photoshop selective color preset:
  11380. @example
  11381. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  11382. @end example
  11383. @end itemize
  11384. @anchor{separatefields}
  11385. @section separatefields
  11386. The @code{separatefields} takes a frame-based video input and splits
  11387. each frame into its components fields, producing a new half height clip
  11388. with twice the frame rate and twice the frame count.
  11389. This filter use field-dominance information in frame to decide which
  11390. of each pair of fields to place first in the output.
  11391. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  11392. @section setdar, setsar
  11393. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  11394. output video.
  11395. This is done by changing the specified Sample (aka Pixel) Aspect
  11396. Ratio, according to the following equation:
  11397. @example
  11398. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  11399. @end example
  11400. Keep in mind that the @code{setdar} filter does not modify the pixel
  11401. dimensions of the video frame. Also, the display aspect ratio set by
  11402. this filter may be changed by later filters in the filterchain,
  11403. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  11404. applied.
  11405. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  11406. the filter output video.
  11407. Note that as a consequence of the application of this filter, the
  11408. output display aspect ratio will change according to the equation
  11409. above.
  11410. Keep in mind that the sample aspect ratio set by the @code{setsar}
  11411. filter may be changed by later filters in the filterchain, e.g. if
  11412. another "setsar" or a "setdar" filter is applied.
  11413. It accepts the following parameters:
  11414. @table @option
  11415. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  11416. Set the aspect ratio used by the filter.
  11417. The parameter can be a floating point number string, an expression, or
  11418. a string of the form @var{num}:@var{den}, where @var{num} and
  11419. @var{den} are the numerator and denominator of the aspect ratio. If
  11420. the parameter is not specified, it is assumed the value "0".
  11421. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  11422. should be escaped.
  11423. @item max
  11424. Set the maximum integer value to use for expressing numerator and
  11425. denominator when reducing the expressed aspect ratio to a rational.
  11426. Default value is @code{100}.
  11427. @end table
  11428. The parameter @var{sar} is an expression containing
  11429. the following constants:
  11430. @table @option
  11431. @item E, PI, PHI
  11432. These are approximated values for the mathematical constants e
  11433. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  11434. @item w, h
  11435. The input width and height.
  11436. @item a
  11437. These are the same as @var{w} / @var{h}.
  11438. @item sar
  11439. The input sample aspect ratio.
  11440. @item dar
  11441. The input display aspect ratio. It is the same as
  11442. (@var{w} / @var{h}) * @var{sar}.
  11443. @item hsub, vsub
  11444. Horizontal and vertical chroma subsample values. For example, for the
  11445. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11446. @end table
  11447. @subsection Examples
  11448. @itemize
  11449. @item
  11450. To change the display aspect ratio to 16:9, specify one of the following:
  11451. @example
  11452. setdar=dar=1.77777
  11453. setdar=dar=16/9
  11454. @end example
  11455. @item
  11456. To change the sample aspect ratio to 10:11, specify:
  11457. @example
  11458. setsar=sar=10/11
  11459. @end example
  11460. @item
  11461. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  11462. 1000 in the aspect ratio reduction, use the command:
  11463. @example
  11464. setdar=ratio=16/9:max=1000
  11465. @end example
  11466. @end itemize
  11467. @anchor{setfield}
  11468. @section setfield
  11469. Force field for the output video frame.
  11470. The @code{setfield} filter marks the interlace type field for the
  11471. output frames. It does not change the input frame, but only sets the
  11472. corresponding property, which affects how the frame is treated by
  11473. following filters (e.g. @code{fieldorder} or @code{yadif}).
  11474. The filter accepts the following options:
  11475. @table @option
  11476. @item mode
  11477. Available values are:
  11478. @table @samp
  11479. @item auto
  11480. Keep the same field property.
  11481. @item bff
  11482. Mark the frame as bottom-field-first.
  11483. @item tff
  11484. Mark the frame as top-field-first.
  11485. @item prog
  11486. Mark the frame as progressive.
  11487. @end table
  11488. @end table
  11489. @anchor{setparams}
  11490. @section setparams
  11491. Force frame parameter for the output video frame.
  11492. The @code{setparams} filter marks interlace and color range for the
  11493. output frames. It does not change the input frame, but only sets the
  11494. corresponding property, which affects how the frame is treated by
  11495. filters/encoders.
  11496. @table @option
  11497. @item field_mode
  11498. Available values are:
  11499. @table @samp
  11500. @item auto
  11501. Keep the same field property (default).
  11502. @item bff
  11503. Mark the frame as bottom-field-first.
  11504. @item tff
  11505. Mark the frame as top-field-first.
  11506. @item prog
  11507. Mark the frame as progressive.
  11508. @end table
  11509. @item range
  11510. Available values are:
  11511. @table @samp
  11512. @item auto
  11513. Keep the same color range property (default).
  11514. @item unspecified, unknown
  11515. Mark the frame as unspecified color range.
  11516. @item limited, tv, mpeg
  11517. Mark the frame as limited range.
  11518. @item full, pc, jpeg
  11519. Mark the frame as full range.
  11520. @end table
  11521. @item color_primaries
  11522. Set the color primaries.
  11523. Available values are:
  11524. @table @samp
  11525. @item auto
  11526. Keep the same color primaries property (default).
  11527. @item bt709
  11528. @item unknown
  11529. @item bt470m
  11530. @item bt470bg
  11531. @item smpte170m
  11532. @item smpte240m
  11533. @item film
  11534. @item bt2020
  11535. @item smpte428
  11536. @item smpte431
  11537. @item smpte432
  11538. @item jedec-p22
  11539. @end table
  11540. @item color_trc
  11541. Set the color transfert.
  11542. Available values are:
  11543. @table @samp
  11544. @item auto
  11545. Keep the same color trc property (default).
  11546. @item bt709
  11547. @item unknown
  11548. @item bt470m
  11549. @item bt470bg
  11550. @item smpte170m
  11551. @item smpte240m
  11552. @item linear
  11553. @item log100
  11554. @item log316
  11555. @item iec61966-2-4
  11556. @item bt1361e
  11557. @item iec61966-2-1
  11558. @item bt2020-10
  11559. @item bt2020-12
  11560. @item smpte2084
  11561. @item smpte428
  11562. @item arib-std-b67
  11563. @end table
  11564. @item colorspace
  11565. Set the colorspace.
  11566. Available values are:
  11567. @table @samp
  11568. @item auto
  11569. Keep the same colorspace property (default).
  11570. @item gbr
  11571. @item bt709
  11572. @item unknown
  11573. @item fcc
  11574. @item bt470bg
  11575. @item smpte170m
  11576. @item smpte240m
  11577. @item ycgco
  11578. @item bt2020nc
  11579. @item bt2020c
  11580. @item smpte2085
  11581. @item chroma-derived-nc
  11582. @item chroma-derived-c
  11583. @item ictcp
  11584. @end table
  11585. @end table
  11586. @section showinfo
  11587. Show a line containing various information for each input video frame.
  11588. The input video is not modified.
  11589. The shown line contains a sequence of key/value pairs of the form
  11590. @var{key}:@var{value}.
  11591. The following values are shown in the output:
  11592. @table @option
  11593. @item n
  11594. The (sequential) number of the input frame, starting from 0.
  11595. @item pts
  11596. The Presentation TimeStamp of the input frame, expressed as a number of
  11597. time base units. The time base unit depends on the filter input pad.
  11598. @item pts_time
  11599. The Presentation TimeStamp of the input frame, expressed as a number of
  11600. seconds.
  11601. @item pos
  11602. The position of the frame in the input stream, or -1 if this information is
  11603. unavailable and/or meaningless (for example in case of synthetic video).
  11604. @item fmt
  11605. The pixel format name.
  11606. @item sar
  11607. The sample aspect ratio of the input frame, expressed in the form
  11608. @var{num}/@var{den}.
  11609. @item s
  11610. The size of the input frame. For the syntax of this option, check the
  11611. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11612. @item i
  11613. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  11614. for bottom field first).
  11615. @item iskey
  11616. This is 1 if the frame is a key frame, 0 otherwise.
  11617. @item type
  11618. The picture type of the input frame ("I" for an I-frame, "P" for a
  11619. P-frame, "B" for a B-frame, or "?" for an unknown type).
  11620. Also refer to the documentation of the @code{AVPictureType} enum and of
  11621. the @code{av_get_picture_type_char} function defined in
  11622. @file{libavutil/avutil.h}.
  11623. @item checksum
  11624. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  11625. @item plane_checksum
  11626. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  11627. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  11628. @end table
  11629. @section showpalette
  11630. Displays the 256 colors palette of each frame. This filter is only relevant for
  11631. @var{pal8} pixel format frames.
  11632. It accepts the following option:
  11633. @table @option
  11634. @item s
  11635. Set the size of the box used to represent one palette color entry. Default is
  11636. @code{30} (for a @code{30x30} pixel box).
  11637. @end table
  11638. @section shuffleframes
  11639. Reorder and/or duplicate and/or drop video frames.
  11640. It accepts the following parameters:
  11641. @table @option
  11642. @item mapping
  11643. Set the destination indexes of input frames.
  11644. This is space or '|' separated list of indexes that maps input frames to output
  11645. frames. Number of indexes also sets maximal value that each index may have.
  11646. '-1' index have special meaning and that is to drop frame.
  11647. @end table
  11648. The first frame has the index 0. The default is to keep the input unchanged.
  11649. @subsection Examples
  11650. @itemize
  11651. @item
  11652. Swap second and third frame of every three frames of the input:
  11653. @example
  11654. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  11655. @end example
  11656. @item
  11657. Swap 10th and 1st frame of every ten frames of the input:
  11658. @example
  11659. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  11660. @end example
  11661. @end itemize
  11662. @section shuffleplanes
  11663. Reorder and/or duplicate video planes.
  11664. It accepts the following parameters:
  11665. @table @option
  11666. @item map0
  11667. The index of the input plane to be used as the first output plane.
  11668. @item map1
  11669. The index of the input plane to be used as the second output plane.
  11670. @item map2
  11671. The index of the input plane to be used as the third output plane.
  11672. @item map3
  11673. The index of the input plane to be used as the fourth output plane.
  11674. @end table
  11675. The first plane has the index 0. The default is to keep the input unchanged.
  11676. @subsection Examples
  11677. @itemize
  11678. @item
  11679. Swap the second and third planes of the input:
  11680. @example
  11681. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  11682. @end example
  11683. @end itemize
  11684. @anchor{signalstats}
  11685. @section signalstats
  11686. Evaluate various visual metrics that assist in determining issues associated
  11687. with the digitization of analog video media.
  11688. By default the filter will log these metadata values:
  11689. @table @option
  11690. @item YMIN
  11691. Display the minimal Y value contained within the input frame. Expressed in
  11692. range of [0-255].
  11693. @item YLOW
  11694. Display the Y value at the 10% percentile within the input frame. Expressed in
  11695. range of [0-255].
  11696. @item YAVG
  11697. Display the average Y value within the input frame. Expressed in range of
  11698. [0-255].
  11699. @item YHIGH
  11700. Display the Y value at the 90% percentile within the input frame. Expressed in
  11701. range of [0-255].
  11702. @item YMAX
  11703. Display the maximum Y value contained within the input frame. Expressed in
  11704. range of [0-255].
  11705. @item UMIN
  11706. Display the minimal U value contained within the input frame. Expressed in
  11707. range of [0-255].
  11708. @item ULOW
  11709. Display the U value at the 10% percentile within the input frame. Expressed in
  11710. range of [0-255].
  11711. @item UAVG
  11712. Display the average U value within the input frame. Expressed in range of
  11713. [0-255].
  11714. @item UHIGH
  11715. Display the U value at the 90% percentile within the input frame. Expressed in
  11716. range of [0-255].
  11717. @item UMAX
  11718. Display the maximum U value contained within the input frame. Expressed in
  11719. range of [0-255].
  11720. @item VMIN
  11721. Display the minimal V value contained within the input frame. Expressed in
  11722. range of [0-255].
  11723. @item VLOW
  11724. Display the V value at the 10% percentile within the input frame. Expressed in
  11725. range of [0-255].
  11726. @item VAVG
  11727. Display the average V value within the input frame. Expressed in range of
  11728. [0-255].
  11729. @item VHIGH
  11730. Display the V value at the 90% percentile within the input frame. Expressed in
  11731. range of [0-255].
  11732. @item VMAX
  11733. Display the maximum V value contained within the input frame. Expressed in
  11734. range of [0-255].
  11735. @item SATMIN
  11736. Display the minimal saturation value contained within the input frame.
  11737. Expressed in range of [0-~181.02].
  11738. @item SATLOW
  11739. Display the saturation value at the 10% percentile within the input frame.
  11740. Expressed in range of [0-~181.02].
  11741. @item SATAVG
  11742. Display the average saturation value within the input frame. Expressed in range
  11743. of [0-~181.02].
  11744. @item SATHIGH
  11745. Display the saturation value at the 90% percentile within the input frame.
  11746. Expressed in range of [0-~181.02].
  11747. @item SATMAX
  11748. Display the maximum saturation value contained within the input frame.
  11749. Expressed in range of [0-~181.02].
  11750. @item HUEMED
  11751. Display the median value for hue within the input frame. Expressed in range of
  11752. [0-360].
  11753. @item HUEAVG
  11754. Display the average value for hue within the input frame. Expressed in range of
  11755. [0-360].
  11756. @item YDIF
  11757. Display the average of sample value difference between all values of the Y
  11758. plane in the current frame and corresponding values of the previous input frame.
  11759. Expressed in range of [0-255].
  11760. @item UDIF
  11761. Display the average of sample value difference between all values of the U
  11762. plane in the current frame and corresponding values of the previous input frame.
  11763. Expressed in range of [0-255].
  11764. @item VDIF
  11765. Display the average of sample value difference between all values of the V
  11766. plane in the current frame and corresponding values of the previous input frame.
  11767. Expressed in range of [0-255].
  11768. @item YBITDEPTH
  11769. Display bit depth of Y plane in current frame.
  11770. Expressed in range of [0-16].
  11771. @item UBITDEPTH
  11772. Display bit depth of U plane in current frame.
  11773. Expressed in range of [0-16].
  11774. @item VBITDEPTH
  11775. Display bit depth of V plane in current frame.
  11776. Expressed in range of [0-16].
  11777. @end table
  11778. The filter accepts the following options:
  11779. @table @option
  11780. @item stat
  11781. @item out
  11782. @option{stat} specify an additional form of image analysis.
  11783. @option{out} output video with the specified type of pixel highlighted.
  11784. Both options accept the following values:
  11785. @table @samp
  11786. @item tout
  11787. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  11788. unlike the neighboring pixels of the same field. Examples of temporal outliers
  11789. include the results of video dropouts, head clogs, or tape tracking issues.
  11790. @item vrep
  11791. Identify @var{vertical line repetition}. Vertical line repetition includes
  11792. similar rows of pixels within a frame. In born-digital video vertical line
  11793. repetition is common, but this pattern is uncommon in video digitized from an
  11794. analog source. When it occurs in video that results from the digitization of an
  11795. analog source it can indicate concealment from a dropout compensator.
  11796. @item brng
  11797. Identify pixels that fall outside of legal broadcast range.
  11798. @end table
  11799. @item color, c
  11800. Set the highlight color for the @option{out} option. The default color is
  11801. yellow.
  11802. @end table
  11803. @subsection Examples
  11804. @itemize
  11805. @item
  11806. Output data of various video metrics:
  11807. @example
  11808. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  11809. @end example
  11810. @item
  11811. Output specific data about the minimum and maximum values of the Y plane per frame:
  11812. @example
  11813. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  11814. @end example
  11815. @item
  11816. Playback video while highlighting pixels that are outside of broadcast range in red.
  11817. @example
  11818. ffplay example.mov -vf signalstats="out=brng:color=red"
  11819. @end example
  11820. @item
  11821. Playback video with signalstats metadata drawn over the frame.
  11822. @example
  11823. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  11824. @end example
  11825. The contents of signalstat_drawtext.txt used in the command are:
  11826. @example
  11827. time %@{pts:hms@}
  11828. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  11829. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  11830. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  11831. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  11832. @end example
  11833. @end itemize
  11834. @anchor{signature}
  11835. @section signature
  11836. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  11837. input. In this case the matching between the inputs can be calculated additionally.
  11838. The filter always passes through the first input. The signature of each stream can
  11839. be written into a file.
  11840. It accepts the following options:
  11841. @table @option
  11842. @item detectmode
  11843. Enable or disable the matching process.
  11844. Available values are:
  11845. @table @samp
  11846. @item off
  11847. Disable the calculation of a matching (default).
  11848. @item full
  11849. Calculate the matching for the whole video and output whether the whole video
  11850. matches or only parts.
  11851. @item fast
  11852. Calculate only until a matching is found or the video ends. Should be faster in
  11853. some cases.
  11854. @end table
  11855. @item nb_inputs
  11856. Set the number of inputs. The option value must be a non negative integer.
  11857. Default value is 1.
  11858. @item filename
  11859. Set the path to which the output is written. If there is more than one input,
  11860. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  11861. integer), that will be replaced with the input number. If no filename is
  11862. specified, no output will be written. This is the default.
  11863. @item format
  11864. Choose the output format.
  11865. Available values are:
  11866. @table @samp
  11867. @item binary
  11868. Use the specified binary representation (default).
  11869. @item xml
  11870. Use the specified xml representation.
  11871. @end table
  11872. @item th_d
  11873. Set threshold to detect one word as similar. The option value must be an integer
  11874. greater than zero. The default value is 9000.
  11875. @item th_dc
  11876. Set threshold to detect all words as similar. The option value must be an integer
  11877. greater than zero. The default value is 60000.
  11878. @item th_xh
  11879. Set threshold to detect frames as similar. The option value must be an integer
  11880. greater than zero. The default value is 116.
  11881. @item th_di
  11882. Set the minimum length of a sequence in frames to recognize it as matching
  11883. sequence. The option value must be a non negative integer value.
  11884. The default value is 0.
  11885. @item th_it
  11886. Set the minimum relation, that matching frames to all frames must have.
  11887. The option value must be a double value between 0 and 1. The default value is 0.5.
  11888. @end table
  11889. @subsection Examples
  11890. @itemize
  11891. @item
  11892. To calculate the signature of an input video and store it in signature.bin:
  11893. @example
  11894. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  11895. @end example
  11896. @item
  11897. To detect whether two videos match and store the signatures in XML format in
  11898. signature0.xml and signature1.xml:
  11899. @example
  11900. 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 -
  11901. @end example
  11902. @end itemize
  11903. @anchor{smartblur}
  11904. @section smartblur
  11905. Blur the input video without impacting the outlines.
  11906. It accepts the following options:
  11907. @table @option
  11908. @item luma_radius, lr
  11909. Set the luma radius. The option value must be a float number in
  11910. the range [0.1,5.0] that specifies the variance of the gaussian filter
  11911. used to blur the image (slower if larger). Default value is 1.0.
  11912. @item luma_strength, ls
  11913. Set the luma strength. The option value must be a float number
  11914. in the range [-1.0,1.0] that configures the blurring. A value included
  11915. in [0.0,1.0] will blur the image whereas a value included in
  11916. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  11917. @item luma_threshold, lt
  11918. Set the luma threshold used as a coefficient to determine
  11919. whether a pixel should be blurred or not. The option value must be an
  11920. integer in the range [-30,30]. A value of 0 will filter all the image,
  11921. a value included in [0,30] will filter flat areas and a value included
  11922. in [-30,0] will filter edges. Default value is 0.
  11923. @item chroma_radius, cr
  11924. Set the chroma radius. The option value must be a float number in
  11925. the range [0.1,5.0] that specifies the variance of the gaussian filter
  11926. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  11927. @item chroma_strength, cs
  11928. Set the chroma strength. The option value must be a float number
  11929. in the range [-1.0,1.0] that configures the blurring. A value included
  11930. in [0.0,1.0] will blur the image whereas a value included in
  11931. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  11932. @item chroma_threshold, ct
  11933. Set the chroma threshold used as a coefficient to determine
  11934. whether a pixel should be blurred or not. The option value must be an
  11935. integer in the range [-30,30]. A value of 0 will filter all the image,
  11936. a value included in [0,30] will filter flat areas and a value included
  11937. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  11938. @end table
  11939. If a chroma option is not explicitly set, the corresponding luma value
  11940. is set.
  11941. @section ssim
  11942. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  11943. This filter takes in input two input videos, the first input is
  11944. considered the "main" source and is passed unchanged to the
  11945. output. The second input is used as a "reference" video for computing
  11946. the SSIM.
  11947. Both video inputs must have the same resolution and pixel format for
  11948. this filter to work correctly. Also it assumes that both inputs
  11949. have the same number of frames, which are compared one by one.
  11950. The filter stores the calculated SSIM of each frame.
  11951. The description of the accepted parameters follows.
  11952. @table @option
  11953. @item stats_file, f
  11954. If specified the filter will use the named file to save the SSIM of
  11955. each individual frame. When filename equals "-" the data is sent to
  11956. standard output.
  11957. @end table
  11958. The file printed if @var{stats_file} is selected, contains a sequence of
  11959. key/value pairs of the form @var{key}:@var{value} for each compared
  11960. couple of frames.
  11961. A description of each shown parameter follows:
  11962. @table @option
  11963. @item n
  11964. sequential number of the input frame, starting from 1
  11965. @item Y, U, V, R, G, B
  11966. SSIM of the compared frames for the component specified by the suffix.
  11967. @item All
  11968. SSIM of the compared frames for the whole frame.
  11969. @item dB
  11970. Same as above but in dB representation.
  11971. @end table
  11972. This filter also supports the @ref{framesync} options.
  11973. For example:
  11974. @example
  11975. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  11976. [main][ref] ssim="stats_file=stats.log" [out]
  11977. @end example
  11978. On this example the input file being processed is compared with the
  11979. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  11980. is stored in @file{stats.log}.
  11981. Another example with both psnr and ssim at same time:
  11982. @example
  11983. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  11984. @end example
  11985. @section stereo3d
  11986. Convert between different stereoscopic image formats.
  11987. The filters accept the following options:
  11988. @table @option
  11989. @item in
  11990. Set stereoscopic image format of input.
  11991. Available values for input image formats are:
  11992. @table @samp
  11993. @item sbsl
  11994. side by side parallel (left eye left, right eye right)
  11995. @item sbsr
  11996. side by side crosseye (right eye left, left eye right)
  11997. @item sbs2l
  11998. side by side parallel with half width resolution
  11999. (left eye left, right eye right)
  12000. @item sbs2r
  12001. side by side crosseye with half width resolution
  12002. (right eye left, left eye right)
  12003. @item abl
  12004. above-below (left eye above, right eye below)
  12005. @item abr
  12006. above-below (right eye above, left eye below)
  12007. @item ab2l
  12008. above-below with half height resolution
  12009. (left eye above, right eye below)
  12010. @item ab2r
  12011. above-below with half height resolution
  12012. (right eye above, left eye below)
  12013. @item al
  12014. alternating frames (left eye first, right eye second)
  12015. @item ar
  12016. alternating frames (right eye first, left eye second)
  12017. @item irl
  12018. interleaved rows (left eye has top row, right eye starts on next row)
  12019. @item irr
  12020. interleaved rows (right eye has top row, left eye starts on next row)
  12021. @item icl
  12022. interleaved columns, left eye first
  12023. @item icr
  12024. interleaved columns, right eye first
  12025. Default value is @samp{sbsl}.
  12026. @end table
  12027. @item out
  12028. Set stereoscopic image format of output.
  12029. @table @samp
  12030. @item sbsl
  12031. side by side parallel (left eye left, right eye right)
  12032. @item sbsr
  12033. side by side crosseye (right eye left, left eye right)
  12034. @item sbs2l
  12035. side by side parallel with half width resolution
  12036. (left eye left, right eye right)
  12037. @item sbs2r
  12038. side by side crosseye with half width resolution
  12039. (right eye left, left eye right)
  12040. @item abl
  12041. above-below (left eye above, right eye below)
  12042. @item abr
  12043. above-below (right eye above, left eye below)
  12044. @item ab2l
  12045. above-below with half height resolution
  12046. (left eye above, right eye below)
  12047. @item ab2r
  12048. above-below with half height resolution
  12049. (right eye above, left eye below)
  12050. @item al
  12051. alternating frames (left eye first, right eye second)
  12052. @item ar
  12053. alternating frames (right eye first, left eye second)
  12054. @item irl
  12055. interleaved rows (left eye has top row, right eye starts on next row)
  12056. @item irr
  12057. interleaved rows (right eye has top row, left eye starts on next row)
  12058. @item arbg
  12059. anaglyph red/blue gray
  12060. (red filter on left eye, blue filter on right eye)
  12061. @item argg
  12062. anaglyph red/green gray
  12063. (red filter on left eye, green filter on right eye)
  12064. @item arcg
  12065. anaglyph red/cyan gray
  12066. (red filter on left eye, cyan filter on right eye)
  12067. @item arch
  12068. anaglyph red/cyan half colored
  12069. (red filter on left eye, cyan filter on right eye)
  12070. @item arcc
  12071. anaglyph red/cyan color
  12072. (red filter on left eye, cyan filter on right eye)
  12073. @item arcd
  12074. anaglyph red/cyan color optimized with the least squares projection of dubois
  12075. (red filter on left eye, cyan filter on right eye)
  12076. @item agmg
  12077. anaglyph green/magenta gray
  12078. (green filter on left eye, magenta filter on right eye)
  12079. @item agmh
  12080. anaglyph green/magenta half colored
  12081. (green filter on left eye, magenta filter on right eye)
  12082. @item agmc
  12083. anaglyph green/magenta colored
  12084. (green filter on left eye, magenta filter on right eye)
  12085. @item agmd
  12086. anaglyph green/magenta color optimized with the least squares projection of dubois
  12087. (green filter on left eye, magenta filter on right eye)
  12088. @item aybg
  12089. anaglyph yellow/blue gray
  12090. (yellow filter on left eye, blue filter on right eye)
  12091. @item aybh
  12092. anaglyph yellow/blue half colored
  12093. (yellow filter on left eye, blue filter on right eye)
  12094. @item aybc
  12095. anaglyph yellow/blue colored
  12096. (yellow filter on left eye, blue filter on right eye)
  12097. @item aybd
  12098. anaglyph yellow/blue color optimized with the least squares projection of dubois
  12099. (yellow filter on left eye, blue filter on right eye)
  12100. @item ml
  12101. mono output (left eye only)
  12102. @item mr
  12103. mono output (right eye only)
  12104. @item chl
  12105. checkerboard, left eye first
  12106. @item chr
  12107. checkerboard, right eye first
  12108. @item icl
  12109. interleaved columns, left eye first
  12110. @item icr
  12111. interleaved columns, right eye first
  12112. @item hdmi
  12113. HDMI frame pack
  12114. @end table
  12115. Default value is @samp{arcd}.
  12116. @end table
  12117. @subsection Examples
  12118. @itemize
  12119. @item
  12120. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  12121. @example
  12122. stereo3d=sbsl:aybd
  12123. @end example
  12124. @item
  12125. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  12126. @example
  12127. stereo3d=abl:sbsr
  12128. @end example
  12129. @end itemize
  12130. @section streamselect, astreamselect
  12131. Select video or audio streams.
  12132. The filter accepts the following options:
  12133. @table @option
  12134. @item inputs
  12135. Set number of inputs. Default is 2.
  12136. @item map
  12137. Set input indexes to remap to outputs.
  12138. @end table
  12139. @subsection Commands
  12140. The @code{streamselect} and @code{astreamselect} filter supports the following
  12141. commands:
  12142. @table @option
  12143. @item map
  12144. Set input indexes to remap to outputs.
  12145. @end table
  12146. @subsection Examples
  12147. @itemize
  12148. @item
  12149. Select first 5 seconds 1st stream and rest of time 2nd stream:
  12150. @example
  12151. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  12152. @end example
  12153. @item
  12154. Same as above, but for audio:
  12155. @example
  12156. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  12157. @end example
  12158. @end itemize
  12159. @section sobel
  12160. Apply sobel operator to input video stream.
  12161. The filter accepts the following option:
  12162. @table @option
  12163. @item planes
  12164. Set which planes will be processed, unprocessed planes will be copied.
  12165. By default value 0xf, all planes will be processed.
  12166. @item scale
  12167. Set value which will be multiplied with filtered result.
  12168. @item delta
  12169. Set value which will be added to filtered result.
  12170. @end table
  12171. @anchor{spp}
  12172. @section spp
  12173. Apply a simple postprocessing filter that compresses and decompresses the image
  12174. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  12175. and average the results.
  12176. The filter accepts the following options:
  12177. @table @option
  12178. @item quality
  12179. Set quality. This option defines the number of levels for averaging. It accepts
  12180. an integer in the range 0-6. If set to @code{0}, the filter will have no
  12181. effect. A value of @code{6} means the higher quality. For each increment of
  12182. that value the speed drops by a factor of approximately 2. Default value is
  12183. @code{3}.
  12184. @item qp
  12185. Force a constant quantization parameter. If not set, the filter will use the QP
  12186. from the video stream (if available).
  12187. @item mode
  12188. Set thresholding mode. Available modes are:
  12189. @table @samp
  12190. @item hard
  12191. Set hard thresholding (default).
  12192. @item soft
  12193. Set soft thresholding (better de-ringing effect, but likely blurrier).
  12194. @end table
  12195. @item use_bframe_qp
  12196. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  12197. option may cause flicker since the B-Frames have often larger QP. Default is
  12198. @code{0} (not enabled).
  12199. @end table
  12200. @section sr
  12201. Scale the input by applying one of the super-resolution methods based on
  12202. convolutional neural networks. Supported models:
  12203. @itemize
  12204. @item
  12205. Super-Resolution Convolutional Neural Network model (SRCNN).
  12206. See @url{https://arxiv.org/abs/1501.00092}.
  12207. @item
  12208. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  12209. See @url{https://arxiv.org/abs/1609.05158}.
  12210. @end itemize
  12211. Training scripts as well as scripts for model generation are provided in
  12212. the repository at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  12213. The filter accepts the following options:
  12214. @table @option
  12215. @item dnn_backend
  12216. Specify which DNN backend to use for model loading and execution. This option accepts
  12217. the following values:
  12218. @table @samp
  12219. @item native
  12220. Native implementation of DNN loading and execution.
  12221. @item tensorflow
  12222. TensorFlow backend. To enable this backend you
  12223. need to install the TensorFlow for C library (see
  12224. @url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
  12225. @code{--enable-libtensorflow}
  12226. @end table
  12227. Default value is @samp{native}.
  12228. @item model
  12229. Set path to model file specifying network architecture and its parameters.
  12230. Note that different backends use different file formats. TensorFlow backend
  12231. can load files for both formats, while native backend can load files for only
  12232. its format.
  12233. @item scale_factor
  12234. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  12235. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  12236. input upscaled using bicubic upscaling with proper scale factor.
  12237. @end table
  12238. @anchor{subtitles}
  12239. @section subtitles
  12240. Draw subtitles on top of input video using the libass library.
  12241. To enable compilation of this filter you need to configure FFmpeg with
  12242. @code{--enable-libass}. This filter also requires a build with libavcodec and
  12243. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  12244. Alpha) subtitles format.
  12245. The filter accepts the following options:
  12246. @table @option
  12247. @item filename, f
  12248. Set the filename of the subtitle file to read. It must be specified.
  12249. @item original_size
  12250. Specify the size of the original video, the video for which the ASS file
  12251. was composed. For the syntax of this option, check the
  12252. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12253. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  12254. correctly scale the fonts if the aspect ratio has been changed.
  12255. @item fontsdir
  12256. Set a directory path containing fonts that can be used by the filter.
  12257. These fonts will be used in addition to whatever the font provider uses.
  12258. @item alpha
  12259. Process alpha channel, by default alpha channel is untouched.
  12260. @item charenc
  12261. Set subtitles input character encoding. @code{subtitles} filter only. Only
  12262. useful if not UTF-8.
  12263. @item stream_index, si
  12264. Set subtitles stream index. @code{subtitles} filter only.
  12265. @item force_style
  12266. Override default style or script info parameters of the subtitles. It accepts a
  12267. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  12268. @end table
  12269. If the first key is not specified, it is assumed that the first value
  12270. specifies the @option{filename}.
  12271. For example, to render the file @file{sub.srt} on top of the input
  12272. video, use the command:
  12273. @example
  12274. subtitles=sub.srt
  12275. @end example
  12276. which is equivalent to:
  12277. @example
  12278. subtitles=filename=sub.srt
  12279. @end example
  12280. To render the default subtitles stream from file @file{video.mkv}, use:
  12281. @example
  12282. subtitles=video.mkv
  12283. @end example
  12284. To render the second subtitles stream from that file, use:
  12285. @example
  12286. subtitles=video.mkv:si=1
  12287. @end example
  12288. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  12289. @code{DejaVu Serif}, use:
  12290. @example
  12291. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HCCFF0000'
  12292. @end example
  12293. @section super2xsai
  12294. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  12295. Interpolate) pixel art scaling algorithm.
  12296. Useful for enlarging pixel art images without reducing sharpness.
  12297. @section swaprect
  12298. Swap two rectangular objects in video.
  12299. This filter accepts the following options:
  12300. @table @option
  12301. @item w
  12302. Set object width.
  12303. @item h
  12304. Set object height.
  12305. @item x1
  12306. Set 1st rect x coordinate.
  12307. @item y1
  12308. Set 1st rect y coordinate.
  12309. @item x2
  12310. Set 2nd rect x coordinate.
  12311. @item y2
  12312. Set 2nd rect y coordinate.
  12313. All expressions are evaluated once for each frame.
  12314. @end table
  12315. The all options are expressions containing the following constants:
  12316. @table @option
  12317. @item w
  12318. @item h
  12319. The input width and height.
  12320. @item a
  12321. same as @var{w} / @var{h}
  12322. @item sar
  12323. input sample aspect ratio
  12324. @item dar
  12325. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  12326. @item n
  12327. The number of the input frame, starting from 0.
  12328. @item t
  12329. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  12330. @item pos
  12331. the position in the file of the input frame, NAN if unknown
  12332. @end table
  12333. @section swapuv
  12334. Swap U & V plane.
  12335. @section telecine
  12336. Apply telecine process to the video.
  12337. This filter accepts the following options:
  12338. @table @option
  12339. @item first_field
  12340. @table @samp
  12341. @item top, t
  12342. top field first
  12343. @item bottom, b
  12344. bottom field first
  12345. The default value is @code{top}.
  12346. @end table
  12347. @item pattern
  12348. A string of numbers representing the pulldown pattern you wish to apply.
  12349. The default value is @code{23}.
  12350. @end table
  12351. @example
  12352. Some typical patterns:
  12353. NTSC output (30i):
  12354. 27.5p: 32222
  12355. 24p: 23 (classic)
  12356. 24p: 2332 (preferred)
  12357. 20p: 33
  12358. 18p: 334
  12359. 16p: 3444
  12360. PAL output (25i):
  12361. 27.5p: 12222
  12362. 24p: 222222222223 ("Euro pulldown")
  12363. 16.67p: 33
  12364. 16p: 33333334
  12365. @end example
  12366. @section threshold
  12367. Apply threshold effect to video stream.
  12368. This filter needs four video streams to perform thresholding.
  12369. First stream is stream we are filtering.
  12370. Second stream is holding threshold values, third stream is holding min values,
  12371. and last, fourth stream is holding max values.
  12372. The filter accepts the following option:
  12373. @table @option
  12374. @item planes
  12375. Set which planes will be processed, unprocessed planes will be copied.
  12376. By default value 0xf, all planes will be processed.
  12377. @end table
  12378. For example if first stream pixel's component value is less then threshold value
  12379. of pixel component from 2nd threshold stream, third stream value will picked,
  12380. otherwise fourth stream pixel component value will be picked.
  12381. Using color source filter one can perform various types of thresholding:
  12382. @subsection Examples
  12383. @itemize
  12384. @item
  12385. Binary threshold, using gray color as threshold:
  12386. @example
  12387. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  12388. @end example
  12389. @item
  12390. Inverted binary threshold, using gray color as threshold:
  12391. @example
  12392. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  12393. @end example
  12394. @item
  12395. Truncate binary threshold, using gray color as threshold:
  12396. @example
  12397. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  12398. @end example
  12399. @item
  12400. Threshold to zero, using gray color as threshold:
  12401. @example
  12402. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  12403. @end example
  12404. @item
  12405. Inverted threshold to zero, using gray color as threshold:
  12406. @example
  12407. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  12408. @end example
  12409. @end itemize
  12410. @section thumbnail
  12411. Select the most representative frame in a given sequence of consecutive frames.
  12412. The filter accepts the following options:
  12413. @table @option
  12414. @item n
  12415. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  12416. will pick one of them, and then handle the next batch of @var{n} frames until
  12417. the end. Default is @code{100}.
  12418. @end table
  12419. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  12420. value will result in a higher memory usage, so a high value is not recommended.
  12421. @subsection Examples
  12422. @itemize
  12423. @item
  12424. Extract one picture each 50 frames:
  12425. @example
  12426. thumbnail=50
  12427. @end example
  12428. @item
  12429. Complete example of a thumbnail creation with @command{ffmpeg}:
  12430. @example
  12431. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  12432. @end example
  12433. @end itemize
  12434. @section tile
  12435. Tile several successive frames together.
  12436. The filter accepts the following options:
  12437. @table @option
  12438. @item layout
  12439. Set the grid size (i.e. the number of lines and columns). For the syntax of
  12440. this option, check the
  12441. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12442. @item nb_frames
  12443. Set the maximum number of frames to render in the given area. It must be less
  12444. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  12445. the area will be used.
  12446. @item margin
  12447. Set the outer border margin in pixels.
  12448. @item padding
  12449. Set the inner border thickness (i.e. the number of pixels between frames). For
  12450. more advanced padding options (such as having different values for the edges),
  12451. refer to the pad video filter.
  12452. @item color
  12453. Specify the color of the unused area. For the syntax of this option, check the
  12454. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12455. The default value of @var{color} is "black".
  12456. @item overlap
  12457. Set the number of frames to overlap when tiling several successive frames together.
  12458. The value must be between @code{0} and @var{nb_frames - 1}.
  12459. @item init_padding
  12460. Set the number of frames to initially be empty before displaying first output frame.
  12461. This controls how soon will one get first output frame.
  12462. The value must be between @code{0} and @var{nb_frames - 1}.
  12463. @end table
  12464. @subsection Examples
  12465. @itemize
  12466. @item
  12467. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  12468. @example
  12469. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  12470. @end example
  12471. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  12472. duplicating each output frame to accommodate the originally detected frame
  12473. rate.
  12474. @item
  12475. Display @code{5} pictures in an area of @code{3x2} frames,
  12476. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  12477. mixed flat and named options:
  12478. @example
  12479. tile=3x2:nb_frames=5:padding=7:margin=2
  12480. @end example
  12481. @end itemize
  12482. @section tinterlace
  12483. Perform various types of temporal field interlacing.
  12484. Frames are counted starting from 1, so the first input frame is
  12485. considered odd.
  12486. The filter accepts the following options:
  12487. @table @option
  12488. @item mode
  12489. Specify the mode of the interlacing. This option can also be specified
  12490. as a value alone. See below for a list of values for this option.
  12491. Available values are:
  12492. @table @samp
  12493. @item merge, 0
  12494. Move odd frames into the upper field, even into the lower field,
  12495. generating a double height frame at half frame rate.
  12496. @example
  12497. ------> time
  12498. Input:
  12499. Frame 1 Frame 2 Frame 3 Frame 4
  12500. 11111 22222 33333 44444
  12501. 11111 22222 33333 44444
  12502. 11111 22222 33333 44444
  12503. 11111 22222 33333 44444
  12504. Output:
  12505. 11111 33333
  12506. 22222 44444
  12507. 11111 33333
  12508. 22222 44444
  12509. 11111 33333
  12510. 22222 44444
  12511. 11111 33333
  12512. 22222 44444
  12513. @end example
  12514. @item drop_even, 1
  12515. Only output odd frames, even frames are dropped, generating a frame with
  12516. unchanged height at half frame rate.
  12517. @example
  12518. ------> time
  12519. Input:
  12520. Frame 1 Frame 2 Frame 3 Frame 4
  12521. 11111 22222 33333 44444
  12522. 11111 22222 33333 44444
  12523. 11111 22222 33333 44444
  12524. 11111 22222 33333 44444
  12525. Output:
  12526. 11111 33333
  12527. 11111 33333
  12528. 11111 33333
  12529. 11111 33333
  12530. @end example
  12531. @item drop_odd, 2
  12532. Only output even frames, odd frames are dropped, generating a frame with
  12533. unchanged height at half frame rate.
  12534. @example
  12535. ------> time
  12536. Input:
  12537. Frame 1 Frame 2 Frame 3 Frame 4
  12538. 11111 22222 33333 44444
  12539. 11111 22222 33333 44444
  12540. 11111 22222 33333 44444
  12541. 11111 22222 33333 44444
  12542. Output:
  12543. 22222 44444
  12544. 22222 44444
  12545. 22222 44444
  12546. 22222 44444
  12547. @end example
  12548. @item pad, 3
  12549. Expand each frame to full height, but pad alternate lines with black,
  12550. generating a frame with double height at the same input frame rate.
  12551. @example
  12552. ------> time
  12553. Input:
  12554. Frame 1 Frame 2 Frame 3 Frame 4
  12555. 11111 22222 33333 44444
  12556. 11111 22222 33333 44444
  12557. 11111 22222 33333 44444
  12558. 11111 22222 33333 44444
  12559. Output:
  12560. 11111 ..... 33333 .....
  12561. ..... 22222 ..... 44444
  12562. 11111 ..... 33333 .....
  12563. ..... 22222 ..... 44444
  12564. 11111 ..... 33333 .....
  12565. ..... 22222 ..... 44444
  12566. 11111 ..... 33333 .....
  12567. ..... 22222 ..... 44444
  12568. @end example
  12569. @item interleave_top, 4
  12570. Interleave the upper field from odd frames with the lower field from
  12571. even frames, generating a frame with unchanged height at half frame rate.
  12572. @example
  12573. ------> time
  12574. Input:
  12575. Frame 1 Frame 2 Frame 3 Frame 4
  12576. 11111<- 22222 33333<- 44444
  12577. 11111 22222<- 33333 44444<-
  12578. 11111<- 22222 33333<- 44444
  12579. 11111 22222<- 33333 44444<-
  12580. Output:
  12581. 11111 33333
  12582. 22222 44444
  12583. 11111 33333
  12584. 22222 44444
  12585. @end example
  12586. @item interleave_bottom, 5
  12587. Interleave the lower field from odd frames with the upper field from
  12588. even frames, generating a frame with unchanged height at half frame rate.
  12589. @example
  12590. ------> time
  12591. Input:
  12592. Frame 1 Frame 2 Frame 3 Frame 4
  12593. 11111 22222<- 33333 44444<-
  12594. 11111<- 22222 33333<- 44444
  12595. 11111 22222<- 33333 44444<-
  12596. 11111<- 22222 33333<- 44444
  12597. Output:
  12598. 22222 44444
  12599. 11111 33333
  12600. 22222 44444
  12601. 11111 33333
  12602. @end example
  12603. @item interlacex2, 6
  12604. Double frame rate with unchanged height. Frames are inserted each
  12605. containing the second temporal field from the previous input frame and
  12606. the first temporal field from the next input frame. This mode relies on
  12607. the top_field_first flag. Useful for interlaced video displays with no
  12608. field synchronisation.
  12609. @example
  12610. ------> time
  12611. Input:
  12612. Frame 1 Frame 2 Frame 3 Frame 4
  12613. 11111 22222 33333 44444
  12614. 11111 22222 33333 44444
  12615. 11111 22222 33333 44444
  12616. 11111 22222 33333 44444
  12617. Output:
  12618. 11111 22222 22222 33333 33333 44444 44444
  12619. 11111 11111 22222 22222 33333 33333 44444
  12620. 11111 22222 22222 33333 33333 44444 44444
  12621. 11111 11111 22222 22222 33333 33333 44444
  12622. @end example
  12623. @item mergex2, 7
  12624. Move odd frames into the upper field, even into the lower field,
  12625. generating a double height frame at same frame rate.
  12626. @example
  12627. ------> time
  12628. Input:
  12629. Frame 1 Frame 2 Frame 3 Frame 4
  12630. 11111 22222 33333 44444
  12631. 11111 22222 33333 44444
  12632. 11111 22222 33333 44444
  12633. 11111 22222 33333 44444
  12634. Output:
  12635. 11111 33333 33333 55555
  12636. 22222 22222 44444 44444
  12637. 11111 33333 33333 55555
  12638. 22222 22222 44444 44444
  12639. 11111 33333 33333 55555
  12640. 22222 22222 44444 44444
  12641. 11111 33333 33333 55555
  12642. 22222 22222 44444 44444
  12643. @end example
  12644. @end table
  12645. Numeric values are deprecated but are accepted for backward
  12646. compatibility reasons.
  12647. Default mode is @code{merge}.
  12648. @item flags
  12649. Specify flags influencing the filter process.
  12650. Available value for @var{flags} is:
  12651. @table @option
  12652. @item low_pass_filter, vlfp
  12653. Enable linear vertical low-pass filtering in the filter.
  12654. Vertical low-pass filtering is required when creating an interlaced
  12655. destination from a progressive source which contains high-frequency
  12656. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  12657. patterning.
  12658. @item complex_filter, cvlfp
  12659. Enable complex vertical low-pass filtering.
  12660. This will slightly less reduce interlace 'twitter' and Moire
  12661. patterning but better retain detail and subjective sharpness impression.
  12662. @end table
  12663. Vertical low-pass filtering can only be enabled for @option{mode}
  12664. @var{interleave_top} and @var{interleave_bottom}.
  12665. @end table
  12666. @section tmix
  12667. Mix successive video frames.
  12668. A description of the accepted options follows.
  12669. @table @option
  12670. @item frames
  12671. The number of successive frames to mix. If unspecified, it defaults to 3.
  12672. @item weights
  12673. Specify weight of each input video frame.
  12674. Each weight is separated by space. If number of weights is smaller than
  12675. number of @var{frames} last specified weight will be used for all remaining
  12676. unset weights.
  12677. @item scale
  12678. Specify scale, if it is set it will be multiplied with sum
  12679. of each weight multiplied with pixel values to give final destination
  12680. pixel value. By default @var{scale} is auto scaled to sum of weights.
  12681. @end table
  12682. @subsection Examples
  12683. @itemize
  12684. @item
  12685. Average 7 successive frames:
  12686. @example
  12687. tmix=frames=7:weights="1 1 1 1 1 1 1"
  12688. @end example
  12689. @item
  12690. Apply simple temporal convolution:
  12691. @example
  12692. tmix=frames=3:weights="-1 3 -1"
  12693. @end example
  12694. @item
  12695. Similar as above but only showing temporal differences:
  12696. @example
  12697. tmix=frames=3:weights="-1 2 -1":scale=1
  12698. @end example
  12699. @end itemize
  12700. @section tonemap
  12701. Tone map colors from different dynamic ranges.
  12702. This filter expects data in single precision floating point, as it needs to
  12703. operate on (and can output) out-of-range values. Another filter, such as
  12704. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  12705. The tonemapping algorithms implemented only work on linear light, so input
  12706. data should be linearized beforehand (and possibly correctly tagged).
  12707. @example
  12708. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  12709. @end example
  12710. @subsection Options
  12711. The filter accepts the following options.
  12712. @table @option
  12713. @item tonemap
  12714. Set the tone map algorithm to use.
  12715. Possible values are:
  12716. @table @var
  12717. @item none
  12718. Do not apply any tone map, only desaturate overbright pixels.
  12719. @item clip
  12720. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  12721. in-range values, while distorting out-of-range values.
  12722. @item linear
  12723. Stretch the entire reference gamut to a linear multiple of the display.
  12724. @item gamma
  12725. Fit a logarithmic transfer between the tone curves.
  12726. @item reinhard
  12727. Preserve overall image brightness with a simple curve, using nonlinear
  12728. contrast, which results in flattening details and degrading color accuracy.
  12729. @item hable
  12730. Preserve both dark and bright details better than @var{reinhard}, at the cost
  12731. of slightly darkening everything. Use it when detail preservation is more
  12732. important than color and brightness accuracy.
  12733. @item mobius
  12734. Smoothly map out-of-range values, while retaining contrast and colors for
  12735. in-range material as much as possible. Use it when color accuracy is more
  12736. important than detail preservation.
  12737. @end table
  12738. Default is none.
  12739. @item param
  12740. Tune the tone mapping algorithm.
  12741. This affects the following algorithms:
  12742. @table @var
  12743. @item none
  12744. Ignored.
  12745. @item linear
  12746. Specifies the scale factor to use while stretching.
  12747. Default to 1.0.
  12748. @item gamma
  12749. Specifies the exponent of the function.
  12750. Default to 1.8.
  12751. @item clip
  12752. Specify an extra linear coefficient to multiply into the signal before clipping.
  12753. Default to 1.0.
  12754. @item reinhard
  12755. Specify the local contrast coefficient at the display peak.
  12756. Default to 0.5, which means that in-gamut values will be about half as bright
  12757. as when clipping.
  12758. @item hable
  12759. Ignored.
  12760. @item mobius
  12761. Specify the transition point from linear to mobius transform. Every value
  12762. below this point is guaranteed to be mapped 1:1. The higher the value, the
  12763. more accurate the result will be, at the cost of losing bright details.
  12764. Default to 0.3, which due to the steep initial slope still preserves in-range
  12765. colors fairly accurately.
  12766. @end table
  12767. @item desat
  12768. Apply desaturation for highlights that exceed this level of brightness. The
  12769. higher the parameter, the more color information will be preserved. This
  12770. setting helps prevent unnaturally blown-out colors for super-highlights, by
  12771. (smoothly) turning into white instead. This makes images feel more natural,
  12772. at the cost of reducing information about out-of-range colors.
  12773. The default of 2.0 is somewhat conservative and will mostly just apply to
  12774. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  12775. This option works only if the input frame has a supported color tag.
  12776. @item peak
  12777. Override signal/nominal/reference peak with this value. Useful when the
  12778. embedded peak information in display metadata is not reliable or when tone
  12779. mapping from a lower range to a higher range.
  12780. @end table
  12781. @anchor{transpose}
  12782. @section transpose
  12783. Transpose rows with columns in the input video and optionally flip it.
  12784. It accepts the following parameters:
  12785. @table @option
  12786. @item dir
  12787. Specify the transposition direction.
  12788. Can assume the following values:
  12789. @table @samp
  12790. @item 0, 4, cclock_flip
  12791. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  12792. @example
  12793. L.R L.l
  12794. . . -> . .
  12795. l.r R.r
  12796. @end example
  12797. @item 1, 5, clock
  12798. Rotate by 90 degrees clockwise, that is:
  12799. @example
  12800. L.R l.L
  12801. . . -> . .
  12802. l.r r.R
  12803. @end example
  12804. @item 2, 6, cclock
  12805. Rotate by 90 degrees counterclockwise, that is:
  12806. @example
  12807. L.R R.r
  12808. . . -> . .
  12809. l.r L.l
  12810. @end example
  12811. @item 3, 7, clock_flip
  12812. Rotate by 90 degrees clockwise and vertically flip, that is:
  12813. @example
  12814. L.R r.R
  12815. . . -> . .
  12816. l.r l.L
  12817. @end example
  12818. @end table
  12819. For values between 4-7, the transposition is only done if the input
  12820. video geometry is portrait and not landscape. These values are
  12821. deprecated, the @code{passthrough} option should be used instead.
  12822. Numerical values are deprecated, and should be dropped in favor of
  12823. symbolic constants.
  12824. @item passthrough
  12825. Do not apply the transposition if the input geometry matches the one
  12826. specified by the specified value. It accepts the following values:
  12827. @table @samp
  12828. @item none
  12829. Always apply transposition.
  12830. @item portrait
  12831. Preserve portrait geometry (when @var{height} >= @var{width}).
  12832. @item landscape
  12833. Preserve landscape geometry (when @var{width} >= @var{height}).
  12834. @end table
  12835. Default value is @code{none}.
  12836. @end table
  12837. For example to rotate by 90 degrees clockwise and preserve portrait
  12838. layout:
  12839. @example
  12840. transpose=dir=1:passthrough=portrait
  12841. @end example
  12842. The command above can also be specified as:
  12843. @example
  12844. transpose=1:portrait
  12845. @end example
  12846. @section transpose_npp
  12847. Transpose rows with columns in the input video and optionally flip it.
  12848. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  12849. It accepts the following parameters:
  12850. @table @option
  12851. @item dir
  12852. Specify the transposition direction.
  12853. Can assume the following values:
  12854. @table @samp
  12855. @item cclock_flip
  12856. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  12857. @item clock
  12858. Rotate by 90 degrees clockwise.
  12859. @item cclock
  12860. Rotate by 90 degrees counterclockwise.
  12861. @item clock_flip
  12862. Rotate by 90 degrees clockwise and vertically flip.
  12863. @end table
  12864. @item passthrough
  12865. Do not apply the transposition if the input geometry matches the one
  12866. specified by the specified value. It accepts the following values:
  12867. @table @samp
  12868. @item none
  12869. Always apply transposition. (default)
  12870. @item portrait
  12871. Preserve portrait geometry (when @var{height} >= @var{width}).
  12872. @item landscape
  12873. Preserve landscape geometry (when @var{width} >= @var{height}).
  12874. @end table
  12875. @end table
  12876. @section trim
  12877. Trim the input so that the output contains one continuous subpart of the input.
  12878. It accepts the following parameters:
  12879. @table @option
  12880. @item start
  12881. Specify the time of the start of the kept section, i.e. the frame with the
  12882. timestamp @var{start} will be the first frame in the output.
  12883. @item end
  12884. Specify the time of the first frame that will be dropped, i.e. the frame
  12885. immediately preceding the one with the timestamp @var{end} will be the last
  12886. frame in the output.
  12887. @item start_pts
  12888. This is the same as @var{start}, except this option sets the start timestamp
  12889. in timebase units instead of seconds.
  12890. @item end_pts
  12891. This is the same as @var{end}, except this option sets the end timestamp
  12892. in timebase units instead of seconds.
  12893. @item duration
  12894. The maximum duration of the output in seconds.
  12895. @item start_frame
  12896. The number of the first frame that should be passed to the output.
  12897. @item end_frame
  12898. The number of the first frame that should be dropped.
  12899. @end table
  12900. @option{start}, @option{end}, and @option{duration} are expressed as time
  12901. duration specifications; see
  12902. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12903. for the accepted syntax.
  12904. Note that the first two sets of the start/end options and the @option{duration}
  12905. option look at the frame timestamp, while the _frame variants simply count the
  12906. frames that pass through the filter. Also note that this filter does not modify
  12907. the timestamps. If you wish for the output timestamps to start at zero, insert a
  12908. setpts filter after the trim filter.
  12909. If multiple start or end options are set, this filter tries to be greedy and
  12910. keep all the frames that match at least one of the specified constraints. To keep
  12911. only the part that matches all the constraints at once, chain multiple trim
  12912. filters.
  12913. The defaults are such that all the input is kept. So it is possible to set e.g.
  12914. just the end values to keep everything before the specified time.
  12915. Examples:
  12916. @itemize
  12917. @item
  12918. Drop everything except the second minute of input:
  12919. @example
  12920. ffmpeg -i INPUT -vf trim=60:120
  12921. @end example
  12922. @item
  12923. Keep only the first second:
  12924. @example
  12925. ffmpeg -i INPUT -vf trim=duration=1
  12926. @end example
  12927. @end itemize
  12928. @section unpremultiply
  12929. Apply alpha unpremultiply effect to input video stream using first plane
  12930. of second stream as alpha.
  12931. Both streams must have same dimensions and same pixel format.
  12932. The filter accepts the following option:
  12933. @table @option
  12934. @item planes
  12935. Set which planes will be processed, unprocessed planes will be copied.
  12936. By default value 0xf, all planes will be processed.
  12937. If the format has 1 or 2 components, then luma is bit 0.
  12938. If the format has 3 or 4 components:
  12939. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  12940. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  12941. If present, the alpha channel is always the last bit.
  12942. @item inplace
  12943. Do not require 2nd input for processing, instead use alpha plane from input stream.
  12944. @end table
  12945. @anchor{unsharp}
  12946. @section unsharp
  12947. Sharpen or blur the input video.
  12948. It accepts the following parameters:
  12949. @table @option
  12950. @item luma_msize_x, lx
  12951. Set the luma matrix horizontal size. It must be an odd integer between
  12952. 3 and 23. The default value is 5.
  12953. @item luma_msize_y, ly
  12954. Set the luma matrix vertical size. It must be an odd integer between 3
  12955. and 23. The default value is 5.
  12956. @item luma_amount, la
  12957. Set the luma effect strength. It must be a floating point number, reasonable
  12958. values lay between -1.5 and 1.5.
  12959. Negative values will blur the input video, while positive values will
  12960. sharpen it, a value of zero will disable the effect.
  12961. Default value is 1.0.
  12962. @item chroma_msize_x, cx
  12963. Set the chroma matrix horizontal size. It must be an odd integer
  12964. between 3 and 23. The default value is 5.
  12965. @item chroma_msize_y, cy
  12966. Set the chroma matrix vertical size. It must be an odd integer
  12967. between 3 and 23. The default value is 5.
  12968. @item chroma_amount, ca
  12969. Set the chroma effect strength. It must be a floating point number, reasonable
  12970. values lay between -1.5 and 1.5.
  12971. Negative values will blur the input video, while positive values will
  12972. sharpen it, a value of zero will disable the effect.
  12973. Default value is 0.0.
  12974. @end table
  12975. All parameters are optional and default to the equivalent of the
  12976. string '5:5:1.0:5:5:0.0'.
  12977. @subsection Examples
  12978. @itemize
  12979. @item
  12980. Apply strong luma sharpen effect:
  12981. @example
  12982. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  12983. @end example
  12984. @item
  12985. Apply a strong blur of both luma and chroma parameters:
  12986. @example
  12987. unsharp=7:7:-2:7:7:-2
  12988. @end example
  12989. @end itemize
  12990. @section uspp
  12991. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  12992. the image at several (or - in the case of @option{quality} level @code{8} - all)
  12993. shifts and average the results.
  12994. The way this differs from the behavior of spp is that uspp actually encodes &
  12995. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  12996. DCT similar to MJPEG.
  12997. The filter accepts the following options:
  12998. @table @option
  12999. @item quality
  13000. Set quality. This option defines the number of levels for averaging. It accepts
  13001. an integer in the range 0-8. If set to @code{0}, the filter will have no
  13002. effect. A value of @code{8} means the higher quality. For each increment of
  13003. that value the speed drops by a factor of approximately 2. Default value is
  13004. @code{3}.
  13005. @item qp
  13006. Force a constant quantization parameter. If not set, the filter will use the QP
  13007. from the video stream (if available).
  13008. @end table
  13009. @section vaguedenoiser
  13010. Apply a wavelet based denoiser.
  13011. It transforms each frame from the video input into the wavelet domain,
  13012. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  13013. the obtained coefficients. It does an inverse wavelet transform after.
  13014. Due to wavelet properties, it should give a nice smoothed result, and
  13015. reduced noise, without blurring picture features.
  13016. This filter accepts the following options:
  13017. @table @option
  13018. @item threshold
  13019. The filtering strength. The higher, the more filtered the video will be.
  13020. Hard thresholding can use a higher threshold than soft thresholding
  13021. before the video looks overfiltered. Default value is 2.
  13022. @item method
  13023. The filtering method the filter will use.
  13024. It accepts the following values:
  13025. @table @samp
  13026. @item hard
  13027. All values under the threshold will be zeroed.
  13028. @item soft
  13029. All values under the threshold will be zeroed. All values above will be
  13030. reduced by the threshold.
  13031. @item garrote
  13032. Scales or nullifies coefficients - intermediary between (more) soft and
  13033. (less) hard thresholding.
  13034. @end table
  13035. Default is garrote.
  13036. @item nsteps
  13037. Number of times, the wavelet will decompose the picture. Picture can't
  13038. be decomposed beyond a particular point (typically, 8 for a 640x480
  13039. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  13040. @item percent
  13041. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  13042. @item planes
  13043. A list of the planes to process. By default all planes are processed.
  13044. @end table
  13045. @section vectorscope
  13046. Display 2 color component values in the two dimensional graph (which is called
  13047. a vectorscope).
  13048. This filter accepts the following options:
  13049. @table @option
  13050. @item mode, m
  13051. Set vectorscope mode.
  13052. It accepts the following values:
  13053. @table @samp
  13054. @item gray
  13055. Gray values are displayed on graph, higher brightness means more pixels have
  13056. same component color value on location in graph. This is the default mode.
  13057. @item color
  13058. Gray values are displayed on graph. Surrounding pixels values which are not
  13059. present in video frame are drawn in gradient of 2 color components which are
  13060. set by option @code{x} and @code{y}. The 3rd color component is static.
  13061. @item color2
  13062. Actual color components values present in video frame are displayed on graph.
  13063. @item color3
  13064. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  13065. on graph increases value of another color component, which is luminance by
  13066. default values of @code{x} and @code{y}.
  13067. @item color4
  13068. Actual colors present in video frame are displayed on graph. If two different
  13069. colors map to same position on graph then color with higher value of component
  13070. not present in graph is picked.
  13071. @item color5
  13072. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  13073. component picked from radial gradient.
  13074. @end table
  13075. @item x
  13076. Set which color component will be represented on X-axis. Default is @code{1}.
  13077. @item y
  13078. Set which color component will be represented on Y-axis. Default is @code{2}.
  13079. @item intensity, i
  13080. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  13081. of color component which represents frequency of (X, Y) location in graph.
  13082. @item envelope, e
  13083. @table @samp
  13084. @item none
  13085. No envelope, this is default.
  13086. @item instant
  13087. Instant envelope, even darkest single pixel will be clearly highlighted.
  13088. @item peak
  13089. Hold maximum and minimum values presented in graph over time. This way you
  13090. can still spot out of range values without constantly looking at vectorscope.
  13091. @item peak+instant
  13092. Peak and instant envelope combined together.
  13093. @end table
  13094. @item graticule, g
  13095. Set what kind of graticule to draw.
  13096. @table @samp
  13097. @item none
  13098. @item green
  13099. @item color
  13100. @end table
  13101. @item opacity, o
  13102. Set graticule opacity.
  13103. @item flags, f
  13104. Set graticule flags.
  13105. @table @samp
  13106. @item white
  13107. Draw graticule for white point.
  13108. @item black
  13109. Draw graticule for black point.
  13110. @item name
  13111. Draw color points short names.
  13112. @end table
  13113. @item bgopacity, b
  13114. Set background opacity.
  13115. @item lthreshold, l
  13116. Set low threshold for color component not represented on X or Y axis.
  13117. Values lower than this value will be ignored. Default is 0.
  13118. Note this value is multiplied with actual max possible value one pixel component
  13119. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  13120. is 0.1 * 255 = 25.
  13121. @item hthreshold, h
  13122. Set high threshold for color component not represented on X or Y axis.
  13123. Values higher than this value will be ignored. Default is 1.
  13124. Note this value is multiplied with actual max possible value one pixel component
  13125. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  13126. is 0.9 * 255 = 230.
  13127. @item colorspace, c
  13128. Set what kind of colorspace to use when drawing graticule.
  13129. @table @samp
  13130. @item auto
  13131. @item 601
  13132. @item 709
  13133. @end table
  13134. Default is auto.
  13135. @end table
  13136. @anchor{vidstabdetect}
  13137. @section vidstabdetect
  13138. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  13139. @ref{vidstabtransform} for pass 2.
  13140. This filter generates a file with relative translation and rotation
  13141. transform information about subsequent frames, which is then used by
  13142. the @ref{vidstabtransform} filter.
  13143. To enable compilation of this filter you need to configure FFmpeg with
  13144. @code{--enable-libvidstab}.
  13145. This filter accepts the following options:
  13146. @table @option
  13147. @item result
  13148. Set the path to the file used to write the transforms information.
  13149. Default value is @file{transforms.trf}.
  13150. @item shakiness
  13151. Set how shaky the video is and how quick the camera is. It accepts an
  13152. integer in the range 1-10, a value of 1 means little shakiness, a
  13153. value of 10 means strong shakiness. Default value is 5.
  13154. @item accuracy
  13155. Set the accuracy of the detection process. It must be a value in the
  13156. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  13157. accuracy. Default value is 15.
  13158. @item stepsize
  13159. Set stepsize of the search process. The region around minimum is
  13160. scanned with 1 pixel resolution. Default value is 6.
  13161. @item mincontrast
  13162. Set minimum contrast. Below this value a local measurement field is
  13163. discarded. Must be a floating point value in the range 0-1. Default
  13164. value is 0.3.
  13165. @item tripod
  13166. Set reference frame number for tripod mode.
  13167. If enabled, the motion of the frames is compared to a reference frame
  13168. in the filtered stream, identified by the specified number. The idea
  13169. is to compensate all movements in a more-or-less static scene and keep
  13170. the camera view absolutely still.
  13171. If set to 0, it is disabled. The frames are counted starting from 1.
  13172. @item show
  13173. Show fields and transforms in the resulting frames. It accepts an
  13174. integer in the range 0-2. Default value is 0, which disables any
  13175. visualization.
  13176. @end table
  13177. @subsection Examples
  13178. @itemize
  13179. @item
  13180. Use default values:
  13181. @example
  13182. vidstabdetect
  13183. @end example
  13184. @item
  13185. Analyze strongly shaky movie and put the results in file
  13186. @file{mytransforms.trf}:
  13187. @example
  13188. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  13189. @end example
  13190. @item
  13191. Visualize the result of internal transformations in the resulting
  13192. video:
  13193. @example
  13194. vidstabdetect=show=1
  13195. @end example
  13196. @item
  13197. Analyze a video with medium shakiness using @command{ffmpeg}:
  13198. @example
  13199. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  13200. @end example
  13201. @end itemize
  13202. @anchor{vidstabtransform}
  13203. @section vidstabtransform
  13204. Video stabilization/deshaking: pass 2 of 2,
  13205. see @ref{vidstabdetect} for pass 1.
  13206. Read a file with transform information for each frame and
  13207. apply/compensate them. Together with the @ref{vidstabdetect}
  13208. filter this can be used to deshake videos. See also
  13209. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  13210. the @ref{unsharp} filter, see below.
  13211. To enable compilation of this filter you need to configure FFmpeg with
  13212. @code{--enable-libvidstab}.
  13213. @subsection Options
  13214. @table @option
  13215. @item input
  13216. Set path to the file used to read the transforms. Default value is
  13217. @file{transforms.trf}.
  13218. @item smoothing
  13219. Set the number of frames (value*2 + 1) used for lowpass filtering the
  13220. camera movements. Default value is 10.
  13221. For example a number of 10 means that 21 frames are used (10 in the
  13222. past and 10 in the future) to smoothen the motion in the video. A
  13223. larger value leads to a smoother video, but limits the acceleration of
  13224. the camera (pan/tilt movements). 0 is a special case where a static
  13225. camera is simulated.
  13226. @item optalgo
  13227. Set the camera path optimization algorithm.
  13228. Accepted values are:
  13229. @table @samp
  13230. @item gauss
  13231. gaussian kernel low-pass filter on camera motion (default)
  13232. @item avg
  13233. averaging on transformations
  13234. @end table
  13235. @item maxshift
  13236. Set maximal number of pixels to translate frames. Default value is -1,
  13237. meaning no limit.
  13238. @item maxangle
  13239. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  13240. value is -1, meaning no limit.
  13241. @item crop
  13242. Specify how to deal with borders that may be visible due to movement
  13243. compensation.
  13244. Available values are:
  13245. @table @samp
  13246. @item keep
  13247. keep image information from previous frame (default)
  13248. @item black
  13249. fill the border black
  13250. @end table
  13251. @item invert
  13252. Invert transforms if set to 1. Default value is 0.
  13253. @item relative
  13254. Consider transforms as relative to previous frame if set to 1,
  13255. absolute if set to 0. Default value is 0.
  13256. @item zoom
  13257. Set percentage to zoom. A positive value will result in a zoom-in
  13258. effect, a negative value in a zoom-out effect. Default value is 0 (no
  13259. zoom).
  13260. @item optzoom
  13261. Set optimal zooming to avoid borders.
  13262. Accepted values are:
  13263. @table @samp
  13264. @item 0
  13265. disabled
  13266. @item 1
  13267. optimal static zoom value is determined (only very strong movements
  13268. will lead to visible borders) (default)
  13269. @item 2
  13270. optimal adaptive zoom value is determined (no borders will be
  13271. visible), see @option{zoomspeed}
  13272. @end table
  13273. Note that the value given at zoom is added to the one calculated here.
  13274. @item zoomspeed
  13275. Set percent to zoom maximally each frame (enabled when
  13276. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  13277. 0.25.
  13278. @item interpol
  13279. Specify type of interpolation.
  13280. Available values are:
  13281. @table @samp
  13282. @item no
  13283. no interpolation
  13284. @item linear
  13285. linear only horizontal
  13286. @item bilinear
  13287. linear in both directions (default)
  13288. @item bicubic
  13289. cubic in both directions (slow)
  13290. @end table
  13291. @item tripod
  13292. Enable virtual tripod mode if set to 1, which is equivalent to
  13293. @code{relative=0:smoothing=0}. Default value is 0.
  13294. Use also @code{tripod} option of @ref{vidstabdetect}.
  13295. @item debug
  13296. Increase log verbosity if set to 1. Also the detected global motions
  13297. are written to the temporary file @file{global_motions.trf}. Default
  13298. value is 0.
  13299. @end table
  13300. @subsection Examples
  13301. @itemize
  13302. @item
  13303. Use @command{ffmpeg} for a typical stabilization with default values:
  13304. @example
  13305. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  13306. @end example
  13307. Note the use of the @ref{unsharp} filter which is always recommended.
  13308. @item
  13309. Zoom in a bit more and load transform data from a given file:
  13310. @example
  13311. vidstabtransform=zoom=5:input="mytransforms.trf"
  13312. @end example
  13313. @item
  13314. Smoothen the video even more:
  13315. @example
  13316. vidstabtransform=smoothing=30
  13317. @end example
  13318. @end itemize
  13319. @section vflip
  13320. Flip the input video vertically.
  13321. For example, to vertically flip a video with @command{ffmpeg}:
  13322. @example
  13323. ffmpeg -i in.avi -vf "vflip" out.avi
  13324. @end example
  13325. @section vfrdet
  13326. Detect variable frame rate video.
  13327. This filter tries to detect if the input is variable or constant frame rate.
  13328. At end it will output number of frames detected as having variable delta pts,
  13329. and ones with constant delta pts.
  13330. If there was frames with variable delta, than it will also show min and max delta
  13331. encountered.
  13332. @section vibrance
  13333. Boost or alter saturation.
  13334. The filter accepts the following options:
  13335. @table @option
  13336. @item intensity
  13337. Set strength of boost if positive value or strength of alter if negative value.
  13338. Default is 0. Allowed range is from -2 to 2.
  13339. @item rbal
  13340. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  13341. @item gbal
  13342. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  13343. @item bbal
  13344. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  13345. @item rlum
  13346. Set the red luma coefficient.
  13347. @item glum
  13348. Set the green luma coefficient.
  13349. @item blum
  13350. Set the blue luma coefficient.
  13351. @end table
  13352. @anchor{vignette}
  13353. @section vignette
  13354. Make or reverse a natural vignetting effect.
  13355. The filter accepts the following options:
  13356. @table @option
  13357. @item angle, a
  13358. Set lens angle expression as a number of radians.
  13359. The value is clipped in the @code{[0,PI/2]} range.
  13360. Default value: @code{"PI/5"}
  13361. @item x0
  13362. @item y0
  13363. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  13364. by default.
  13365. @item mode
  13366. Set forward/backward mode.
  13367. Available modes are:
  13368. @table @samp
  13369. @item forward
  13370. The larger the distance from the central point, the darker the image becomes.
  13371. @item backward
  13372. The larger the distance from the central point, the brighter the image becomes.
  13373. This can be used to reverse a vignette effect, though there is no automatic
  13374. detection to extract the lens @option{angle} and other settings (yet). It can
  13375. also be used to create a burning effect.
  13376. @end table
  13377. Default value is @samp{forward}.
  13378. @item eval
  13379. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  13380. It accepts the following values:
  13381. @table @samp
  13382. @item init
  13383. Evaluate expressions only once during the filter initialization.
  13384. @item frame
  13385. Evaluate expressions for each incoming frame. This is way slower than the
  13386. @samp{init} mode since it requires all the scalers to be re-computed, but it
  13387. allows advanced dynamic expressions.
  13388. @end table
  13389. Default value is @samp{init}.
  13390. @item dither
  13391. Set dithering to reduce the circular banding effects. Default is @code{1}
  13392. (enabled).
  13393. @item aspect
  13394. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  13395. Setting this value to the SAR of the input will make a rectangular vignetting
  13396. following the dimensions of the video.
  13397. Default is @code{1/1}.
  13398. @end table
  13399. @subsection Expressions
  13400. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  13401. following parameters.
  13402. @table @option
  13403. @item w
  13404. @item h
  13405. input width and height
  13406. @item n
  13407. the number of input frame, starting from 0
  13408. @item pts
  13409. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  13410. @var{TB} units, NAN if undefined
  13411. @item r
  13412. frame rate of the input video, NAN if the input frame rate is unknown
  13413. @item t
  13414. the PTS (Presentation TimeStamp) of the filtered video frame,
  13415. expressed in seconds, NAN if undefined
  13416. @item tb
  13417. time base of the input video
  13418. @end table
  13419. @subsection Examples
  13420. @itemize
  13421. @item
  13422. Apply simple strong vignetting effect:
  13423. @example
  13424. vignette=PI/4
  13425. @end example
  13426. @item
  13427. Make a flickering vignetting:
  13428. @example
  13429. vignette='PI/4+random(1)*PI/50':eval=frame
  13430. @end example
  13431. @end itemize
  13432. @section vmafmotion
  13433. Obtain the average vmaf motion score of a video.
  13434. It is one of the component filters of VMAF.
  13435. The obtained average motion score is printed through the logging system.
  13436. In the below example the input file @file{ref.mpg} is being processed and score
  13437. is computed.
  13438. @example
  13439. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  13440. @end example
  13441. @section vstack
  13442. Stack input videos vertically.
  13443. All streams must be of same pixel format and of same width.
  13444. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  13445. to create same output.
  13446. The filter accept the following option:
  13447. @table @option
  13448. @item inputs
  13449. Set number of input streams. Default is 2.
  13450. @item shortest
  13451. If set to 1, force the output to terminate when the shortest input
  13452. terminates. Default value is 0.
  13453. @end table
  13454. @section w3fdif
  13455. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  13456. Deinterlacing Filter").
  13457. Based on the process described by Martin Weston for BBC R&D, and
  13458. implemented based on the de-interlace algorithm written by Jim
  13459. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  13460. uses filter coefficients calculated by BBC R&D.
  13461. There are two sets of filter coefficients, so called "simple":
  13462. and "complex". Which set of filter coefficients is used can
  13463. be set by passing an optional parameter:
  13464. @table @option
  13465. @item filter
  13466. Set the interlacing filter coefficients. Accepts one of the following values:
  13467. @table @samp
  13468. @item simple
  13469. Simple filter coefficient set.
  13470. @item complex
  13471. More-complex filter coefficient set.
  13472. @end table
  13473. Default value is @samp{complex}.
  13474. @item deint
  13475. Specify which frames to deinterlace. Accept one of the following values:
  13476. @table @samp
  13477. @item all
  13478. Deinterlace all frames,
  13479. @item interlaced
  13480. Only deinterlace frames marked as interlaced.
  13481. @end table
  13482. Default value is @samp{all}.
  13483. @end table
  13484. @section waveform
  13485. Video waveform monitor.
  13486. The waveform monitor plots color component intensity. By default luminance
  13487. only. Each column of the waveform corresponds to a column of pixels in the
  13488. source video.
  13489. It accepts the following options:
  13490. @table @option
  13491. @item mode, m
  13492. Can be either @code{row}, or @code{column}. Default is @code{column}.
  13493. In row mode, the graph on the left side represents color component value 0 and
  13494. the right side represents value = 255. In column mode, the top side represents
  13495. color component value = 0 and bottom side represents value = 255.
  13496. @item intensity, i
  13497. Set intensity. Smaller values are useful to find out how many values of the same
  13498. luminance are distributed across input rows/columns.
  13499. Default value is @code{0.04}. Allowed range is [0, 1].
  13500. @item mirror, r
  13501. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  13502. In mirrored mode, higher values will be represented on the left
  13503. side for @code{row} mode and at the top for @code{column} mode. Default is
  13504. @code{1} (mirrored).
  13505. @item display, d
  13506. Set display mode.
  13507. It accepts the following values:
  13508. @table @samp
  13509. @item overlay
  13510. Presents information identical to that in the @code{parade}, except
  13511. that the graphs representing color components are superimposed directly
  13512. over one another.
  13513. This display mode makes it easier to spot relative differences or similarities
  13514. in overlapping areas of the color components that are supposed to be identical,
  13515. such as neutral whites, grays, or blacks.
  13516. @item stack
  13517. Display separate graph for the color components side by side in
  13518. @code{row} mode or one below the other in @code{column} mode.
  13519. @item parade
  13520. Display separate graph for the color components side by side in
  13521. @code{column} mode or one below the other in @code{row} mode.
  13522. Using this display mode makes it easy to spot color casts in the highlights
  13523. and shadows of an image, by comparing the contours of the top and the bottom
  13524. graphs of each waveform. Since whites, grays, and blacks are characterized
  13525. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  13526. should display three waveforms of roughly equal width/height. If not, the
  13527. correction is easy to perform by making level adjustments the three waveforms.
  13528. @end table
  13529. Default is @code{stack}.
  13530. @item components, c
  13531. Set which color components to display. Default is 1, which means only luminance
  13532. or red color component if input is in RGB colorspace. If is set for example to
  13533. 7 it will display all 3 (if) available color components.
  13534. @item envelope, e
  13535. @table @samp
  13536. @item none
  13537. No envelope, this is default.
  13538. @item instant
  13539. Instant envelope, minimum and maximum values presented in graph will be easily
  13540. visible even with small @code{step} value.
  13541. @item peak
  13542. Hold minimum and maximum values presented in graph across time. This way you
  13543. can still spot out of range values without constantly looking at waveforms.
  13544. @item peak+instant
  13545. Peak and instant envelope combined together.
  13546. @end table
  13547. @item filter, f
  13548. @table @samp
  13549. @item lowpass
  13550. No filtering, this is default.
  13551. @item flat
  13552. Luma and chroma combined together.
  13553. @item aflat
  13554. Similar as above, but shows difference between blue and red chroma.
  13555. @item xflat
  13556. Similar as above, but use different colors.
  13557. @item chroma
  13558. Displays only chroma.
  13559. @item color
  13560. Displays actual color value on waveform.
  13561. @item acolor
  13562. Similar as above, but with luma showing frequency of chroma values.
  13563. @end table
  13564. @item graticule, g
  13565. Set which graticule to display.
  13566. @table @samp
  13567. @item none
  13568. Do not display graticule.
  13569. @item green
  13570. Display green graticule showing legal broadcast ranges.
  13571. @item orange
  13572. Display orange graticule showing legal broadcast ranges.
  13573. @end table
  13574. @item opacity, o
  13575. Set graticule opacity.
  13576. @item flags, fl
  13577. Set graticule flags.
  13578. @table @samp
  13579. @item numbers
  13580. Draw numbers above lines. By default enabled.
  13581. @item dots
  13582. Draw dots instead of lines.
  13583. @end table
  13584. @item scale, s
  13585. Set scale used for displaying graticule.
  13586. @table @samp
  13587. @item digital
  13588. @item millivolts
  13589. @item ire
  13590. @end table
  13591. Default is digital.
  13592. @item bgopacity, b
  13593. Set background opacity.
  13594. @end table
  13595. @section weave, doubleweave
  13596. The @code{weave} takes a field-based video input and join
  13597. each two sequential fields into single frame, producing a new double
  13598. height clip with half the frame rate and half the frame count.
  13599. The @code{doubleweave} works same as @code{weave} but without
  13600. halving frame rate and frame count.
  13601. It accepts the following option:
  13602. @table @option
  13603. @item first_field
  13604. Set first field. Available values are:
  13605. @table @samp
  13606. @item top, t
  13607. Set the frame as top-field-first.
  13608. @item bottom, b
  13609. Set the frame as bottom-field-first.
  13610. @end table
  13611. @end table
  13612. @subsection Examples
  13613. @itemize
  13614. @item
  13615. Interlace video using @ref{select} and @ref{separatefields} filter:
  13616. @example
  13617. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  13618. @end example
  13619. @end itemize
  13620. @section xbr
  13621. Apply the xBR high-quality magnification filter which is designed for pixel
  13622. art. It follows a set of edge-detection rules, see
  13623. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  13624. It accepts the following option:
  13625. @table @option
  13626. @item n
  13627. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  13628. @code{3xBR} and @code{4} for @code{4xBR}.
  13629. Default is @code{3}.
  13630. @end table
  13631. @section xstack
  13632. Stack video inputs into custom layout.
  13633. All streams must be of same pixel format.
  13634. The filter accept the following option:
  13635. @table @option
  13636. @item inputs
  13637. Set number of input streams. Default is 2.
  13638. @item layout
  13639. Specify layout of inputs.
  13640. This option requires the desired layout configuration to be explicitly set by the user.
  13641. This sets position of each video input in output. Each input
  13642. is separated by '|'.
  13643. The first number represents the column, and the second number represents the row.
  13644. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  13645. where X is video input from which to take width or height.
  13646. Multiple values can be used when separated by '+'. In such
  13647. case values are summed together.
  13648. @item shortest
  13649. If set to 1, force the output to terminate when the shortest input
  13650. terminates. Default value is 0.
  13651. @end table
  13652. @subsection Examples
  13653. @itemize
  13654. @item
  13655. Display 4 inputs into 2x2 grid,
  13656. note that if inputs are of different sizes unused gaps might appear,
  13657. as not all of output video is used.
  13658. @example
  13659. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  13660. @end example
  13661. @item
  13662. Display 4 inputs into 1x4 grid,
  13663. note that if inputs are of different sizes unused gaps might appear,
  13664. as not all of output video is used.
  13665. @example
  13666. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  13667. @end example
  13668. @item
  13669. Display 9 inputs into 3x3 grid,
  13670. note that if inputs are of different sizes unused gaps might appear,
  13671. as not all of output video is used.
  13672. @example
  13673. xstack=inputs=9:layout=w3_0|w3_h0+h2|w3_h0|0_h4|0_0|w3+w1_0|0_h1+h2|w3+w1_h0|w3+w1_h1+h2
  13674. @end example
  13675. @end itemize
  13676. @anchor{yadif}
  13677. @section yadif
  13678. Deinterlace the input video ("yadif" means "yet another deinterlacing
  13679. filter").
  13680. It accepts the following parameters:
  13681. @table @option
  13682. @item mode
  13683. The interlacing mode to adopt. It accepts one of the following values:
  13684. @table @option
  13685. @item 0, send_frame
  13686. Output one frame for each frame.
  13687. @item 1, send_field
  13688. Output one frame for each field.
  13689. @item 2, send_frame_nospatial
  13690. Like @code{send_frame}, but it skips the spatial interlacing check.
  13691. @item 3, send_field_nospatial
  13692. Like @code{send_field}, but it skips the spatial interlacing check.
  13693. @end table
  13694. The default value is @code{send_frame}.
  13695. @item parity
  13696. The picture field parity assumed for the input interlaced video. It accepts one
  13697. of the following values:
  13698. @table @option
  13699. @item 0, tff
  13700. Assume the top field is first.
  13701. @item 1, bff
  13702. Assume the bottom field is first.
  13703. @item -1, auto
  13704. Enable automatic detection of field parity.
  13705. @end table
  13706. The default value is @code{auto}.
  13707. If the interlacing is unknown or the decoder does not export this information,
  13708. top field first will be assumed.
  13709. @item deint
  13710. Specify which frames to deinterlace. Accept one of the following
  13711. values:
  13712. @table @option
  13713. @item 0, all
  13714. Deinterlace all frames.
  13715. @item 1, interlaced
  13716. Only deinterlace frames marked as interlaced.
  13717. @end table
  13718. The default value is @code{all}.
  13719. @end table
  13720. @section yadif_cuda
  13721. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  13722. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  13723. and/or nvenc.
  13724. It accepts the following parameters:
  13725. @table @option
  13726. @item mode
  13727. The interlacing mode to adopt. It accepts one of the following values:
  13728. @table @option
  13729. @item 0, send_frame
  13730. Output one frame for each frame.
  13731. @item 1, send_field
  13732. Output one frame for each field.
  13733. @item 2, send_frame_nospatial
  13734. Like @code{send_frame}, but it skips the spatial interlacing check.
  13735. @item 3, send_field_nospatial
  13736. Like @code{send_field}, but it skips the spatial interlacing check.
  13737. @end table
  13738. The default value is @code{send_frame}.
  13739. @item parity
  13740. The picture field parity assumed for the input interlaced video. It accepts one
  13741. of the following values:
  13742. @table @option
  13743. @item 0, tff
  13744. Assume the top field is first.
  13745. @item 1, bff
  13746. Assume the bottom field is first.
  13747. @item -1, auto
  13748. Enable automatic detection of field parity.
  13749. @end table
  13750. The default value is @code{auto}.
  13751. If the interlacing is unknown or the decoder does not export this information,
  13752. top field first will be assumed.
  13753. @item deint
  13754. Specify which frames to deinterlace. Accept one of the following
  13755. values:
  13756. @table @option
  13757. @item 0, all
  13758. Deinterlace all frames.
  13759. @item 1, interlaced
  13760. Only deinterlace frames marked as interlaced.
  13761. @end table
  13762. The default value is @code{all}.
  13763. @end table
  13764. @section zoompan
  13765. Apply Zoom & Pan effect.
  13766. This filter accepts the following options:
  13767. @table @option
  13768. @item zoom, z
  13769. Set the zoom expression. Default is 1.
  13770. @item x
  13771. @item y
  13772. Set the x and y expression. Default is 0.
  13773. @item d
  13774. Set the duration expression in number of frames.
  13775. This sets for how many number of frames effect will last for
  13776. single input image.
  13777. @item s
  13778. Set the output image size, default is 'hd720'.
  13779. @item fps
  13780. Set the output frame rate, default is '25'.
  13781. @end table
  13782. Each expression can contain the following constants:
  13783. @table @option
  13784. @item in_w, iw
  13785. Input width.
  13786. @item in_h, ih
  13787. Input height.
  13788. @item out_w, ow
  13789. Output width.
  13790. @item out_h, oh
  13791. Output height.
  13792. @item in
  13793. Input frame count.
  13794. @item on
  13795. Output frame count.
  13796. @item x
  13797. @item y
  13798. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  13799. for current input frame.
  13800. @item px
  13801. @item py
  13802. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  13803. not yet such frame (first input frame).
  13804. @item zoom
  13805. Last calculated zoom from 'z' expression for current input frame.
  13806. @item pzoom
  13807. Last calculated zoom of last output frame of previous input frame.
  13808. @item duration
  13809. Number of output frames for current input frame. Calculated from 'd' expression
  13810. for each input frame.
  13811. @item pduration
  13812. number of output frames created for previous input frame
  13813. @item a
  13814. Rational number: input width / input height
  13815. @item sar
  13816. sample aspect ratio
  13817. @item dar
  13818. display aspect ratio
  13819. @end table
  13820. @subsection Examples
  13821. @itemize
  13822. @item
  13823. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  13824. @example
  13825. 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
  13826. @end example
  13827. @item
  13828. Zoom-in up to 1.5 and pan always at center of picture:
  13829. @example
  13830. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  13831. @end example
  13832. @item
  13833. Same as above but without pausing:
  13834. @example
  13835. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  13836. @end example
  13837. @end itemize
  13838. @anchor{zscale}
  13839. @section zscale
  13840. Scale (resize) the input video, using the z.lib library:
  13841. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  13842. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  13843. The zscale filter forces the output display aspect ratio to be the same
  13844. as the input, by changing the output sample aspect ratio.
  13845. If the input image format is different from the format requested by
  13846. the next filter, the zscale filter will convert the input to the
  13847. requested format.
  13848. @subsection Options
  13849. The filter accepts the following options.
  13850. @table @option
  13851. @item width, w
  13852. @item height, h
  13853. Set the output video dimension expression. Default value is the input
  13854. dimension.
  13855. If the @var{width} or @var{w} value is 0, the input width is used for
  13856. the output. If the @var{height} or @var{h} value is 0, the input height
  13857. is used for the output.
  13858. If one and only one of the values is -n with n >= 1, the zscale filter
  13859. will use a value that maintains the aspect ratio of the input image,
  13860. calculated from the other specified dimension. After that it will,
  13861. however, make sure that the calculated dimension is divisible by n and
  13862. adjust the value if necessary.
  13863. If both values are -n with n >= 1, the behavior will be identical to
  13864. both values being set to 0 as previously detailed.
  13865. See below for the list of accepted constants for use in the dimension
  13866. expression.
  13867. @item size, s
  13868. Set the video size. For the syntax of this option, check the
  13869. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13870. @item dither, d
  13871. Set the dither type.
  13872. Possible values are:
  13873. @table @var
  13874. @item none
  13875. @item ordered
  13876. @item random
  13877. @item error_diffusion
  13878. @end table
  13879. Default is none.
  13880. @item filter, f
  13881. Set the resize filter type.
  13882. Possible values are:
  13883. @table @var
  13884. @item point
  13885. @item bilinear
  13886. @item bicubic
  13887. @item spline16
  13888. @item spline36
  13889. @item lanczos
  13890. @end table
  13891. Default is bilinear.
  13892. @item range, r
  13893. Set the color range.
  13894. Possible values are:
  13895. @table @var
  13896. @item input
  13897. @item limited
  13898. @item full
  13899. @end table
  13900. Default is same as input.
  13901. @item primaries, p
  13902. Set the color primaries.
  13903. Possible values are:
  13904. @table @var
  13905. @item input
  13906. @item 709
  13907. @item unspecified
  13908. @item 170m
  13909. @item 240m
  13910. @item 2020
  13911. @end table
  13912. Default is same as input.
  13913. @item transfer, t
  13914. Set the transfer characteristics.
  13915. Possible values are:
  13916. @table @var
  13917. @item input
  13918. @item 709
  13919. @item unspecified
  13920. @item 601
  13921. @item linear
  13922. @item 2020_10
  13923. @item 2020_12
  13924. @item smpte2084
  13925. @item iec61966-2-1
  13926. @item arib-std-b67
  13927. @end table
  13928. Default is same as input.
  13929. @item matrix, m
  13930. Set the colorspace matrix.
  13931. Possible value are:
  13932. @table @var
  13933. @item input
  13934. @item 709
  13935. @item unspecified
  13936. @item 470bg
  13937. @item 170m
  13938. @item 2020_ncl
  13939. @item 2020_cl
  13940. @end table
  13941. Default is same as input.
  13942. @item rangein, rin
  13943. Set the input color range.
  13944. Possible values are:
  13945. @table @var
  13946. @item input
  13947. @item limited
  13948. @item full
  13949. @end table
  13950. Default is same as input.
  13951. @item primariesin, pin
  13952. Set the input color primaries.
  13953. Possible values are:
  13954. @table @var
  13955. @item input
  13956. @item 709
  13957. @item unspecified
  13958. @item 170m
  13959. @item 240m
  13960. @item 2020
  13961. @end table
  13962. Default is same as input.
  13963. @item transferin, tin
  13964. Set the input transfer characteristics.
  13965. Possible values are:
  13966. @table @var
  13967. @item input
  13968. @item 709
  13969. @item unspecified
  13970. @item 601
  13971. @item linear
  13972. @item 2020_10
  13973. @item 2020_12
  13974. @end table
  13975. Default is same as input.
  13976. @item matrixin, min
  13977. Set the input colorspace matrix.
  13978. Possible value are:
  13979. @table @var
  13980. @item input
  13981. @item 709
  13982. @item unspecified
  13983. @item 470bg
  13984. @item 170m
  13985. @item 2020_ncl
  13986. @item 2020_cl
  13987. @end table
  13988. @item chromal, c
  13989. Set the output chroma location.
  13990. Possible values are:
  13991. @table @var
  13992. @item input
  13993. @item left
  13994. @item center
  13995. @item topleft
  13996. @item top
  13997. @item bottomleft
  13998. @item bottom
  13999. @end table
  14000. @item chromalin, cin
  14001. Set the input chroma location.
  14002. Possible values are:
  14003. @table @var
  14004. @item input
  14005. @item left
  14006. @item center
  14007. @item topleft
  14008. @item top
  14009. @item bottomleft
  14010. @item bottom
  14011. @end table
  14012. @item npl
  14013. Set the nominal peak luminance.
  14014. @end table
  14015. The values of the @option{w} and @option{h} options are expressions
  14016. containing the following constants:
  14017. @table @var
  14018. @item in_w
  14019. @item in_h
  14020. The input width and height
  14021. @item iw
  14022. @item ih
  14023. These are the same as @var{in_w} and @var{in_h}.
  14024. @item out_w
  14025. @item out_h
  14026. The output (scaled) width and height
  14027. @item ow
  14028. @item oh
  14029. These are the same as @var{out_w} and @var{out_h}
  14030. @item a
  14031. The same as @var{iw} / @var{ih}
  14032. @item sar
  14033. input sample aspect ratio
  14034. @item dar
  14035. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  14036. @item hsub
  14037. @item vsub
  14038. horizontal and vertical input chroma subsample values. For example for the
  14039. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14040. @item ohsub
  14041. @item ovsub
  14042. horizontal and vertical output chroma subsample values. For example for the
  14043. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14044. @end table
  14045. @table @option
  14046. @end table
  14047. @c man end VIDEO FILTERS
  14048. @chapter Video Sources
  14049. @c man begin VIDEO SOURCES
  14050. Below is a description of the currently available video sources.
  14051. @section buffer
  14052. Buffer video frames, and make them available to the filter chain.
  14053. This source is mainly intended for a programmatic use, in particular
  14054. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  14055. It accepts the following parameters:
  14056. @table @option
  14057. @item video_size
  14058. Specify the size (width and height) of the buffered video frames. For the
  14059. syntax of this option, check the
  14060. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14061. @item width
  14062. The input video width.
  14063. @item height
  14064. The input video height.
  14065. @item pix_fmt
  14066. A string representing the pixel format of the buffered video frames.
  14067. It may be a number corresponding to a pixel format, or a pixel format
  14068. name.
  14069. @item time_base
  14070. Specify the timebase assumed by the timestamps of the buffered frames.
  14071. @item frame_rate
  14072. Specify the frame rate expected for the video stream.
  14073. @item pixel_aspect, sar
  14074. The sample (pixel) aspect ratio of the input video.
  14075. @item sws_param
  14076. Specify the optional parameters to be used for the scale filter which
  14077. is automatically inserted when an input change is detected in the
  14078. input size or format.
  14079. @item hw_frames_ctx
  14080. When using a hardware pixel format, this should be a reference to an
  14081. AVHWFramesContext describing input frames.
  14082. @end table
  14083. For example:
  14084. @example
  14085. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  14086. @end example
  14087. will instruct the source to accept video frames with size 320x240 and
  14088. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  14089. square pixels (1:1 sample aspect ratio).
  14090. Since the pixel format with name "yuv410p" corresponds to the number 6
  14091. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  14092. this example corresponds to:
  14093. @example
  14094. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  14095. @end example
  14096. Alternatively, the options can be specified as a flat string, but this
  14097. syntax is deprecated:
  14098. @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}]
  14099. @section cellauto
  14100. Create a pattern generated by an elementary cellular automaton.
  14101. The initial state of the cellular automaton can be defined through the
  14102. @option{filename} and @option{pattern} options. If such options are
  14103. not specified an initial state is created randomly.
  14104. At each new frame a new row in the video is filled with the result of
  14105. the cellular automaton next generation. The behavior when the whole
  14106. frame is filled is defined by the @option{scroll} option.
  14107. This source accepts the following options:
  14108. @table @option
  14109. @item filename, f
  14110. Read the initial cellular automaton state, i.e. the starting row, from
  14111. the specified file.
  14112. In the file, each non-whitespace character is considered an alive
  14113. cell, a newline will terminate the row, and further characters in the
  14114. file will be ignored.
  14115. @item pattern, p
  14116. Read the initial cellular automaton state, i.e. the starting row, from
  14117. the specified string.
  14118. Each non-whitespace character in the string is considered an alive
  14119. cell, a newline will terminate the row, and further characters in the
  14120. string will be ignored.
  14121. @item rate, r
  14122. Set the video rate, that is the number of frames generated per second.
  14123. Default is 25.
  14124. @item random_fill_ratio, ratio
  14125. Set the random fill ratio for the initial cellular automaton row. It
  14126. is a floating point number value ranging from 0 to 1, defaults to
  14127. 1/PHI.
  14128. This option is ignored when a file or a pattern is specified.
  14129. @item random_seed, seed
  14130. Set the seed for filling randomly the initial row, must be an integer
  14131. included between 0 and UINT32_MAX. If not specified, or if explicitly
  14132. set to -1, the filter will try to use a good random seed on a best
  14133. effort basis.
  14134. @item rule
  14135. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  14136. Default value is 110.
  14137. @item size, s
  14138. Set the size of the output video. For the syntax of this option, check the
  14139. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14140. If @option{filename} or @option{pattern} is specified, the size is set
  14141. by default to the width of the specified initial state row, and the
  14142. height is set to @var{width} * PHI.
  14143. If @option{size} is set, it must contain the width of the specified
  14144. pattern string, and the specified pattern will be centered in the
  14145. larger row.
  14146. If a filename or a pattern string is not specified, the size value
  14147. defaults to "320x518" (used for a randomly generated initial state).
  14148. @item scroll
  14149. If set to 1, scroll the output upward when all the rows in the output
  14150. have been already filled. If set to 0, the new generated row will be
  14151. written over the top row just after the bottom row is filled.
  14152. Defaults to 1.
  14153. @item start_full, full
  14154. If set to 1, completely fill the output with generated rows before
  14155. outputting the first frame.
  14156. This is the default behavior, for disabling set the value to 0.
  14157. @item stitch
  14158. If set to 1, stitch the left and right row edges together.
  14159. This is the default behavior, for disabling set the value to 0.
  14160. @end table
  14161. @subsection Examples
  14162. @itemize
  14163. @item
  14164. Read the initial state from @file{pattern}, and specify an output of
  14165. size 200x400.
  14166. @example
  14167. cellauto=f=pattern:s=200x400
  14168. @end example
  14169. @item
  14170. Generate a random initial row with a width of 200 cells, with a fill
  14171. ratio of 2/3:
  14172. @example
  14173. cellauto=ratio=2/3:s=200x200
  14174. @end example
  14175. @item
  14176. Create a pattern generated by rule 18 starting by a single alive cell
  14177. centered on an initial row with width 100:
  14178. @example
  14179. cellauto=p=@@:s=100x400:full=0:rule=18
  14180. @end example
  14181. @item
  14182. Specify a more elaborated initial pattern:
  14183. @example
  14184. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  14185. @end example
  14186. @end itemize
  14187. @anchor{coreimagesrc}
  14188. @section coreimagesrc
  14189. Video source generated on GPU using Apple's CoreImage API on OSX.
  14190. This video source is a specialized version of the @ref{coreimage} video filter.
  14191. Use a core image generator at the beginning of the applied filterchain to
  14192. generate the content.
  14193. The coreimagesrc video source accepts the following options:
  14194. @table @option
  14195. @item list_generators
  14196. List all available generators along with all their respective options as well as
  14197. possible minimum and maximum values along with the default values.
  14198. @example
  14199. list_generators=true
  14200. @end example
  14201. @item size, s
  14202. Specify the size of the sourced video. For the syntax of this option, check the
  14203. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14204. The default value is @code{320x240}.
  14205. @item rate, r
  14206. Specify the frame rate of the sourced video, as the number of frames
  14207. generated per second. It has to be a string in the format
  14208. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  14209. number or a valid video frame rate abbreviation. The default value is
  14210. "25".
  14211. @item sar
  14212. Set the sample aspect ratio of the sourced video.
  14213. @item duration, d
  14214. Set the duration of the sourced video. See
  14215. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14216. for the accepted syntax.
  14217. If not specified, or the expressed duration is negative, the video is
  14218. supposed to be generated forever.
  14219. @end table
  14220. Additionally, all options of the @ref{coreimage} video filter are accepted.
  14221. A complete filterchain can be used for further processing of the
  14222. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  14223. and examples for details.
  14224. @subsection Examples
  14225. @itemize
  14226. @item
  14227. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  14228. given as complete and escaped command-line for Apple's standard bash shell:
  14229. @example
  14230. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  14231. @end example
  14232. This example is equivalent to the QRCode example of @ref{coreimage} without the
  14233. need for a nullsrc video source.
  14234. @end itemize
  14235. @section mandelbrot
  14236. Generate a Mandelbrot set fractal, and progressively zoom towards the
  14237. point specified with @var{start_x} and @var{start_y}.
  14238. This source accepts the following options:
  14239. @table @option
  14240. @item end_pts
  14241. Set the terminal pts value. Default value is 400.
  14242. @item end_scale
  14243. Set the terminal scale value.
  14244. Must be a floating point value. Default value is 0.3.
  14245. @item inner
  14246. Set the inner coloring mode, that is the algorithm used to draw the
  14247. Mandelbrot fractal internal region.
  14248. It shall assume one of the following values:
  14249. @table @option
  14250. @item black
  14251. Set black mode.
  14252. @item convergence
  14253. Show time until convergence.
  14254. @item mincol
  14255. Set color based on point closest to the origin of the iterations.
  14256. @item period
  14257. Set period mode.
  14258. @end table
  14259. Default value is @var{mincol}.
  14260. @item bailout
  14261. Set the bailout value. Default value is 10.0.
  14262. @item maxiter
  14263. Set the maximum of iterations performed by the rendering
  14264. algorithm. Default value is 7189.
  14265. @item outer
  14266. Set outer coloring mode.
  14267. It shall assume one of following values:
  14268. @table @option
  14269. @item iteration_count
  14270. Set iteration cound mode.
  14271. @item normalized_iteration_count
  14272. set normalized iteration count mode.
  14273. @end table
  14274. Default value is @var{normalized_iteration_count}.
  14275. @item rate, r
  14276. Set frame rate, expressed as number of frames per second. Default
  14277. value is "25".
  14278. @item size, s
  14279. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  14280. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  14281. @item start_scale
  14282. Set the initial scale value. Default value is 3.0.
  14283. @item start_x
  14284. Set the initial x position. Must be a floating point value between
  14285. -100 and 100. Default value is -0.743643887037158704752191506114774.
  14286. @item start_y
  14287. Set the initial y position. Must be a floating point value between
  14288. -100 and 100. Default value is -0.131825904205311970493132056385139.
  14289. @end table
  14290. @section mptestsrc
  14291. Generate various test patterns, as generated by the MPlayer test filter.
  14292. The size of the generated video is fixed, and is 256x256.
  14293. This source is useful in particular for testing encoding features.
  14294. This source accepts the following options:
  14295. @table @option
  14296. @item rate, r
  14297. Specify the frame rate of the sourced video, as the number of frames
  14298. generated per second. It has to be a string in the format
  14299. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  14300. number or a valid video frame rate abbreviation. The default value is
  14301. "25".
  14302. @item duration, d
  14303. Set the duration of the sourced video. See
  14304. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14305. for the accepted syntax.
  14306. If not specified, or the expressed duration is negative, the video is
  14307. supposed to be generated forever.
  14308. @item test, t
  14309. Set the number or the name of the test to perform. Supported tests are:
  14310. @table @option
  14311. @item dc_luma
  14312. @item dc_chroma
  14313. @item freq_luma
  14314. @item freq_chroma
  14315. @item amp_luma
  14316. @item amp_chroma
  14317. @item cbp
  14318. @item mv
  14319. @item ring1
  14320. @item ring2
  14321. @item all
  14322. @end table
  14323. Default value is "all", which will cycle through the list of all tests.
  14324. @end table
  14325. Some examples:
  14326. @example
  14327. mptestsrc=t=dc_luma
  14328. @end example
  14329. will generate a "dc_luma" test pattern.
  14330. @section frei0r_src
  14331. Provide a frei0r source.
  14332. To enable compilation of this filter you need to install the frei0r
  14333. header and configure FFmpeg with @code{--enable-frei0r}.
  14334. This source accepts the following parameters:
  14335. @table @option
  14336. @item size
  14337. The size of the video to generate. For the syntax of this option, check the
  14338. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14339. @item framerate
  14340. The framerate of the generated video. It may be a string of the form
  14341. @var{num}/@var{den} or a frame rate abbreviation.
  14342. @item filter_name
  14343. The name to the frei0r source to load. For more information regarding frei0r and
  14344. how to set the parameters, read the @ref{frei0r} section in the video filters
  14345. documentation.
  14346. @item filter_params
  14347. A '|'-separated list of parameters to pass to the frei0r source.
  14348. @end table
  14349. For example, to generate a frei0r partik0l source with size 200x200
  14350. and frame rate 10 which is overlaid on the overlay filter main input:
  14351. @example
  14352. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  14353. @end example
  14354. @section life
  14355. Generate a life pattern.
  14356. This source is based on a generalization of John Conway's life game.
  14357. The sourced input represents a life grid, each pixel represents a cell
  14358. which can be in one of two possible states, alive or dead. Every cell
  14359. interacts with its eight neighbours, which are the cells that are
  14360. horizontally, vertically, or diagonally adjacent.
  14361. At each interaction the grid evolves according to the adopted rule,
  14362. which specifies the number of neighbor alive cells which will make a
  14363. cell stay alive or born. The @option{rule} option allows one to specify
  14364. the rule to adopt.
  14365. This source accepts the following options:
  14366. @table @option
  14367. @item filename, f
  14368. Set the file from which to read the initial grid state. In the file,
  14369. each non-whitespace character is considered an alive cell, and newline
  14370. is used to delimit the end of each row.
  14371. If this option is not specified, the initial grid is generated
  14372. randomly.
  14373. @item rate, r
  14374. Set the video rate, that is the number of frames generated per second.
  14375. Default is 25.
  14376. @item random_fill_ratio, ratio
  14377. Set the random fill ratio for the initial random grid. It is a
  14378. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  14379. It is ignored when a file is specified.
  14380. @item random_seed, seed
  14381. Set the seed for filling the initial random grid, must be an integer
  14382. included between 0 and UINT32_MAX. If not specified, or if explicitly
  14383. set to -1, the filter will try to use a good random seed on a best
  14384. effort basis.
  14385. @item rule
  14386. Set the life rule.
  14387. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  14388. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  14389. @var{NS} specifies the number of alive neighbor cells which make a
  14390. live cell stay alive, and @var{NB} the number of alive neighbor cells
  14391. which make a dead cell to become alive (i.e. to "born").
  14392. "s" and "b" can be used in place of "S" and "B", respectively.
  14393. Alternatively a rule can be specified by an 18-bits integer. The 9
  14394. high order bits are used to encode the next cell state if it is alive
  14395. for each number of neighbor alive cells, the low order bits specify
  14396. the rule for "borning" new cells. Higher order bits encode for an
  14397. higher number of neighbor cells.
  14398. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  14399. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  14400. Default value is "S23/B3", which is the original Conway's game of life
  14401. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  14402. cells, and will born a new cell if there are three alive cells around
  14403. a dead cell.
  14404. @item size, s
  14405. Set the size of the output video. For the syntax of this option, check the
  14406. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14407. If @option{filename} is specified, the size is set by default to the
  14408. same size of the input file. If @option{size} is set, it must contain
  14409. the size specified in the input file, and the initial grid defined in
  14410. that file is centered in the larger resulting area.
  14411. If a filename is not specified, the size value defaults to "320x240"
  14412. (used for a randomly generated initial grid).
  14413. @item stitch
  14414. If set to 1, stitch the left and right grid edges together, and the
  14415. top and bottom edges also. Defaults to 1.
  14416. @item mold
  14417. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  14418. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  14419. value from 0 to 255.
  14420. @item life_color
  14421. Set the color of living (or new born) cells.
  14422. @item death_color
  14423. Set the color of dead cells. If @option{mold} is set, this is the first color
  14424. used to represent a dead cell.
  14425. @item mold_color
  14426. Set mold color, for definitely dead and moldy cells.
  14427. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  14428. ffmpeg-utils manual,ffmpeg-utils}.
  14429. @end table
  14430. @subsection Examples
  14431. @itemize
  14432. @item
  14433. Read a grid from @file{pattern}, and center it on a grid of size
  14434. 300x300 pixels:
  14435. @example
  14436. life=f=pattern:s=300x300
  14437. @end example
  14438. @item
  14439. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  14440. @example
  14441. life=ratio=2/3:s=200x200
  14442. @end example
  14443. @item
  14444. Specify a custom rule for evolving a randomly generated grid:
  14445. @example
  14446. life=rule=S14/B34
  14447. @end example
  14448. @item
  14449. Full example with slow death effect (mold) using @command{ffplay}:
  14450. @example
  14451. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  14452. @end example
  14453. @end itemize
  14454. @anchor{allrgb}
  14455. @anchor{allyuv}
  14456. @anchor{color}
  14457. @anchor{haldclutsrc}
  14458. @anchor{nullsrc}
  14459. @anchor{pal75bars}
  14460. @anchor{pal100bars}
  14461. @anchor{rgbtestsrc}
  14462. @anchor{smptebars}
  14463. @anchor{smptehdbars}
  14464. @anchor{testsrc}
  14465. @anchor{testsrc2}
  14466. @anchor{yuvtestsrc}
  14467. @section allrgb, allyuv, color, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  14468. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  14469. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  14470. The @code{color} source provides an uniformly colored input.
  14471. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  14472. @ref{haldclut} filter.
  14473. The @code{nullsrc} source returns unprocessed video frames. It is
  14474. mainly useful to be employed in analysis / debugging tools, or as the
  14475. source for filters which ignore the input data.
  14476. The @code{pal75bars} source generates a color bars pattern, based on
  14477. EBU PAL recommendations with 75% color levels.
  14478. The @code{pal100bars} source generates a color bars pattern, based on
  14479. EBU PAL recommendations with 100% color levels.
  14480. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  14481. detecting RGB vs BGR issues. You should see a red, green and blue
  14482. stripe from top to bottom.
  14483. The @code{smptebars} source generates a color bars pattern, based on
  14484. the SMPTE Engineering Guideline EG 1-1990.
  14485. The @code{smptehdbars} source generates a color bars pattern, based on
  14486. the SMPTE RP 219-2002.
  14487. The @code{testsrc} source generates a test video pattern, showing a
  14488. color pattern, a scrolling gradient and a timestamp. This is mainly
  14489. intended for testing purposes.
  14490. The @code{testsrc2} source is similar to testsrc, but supports more
  14491. pixel formats instead of just @code{rgb24}. This allows using it as an
  14492. input for other tests without requiring a format conversion.
  14493. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  14494. see a y, cb and cr stripe from top to bottom.
  14495. The sources accept the following parameters:
  14496. @table @option
  14497. @item level
  14498. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  14499. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  14500. pixels to be used as identity matrix for 3D lookup tables. Each component is
  14501. coded on a @code{1/(N*N)} scale.
  14502. @item color, c
  14503. Specify the color of the source, only available in the @code{color}
  14504. source. For the syntax of this option, check the
  14505. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14506. @item size, s
  14507. Specify the size of the sourced video. For the syntax of this option, check the
  14508. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14509. The default value is @code{320x240}.
  14510. This option is not available with the @code{allrgb}, @code{allyuv}, and
  14511. @code{haldclutsrc} filters.
  14512. @item rate, r
  14513. Specify the frame rate of the sourced video, as the number of frames
  14514. generated per second. It has to be a string in the format
  14515. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  14516. number or a valid video frame rate abbreviation. The default value is
  14517. "25".
  14518. @item duration, d
  14519. Set the duration of the sourced video. See
  14520. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  14521. for the accepted syntax.
  14522. If not specified, or the expressed duration is negative, the video is
  14523. supposed to be generated forever.
  14524. @item sar
  14525. Set the sample aspect ratio of the sourced video.
  14526. @item alpha
  14527. Specify the alpha (opacity) of the background, only available in the
  14528. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  14529. 255 (fully opaque, the default).
  14530. @item decimals, n
  14531. Set the number of decimals to show in the timestamp, only available in the
  14532. @code{testsrc} source.
  14533. The displayed timestamp value will correspond to the original
  14534. timestamp value multiplied by the power of 10 of the specified
  14535. value. Default value is 0.
  14536. @end table
  14537. @subsection Examples
  14538. @itemize
  14539. @item
  14540. Generate a video with a duration of 5.3 seconds, with size
  14541. 176x144 and a frame rate of 10 frames per second:
  14542. @example
  14543. testsrc=duration=5.3:size=qcif:rate=10
  14544. @end example
  14545. @item
  14546. The following graph description will generate a red source
  14547. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  14548. frames per second:
  14549. @example
  14550. color=c=red@@0.2:s=qcif:r=10
  14551. @end example
  14552. @item
  14553. If the input content is to be ignored, @code{nullsrc} can be used. The
  14554. following command generates noise in the luminance plane by employing
  14555. the @code{geq} filter:
  14556. @example
  14557. nullsrc=s=256x256, geq=random(1)*255:128:128
  14558. @end example
  14559. @end itemize
  14560. @subsection Commands
  14561. The @code{color} source supports the following commands:
  14562. @table @option
  14563. @item c, color
  14564. Set the color of the created image. Accepts the same syntax of the
  14565. corresponding @option{color} option.
  14566. @end table
  14567. @section openclsrc
  14568. Generate video using an OpenCL program.
  14569. @table @option
  14570. @item source
  14571. OpenCL program source file.
  14572. @item kernel
  14573. Kernel name in program.
  14574. @item size, s
  14575. Size of frames to generate. This must be set.
  14576. @item format
  14577. Pixel format to use for the generated frames. This must be set.
  14578. @item rate, r
  14579. Number of frames generated every second. Default value is '25'.
  14580. @end table
  14581. For details of how the program loading works, see the @ref{program_opencl}
  14582. filter.
  14583. Example programs:
  14584. @itemize
  14585. @item
  14586. Generate a colour ramp by setting pixel values from the position of the pixel
  14587. in the output image. (Note that this will work with all pixel formats, but
  14588. the generated output will not be the same.)
  14589. @verbatim
  14590. __kernel void ramp(__write_only image2d_t dst,
  14591. unsigned int index)
  14592. {
  14593. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  14594. float4 val;
  14595. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  14596. write_imagef(dst, loc, val);
  14597. }
  14598. @end verbatim
  14599. @item
  14600. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  14601. @verbatim
  14602. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  14603. unsigned int index)
  14604. {
  14605. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  14606. float4 value = 0.0f;
  14607. int x = loc.x + index;
  14608. int y = loc.y + index;
  14609. while (x > 0 || y > 0) {
  14610. if (x % 3 == 1 && y % 3 == 1) {
  14611. value = 1.0f;
  14612. break;
  14613. }
  14614. x /= 3;
  14615. y /= 3;
  14616. }
  14617. write_imagef(dst, loc, value);
  14618. }
  14619. @end verbatim
  14620. @end itemize
  14621. @c man end VIDEO SOURCES
  14622. @chapter Video Sinks
  14623. @c man begin VIDEO SINKS
  14624. Below is a description of the currently available video sinks.
  14625. @section buffersink
  14626. Buffer video frames, and make them available to the end of the filter
  14627. graph.
  14628. This sink is mainly intended for programmatic use, in particular
  14629. through the interface defined in @file{libavfilter/buffersink.h}
  14630. or the options system.
  14631. It accepts a pointer to an AVBufferSinkContext structure, which
  14632. defines the incoming buffers' formats, to be passed as the opaque
  14633. parameter to @code{avfilter_init_filter} for initialization.
  14634. @section nullsink
  14635. Null video sink: do absolutely nothing with the input video. It is
  14636. mainly useful as a template and for use in analysis / debugging
  14637. tools.
  14638. @c man end VIDEO SINKS
  14639. @chapter Multimedia Filters
  14640. @c man begin MULTIMEDIA FILTERS
  14641. Below is a description of the currently available multimedia filters.
  14642. @section abitscope
  14643. Convert input audio to a video output, displaying the audio bit scope.
  14644. The filter accepts the following options:
  14645. @table @option
  14646. @item rate, r
  14647. Set frame rate, expressed as number of frames per second. Default
  14648. value is "25".
  14649. @item size, s
  14650. Specify the video size for the output. For the syntax of this option, check the
  14651. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14652. Default value is @code{1024x256}.
  14653. @item colors
  14654. Specify list of colors separated by space or by '|' which will be used to
  14655. draw channels. Unrecognized or missing colors will be replaced
  14656. by white color.
  14657. @end table
  14658. @section ahistogram
  14659. Convert input audio to a video output, displaying the volume histogram.
  14660. The filter accepts the following options:
  14661. @table @option
  14662. @item dmode
  14663. Specify how histogram is calculated.
  14664. It accepts the following values:
  14665. @table @samp
  14666. @item single
  14667. Use single histogram for all channels.
  14668. @item separate
  14669. Use separate histogram for each channel.
  14670. @end table
  14671. Default is @code{single}.
  14672. @item rate, r
  14673. Set frame rate, expressed as number of frames per second. Default
  14674. value is "25".
  14675. @item size, s
  14676. Specify the video size for the output. For the syntax of this option, check the
  14677. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14678. Default value is @code{hd720}.
  14679. @item scale
  14680. Set display scale.
  14681. It accepts the following values:
  14682. @table @samp
  14683. @item log
  14684. logarithmic
  14685. @item sqrt
  14686. square root
  14687. @item cbrt
  14688. cubic root
  14689. @item lin
  14690. linear
  14691. @item rlog
  14692. reverse logarithmic
  14693. @end table
  14694. Default is @code{log}.
  14695. @item ascale
  14696. Set amplitude scale.
  14697. It accepts the following values:
  14698. @table @samp
  14699. @item log
  14700. logarithmic
  14701. @item lin
  14702. linear
  14703. @end table
  14704. Default is @code{log}.
  14705. @item acount
  14706. Set how much frames to accumulate in histogram.
  14707. Defauls is 1. Setting this to -1 accumulates all frames.
  14708. @item rheight
  14709. Set histogram ratio of window height.
  14710. @item slide
  14711. Set sonogram sliding.
  14712. It accepts the following values:
  14713. @table @samp
  14714. @item replace
  14715. replace old rows with new ones.
  14716. @item scroll
  14717. scroll from top to bottom.
  14718. @end table
  14719. Default is @code{replace}.
  14720. @end table
  14721. @section aphasemeter
  14722. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  14723. representing mean phase of current audio frame. A video output can also be produced and is
  14724. enabled by default. The audio is passed through as first output.
  14725. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  14726. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  14727. and @code{1} means channels are in phase.
  14728. The filter accepts the following options, all related to its video output:
  14729. @table @option
  14730. @item rate, r
  14731. Set the output frame rate. Default value is @code{25}.
  14732. @item size, s
  14733. Set the video size for the output. For the syntax of this option, check the
  14734. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14735. Default value is @code{800x400}.
  14736. @item rc
  14737. @item gc
  14738. @item bc
  14739. Specify the red, green, blue contrast. Default values are @code{2},
  14740. @code{7} and @code{1}.
  14741. Allowed range is @code{[0, 255]}.
  14742. @item mpc
  14743. Set color which will be used for drawing median phase. If color is
  14744. @code{none} which is default, no median phase value will be drawn.
  14745. @item video
  14746. Enable video output. Default is enabled.
  14747. @end table
  14748. @section avectorscope
  14749. Convert input audio to a video output, representing the audio vector
  14750. scope.
  14751. The filter is used to measure the difference between channels of stereo
  14752. audio stream. A monoaural signal, consisting of identical left and right
  14753. signal, results in straight vertical line. Any stereo separation is visible
  14754. as a deviation from this line, creating a Lissajous figure.
  14755. If the straight (or deviation from it) but horizontal line appears this
  14756. indicates that the left and right channels are out of phase.
  14757. The filter accepts the following options:
  14758. @table @option
  14759. @item mode, m
  14760. Set the vectorscope mode.
  14761. Available values are:
  14762. @table @samp
  14763. @item lissajous
  14764. Lissajous rotated by 45 degrees.
  14765. @item lissajous_xy
  14766. Same as above but not rotated.
  14767. @item polar
  14768. Shape resembling half of circle.
  14769. @end table
  14770. Default value is @samp{lissajous}.
  14771. @item size, s
  14772. Set the video size for the output. For the syntax of this option, check the
  14773. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14774. Default value is @code{400x400}.
  14775. @item rate, r
  14776. Set the output frame rate. Default value is @code{25}.
  14777. @item rc
  14778. @item gc
  14779. @item bc
  14780. @item ac
  14781. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  14782. @code{160}, @code{80} and @code{255}.
  14783. Allowed range is @code{[0, 255]}.
  14784. @item rf
  14785. @item gf
  14786. @item bf
  14787. @item af
  14788. Specify the red, green, blue and alpha fade. Default values are @code{15},
  14789. @code{10}, @code{5} and @code{5}.
  14790. Allowed range is @code{[0, 255]}.
  14791. @item zoom
  14792. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  14793. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  14794. @item draw
  14795. Set the vectorscope drawing mode.
  14796. Available values are:
  14797. @table @samp
  14798. @item dot
  14799. Draw dot for each sample.
  14800. @item line
  14801. Draw line between previous and current sample.
  14802. @end table
  14803. Default value is @samp{dot}.
  14804. @item scale
  14805. Specify amplitude scale of audio samples.
  14806. Available values are:
  14807. @table @samp
  14808. @item lin
  14809. Linear.
  14810. @item sqrt
  14811. Square root.
  14812. @item cbrt
  14813. Cubic root.
  14814. @item log
  14815. Logarithmic.
  14816. @end table
  14817. @item swap
  14818. Swap left channel axis with right channel axis.
  14819. @item mirror
  14820. Mirror axis.
  14821. @table @samp
  14822. @item none
  14823. No mirror.
  14824. @item x
  14825. Mirror only x axis.
  14826. @item y
  14827. Mirror only y axis.
  14828. @item xy
  14829. Mirror both axis.
  14830. @end table
  14831. @end table
  14832. @subsection Examples
  14833. @itemize
  14834. @item
  14835. Complete example using @command{ffplay}:
  14836. @example
  14837. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  14838. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  14839. @end example
  14840. @end itemize
  14841. @section bench, abench
  14842. Benchmark part of a filtergraph.
  14843. The filter accepts the following options:
  14844. @table @option
  14845. @item action
  14846. Start or stop a timer.
  14847. Available values are:
  14848. @table @samp
  14849. @item start
  14850. Get the current time, set it as frame metadata (using the key
  14851. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  14852. @item stop
  14853. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  14854. the input frame metadata to get the time difference. Time difference, average,
  14855. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  14856. @code{min}) are then printed. The timestamps are expressed in seconds.
  14857. @end table
  14858. @end table
  14859. @subsection Examples
  14860. @itemize
  14861. @item
  14862. Benchmark @ref{selectivecolor} filter:
  14863. @example
  14864. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  14865. @end example
  14866. @end itemize
  14867. @section concat
  14868. Concatenate audio and video streams, joining them together one after the
  14869. other.
  14870. The filter works on segments of synchronized video and audio streams. All
  14871. segments must have the same number of streams of each type, and that will
  14872. also be the number of streams at output.
  14873. The filter accepts the following options:
  14874. @table @option
  14875. @item n
  14876. Set the number of segments. Default is 2.
  14877. @item v
  14878. Set the number of output video streams, that is also the number of video
  14879. streams in each segment. Default is 1.
  14880. @item a
  14881. Set the number of output audio streams, that is also the number of audio
  14882. streams in each segment. Default is 0.
  14883. @item unsafe
  14884. Activate unsafe mode: do not fail if segments have a different format.
  14885. @end table
  14886. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  14887. @var{a} audio outputs.
  14888. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  14889. segment, in the same order as the outputs, then the inputs for the second
  14890. segment, etc.
  14891. Related streams do not always have exactly the same duration, for various
  14892. reasons including codec frame size or sloppy authoring. For that reason,
  14893. related synchronized streams (e.g. a video and its audio track) should be
  14894. concatenated at once. The concat filter will use the duration of the longest
  14895. stream in each segment (except the last one), and if necessary pad shorter
  14896. audio streams with silence.
  14897. For this filter to work correctly, all segments must start at timestamp 0.
  14898. All corresponding streams must have the same parameters in all segments; the
  14899. filtering system will automatically select a common pixel format for video
  14900. streams, and a common sample format, sample rate and channel layout for
  14901. audio streams, but other settings, such as resolution, must be converted
  14902. explicitly by the user.
  14903. Different frame rates are acceptable but will result in variable frame rate
  14904. at output; be sure to configure the output file to handle it.
  14905. @subsection Examples
  14906. @itemize
  14907. @item
  14908. Concatenate an opening, an episode and an ending, all in bilingual version
  14909. (video in stream 0, audio in streams 1 and 2):
  14910. @example
  14911. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  14912. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  14913. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  14914. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  14915. @end example
  14916. @item
  14917. Concatenate two parts, handling audio and video separately, using the
  14918. (a)movie sources, and adjusting the resolution:
  14919. @example
  14920. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  14921. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  14922. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  14923. @end example
  14924. Note that a desync will happen at the stitch if the audio and video streams
  14925. do not have exactly the same duration in the first file.
  14926. @end itemize
  14927. @subsection Commands
  14928. This filter supports the following commands:
  14929. @table @option
  14930. @item next
  14931. Close the current segment and step to the next one
  14932. @end table
  14933. @section drawgraph, adrawgraph
  14934. Draw a graph using input video or audio metadata.
  14935. It accepts the following parameters:
  14936. @table @option
  14937. @item m1
  14938. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  14939. @item fg1
  14940. Set 1st foreground color expression.
  14941. @item m2
  14942. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  14943. @item fg2
  14944. Set 2nd foreground color expression.
  14945. @item m3
  14946. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  14947. @item fg3
  14948. Set 3rd foreground color expression.
  14949. @item m4
  14950. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  14951. @item fg4
  14952. Set 4th foreground color expression.
  14953. @item min
  14954. Set minimal value of metadata value.
  14955. @item max
  14956. Set maximal value of metadata value.
  14957. @item bg
  14958. Set graph background color. Default is white.
  14959. @item mode
  14960. Set graph mode.
  14961. Available values for mode is:
  14962. @table @samp
  14963. @item bar
  14964. @item dot
  14965. @item line
  14966. @end table
  14967. Default is @code{line}.
  14968. @item slide
  14969. Set slide mode.
  14970. Available values for slide is:
  14971. @table @samp
  14972. @item frame
  14973. Draw new frame when right border is reached.
  14974. @item replace
  14975. Replace old columns with new ones.
  14976. @item scroll
  14977. Scroll from right to left.
  14978. @item rscroll
  14979. Scroll from left to right.
  14980. @item picture
  14981. Draw single picture.
  14982. @end table
  14983. Default is @code{frame}.
  14984. @item size
  14985. Set size of graph video. For the syntax of this option, check the
  14986. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14987. The default value is @code{900x256}.
  14988. The foreground color expressions can use the following variables:
  14989. @table @option
  14990. @item MIN
  14991. Minimal value of metadata value.
  14992. @item MAX
  14993. Maximal value of metadata value.
  14994. @item VAL
  14995. Current metadata key value.
  14996. @end table
  14997. The color is defined as 0xAABBGGRR.
  14998. @end table
  14999. Example using metadata from @ref{signalstats} filter:
  15000. @example
  15001. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  15002. @end example
  15003. Example using metadata from @ref{ebur128} filter:
  15004. @example
  15005. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  15006. @end example
  15007. @anchor{ebur128}
  15008. @section ebur128
  15009. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  15010. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  15011. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  15012. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  15013. The filter also has a video output (see the @var{video} option) with a real
  15014. time graph to observe the loudness evolution. The graphic contains the logged
  15015. message mentioned above, so it is not printed anymore when this option is set,
  15016. unless the verbose logging is set. The main graphing area contains the
  15017. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  15018. the momentary loudness (400 milliseconds), but can optionally be configured
  15019. to instead display short-term loudness (see @var{gauge}).
  15020. The green area marks a +/- 1LU target range around the target loudness
  15021. (-23LUFS by default, unless modified through @var{target}).
  15022. More information about the Loudness Recommendation EBU R128 on
  15023. @url{http://tech.ebu.ch/loudness}.
  15024. The filter accepts the following options:
  15025. @table @option
  15026. @item video
  15027. Activate the video output. The audio stream is passed unchanged whether this
  15028. option is set or no. The video stream will be the first output stream if
  15029. activated. Default is @code{0}.
  15030. @item size
  15031. Set the video size. This option is for video only. For the syntax of this
  15032. option, check the
  15033. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15034. Default and minimum resolution is @code{640x480}.
  15035. @item meter
  15036. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  15037. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  15038. other integer value between this range is allowed.
  15039. @item metadata
  15040. Set metadata injection. If set to @code{1}, the audio input will be segmented
  15041. into 100ms output frames, each of them containing various loudness information
  15042. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  15043. Default is @code{0}.
  15044. @item framelog
  15045. Force the frame logging level.
  15046. Available values are:
  15047. @table @samp
  15048. @item info
  15049. information logging level
  15050. @item verbose
  15051. verbose logging level
  15052. @end table
  15053. By default, the logging level is set to @var{info}. If the @option{video} or
  15054. the @option{metadata} options are set, it switches to @var{verbose}.
  15055. @item peak
  15056. Set peak mode(s).
  15057. Available modes can be cumulated (the option is a @code{flag} type). Possible
  15058. values are:
  15059. @table @samp
  15060. @item none
  15061. Disable any peak mode (default).
  15062. @item sample
  15063. Enable sample-peak mode.
  15064. Simple peak mode looking for the higher sample value. It logs a message
  15065. for sample-peak (identified by @code{SPK}).
  15066. @item true
  15067. Enable true-peak mode.
  15068. If enabled, the peak lookup is done on an over-sampled version of the input
  15069. stream for better peak accuracy. It logs a message for true-peak.
  15070. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  15071. This mode requires a build with @code{libswresample}.
  15072. @end table
  15073. @item dualmono
  15074. Treat mono input files as "dual mono". If a mono file is intended for playback
  15075. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  15076. If set to @code{true}, this option will compensate for this effect.
  15077. Multi-channel input files are not affected by this option.
  15078. @item panlaw
  15079. Set a specific pan law to be used for the measurement of dual mono files.
  15080. This parameter is optional, and has a default value of -3.01dB.
  15081. @item target
  15082. Set a specific target level (in LUFS) used as relative zero in the visualization.
  15083. This parameter is optional and has a default value of -23LUFS as specified
  15084. by EBU R128. However, material published online may prefer a level of -16LUFS
  15085. (e.g. for use with podcasts or video platforms).
  15086. @item gauge
  15087. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  15088. @code{shortterm}. By default the momentary value will be used, but in certain
  15089. scenarios it may be more useful to observe the short term value instead (e.g.
  15090. live mixing).
  15091. @item scale
  15092. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  15093. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  15094. video output, not the summary or continuous log output.
  15095. @end table
  15096. @subsection Examples
  15097. @itemize
  15098. @item
  15099. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  15100. @example
  15101. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  15102. @end example
  15103. @item
  15104. Run an analysis with @command{ffmpeg}:
  15105. @example
  15106. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  15107. @end example
  15108. @end itemize
  15109. @section interleave, ainterleave
  15110. Temporally interleave frames from several inputs.
  15111. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  15112. These filters read frames from several inputs and send the oldest
  15113. queued frame to the output.
  15114. Input streams must have well defined, monotonically increasing frame
  15115. timestamp values.
  15116. In order to submit one frame to output, these filters need to enqueue
  15117. at least one frame for each input, so they cannot work in case one
  15118. input is not yet terminated and will not receive incoming frames.
  15119. For example consider the case when one input is a @code{select} filter
  15120. which always drops input frames. The @code{interleave} filter will keep
  15121. reading from that input, but it will never be able to send new frames
  15122. to output until the input sends an end-of-stream signal.
  15123. Also, depending on inputs synchronization, the filters will drop
  15124. frames in case one input receives more frames than the other ones, and
  15125. the queue is already filled.
  15126. These filters accept the following options:
  15127. @table @option
  15128. @item nb_inputs, n
  15129. Set the number of different inputs, it is 2 by default.
  15130. @end table
  15131. @subsection Examples
  15132. @itemize
  15133. @item
  15134. Interleave frames belonging to different streams using @command{ffmpeg}:
  15135. @example
  15136. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  15137. @end example
  15138. @item
  15139. Add flickering blur effect:
  15140. @example
  15141. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  15142. @end example
  15143. @end itemize
  15144. @section metadata, ametadata
  15145. Manipulate frame metadata.
  15146. This filter accepts the following options:
  15147. @table @option
  15148. @item mode
  15149. Set mode of operation of the filter.
  15150. Can be one of the following:
  15151. @table @samp
  15152. @item select
  15153. If both @code{value} and @code{key} is set, select frames
  15154. which have such metadata. If only @code{key} is set, select
  15155. every frame that has such key in metadata.
  15156. @item add
  15157. Add new metadata @code{key} and @code{value}. If key is already available
  15158. do nothing.
  15159. @item modify
  15160. Modify value of already present key.
  15161. @item delete
  15162. If @code{value} is set, delete only keys that have such value.
  15163. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  15164. the frame.
  15165. @item print
  15166. Print key and its value if metadata was found. If @code{key} is not set print all
  15167. metadata values available in frame.
  15168. @end table
  15169. @item key
  15170. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  15171. @item value
  15172. Set metadata value which will be used. This option is mandatory for
  15173. @code{modify} and @code{add} mode.
  15174. @item function
  15175. Which function to use when comparing metadata value and @code{value}.
  15176. Can be one of following:
  15177. @table @samp
  15178. @item same_str
  15179. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  15180. @item starts_with
  15181. Values are interpreted as strings, returns true if metadata value starts with
  15182. the @code{value} option string.
  15183. @item less
  15184. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  15185. @item equal
  15186. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  15187. @item greater
  15188. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  15189. @item expr
  15190. Values are interpreted as floats, returns true if expression from option @code{expr}
  15191. evaluates to true.
  15192. @end table
  15193. @item expr
  15194. Set expression which is used when @code{function} is set to @code{expr}.
  15195. The expression is evaluated through the eval API and can contain the following
  15196. constants:
  15197. @table @option
  15198. @item VALUE1
  15199. Float representation of @code{value} from metadata key.
  15200. @item VALUE2
  15201. Float representation of @code{value} as supplied by user in @code{value} option.
  15202. @end table
  15203. @item file
  15204. If specified in @code{print} mode, output is written to the named file. Instead of
  15205. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  15206. for standard output. If @code{file} option is not set, output is written to the log
  15207. with AV_LOG_INFO loglevel.
  15208. @end table
  15209. @subsection Examples
  15210. @itemize
  15211. @item
  15212. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  15213. between 0 and 1.
  15214. @example
  15215. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  15216. @end example
  15217. @item
  15218. Print silencedetect output to file @file{metadata.txt}.
  15219. @example
  15220. silencedetect,ametadata=mode=print:file=metadata.txt
  15221. @end example
  15222. @item
  15223. Direct all metadata to a pipe with file descriptor 4.
  15224. @example
  15225. metadata=mode=print:file='pipe\:4'
  15226. @end example
  15227. @end itemize
  15228. @section perms, aperms
  15229. Set read/write permissions for the output frames.
  15230. These filters are mainly aimed at developers to test direct path in the
  15231. following filter in the filtergraph.
  15232. The filters accept the following options:
  15233. @table @option
  15234. @item mode
  15235. Select the permissions mode.
  15236. It accepts the following values:
  15237. @table @samp
  15238. @item none
  15239. Do nothing. This is the default.
  15240. @item ro
  15241. Set all the output frames read-only.
  15242. @item rw
  15243. Set all the output frames directly writable.
  15244. @item toggle
  15245. Make the frame read-only if writable, and writable if read-only.
  15246. @item random
  15247. Set each output frame read-only or writable randomly.
  15248. @end table
  15249. @item seed
  15250. Set the seed for the @var{random} mode, must be an integer included between
  15251. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  15252. @code{-1}, the filter will try to use a good random seed on a best effort
  15253. basis.
  15254. @end table
  15255. Note: in case of auto-inserted filter between the permission filter and the
  15256. following one, the permission might not be received as expected in that
  15257. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  15258. perms/aperms filter can avoid this problem.
  15259. @section realtime, arealtime
  15260. Slow down filtering to match real time approximately.
  15261. These filters will pause the filtering for a variable amount of time to
  15262. match the output rate with the input timestamps.
  15263. They are similar to the @option{re} option to @code{ffmpeg}.
  15264. They accept the following options:
  15265. @table @option
  15266. @item limit
  15267. Time limit for the pauses. Any pause longer than that will be considered
  15268. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  15269. @end table
  15270. @anchor{select}
  15271. @section select, aselect
  15272. Select frames to pass in output.
  15273. This filter accepts the following options:
  15274. @table @option
  15275. @item expr, e
  15276. Set expression, which is evaluated for each input frame.
  15277. If the expression is evaluated to zero, the frame is discarded.
  15278. If the evaluation result is negative or NaN, the frame is sent to the
  15279. first output; otherwise it is sent to the output with index
  15280. @code{ceil(val)-1}, assuming that the input index starts from 0.
  15281. For example a value of @code{1.2} corresponds to the output with index
  15282. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  15283. @item outputs, n
  15284. Set the number of outputs. The output to which to send the selected
  15285. frame is based on the result of the evaluation. Default value is 1.
  15286. @end table
  15287. The expression can contain the following constants:
  15288. @table @option
  15289. @item n
  15290. The (sequential) number of the filtered frame, starting from 0.
  15291. @item selected_n
  15292. The (sequential) number of the selected frame, starting from 0.
  15293. @item prev_selected_n
  15294. The sequential number of the last selected frame. It's NAN if undefined.
  15295. @item TB
  15296. The timebase of the input timestamps.
  15297. @item pts
  15298. The PTS (Presentation TimeStamp) of the filtered video frame,
  15299. expressed in @var{TB} units. It's NAN if undefined.
  15300. @item t
  15301. The PTS of the filtered video frame,
  15302. expressed in seconds. It's NAN if undefined.
  15303. @item prev_pts
  15304. The PTS of the previously filtered video frame. It's NAN if undefined.
  15305. @item prev_selected_pts
  15306. The PTS of the last previously filtered video frame. It's NAN if undefined.
  15307. @item prev_selected_t
  15308. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  15309. @item start_pts
  15310. The PTS of the first video frame in the video. It's NAN if undefined.
  15311. @item start_t
  15312. The time of the first video frame in the video. It's NAN if undefined.
  15313. @item pict_type @emph{(video only)}
  15314. The type of the filtered frame. It can assume one of the following
  15315. values:
  15316. @table @option
  15317. @item I
  15318. @item P
  15319. @item B
  15320. @item S
  15321. @item SI
  15322. @item SP
  15323. @item BI
  15324. @end table
  15325. @item interlace_type @emph{(video only)}
  15326. The frame interlace type. It can assume one of the following values:
  15327. @table @option
  15328. @item PROGRESSIVE
  15329. The frame is progressive (not interlaced).
  15330. @item TOPFIRST
  15331. The frame is top-field-first.
  15332. @item BOTTOMFIRST
  15333. The frame is bottom-field-first.
  15334. @end table
  15335. @item consumed_sample_n @emph{(audio only)}
  15336. the number of selected samples before the current frame
  15337. @item samples_n @emph{(audio only)}
  15338. the number of samples in the current frame
  15339. @item sample_rate @emph{(audio only)}
  15340. the input sample rate
  15341. @item key
  15342. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  15343. @item pos
  15344. the position in the file of the filtered frame, -1 if the information
  15345. is not available (e.g. for synthetic video)
  15346. @item scene @emph{(video only)}
  15347. value between 0 and 1 to indicate a new scene; a low value reflects a low
  15348. probability for the current frame to introduce a new scene, while a higher
  15349. value means the current frame is more likely to be one (see the example below)
  15350. @item concatdec_select
  15351. The concat demuxer can select only part of a concat input file by setting an
  15352. inpoint and an outpoint, but the output packets may not be entirely contained
  15353. in the selected interval. By using this variable, it is possible to skip frames
  15354. generated by the concat demuxer which are not exactly contained in the selected
  15355. interval.
  15356. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  15357. and the @var{lavf.concat.duration} packet metadata values which are also
  15358. present in the decoded frames.
  15359. The @var{concatdec_select} variable is -1 if the frame pts is at least
  15360. start_time and either the duration metadata is missing or the frame pts is less
  15361. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  15362. missing.
  15363. That basically means that an input frame is selected if its pts is within the
  15364. interval set by the concat demuxer.
  15365. @end table
  15366. The default value of the select expression is "1".
  15367. @subsection Examples
  15368. @itemize
  15369. @item
  15370. Select all frames in input:
  15371. @example
  15372. select
  15373. @end example
  15374. The example above is the same as:
  15375. @example
  15376. select=1
  15377. @end example
  15378. @item
  15379. Skip all frames:
  15380. @example
  15381. select=0
  15382. @end example
  15383. @item
  15384. Select only I-frames:
  15385. @example
  15386. select='eq(pict_type\,I)'
  15387. @end example
  15388. @item
  15389. Select one frame every 100:
  15390. @example
  15391. select='not(mod(n\,100))'
  15392. @end example
  15393. @item
  15394. Select only frames contained in the 10-20 time interval:
  15395. @example
  15396. select=between(t\,10\,20)
  15397. @end example
  15398. @item
  15399. Select only I-frames contained in the 10-20 time interval:
  15400. @example
  15401. select=between(t\,10\,20)*eq(pict_type\,I)
  15402. @end example
  15403. @item
  15404. Select frames with a minimum distance of 10 seconds:
  15405. @example
  15406. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  15407. @end example
  15408. @item
  15409. Use aselect to select only audio frames with samples number > 100:
  15410. @example
  15411. aselect='gt(samples_n\,100)'
  15412. @end example
  15413. @item
  15414. Create a mosaic of the first scenes:
  15415. @example
  15416. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  15417. @end example
  15418. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  15419. choice.
  15420. @item
  15421. Send even and odd frames to separate outputs, and compose them:
  15422. @example
  15423. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  15424. @end example
  15425. @item
  15426. Select useful frames from an ffconcat file which is using inpoints and
  15427. outpoints but where the source files are not intra frame only.
  15428. @example
  15429. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  15430. @end example
  15431. @end itemize
  15432. @section sendcmd, asendcmd
  15433. Send commands to filters in the filtergraph.
  15434. These filters read commands to be sent to other filters in the
  15435. filtergraph.
  15436. @code{sendcmd} must be inserted between two video filters,
  15437. @code{asendcmd} must be inserted between two audio filters, but apart
  15438. from that they act the same way.
  15439. The specification of commands can be provided in the filter arguments
  15440. with the @var{commands} option, or in a file specified by the
  15441. @var{filename} option.
  15442. These filters accept the following options:
  15443. @table @option
  15444. @item commands, c
  15445. Set the commands to be read and sent to the other filters.
  15446. @item filename, f
  15447. Set the filename of the commands to be read and sent to the other
  15448. filters.
  15449. @end table
  15450. @subsection Commands syntax
  15451. A commands description consists of a sequence of interval
  15452. specifications, comprising a list of commands to be executed when a
  15453. particular event related to that interval occurs. The occurring event
  15454. is typically the current frame time entering or leaving a given time
  15455. interval.
  15456. An interval is specified by the following syntax:
  15457. @example
  15458. @var{START}[-@var{END}] @var{COMMANDS};
  15459. @end example
  15460. The time interval is specified by the @var{START} and @var{END} times.
  15461. @var{END} is optional and defaults to the maximum time.
  15462. The current frame time is considered within the specified interval if
  15463. it is included in the interval [@var{START}, @var{END}), that is when
  15464. the time is greater or equal to @var{START} and is lesser than
  15465. @var{END}.
  15466. @var{COMMANDS} consists of a sequence of one or more command
  15467. specifications, separated by ",", relating to that interval. The
  15468. syntax of a command specification is given by:
  15469. @example
  15470. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  15471. @end example
  15472. @var{FLAGS} is optional and specifies the type of events relating to
  15473. the time interval which enable sending the specified command, and must
  15474. be a non-null sequence of identifier flags separated by "+" or "|" and
  15475. enclosed between "[" and "]".
  15476. The following flags are recognized:
  15477. @table @option
  15478. @item enter
  15479. The command is sent when the current frame timestamp enters the
  15480. specified interval. In other words, the command is sent when the
  15481. previous frame timestamp was not in the given interval, and the
  15482. current is.
  15483. @item leave
  15484. The command is sent when the current frame timestamp leaves the
  15485. specified interval. In other words, the command is sent when the
  15486. previous frame timestamp was in the given interval, and the
  15487. current is not.
  15488. @end table
  15489. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  15490. assumed.
  15491. @var{TARGET} specifies the target of the command, usually the name of
  15492. the filter class or a specific filter instance name.
  15493. @var{COMMAND} specifies the name of the command for the target filter.
  15494. @var{ARG} is optional and specifies the optional list of argument for
  15495. the given @var{COMMAND}.
  15496. Between one interval specification and another, whitespaces, or
  15497. sequences of characters starting with @code{#} until the end of line,
  15498. are ignored and can be used to annotate comments.
  15499. A simplified BNF description of the commands specification syntax
  15500. follows:
  15501. @example
  15502. @var{COMMAND_FLAG} ::= "enter" | "leave"
  15503. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  15504. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  15505. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  15506. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  15507. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  15508. @end example
  15509. @subsection Examples
  15510. @itemize
  15511. @item
  15512. Specify audio tempo change at second 4:
  15513. @example
  15514. asendcmd=c='4.0 atempo tempo 1.5',atempo
  15515. @end example
  15516. @item
  15517. Target a specific filter instance:
  15518. @example
  15519. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  15520. @end example
  15521. @item
  15522. Specify a list of drawtext and hue commands in a file.
  15523. @example
  15524. # show text in the interval 5-10
  15525. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  15526. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  15527. # desaturate the image in the interval 15-20
  15528. 15.0-20.0 [enter] hue s 0,
  15529. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  15530. [leave] hue s 1,
  15531. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  15532. # apply an exponential saturation fade-out effect, starting from time 25
  15533. 25 [enter] hue s exp(25-t)
  15534. @end example
  15535. A filtergraph allowing to read and process the above command list
  15536. stored in a file @file{test.cmd}, can be specified with:
  15537. @example
  15538. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  15539. @end example
  15540. @end itemize
  15541. @anchor{setpts}
  15542. @section setpts, asetpts
  15543. Change the PTS (presentation timestamp) of the input frames.
  15544. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  15545. This filter accepts the following options:
  15546. @table @option
  15547. @item expr
  15548. The expression which is evaluated for each frame to construct its timestamp.
  15549. @end table
  15550. The expression is evaluated through the eval API and can contain the following
  15551. constants:
  15552. @table @option
  15553. @item FRAME_RATE, FR
  15554. frame rate, only defined for constant frame-rate video
  15555. @item PTS
  15556. The presentation timestamp in input
  15557. @item N
  15558. The count of the input frame for video or the number of consumed samples,
  15559. not including the current frame for audio, starting from 0.
  15560. @item NB_CONSUMED_SAMPLES
  15561. The number of consumed samples, not including the current frame (only
  15562. audio)
  15563. @item NB_SAMPLES, S
  15564. The number of samples in the current frame (only audio)
  15565. @item SAMPLE_RATE, SR
  15566. The audio sample rate.
  15567. @item STARTPTS
  15568. The PTS of the first frame.
  15569. @item STARTT
  15570. the time in seconds of the first frame
  15571. @item INTERLACED
  15572. State whether the current frame is interlaced.
  15573. @item T
  15574. the time in seconds of the current frame
  15575. @item POS
  15576. original position in the file of the frame, or undefined if undefined
  15577. for the current frame
  15578. @item PREV_INPTS
  15579. The previous input PTS.
  15580. @item PREV_INT
  15581. previous input time in seconds
  15582. @item PREV_OUTPTS
  15583. The previous output PTS.
  15584. @item PREV_OUTT
  15585. previous output time in seconds
  15586. @item RTCTIME
  15587. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  15588. instead.
  15589. @item RTCSTART
  15590. The wallclock (RTC) time at the start of the movie in microseconds.
  15591. @item TB
  15592. The timebase of the input timestamps.
  15593. @end table
  15594. @subsection Examples
  15595. @itemize
  15596. @item
  15597. Start counting PTS from zero
  15598. @example
  15599. setpts=PTS-STARTPTS
  15600. @end example
  15601. @item
  15602. Apply fast motion effect:
  15603. @example
  15604. setpts=0.5*PTS
  15605. @end example
  15606. @item
  15607. Apply slow motion effect:
  15608. @example
  15609. setpts=2.0*PTS
  15610. @end example
  15611. @item
  15612. Set fixed rate of 25 frames per second:
  15613. @example
  15614. setpts=N/(25*TB)
  15615. @end example
  15616. @item
  15617. Set fixed rate 25 fps with some jitter:
  15618. @example
  15619. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  15620. @end example
  15621. @item
  15622. Apply an offset of 10 seconds to the input PTS:
  15623. @example
  15624. setpts=PTS+10/TB
  15625. @end example
  15626. @item
  15627. Generate timestamps from a "live source" and rebase onto the current timebase:
  15628. @example
  15629. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  15630. @end example
  15631. @item
  15632. Generate timestamps by counting samples:
  15633. @example
  15634. asetpts=N/SR/TB
  15635. @end example
  15636. @end itemize
  15637. @section setrange
  15638. Force color range for the output video frame.
  15639. The @code{setrange} filter marks the color range property for the
  15640. output frames. It does not change the input frame, but only sets the
  15641. corresponding property, which affects how the frame is treated by
  15642. following filters.
  15643. The filter accepts the following options:
  15644. @table @option
  15645. @item range
  15646. Available values are:
  15647. @table @samp
  15648. @item auto
  15649. Keep the same color range property.
  15650. @item unspecified, unknown
  15651. Set the color range as unspecified.
  15652. @item limited, tv, mpeg
  15653. Set the color range as limited.
  15654. @item full, pc, jpeg
  15655. Set the color range as full.
  15656. @end table
  15657. @end table
  15658. @section settb, asettb
  15659. Set the timebase to use for the output frames timestamps.
  15660. It is mainly useful for testing timebase configuration.
  15661. It accepts the following parameters:
  15662. @table @option
  15663. @item expr, tb
  15664. The expression which is evaluated into the output timebase.
  15665. @end table
  15666. The value for @option{tb} is an arithmetic expression representing a
  15667. rational. The expression can contain the constants "AVTB" (the default
  15668. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  15669. audio only). Default value is "intb".
  15670. @subsection Examples
  15671. @itemize
  15672. @item
  15673. Set the timebase to 1/25:
  15674. @example
  15675. settb=expr=1/25
  15676. @end example
  15677. @item
  15678. Set the timebase to 1/10:
  15679. @example
  15680. settb=expr=0.1
  15681. @end example
  15682. @item
  15683. Set the timebase to 1001/1000:
  15684. @example
  15685. settb=1+0.001
  15686. @end example
  15687. @item
  15688. Set the timebase to 2*intb:
  15689. @example
  15690. settb=2*intb
  15691. @end example
  15692. @item
  15693. Set the default timebase value:
  15694. @example
  15695. settb=AVTB
  15696. @end example
  15697. @end itemize
  15698. @section showcqt
  15699. Convert input audio to a video output representing frequency spectrum
  15700. logarithmically using Brown-Puckette constant Q transform algorithm with
  15701. direct frequency domain coefficient calculation (but the transform itself
  15702. is not really constant Q, instead the Q factor is actually variable/clamped),
  15703. with musical tone scale, from E0 to D#10.
  15704. The filter accepts the following options:
  15705. @table @option
  15706. @item size, s
  15707. Specify the video size for the output. It must be even. For the syntax of this option,
  15708. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15709. Default value is @code{1920x1080}.
  15710. @item fps, rate, r
  15711. Set the output frame rate. Default value is @code{25}.
  15712. @item bar_h
  15713. Set the bargraph height. It must be even. Default value is @code{-1} which
  15714. computes the bargraph height automatically.
  15715. @item axis_h
  15716. Set the axis height. It must be even. Default value is @code{-1} which computes
  15717. the axis height automatically.
  15718. @item sono_h
  15719. Set the sonogram height. It must be even. Default value is @code{-1} which
  15720. computes the sonogram height automatically.
  15721. @item fullhd
  15722. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  15723. instead. Default value is @code{1}.
  15724. @item sono_v, volume
  15725. Specify the sonogram volume expression. It can contain variables:
  15726. @table @option
  15727. @item bar_v
  15728. the @var{bar_v} evaluated expression
  15729. @item frequency, freq, f
  15730. the frequency where it is evaluated
  15731. @item timeclamp, tc
  15732. the value of @var{timeclamp} option
  15733. @end table
  15734. and functions:
  15735. @table @option
  15736. @item a_weighting(f)
  15737. A-weighting of equal loudness
  15738. @item b_weighting(f)
  15739. B-weighting of equal loudness
  15740. @item c_weighting(f)
  15741. C-weighting of equal loudness.
  15742. @end table
  15743. Default value is @code{16}.
  15744. @item bar_v, volume2
  15745. Specify the bargraph volume expression. It can contain variables:
  15746. @table @option
  15747. @item sono_v
  15748. the @var{sono_v} evaluated expression
  15749. @item frequency, freq, f
  15750. the frequency where it is evaluated
  15751. @item timeclamp, tc
  15752. the value of @var{timeclamp} option
  15753. @end table
  15754. and functions:
  15755. @table @option
  15756. @item a_weighting(f)
  15757. A-weighting of equal loudness
  15758. @item b_weighting(f)
  15759. B-weighting of equal loudness
  15760. @item c_weighting(f)
  15761. C-weighting of equal loudness.
  15762. @end table
  15763. Default value is @code{sono_v}.
  15764. @item sono_g, gamma
  15765. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  15766. higher gamma makes the spectrum having more range. Default value is @code{3}.
  15767. Acceptable range is @code{[1, 7]}.
  15768. @item bar_g, gamma2
  15769. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  15770. @code{[1, 7]}.
  15771. @item bar_t
  15772. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  15773. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  15774. @item timeclamp, tc
  15775. Specify the transform timeclamp. At low frequency, there is trade-off between
  15776. accuracy in time domain and frequency domain. If timeclamp is lower,
  15777. event in time domain is represented more accurately (such as fast bass drum),
  15778. otherwise event in frequency domain is represented more accurately
  15779. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  15780. @item attack
  15781. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  15782. limits future samples by applying asymmetric windowing in time domain, useful
  15783. when low latency is required. Accepted range is @code{[0, 1]}.
  15784. @item basefreq
  15785. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  15786. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  15787. @item endfreq
  15788. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  15789. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  15790. @item coeffclamp
  15791. This option is deprecated and ignored.
  15792. @item tlength
  15793. Specify the transform length in time domain. Use this option to control accuracy
  15794. trade-off between time domain and frequency domain at every frequency sample.
  15795. It can contain variables:
  15796. @table @option
  15797. @item frequency, freq, f
  15798. the frequency where it is evaluated
  15799. @item timeclamp, tc
  15800. the value of @var{timeclamp} option.
  15801. @end table
  15802. Default value is @code{384*tc/(384+tc*f)}.
  15803. @item count
  15804. Specify the transform count for every video frame. Default value is @code{6}.
  15805. Acceptable range is @code{[1, 30]}.
  15806. @item fcount
  15807. Specify the transform count for every single pixel. Default value is @code{0},
  15808. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  15809. @item fontfile
  15810. Specify font file for use with freetype to draw the axis. If not specified,
  15811. use embedded font. Note that drawing with font file or embedded font is not
  15812. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  15813. option instead.
  15814. @item font
  15815. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  15816. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  15817. @item fontcolor
  15818. Specify font color expression. This is arithmetic expression that should return
  15819. integer value 0xRRGGBB. It can contain variables:
  15820. @table @option
  15821. @item frequency, freq, f
  15822. the frequency where it is evaluated
  15823. @item timeclamp, tc
  15824. the value of @var{timeclamp} option
  15825. @end table
  15826. and functions:
  15827. @table @option
  15828. @item midi(f)
  15829. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  15830. @item r(x), g(x), b(x)
  15831. red, green, and blue value of intensity x.
  15832. @end table
  15833. Default value is @code{st(0, (midi(f)-59.5)/12);
  15834. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  15835. r(1-ld(1)) + b(ld(1))}.
  15836. @item axisfile
  15837. Specify image file to draw the axis. This option override @var{fontfile} and
  15838. @var{fontcolor} option.
  15839. @item axis, text
  15840. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  15841. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  15842. Default value is @code{1}.
  15843. @item csp
  15844. Set colorspace. The accepted values are:
  15845. @table @samp
  15846. @item unspecified
  15847. Unspecified (default)
  15848. @item bt709
  15849. BT.709
  15850. @item fcc
  15851. FCC
  15852. @item bt470bg
  15853. BT.470BG or BT.601-6 625
  15854. @item smpte170m
  15855. SMPTE-170M or BT.601-6 525
  15856. @item smpte240m
  15857. SMPTE-240M
  15858. @item bt2020ncl
  15859. BT.2020 with non-constant luminance
  15860. @end table
  15861. @item cscheme
  15862. Set spectrogram color scheme. This is list of floating point values with format
  15863. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  15864. The default is @code{1|0.5|0|0|0.5|1}.
  15865. @end table
  15866. @subsection Examples
  15867. @itemize
  15868. @item
  15869. Playing audio while showing the spectrum:
  15870. @example
  15871. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  15872. @end example
  15873. @item
  15874. Same as above, but with frame rate 30 fps:
  15875. @example
  15876. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  15877. @end example
  15878. @item
  15879. Playing at 1280x720:
  15880. @example
  15881. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  15882. @end example
  15883. @item
  15884. Disable sonogram display:
  15885. @example
  15886. sono_h=0
  15887. @end example
  15888. @item
  15889. A1 and its harmonics: A1, A2, (near)E3, A3:
  15890. @example
  15891. 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),
  15892. asplit[a][out1]; [a] showcqt [out0]'
  15893. @end example
  15894. @item
  15895. Same as above, but with more accuracy in frequency domain:
  15896. @example
  15897. 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),
  15898. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  15899. @end example
  15900. @item
  15901. Custom volume:
  15902. @example
  15903. bar_v=10:sono_v=bar_v*a_weighting(f)
  15904. @end example
  15905. @item
  15906. Custom gamma, now spectrum is linear to the amplitude.
  15907. @example
  15908. bar_g=2:sono_g=2
  15909. @end example
  15910. @item
  15911. Custom tlength equation:
  15912. @example
  15913. 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)))'
  15914. @end example
  15915. @item
  15916. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  15917. @example
  15918. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  15919. @end example
  15920. @item
  15921. Custom font using fontconfig:
  15922. @example
  15923. font='Courier New,Monospace,mono|bold'
  15924. @end example
  15925. @item
  15926. Custom frequency range with custom axis using image file:
  15927. @example
  15928. axisfile=myaxis.png:basefreq=40:endfreq=10000
  15929. @end example
  15930. @end itemize
  15931. @section showfreqs
  15932. Convert input audio to video output representing the audio power spectrum.
  15933. Audio amplitude is on Y-axis while frequency is on X-axis.
  15934. The filter accepts the following options:
  15935. @table @option
  15936. @item size, s
  15937. Specify size of video. For the syntax of this option, check the
  15938. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15939. Default is @code{1024x512}.
  15940. @item mode
  15941. Set display mode.
  15942. This set how each frequency bin will be represented.
  15943. It accepts the following values:
  15944. @table @samp
  15945. @item line
  15946. @item bar
  15947. @item dot
  15948. @end table
  15949. Default is @code{bar}.
  15950. @item ascale
  15951. Set amplitude scale.
  15952. It accepts the following values:
  15953. @table @samp
  15954. @item lin
  15955. Linear scale.
  15956. @item sqrt
  15957. Square root scale.
  15958. @item cbrt
  15959. Cubic root scale.
  15960. @item log
  15961. Logarithmic scale.
  15962. @end table
  15963. Default is @code{log}.
  15964. @item fscale
  15965. Set frequency scale.
  15966. It accepts the following values:
  15967. @table @samp
  15968. @item lin
  15969. Linear scale.
  15970. @item log
  15971. Logarithmic scale.
  15972. @item rlog
  15973. Reverse logarithmic scale.
  15974. @end table
  15975. Default is @code{lin}.
  15976. @item win_size
  15977. Set window size.
  15978. It accepts the following values:
  15979. @table @samp
  15980. @item w16
  15981. @item w32
  15982. @item w64
  15983. @item w128
  15984. @item w256
  15985. @item w512
  15986. @item w1024
  15987. @item w2048
  15988. @item w4096
  15989. @item w8192
  15990. @item w16384
  15991. @item w32768
  15992. @item w65536
  15993. @end table
  15994. Default is @code{w2048}
  15995. @item win_func
  15996. Set windowing function.
  15997. It accepts the following values:
  15998. @table @samp
  15999. @item rect
  16000. @item bartlett
  16001. @item hanning
  16002. @item hamming
  16003. @item blackman
  16004. @item welch
  16005. @item flattop
  16006. @item bharris
  16007. @item bnuttall
  16008. @item bhann
  16009. @item sine
  16010. @item nuttall
  16011. @item lanczos
  16012. @item gauss
  16013. @item tukey
  16014. @item dolph
  16015. @item cauchy
  16016. @item parzen
  16017. @item poisson
  16018. @item bohman
  16019. @end table
  16020. Default is @code{hanning}.
  16021. @item overlap
  16022. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  16023. which means optimal overlap for selected window function will be picked.
  16024. @item averaging
  16025. Set time averaging. Setting this to 0 will display current maximal peaks.
  16026. Default is @code{1}, which means time averaging is disabled.
  16027. @item colors
  16028. Specify list of colors separated by space or by '|' which will be used to
  16029. draw channel frequencies. Unrecognized or missing colors will be replaced
  16030. by white color.
  16031. @item cmode
  16032. Set channel display mode.
  16033. It accepts the following values:
  16034. @table @samp
  16035. @item combined
  16036. @item separate
  16037. @end table
  16038. Default is @code{combined}.
  16039. @item minamp
  16040. Set minimum amplitude used in @code{log} amplitude scaler.
  16041. @end table
  16042. @anchor{showspectrum}
  16043. @section showspectrum
  16044. Convert input audio to a video output, representing the audio frequency
  16045. spectrum.
  16046. The filter accepts the following options:
  16047. @table @option
  16048. @item size, s
  16049. Specify the video size for the output. For the syntax of this option, check the
  16050. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16051. Default value is @code{640x512}.
  16052. @item slide
  16053. Specify how the spectrum should slide along the window.
  16054. It accepts the following values:
  16055. @table @samp
  16056. @item replace
  16057. the samples start again on the left when they reach the right
  16058. @item scroll
  16059. the samples scroll from right to left
  16060. @item fullframe
  16061. frames are only produced when the samples reach the right
  16062. @item rscroll
  16063. the samples scroll from left to right
  16064. @end table
  16065. Default value is @code{replace}.
  16066. @item mode
  16067. Specify display mode.
  16068. It accepts the following values:
  16069. @table @samp
  16070. @item combined
  16071. all channels are displayed in the same row
  16072. @item separate
  16073. all channels are displayed in separate rows
  16074. @end table
  16075. Default value is @samp{combined}.
  16076. @item color
  16077. Specify display color mode.
  16078. It accepts the following values:
  16079. @table @samp
  16080. @item channel
  16081. each channel is displayed in a separate color
  16082. @item intensity
  16083. each channel is displayed using the same color scheme
  16084. @item rainbow
  16085. each channel is displayed using the rainbow color scheme
  16086. @item moreland
  16087. each channel is displayed using the moreland color scheme
  16088. @item nebulae
  16089. each channel is displayed using the nebulae color scheme
  16090. @item fire
  16091. each channel is displayed using the fire color scheme
  16092. @item fiery
  16093. each channel is displayed using the fiery color scheme
  16094. @item fruit
  16095. each channel is displayed using the fruit color scheme
  16096. @item cool
  16097. each channel is displayed using the cool color scheme
  16098. @item magma
  16099. each channel is displayed using the magma color scheme
  16100. @item green
  16101. each channel is displayed using the green color scheme
  16102. @end table
  16103. Default value is @samp{channel}.
  16104. @item scale
  16105. Specify scale used for calculating intensity color values.
  16106. It accepts the following values:
  16107. @table @samp
  16108. @item lin
  16109. linear
  16110. @item sqrt
  16111. square root, default
  16112. @item cbrt
  16113. cubic root
  16114. @item log
  16115. logarithmic
  16116. @item 4thrt
  16117. 4th root
  16118. @item 5thrt
  16119. 5th root
  16120. @end table
  16121. Default value is @samp{sqrt}.
  16122. @item saturation
  16123. Set saturation modifier for displayed colors. Negative values provide
  16124. alternative color scheme. @code{0} is no saturation at all.
  16125. Saturation must be in [-10.0, 10.0] range.
  16126. Default value is @code{1}.
  16127. @item win_func
  16128. Set window function.
  16129. It accepts the following values:
  16130. @table @samp
  16131. @item rect
  16132. @item bartlett
  16133. @item hann
  16134. @item hanning
  16135. @item hamming
  16136. @item blackman
  16137. @item welch
  16138. @item flattop
  16139. @item bharris
  16140. @item bnuttall
  16141. @item bhann
  16142. @item sine
  16143. @item nuttall
  16144. @item lanczos
  16145. @item gauss
  16146. @item tukey
  16147. @item dolph
  16148. @item cauchy
  16149. @item parzen
  16150. @item poisson
  16151. @item bohman
  16152. @end table
  16153. Default value is @code{hann}.
  16154. @item orientation
  16155. Set orientation of time vs frequency axis. Can be @code{vertical} or
  16156. @code{horizontal}. Default is @code{vertical}.
  16157. @item overlap
  16158. Set ratio of overlap window. Default value is @code{0}.
  16159. When value is @code{1} overlap is set to recommended size for specific
  16160. window function currently used.
  16161. @item gain
  16162. Set scale gain for calculating intensity color values.
  16163. Default value is @code{1}.
  16164. @item data
  16165. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  16166. @item rotation
  16167. Set color rotation, must be in [-1.0, 1.0] range.
  16168. Default value is @code{0}.
  16169. @item start
  16170. Set start frequency from which to display spectrogram. Default is @code{0}.
  16171. @item stop
  16172. Set stop frequency to which to display spectrogram. Default is @code{0}.
  16173. @item fps
  16174. Set upper frame rate limit. Default is @code{auto}, unlimited.
  16175. @item legend
  16176. Draw time and frequency axes and legends. Default is disabled.
  16177. @end table
  16178. The usage is very similar to the showwaves filter; see the examples in that
  16179. section.
  16180. @subsection Examples
  16181. @itemize
  16182. @item
  16183. Large window with logarithmic color scaling:
  16184. @example
  16185. showspectrum=s=1280x480:scale=log
  16186. @end example
  16187. @item
  16188. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  16189. @example
  16190. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  16191. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  16192. @end example
  16193. @end itemize
  16194. @section showspectrumpic
  16195. Convert input audio to a single video frame, representing the audio frequency
  16196. spectrum.
  16197. The filter accepts the following options:
  16198. @table @option
  16199. @item size, s
  16200. Specify the video size for the output. For the syntax of this option, check the
  16201. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16202. Default value is @code{4096x2048}.
  16203. @item mode
  16204. Specify display mode.
  16205. It accepts the following values:
  16206. @table @samp
  16207. @item combined
  16208. all channels are displayed in the same row
  16209. @item separate
  16210. all channels are displayed in separate rows
  16211. @end table
  16212. Default value is @samp{combined}.
  16213. @item color
  16214. Specify display color mode.
  16215. It accepts the following values:
  16216. @table @samp
  16217. @item channel
  16218. each channel is displayed in a separate color
  16219. @item intensity
  16220. each channel is displayed using the same color scheme
  16221. @item rainbow
  16222. each channel is displayed using the rainbow color scheme
  16223. @item moreland
  16224. each channel is displayed using the moreland color scheme
  16225. @item nebulae
  16226. each channel is displayed using the nebulae color scheme
  16227. @item fire
  16228. each channel is displayed using the fire color scheme
  16229. @item fiery
  16230. each channel is displayed using the fiery color scheme
  16231. @item fruit
  16232. each channel is displayed using the fruit color scheme
  16233. @item cool
  16234. each channel is displayed using the cool color scheme
  16235. @item magma
  16236. each channel is displayed using the magma color scheme
  16237. @item green
  16238. each channel is displayed using the green color scheme
  16239. @end table
  16240. Default value is @samp{intensity}.
  16241. @item scale
  16242. Specify scale used for calculating intensity color values.
  16243. It accepts the following values:
  16244. @table @samp
  16245. @item lin
  16246. linear
  16247. @item sqrt
  16248. square root, default
  16249. @item cbrt
  16250. cubic root
  16251. @item log
  16252. logarithmic
  16253. @item 4thrt
  16254. 4th root
  16255. @item 5thrt
  16256. 5th root
  16257. @end table
  16258. Default value is @samp{log}.
  16259. @item saturation
  16260. Set saturation modifier for displayed colors. Negative values provide
  16261. alternative color scheme. @code{0} is no saturation at all.
  16262. Saturation must be in [-10.0, 10.0] range.
  16263. Default value is @code{1}.
  16264. @item win_func
  16265. Set window function.
  16266. It accepts the following values:
  16267. @table @samp
  16268. @item rect
  16269. @item bartlett
  16270. @item hann
  16271. @item hanning
  16272. @item hamming
  16273. @item blackman
  16274. @item welch
  16275. @item flattop
  16276. @item bharris
  16277. @item bnuttall
  16278. @item bhann
  16279. @item sine
  16280. @item nuttall
  16281. @item lanczos
  16282. @item gauss
  16283. @item tukey
  16284. @item dolph
  16285. @item cauchy
  16286. @item parzen
  16287. @item poisson
  16288. @item bohman
  16289. @end table
  16290. Default value is @code{hann}.
  16291. @item orientation
  16292. Set orientation of time vs frequency axis. Can be @code{vertical} or
  16293. @code{horizontal}. Default is @code{vertical}.
  16294. @item gain
  16295. Set scale gain for calculating intensity color values.
  16296. Default value is @code{1}.
  16297. @item legend
  16298. Draw time and frequency axes and legends. Default is enabled.
  16299. @item rotation
  16300. Set color rotation, must be in [-1.0, 1.0] range.
  16301. Default value is @code{0}.
  16302. @item start
  16303. Set start frequency from which to display spectrogram. Default is @code{0}.
  16304. @item stop
  16305. Set stop frequency to which to display spectrogram. Default is @code{0}.
  16306. @end table
  16307. @subsection Examples
  16308. @itemize
  16309. @item
  16310. Extract an audio spectrogram of a whole audio track
  16311. in a 1024x1024 picture using @command{ffmpeg}:
  16312. @example
  16313. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  16314. @end example
  16315. @end itemize
  16316. @section showvolume
  16317. Convert input audio volume to a video output.
  16318. The filter accepts the following options:
  16319. @table @option
  16320. @item rate, r
  16321. Set video rate.
  16322. @item b
  16323. Set border width, allowed range is [0, 5]. Default is 1.
  16324. @item w
  16325. Set channel width, allowed range is [80, 8192]. Default is 400.
  16326. @item h
  16327. Set channel height, allowed range is [1, 900]. Default is 20.
  16328. @item f
  16329. Set fade, allowed range is [0, 1]. Default is 0.95.
  16330. @item c
  16331. Set volume color expression.
  16332. The expression can use the following variables:
  16333. @table @option
  16334. @item VOLUME
  16335. Current max volume of channel in dB.
  16336. @item PEAK
  16337. Current peak.
  16338. @item CHANNEL
  16339. Current channel number, starting from 0.
  16340. @end table
  16341. @item t
  16342. If set, displays channel names. Default is enabled.
  16343. @item v
  16344. If set, displays volume values. Default is enabled.
  16345. @item o
  16346. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  16347. default is @code{h}.
  16348. @item s
  16349. Set step size, allowed range is [0, 5]. Default is 0, which means
  16350. step is disabled.
  16351. @item p
  16352. Set background opacity, allowed range is [0, 1]. Default is 0.
  16353. @item m
  16354. Set metering mode, can be peak: @code{p} or rms: @code{r},
  16355. default is @code{p}.
  16356. @item ds
  16357. Set display scale, can be linear: @code{lin} or log: @code{log},
  16358. default is @code{lin}.
  16359. @item dm
  16360. In second.
  16361. If set to > 0., display a line for the max level
  16362. in the previous seconds.
  16363. default is disabled: @code{0.}
  16364. @item dmc
  16365. The color of the max line. Use when @code{dm} option is set to > 0.
  16366. default is: @code{orange}
  16367. @end table
  16368. @section showwaves
  16369. Convert input audio to a video output, representing the samples waves.
  16370. The filter accepts the following options:
  16371. @table @option
  16372. @item size, s
  16373. Specify the video size for the output. For the syntax of this option, check the
  16374. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16375. Default value is @code{600x240}.
  16376. @item mode
  16377. Set display mode.
  16378. Available values are:
  16379. @table @samp
  16380. @item point
  16381. Draw a point for each sample.
  16382. @item line
  16383. Draw a vertical line for each sample.
  16384. @item p2p
  16385. Draw a point for each sample and a line between them.
  16386. @item cline
  16387. Draw a centered vertical line for each sample.
  16388. @end table
  16389. Default value is @code{point}.
  16390. @item n
  16391. Set the number of samples which are printed on the same column. A
  16392. larger value will decrease the frame rate. Must be a positive
  16393. integer. This option can be set only if the value for @var{rate}
  16394. is not explicitly specified.
  16395. @item rate, r
  16396. Set the (approximate) output frame rate. This is done by setting the
  16397. option @var{n}. Default value is "25".
  16398. @item split_channels
  16399. Set if channels should be drawn separately or overlap. Default value is 0.
  16400. @item colors
  16401. Set colors separated by '|' which are going to be used for drawing of each channel.
  16402. @item scale
  16403. Set amplitude scale.
  16404. Available values are:
  16405. @table @samp
  16406. @item lin
  16407. Linear.
  16408. @item log
  16409. Logarithmic.
  16410. @item sqrt
  16411. Square root.
  16412. @item cbrt
  16413. Cubic root.
  16414. @end table
  16415. Default is linear.
  16416. @item draw
  16417. Set the draw mode. This is mostly useful to set for high @var{n}.
  16418. Available values are:
  16419. @table @samp
  16420. @item scale
  16421. Scale pixel values for each drawn sample.
  16422. @item full
  16423. Draw every sample directly.
  16424. @end table
  16425. Default value is @code{scale}.
  16426. @end table
  16427. @subsection Examples
  16428. @itemize
  16429. @item
  16430. Output the input file audio and the corresponding video representation
  16431. at the same time:
  16432. @example
  16433. amovie=a.mp3,asplit[out0],showwaves[out1]
  16434. @end example
  16435. @item
  16436. Create a synthetic signal and show it with showwaves, forcing a
  16437. frame rate of 30 frames per second:
  16438. @example
  16439. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  16440. @end example
  16441. @end itemize
  16442. @section showwavespic
  16443. Convert input audio to a single video frame, representing the samples waves.
  16444. The filter accepts the following options:
  16445. @table @option
  16446. @item size, s
  16447. Specify the video size for the output. For the syntax of this option, check the
  16448. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16449. Default value is @code{600x240}.
  16450. @item split_channels
  16451. Set if channels should be drawn separately or overlap. Default value is 0.
  16452. @item colors
  16453. Set colors separated by '|' which are going to be used for drawing of each channel.
  16454. @item scale
  16455. Set amplitude scale.
  16456. Available values are:
  16457. @table @samp
  16458. @item lin
  16459. Linear.
  16460. @item log
  16461. Logarithmic.
  16462. @item sqrt
  16463. Square root.
  16464. @item cbrt
  16465. Cubic root.
  16466. @end table
  16467. Default is linear.
  16468. @end table
  16469. @subsection Examples
  16470. @itemize
  16471. @item
  16472. Extract a channel split representation of the wave form of a whole audio track
  16473. in a 1024x800 picture using @command{ffmpeg}:
  16474. @example
  16475. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  16476. @end example
  16477. @end itemize
  16478. @section sidedata, asidedata
  16479. Delete frame side data, or select frames based on it.
  16480. This filter accepts the following options:
  16481. @table @option
  16482. @item mode
  16483. Set mode of operation of the filter.
  16484. Can be one of the following:
  16485. @table @samp
  16486. @item select
  16487. Select every frame with side data of @code{type}.
  16488. @item delete
  16489. Delete side data of @code{type}. If @code{type} is not set, delete all side
  16490. data in the frame.
  16491. @end table
  16492. @item type
  16493. Set side data type used with all modes. Must be set for @code{select} mode. For
  16494. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  16495. in @file{libavutil/frame.h}. For example, to choose
  16496. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  16497. @end table
  16498. @section spectrumsynth
  16499. Sythesize audio from 2 input video spectrums, first input stream represents
  16500. magnitude across time and second represents phase across time.
  16501. The filter will transform from frequency domain as displayed in videos back
  16502. to time domain as presented in audio output.
  16503. This filter is primarily created for reversing processed @ref{showspectrum}
  16504. filter outputs, but can synthesize sound from other spectrograms too.
  16505. But in such case results are going to be poor if the phase data is not
  16506. available, because in such cases phase data need to be recreated, usually
  16507. its just recreated from random noise.
  16508. For best results use gray only output (@code{channel} color mode in
  16509. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  16510. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  16511. @code{data} option. Inputs videos should generally use @code{fullframe}
  16512. slide mode as that saves resources needed for decoding video.
  16513. The filter accepts the following options:
  16514. @table @option
  16515. @item sample_rate
  16516. Specify sample rate of output audio, the sample rate of audio from which
  16517. spectrum was generated may differ.
  16518. @item channels
  16519. Set number of channels represented in input video spectrums.
  16520. @item scale
  16521. Set scale which was used when generating magnitude input spectrum.
  16522. Can be @code{lin} or @code{log}. Default is @code{log}.
  16523. @item slide
  16524. Set slide which was used when generating inputs spectrums.
  16525. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  16526. Default is @code{fullframe}.
  16527. @item win_func
  16528. Set window function used for resynthesis.
  16529. @item overlap
  16530. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  16531. which means optimal overlap for selected window function will be picked.
  16532. @item orientation
  16533. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  16534. Default is @code{vertical}.
  16535. @end table
  16536. @subsection Examples
  16537. @itemize
  16538. @item
  16539. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  16540. then resynthesize videos back to audio with spectrumsynth:
  16541. @example
  16542. 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
  16543. 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
  16544. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  16545. @end example
  16546. @end itemize
  16547. @section split, asplit
  16548. Split input into several identical outputs.
  16549. @code{asplit} works with audio input, @code{split} with video.
  16550. The filter accepts a single parameter which specifies the number of outputs. If
  16551. unspecified, it defaults to 2.
  16552. @subsection Examples
  16553. @itemize
  16554. @item
  16555. Create two separate outputs from the same input:
  16556. @example
  16557. [in] split [out0][out1]
  16558. @end example
  16559. @item
  16560. To create 3 or more outputs, you need to specify the number of
  16561. outputs, like in:
  16562. @example
  16563. [in] asplit=3 [out0][out1][out2]
  16564. @end example
  16565. @item
  16566. Create two separate outputs from the same input, one cropped and
  16567. one padded:
  16568. @example
  16569. [in] split [splitout1][splitout2];
  16570. [splitout1] crop=100:100:0:0 [cropout];
  16571. [splitout2] pad=200:200:100:100 [padout];
  16572. @end example
  16573. @item
  16574. Create 5 copies of the input audio with @command{ffmpeg}:
  16575. @example
  16576. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  16577. @end example
  16578. @end itemize
  16579. @section zmq, azmq
  16580. Receive commands sent through a libzmq client, and forward them to
  16581. filters in the filtergraph.
  16582. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  16583. must be inserted between two video filters, @code{azmq} between two
  16584. audio filters. Both are capable to send messages to any filter type.
  16585. To enable these filters you need to install the libzmq library and
  16586. headers and configure FFmpeg with @code{--enable-libzmq}.
  16587. For more information about libzmq see:
  16588. @url{http://www.zeromq.org/}
  16589. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  16590. receives messages sent through a network interface defined by the
  16591. @option{bind_address} (or the abbreviation "@option{b}") option.
  16592. Default value of this option is @file{tcp://localhost:5555}. You may
  16593. want to alter this value to your needs, but do not forget to escape any
  16594. ':' signs (see @ref{filtergraph escaping}).
  16595. The received message must be in the form:
  16596. @example
  16597. @var{TARGET} @var{COMMAND} [@var{ARG}]
  16598. @end example
  16599. @var{TARGET} specifies the target of the command, usually the name of
  16600. the filter class or a specific filter instance name. The default
  16601. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  16602. but you can override this by using the @samp{filter_name@@id} syntax
  16603. (see @ref{Filtergraph syntax}).
  16604. @var{COMMAND} specifies the name of the command for the target filter.
  16605. @var{ARG} is optional and specifies the optional argument list for the
  16606. given @var{COMMAND}.
  16607. Upon reception, the message is processed and the corresponding command
  16608. is injected into the filtergraph. Depending on the result, the filter
  16609. will send a reply to the client, adopting the format:
  16610. @example
  16611. @var{ERROR_CODE} @var{ERROR_REASON}
  16612. @var{MESSAGE}
  16613. @end example
  16614. @var{MESSAGE} is optional.
  16615. @subsection Examples
  16616. Look at @file{tools/zmqsend} for an example of a zmq client which can
  16617. be used to send commands processed by these filters.
  16618. Consider the following filtergraph generated by @command{ffplay}.
  16619. In this example the last overlay filter has an instance name. All other
  16620. filters will have default instance names.
  16621. @example
  16622. ffplay -dumpgraph 1 -f lavfi "
  16623. color=s=100x100:c=red [l];
  16624. color=s=100x100:c=blue [r];
  16625. nullsrc=s=200x100, zmq [bg];
  16626. [bg][l] overlay [bg+l];
  16627. [bg+l][r] overlay@@my=x=100 "
  16628. @end example
  16629. To change the color of the left side of the video, the following
  16630. command can be used:
  16631. @example
  16632. echo Parsed_color_0 c yellow | tools/zmqsend
  16633. @end example
  16634. To change the right side:
  16635. @example
  16636. echo Parsed_color_1 c pink | tools/zmqsend
  16637. @end example
  16638. To change the position of the right side:
  16639. @example
  16640. echo overlay@@my x 150 | tools/zmqsend
  16641. @end example
  16642. @c man end MULTIMEDIA FILTERS
  16643. @chapter Multimedia Sources
  16644. @c man begin MULTIMEDIA SOURCES
  16645. Below is a description of the currently available multimedia sources.
  16646. @section amovie
  16647. This is the same as @ref{movie} source, except it selects an audio
  16648. stream by default.
  16649. @anchor{movie}
  16650. @section movie
  16651. Read audio and/or video stream(s) from a movie container.
  16652. It accepts the following parameters:
  16653. @table @option
  16654. @item filename
  16655. The name of the resource to read (not necessarily a file; it can also be a
  16656. device or a stream accessed through some protocol).
  16657. @item format_name, f
  16658. Specifies the format assumed for the movie to read, and can be either
  16659. the name of a container or an input device. If not specified, the
  16660. format is guessed from @var{movie_name} or by probing.
  16661. @item seek_point, sp
  16662. Specifies the seek point in seconds. The frames will be output
  16663. starting from this seek point. The parameter is evaluated with
  16664. @code{av_strtod}, so the numerical value may be suffixed by an IS
  16665. postfix. The default value is "0".
  16666. @item streams, s
  16667. Specifies the streams to read. Several streams can be specified,
  16668. separated by "+". The source will then have as many outputs, in the
  16669. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  16670. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  16671. respectively the default (best suited) video and audio stream. Default
  16672. is "dv", or "da" if the filter is called as "amovie".
  16673. @item stream_index, si
  16674. Specifies the index of the video stream to read. If the value is -1,
  16675. the most suitable video stream will be automatically selected. The default
  16676. value is "-1". Deprecated. If the filter is called "amovie", it will select
  16677. audio instead of video.
  16678. @item loop
  16679. Specifies how many times to read the stream in sequence.
  16680. If the value is 0, the stream will be looped infinitely.
  16681. Default value is "1".
  16682. Note that when the movie is looped the source timestamps are not
  16683. changed, so it will generate non monotonically increasing timestamps.
  16684. @item discontinuity
  16685. Specifies the time difference between frames above which the point is
  16686. considered a timestamp discontinuity which is removed by adjusting the later
  16687. timestamps.
  16688. @end table
  16689. It allows overlaying a second video on top of the main input of
  16690. a filtergraph, as shown in this graph:
  16691. @example
  16692. input -----------> deltapts0 --> overlay --> output
  16693. ^
  16694. |
  16695. movie --> scale--> deltapts1 -------+
  16696. @end example
  16697. @subsection Examples
  16698. @itemize
  16699. @item
  16700. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  16701. on top of the input labelled "in":
  16702. @example
  16703. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  16704. [in] setpts=PTS-STARTPTS [main];
  16705. [main][over] overlay=16:16 [out]
  16706. @end example
  16707. @item
  16708. Read from a video4linux2 device, and overlay it on top of the input
  16709. labelled "in":
  16710. @example
  16711. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  16712. [in] setpts=PTS-STARTPTS [main];
  16713. [main][over] overlay=16:16 [out]
  16714. @end example
  16715. @item
  16716. Read the first video stream and the audio stream with id 0x81 from
  16717. dvd.vob; the video is connected to the pad named "video" and the audio is
  16718. connected to the pad named "audio":
  16719. @example
  16720. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  16721. @end example
  16722. @end itemize
  16723. @subsection Commands
  16724. Both movie and amovie support the following commands:
  16725. @table @option
  16726. @item seek
  16727. Perform seek using "av_seek_frame".
  16728. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  16729. @itemize
  16730. @item
  16731. @var{stream_index}: If stream_index is -1, a default
  16732. stream is selected, and @var{timestamp} is automatically converted
  16733. from AV_TIME_BASE units to the stream specific time_base.
  16734. @item
  16735. @var{timestamp}: Timestamp in AVStream.time_base units
  16736. or, if no stream is specified, in AV_TIME_BASE units.
  16737. @item
  16738. @var{flags}: Flags which select direction and seeking mode.
  16739. @end itemize
  16740. @item get_duration
  16741. Get movie duration in AV_TIME_BASE units.
  16742. @end table
  16743. @c man end MULTIMEDIA SOURCES