filters.texi 479 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013
  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{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.
  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{LINKLABEL} ::= "[" @var{NAME} "]"
  173. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  174. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  175. @var{FILTER} ::= [@var{LINKLABELS}] @var{NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  176. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  177. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  178. @end example
  179. @section Notes on filtergraph escaping
  180. Filtergraph description composition entails several levels of
  181. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  182. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  183. information about the employed escaping procedure.
  184. A first level escaping affects the content of each filter option
  185. value, which may contain the special character @code{:} used to
  186. separate values, or one of the escaping characters @code{\'}.
  187. A second level escaping affects the whole filter description, which
  188. may contain the escaping characters @code{\'} or the special
  189. characters @code{[],;} used by the filtergraph description.
  190. Finally, when you specify a filtergraph on a shell commandline, you
  191. need to perform a third level escaping for the shell special
  192. characters contained within it.
  193. For example, consider the following string to be embedded in
  194. the @ref{drawtext} filter description @option{text} value:
  195. @example
  196. this is a 'string': may contain one, or more, special characters
  197. @end example
  198. This string contains the @code{'} special escaping character, and the
  199. @code{:} special character, so it needs to be escaped in this way:
  200. @example
  201. text=this is a \'string\'\: may contain one, or more, special characters
  202. @end example
  203. A second level of escaping is required when embedding the filter
  204. description in a filtergraph description, in order to escape all the
  205. filtergraph special characters. Thus the example above becomes:
  206. @example
  207. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  208. @end example
  209. (note that in addition to the @code{\'} escaping special characters,
  210. also @code{,} needs to be escaped).
  211. Finally an additional level of escaping is needed when writing the
  212. filtergraph description in a shell command, which depends on the
  213. escaping rules of the adopted shell. For example, assuming that
  214. @code{\} is special and needs to be escaped with another @code{\}, the
  215. previous string will finally result in:
  216. @example
  217. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  218. @end example
  219. @chapter Timeline editing
  220. Some filters support a generic @option{enable} option. For the filters
  221. supporting timeline editing, this option can be set to an expression which is
  222. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  223. the filter will be enabled, otherwise the frame will be sent unchanged to the
  224. next filter in the filtergraph.
  225. The expression accepts the following values:
  226. @table @samp
  227. @item t
  228. timestamp expressed in seconds, NAN if the input timestamp is unknown
  229. @item n
  230. sequential number of the input frame, starting from 0
  231. @item pos
  232. the position in the file of the input frame, NAN if unknown
  233. @item w
  234. @item h
  235. width and height of the input frame if video
  236. @end table
  237. Additionally, these filters support an @option{enable} command that can be used
  238. to re-define the expression.
  239. Like any other filtering option, the @option{enable} option follows the same
  240. rules.
  241. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  242. minutes, and a @ref{curves} filter starting at 3 seconds:
  243. @example
  244. smartblur = enable='between(t,10,3*60)',
  245. curves = enable='gte(t,3)' : preset=cross_process
  246. @end example
  247. @c man end FILTERGRAPH DESCRIPTION
  248. @chapter Audio Filters
  249. @c man begin AUDIO FILTERS
  250. When you configure your FFmpeg build, you can disable any of the
  251. existing filters using @code{--disable-filters}.
  252. The configure output will show the audio filters included in your
  253. build.
  254. Below is a description of the currently available audio filters.
  255. @section acompressor
  256. A compressor is mainly used to reduce the dynamic range of a signal.
  257. Especially modern music is mostly compressed at a high ratio to
  258. improve the overall loudness. It's done to get the highest attention
  259. of a listener, "fatten" the sound and bring more "power" to the track.
  260. If a signal is compressed too much it may sound dull or "dead"
  261. afterwards or it may start to "pump" (which could be a powerful effect
  262. but can also destroy a track completely).
  263. The right compression is the key to reach a professional sound and is
  264. the high art of mixing and mastering. Because of its complex settings
  265. it may take a long time to get the right feeling for this kind of effect.
  266. Compression is done by detecting the volume above a chosen level
  267. @code{threshold} and dividing it by the factor set with @code{ratio}.
  268. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  269. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  270. the signal would cause distortion of the waveform the reduction can be
  271. levelled over the time. This is done by setting "Attack" and "Release".
  272. @code{attack} determines how long the signal has to rise above the threshold
  273. before any reduction will occur and @code{release} sets the time the signal
  274. has to fall below the threshold to reduce the reduction again. Shorter signals
  275. than the chosen attack time will be left untouched.
  276. The overall reduction of the signal can be made up afterwards with the
  277. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  278. raising the makeup to this level results in a signal twice as loud than the
  279. source. To gain a softer entry in the compression the @code{knee} flattens the
  280. hard edge at the threshold in the range of the chosen decibels.
  281. The filter accepts the following options:
  282. @table @option
  283. @item level_in
  284. Set input gain. Default is 1. Range is between 0.015625 and 64.
  285. @item threshold
  286. If a signal of second stream rises above this level it will affect the gain
  287. reduction of the first stream.
  288. By default it is 0.125. Range is between 0.00097563 and 1.
  289. @item ratio
  290. Set a ratio by which the signal is reduced. 1:2 means that if the level
  291. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  292. Default is 2. Range is between 1 and 20.
  293. @item attack
  294. Amount of milliseconds the signal has to rise above the threshold before gain
  295. reduction starts. Default is 20. Range is between 0.01 and 2000.
  296. @item release
  297. Amount of milliseconds the signal has to fall below the threshold before
  298. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  299. @item makeup
  300. Set the amount by how much signal will be amplified after processing.
  301. Default is 2. Range is from 1 and 64.
  302. @item knee
  303. Curve the sharp knee around the threshold to enter gain reduction more softly.
  304. Default is 2.82843. Range is between 1 and 8.
  305. @item link
  306. Choose if the @code{average} level between all channels of input stream
  307. or the louder(@code{maximum}) channel of input stream affects the
  308. reduction. Default is @code{average}.
  309. @item detection
  310. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  311. of @code{rms}. Default is @code{rms} which is mostly smoother.
  312. @item mix
  313. How much to use compressed signal in output. Default is 1.
  314. Range is between 0 and 1.
  315. @end table
  316. @section acrossfade
  317. Apply cross fade from one input audio stream to another input audio stream.
  318. The cross fade is applied for specified duration near the end of first stream.
  319. The filter accepts the following options:
  320. @table @option
  321. @item nb_samples, ns
  322. Specify the number of samples for which the cross fade effect has to last.
  323. At the end of the cross fade effect the first input audio will be completely
  324. silent. Default is 44100.
  325. @item duration, d
  326. Specify the duration of the cross fade effect. See
  327. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  328. for the accepted syntax.
  329. By default the duration is determined by @var{nb_samples}.
  330. If set this option is used instead of @var{nb_samples}.
  331. @item overlap, o
  332. Should first stream end overlap with second stream start. Default is enabled.
  333. @item curve1
  334. Set curve for cross fade transition for first stream.
  335. @item curve2
  336. Set curve for cross fade transition for second stream.
  337. For description of available curve types see @ref{afade} filter description.
  338. @end table
  339. @subsection Examples
  340. @itemize
  341. @item
  342. Cross fade from one input to another:
  343. @example
  344. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  345. @end example
  346. @item
  347. Cross fade from one input to another but without overlapping:
  348. @example
  349. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  350. @end example
  351. @end itemize
  352. @section acrusher
  353. Reduce audio bit resolution.
  354. This filter is bit crusher with enhanced functionality. A bit crusher
  355. is used to audibly reduce number of bits an audio signal is sampled
  356. with. This doesn't change the bit depth at all, it just produces the
  357. effect. Material reduced in bit depth sounds more harsh and "digital".
  358. This filter is able to even round to continuous values instead of discrete
  359. bit depths.
  360. Additionally it has a D/C offset which results in different crushing of
  361. the lower and the upper half of the signal.
  362. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  363. Another feature of this filter is the logarithmic mode.
  364. This setting switches from linear distances between bits to logarithmic ones.
  365. The result is a much more "natural" sounding crusher which doesn't gate low
  366. signals for example. The human ear has a logarithmic perception, too
  367. so this kind of crushing is much more pleasant.
  368. Logarithmic crushing is also able to get anti-aliased.
  369. The filter accepts the following options:
  370. @table @option
  371. @item level_in
  372. Set level in.
  373. @item level_out
  374. Set level out.
  375. @item bits
  376. Set bit reduction.
  377. @item mix
  378. Set mixing amount.
  379. @item mode
  380. Can be linear: @code{lin} or logarithmic: @code{log}.
  381. @item dc
  382. Set DC.
  383. @item aa
  384. Set anti-aliasing.
  385. @item samples
  386. Set sample reduction.
  387. @item lfo
  388. Enable LFO. By default disabled.
  389. @item lforange
  390. Set LFO range.
  391. @item lforate
  392. Set LFO rate.
  393. @end table
  394. @section adelay
  395. Delay one or more audio channels.
  396. Samples in delayed channel are filled with silence.
  397. The filter accepts the following option:
  398. @table @option
  399. @item delays
  400. Set list of delays in milliseconds for each channel separated by '|'.
  401. At least one delay greater than 0 should be provided.
  402. Unused delays will be silently ignored. If number of given delays is
  403. smaller than number of channels all remaining channels will not be delayed.
  404. If you want to delay exact number of samples, append 'S' to number.
  405. @end table
  406. @subsection Examples
  407. @itemize
  408. @item
  409. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  410. the second channel (and any other channels that may be present) unchanged.
  411. @example
  412. adelay=1500|0|500
  413. @end example
  414. @item
  415. Delay second channel by 500 samples, the third channel by 700 samples and leave
  416. the first channel (and any other channels that may be present) unchanged.
  417. @example
  418. adelay=0|500S|700S
  419. @end example
  420. @end itemize
  421. @section aecho
  422. Apply echoing to the input audio.
  423. Echoes are reflected sound and can occur naturally amongst mountains
  424. (and sometimes large buildings) when talking or shouting; digital echo
  425. effects emulate this behaviour and are often used to help fill out the
  426. sound of a single instrument or vocal. The time difference between the
  427. original signal and the reflection is the @code{delay}, and the
  428. loudness of the reflected signal is the @code{decay}.
  429. Multiple echoes can have different delays and decays.
  430. A description of the accepted parameters follows.
  431. @table @option
  432. @item in_gain
  433. Set input gain of reflected signal. Default is @code{0.6}.
  434. @item out_gain
  435. Set output gain of reflected signal. Default is @code{0.3}.
  436. @item delays
  437. Set list of time intervals in milliseconds between original signal and reflections
  438. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  439. Default is @code{1000}.
  440. @item decays
  441. Set list of loudnesses of reflected signals separated by '|'.
  442. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  443. Default is @code{0.5}.
  444. @end table
  445. @subsection Examples
  446. @itemize
  447. @item
  448. Make it sound as if there are twice as many instruments as are actually playing:
  449. @example
  450. aecho=0.8:0.88:60:0.4
  451. @end example
  452. @item
  453. If delay is very short, then it sound like a (metallic) robot playing music:
  454. @example
  455. aecho=0.8:0.88:6:0.4
  456. @end example
  457. @item
  458. A longer delay will sound like an open air concert in the mountains:
  459. @example
  460. aecho=0.8:0.9:1000:0.3
  461. @end example
  462. @item
  463. Same as above but with one more mountain:
  464. @example
  465. aecho=0.8:0.9:1000|1800:0.3|0.25
  466. @end example
  467. @end itemize
  468. @section aemphasis
  469. Audio emphasis filter creates or restores material directly taken from LPs or
  470. emphased CDs with different filter curves. E.g. to store music on vinyl the
  471. signal has to be altered by a filter first to even out the disadvantages of
  472. this recording medium.
  473. Once the material is played back the inverse filter has to be applied to
  474. restore the distortion of the frequency response.
  475. The filter accepts the following options:
  476. @table @option
  477. @item level_in
  478. Set input gain.
  479. @item level_out
  480. Set output gain.
  481. @item mode
  482. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  483. use @code{production} mode. Default is @code{reproduction} mode.
  484. @item type
  485. Set filter type. Selects medium. Can be one of the following:
  486. @table @option
  487. @item col
  488. select Columbia.
  489. @item emi
  490. select EMI.
  491. @item bsi
  492. select BSI (78RPM).
  493. @item riaa
  494. select RIAA.
  495. @item cd
  496. select Compact Disc (CD).
  497. @item 50fm
  498. select 50µs (FM).
  499. @item 75fm
  500. select 75µs (FM).
  501. @item 50kf
  502. select 50µs (FM-KF).
  503. @item 75kf
  504. select 75µs (FM-KF).
  505. @end table
  506. @end table
  507. @section aeval
  508. Modify an audio signal according to the specified expressions.
  509. This filter accepts one or more expressions (one for each channel),
  510. which are evaluated and used to modify a corresponding audio signal.
  511. It accepts the following parameters:
  512. @table @option
  513. @item exprs
  514. Set the '|'-separated expressions list for each separate channel. If
  515. the number of input channels is greater than the number of
  516. expressions, the last specified expression is used for the remaining
  517. output channels.
  518. @item channel_layout, c
  519. Set output channel layout. If not specified, the channel layout is
  520. specified by the number of expressions. If set to @samp{same}, it will
  521. use by default the same input channel layout.
  522. @end table
  523. Each expression in @var{exprs} can contain the following constants and functions:
  524. @table @option
  525. @item ch
  526. channel number of the current expression
  527. @item n
  528. number of the evaluated sample, starting from 0
  529. @item s
  530. sample rate
  531. @item t
  532. time of the evaluated sample expressed in seconds
  533. @item nb_in_channels
  534. @item nb_out_channels
  535. input and output number of channels
  536. @item val(CH)
  537. the value of input channel with number @var{CH}
  538. @end table
  539. Note: this filter is slow. For faster processing you should use a
  540. dedicated filter.
  541. @subsection Examples
  542. @itemize
  543. @item
  544. Half volume:
  545. @example
  546. aeval=val(ch)/2:c=same
  547. @end example
  548. @item
  549. Invert phase of the second channel:
  550. @example
  551. aeval=val(0)|-val(1)
  552. @end example
  553. @end itemize
  554. @anchor{afade}
  555. @section afade
  556. Apply fade-in/out effect to input audio.
  557. A description of the accepted parameters follows.
  558. @table @option
  559. @item type, t
  560. Specify the effect type, can be either @code{in} for fade-in, or
  561. @code{out} for a fade-out effect. Default is @code{in}.
  562. @item start_sample, ss
  563. Specify the number of the start sample for starting to apply the fade
  564. effect. Default is 0.
  565. @item nb_samples, ns
  566. Specify the number of samples for which the fade effect has to last. At
  567. the end of the fade-in effect the output audio will have the same
  568. volume as the input audio, at the end of the fade-out transition
  569. the output audio will be silence. Default is 44100.
  570. @item start_time, st
  571. Specify the start time of the fade effect. Default is 0.
  572. The value must be specified as a time duration; see
  573. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  574. for the accepted syntax.
  575. If set this option is used instead of @var{start_sample}.
  576. @item duration, d
  577. Specify the duration of the fade effect. See
  578. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  579. for the accepted syntax.
  580. At the end of the fade-in effect the output audio will have the same
  581. volume as the input audio, at the end of the fade-out transition
  582. the output audio will be silence.
  583. By default the duration is determined by @var{nb_samples}.
  584. If set this option is used instead of @var{nb_samples}.
  585. @item curve
  586. Set curve for fade transition.
  587. It accepts the following values:
  588. @table @option
  589. @item tri
  590. select triangular, linear slope (default)
  591. @item qsin
  592. select quarter of sine wave
  593. @item hsin
  594. select half of sine wave
  595. @item esin
  596. select exponential sine wave
  597. @item log
  598. select logarithmic
  599. @item ipar
  600. select inverted parabola
  601. @item qua
  602. select quadratic
  603. @item cub
  604. select cubic
  605. @item squ
  606. select square root
  607. @item cbr
  608. select cubic root
  609. @item par
  610. select parabola
  611. @item exp
  612. select exponential
  613. @item iqsin
  614. select inverted quarter of sine wave
  615. @item ihsin
  616. select inverted half of sine wave
  617. @item dese
  618. select double-exponential seat
  619. @item desi
  620. select double-exponential sigmoid
  621. @end table
  622. @end table
  623. @subsection Examples
  624. @itemize
  625. @item
  626. Fade in first 15 seconds of audio:
  627. @example
  628. afade=t=in:ss=0:d=15
  629. @end example
  630. @item
  631. Fade out last 25 seconds of a 900 seconds audio:
  632. @example
  633. afade=t=out:st=875:d=25
  634. @end example
  635. @end itemize
  636. @section afftfilt
  637. Apply arbitrary expressions to samples in frequency domain.
  638. @table @option
  639. @item real
  640. Set frequency domain real expression for each separate channel separated
  641. by '|'. Default is "1".
  642. If the number of input channels is greater than the number of
  643. expressions, the last specified expression is used for the remaining
  644. output channels.
  645. @item imag
  646. Set frequency domain imaginary expression for each separate channel
  647. separated by '|'. If not set, @var{real} option is used.
  648. Each expression in @var{real} and @var{imag} can contain the following
  649. constants:
  650. @table @option
  651. @item sr
  652. sample rate
  653. @item b
  654. current frequency bin number
  655. @item nb
  656. number of available bins
  657. @item ch
  658. channel number of the current expression
  659. @item chs
  660. number of channels
  661. @item pts
  662. current frame pts
  663. @end table
  664. @item win_size
  665. Set window size.
  666. It accepts the following values:
  667. @table @samp
  668. @item w16
  669. @item w32
  670. @item w64
  671. @item w128
  672. @item w256
  673. @item w512
  674. @item w1024
  675. @item w2048
  676. @item w4096
  677. @item w8192
  678. @item w16384
  679. @item w32768
  680. @item w65536
  681. @end table
  682. Default is @code{w4096}
  683. @item win_func
  684. Set window function. Default is @code{hann}.
  685. @item overlap
  686. Set window overlap. If set to 1, the recommended overlap for selected
  687. window function will be picked. Default is @code{0.75}.
  688. @end table
  689. @subsection Examples
  690. @itemize
  691. @item
  692. Leave almost only low frequencies in audio:
  693. @example
  694. afftfilt="1-clip((b/nb)*b,0,1)"
  695. @end example
  696. @end itemize
  697. @anchor{aformat}
  698. @section aformat
  699. Set output format constraints for the input audio. The framework will
  700. negotiate the most appropriate format to minimize conversions.
  701. It accepts the following parameters:
  702. @table @option
  703. @item sample_fmts
  704. A '|'-separated list of requested sample formats.
  705. @item sample_rates
  706. A '|'-separated list of requested sample rates.
  707. @item channel_layouts
  708. A '|'-separated list of requested channel layouts.
  709. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  710. for the required syntax.
  711. @end table
  712. If a parameter is omitted, all values are allowed.
  713. Force the output to either unsigned 8-bit or signed 16-bit stereo
  714. @example
  715. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  716. @end example
  717. @section agate
  718. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  719. processing reduces disturbing noise between useful signals.
  720. Gating is done by detecting the volume below a chosen level @var{threshold}
  721. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  722. floor is set via @var{range}. Because an exact manipulation of the signal
  723. would cause distortion of the waveform the reduction can be levelled over
  724. time. This is done by setting @var{attack} and @var{release}.
  725. @var{attack} determines how long the signal has to fall below the threshold
  726. before any reduction will occur and @var{release} sets the time the signal
  727. has to rise above the threshold to reduce the reduction again.
  728. Shorter signals than the chosen attack time will be left untouched.
  729. @table @option
  730. @item level_in
  731. Set input level before filtering.
  732. Default is 1. Allowed range is from 0.015625 to 64.
  733. @item range
  734. Set the level of gain reduction when the signal is below the threshold.
  735. Default is 0.06125. Allowed range is from 0 to 1.
  736. @item threshold
  737. If a signal rises above this level the gain reduction is released.
  738. Default is 0.125. Allowed range is from 0 to 1.
  739. @item ratio
  740. Set a ratio by which the signal is reduced.
  741. Default is 2. Allowed range is from 1 to 9000.
  742. @item attack
  743. Amount of milliseconds the signal has to rise above the threshold before gain
  744. reduction stops.
  745. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  746. @item release
  747. Amount of milliseconds the signal has to fall below the threshold before the
  748. reduction is increased again. Default is 250 milliseconds.
  749. Allowed range is from 0.01 to 9000.
  750. @item makeup
  751. Set amount of amplification of signal after processing.
  752. Default is 1. Allowed range is from 1 to 64.
  753. @item knee
  754. Curve the sharp knee around the threshold to enter gain reduction more softly.
  755. Default is 2.828427125. Allowed range is from 1 to 8.
  756. @item detection
  757. Choose if exact signal should be taken for detection or an RMS like one.
  758. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  759. @item link
  760. Choose if the average level between all channels or the louder channel affects
  761. the reduction.
  762. Default is @code{average}. Can be @code{average} or @code{maximum}.
  763. @end table
  764. @section alimiter
  765. The limiter prevents an input signal from rising over a desired threshold.
  766. This limiter uses lookahead technology to prevent your signal from distorting.
  767. It means that there is a small delay after the signal is processed. Keep in mind
  768. that the delay it produces is the attack time you set.
  769. The filter accepts the following options:
  770. @table @option
  771. @item level_in
  772. Set input gain. Default is 1.
  773. @item level_out
  774. Set output gain. Default is 1.
  775. @item limit
  776. Don't let signals above this level pass the limiter. Default is 1.
  777. @item attack
  778. The limiter will reach its attenuation level in this amount of time in
  779. milliseconds. Default is 5 milliseconds.
  780. @item release
  781. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  782. Default is 50 milliseconds.
  783. @item asc
  784. When gain reduction is always needed ASC takes care of releasing to an
  785. average reduction level rather than reaching a reduction of 0 in the release
  786. time.
  787. @item asc_level
  788. Select how much the release time is affected by ASC, 0 means nearly no changes
  789. in release time while 1 produces higher release times.
  790. @item level
  791. Auto level output signal. Default is enabled.
  792. This normalizes audio back to 0dB if enabled.
  793. @end table
  794. Depending on picked setting it is recommended to upsample input 2x or 4x times
  795. with @ref{aresample} before applying this filter.
  796. @section allpass
  797. Apply a two-pole all-pass filter with central frequency (in Hz)
  798. @var{frequency}, and filter-width @var{width}.
  799. An all-pass filter changes the audio's frequency to phase relationship
  800. without changing its frequency to amplitude relationship.
  801. The filter accepts the following options:
  802. @table @option
  803. @item frequency, f
  804. Set frequency in Hz.
  805. @item width_type
  806. Set method to specify band-width of filter.
  807. @table @option
  808. @item h
  809. Hz
  810. @item q
  811. Q-Factor
  812. @item o
  813. octave
  814. @item s
  815. slope
  816. @end table
  817. @item width, w
  818. Specify the band-width of a filter in width_type units.
  819. @end table
  820. @section aloop
  821. Loop audio samples.
  822. The filter accepts the following options:
  823. @table @option
  824. @item loop
  825. Set the number of loops.
  826. @item size
  827. Set maximal number of samples.
  828. @item start
  829. Set first sample of loop.
  830. @end table
  831. @anchor{amerge}
  832. @section amerge
  833. Merge two or more audio streams into a single multi-channel stream.
  834. The filter accepts the following options:
  835. @table @option
  836. @item inputs
  837. Set the number of inputs. Default is 2.
  838. @end table
  839. If the channel layouts of the inputs are disjoint, and therefore compatible,
  840. the channel layout of the output will be set accordingly and the channels
  841. will be reordered as necessary. If the channel layouts of the inputs are not
  842. disjoint, the output will have all the channels of the first input then all
  843. the channels of the second input, in that order, and the channel layout of
  844. the output will be the default value corresponding to the total number of
  845. channels.
  846. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  847. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  848. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  849. first input, b1 is the first channel of the second input).
  850. On the other hand, if both input are in stereo, the output channels will be
  851. in the default order: a1, a2, b1, b2, and the channel layout will be
  852. arbitrarily set to 4.0, which may or may not be the expected value.
  853. All inputs must have the same sample rate, and format.
  854. If inputs do not have the same duration, the output will stop with the
  855. shortest.
  856. @subsection Examples
  857. @itemize
  858. @item
  859. Merge two mono files into a stereo stream:
  860. @example
  861. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  862. @end example
  863. @item
  864. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  865. @example
  866. 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
  867. @end example
  868. @end itemize
  869. @section amix
  870. Mixes multiple audio inputs into a single output.
  871. Note that this filter only supports float samples (the @var{amerge}
  872. and @var{pan} audio filters support many formats). If the @var{amix}
  873. input has integer samples then @ref{aresample} will be automatically
  874. inserted to perform the conversion to float samples.
  875. For example
  876. @example
  877. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  878. @end example
  879. will mix 3 input audio streams to a single output with the same duration as the
  880. first input and a dropout transition time of 3 seconds.
  881. It accepts the following parameters:
  882. @table @option
  883. @item inputs
  884. The number of inputs. If unspecified, it defaults to 2.
  885. @item duration
  886. How to determine the end-of-stream.
  887. @table @option
  888. @item longest
  889. The duration of the longest input. (default)
  890. @item shortest
  891. The duration of the shortest input.
  892. @item first
  893. The duration of the first input.
  894. @end table
  895. @item dropout_transition
  896. The transition time, in seconds, for volume renormalization when an input
  897. stream ends. The default value is 2 seconds.
  898. @end table
  899. @section anequalizer
  900. High-order parametric multiband equalizer for each channel.
  901. It accepts the following parameters:
  902. @table @option
  903. @item params
  904. This option string is in format:
  905. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  906. Each equalizer band is separated by '|'.
  907. @table @option
  908. @item chn
  909. Set channel number to which equalization will be applied.
  910. If input doesn't have that channel the entry is ignored.
  911. @item f
  912. Set central frequency for band.
  913. If input doesn't have that frequency the entry is ignored.
  914. @item w
  915. Set band width in hertz.
  916. @item g
  917. Set band gain in dB.
  918. @item t
  919. Set filter type for band, optional, can be:
  920. @table @samp
  921. @item 0
  922. Butterworth, this is default.
  923. @item 1
  924. Chebyshev type 1.
  925. @item 2
  926. Chebyshev type 2.
  927. @end table
  928. @end table
  929. @item curves
  930. With this option activated frequency response of anequalizer is displayed
  931. in video stream.
  932. @item size
  933. Set video stream size. Only useful if curves option is activated.
  934. @item mgain
  935. Set max gain that will be displayed. Only useful if curves option is activated.
  936. Setting this to a reasonable value makes it possible to display gain which is derived from
  937. neighbour bands which are too close to each other and thus produce higher gain
  938. when both are activated.
  939. @item fscale
  940. Set frequency scale used to draw frequency response in video output.
  941. Can be linear or logarithmic. Default is logarithmic.
  942. @item colors
  943. Set color for each channel curve which is going to be displayed in video stream.
  944. This is list of color names separated by space or by '|'.
  945. Unrecognised or missing colors will be replaced by white color.
  946. @end table
  947. @subsection Examples
  948. @itemize
  949. @item
  950. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  951. for first 2 channels using Chebyshev type 1 filter:
  952. @example
  953. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  954. @end example
  955. @end itemize
  956. @subsection Commands
  957. This filter supports the following commands:
  958. @table @option
  959. @item change
  960. Alter existing filter parameters.
  961. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  962. @var{fN} is existing filter number, starting from 0, if no such filter is available
  963. error is returned.
  964. @var{freq} set new frequency parameter.
  965. @var{width} set new width parameter in herz.
  966. @var{gain} set new gain parameter in dB.
  967. Full filter invocation with asendcmd may look like this:
  968. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  969. @end table
  970. @section anull
  971. Pass the audio source unchanged to the output.
  972. @section apad
  973. Pad the end of an audio stream with silence.
  974. This can be used together with @command{ffmpeg} @option{-shortest} to
  975. extend audio streams to the same length as the video stream.
  976. A description of the accepted options follows.
  977. @table @option
  978. @item packet_size
  979. Set silence packet size. Default value is 4096.
  980. @item pad_len
  981. Set the number of samples of silence to add to the end. After the
  982. value is reached, the stream is terminated. This option is mutually
  983. exclusive with @option{whole_len}.
  984. @item whole_len
  985. Set the minimum total number of samples in the output audio stream. If
  986. the value is longer than the input audio length, silence is added to
  987. the end, until the value is reached. This option is mutually exclusive
  988. with @option{pad_len}.
  989. @end table
  990. If neither the @option{pad_len} nor the @option{whole_len} option is
  991. set, the filter will add silence to the end of the input stream
  992. indefinitely.
  993. @subsection Examples
  994. @itemize
  995. @item
  996. Add 1024 samples of silence to the end of the input:
  997. @example
  998. apad=pad_len=1024
  999. @end example
  1000. @item
  1001. Make sure the audio output will contain at least 10000 samples, pad
  1002. the input with silence if required:
  1003. @example
  1004. apad=whole_len=10000
  1005. @end example
  1006. @item
  1007. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1008. video stream will always result the shortest and will be converted
  1009. until the end in the output file when using the @option{shortest}
  1010. option:
  1011. @example
  1012. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1013. @end example
  1014. @end itemize
  1015. @section aphaser
  1016. Add a phasing effect to the input audio.
  1017. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1018. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1019. A description of the accepted parameters follows.
  1020. @table @option
  1021. @item in_gain
  1022. Set input gain. Default is 0.4.
  1023. @item out_gain
  1024. Set output gain. Default is 0.74
  1025. @item delay
  1026. Set delay in milliseconds. Default is 3.0.
  1027. @item decay
  1028. Set decay. Default is 0.4.
  1029. @item speed
  1030. Set modulation speed in Hz. Default is 0.5.
  1031. @item type
  1032. Set modulation type. Default is triangular.
  1033. It accepts the following values:
  1034. @table @samp
  1035. @item triangular, t
  1036. @item sinusoidal, s
  1037. @end table
  1038. @end table
  1039. @section apulsator
  1040. Audio pulsator is something between an autopanner and a tremolo.
  1041. But it can produce funny stereo effects as well. Pulsator changes the volume
  1042. of the left and right channel based on a LFO (low frequency oscillator) with
  1043. different waveforms and shifted phases.
  1044. This filter have the ability to define an offset between left and right
  1045. channel. An offset of 0 means that both LFO shapes match each other.
  1046. The left and right channel are altered equally - a conventional tremolo.
  1047. An offset of 50% means that the shape of the right channel is exactly shifted
  1048. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1049. an autopanner. At 1 both curves match again. Every setting in between moves the
  1050. phase shift gapless between all stages and produces some "bypassing" sounds with
  1051. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1052. the 0.5) the faster the signal passes from the left to the right speaker.
  1053. The filter accepts the following options:
  1054. @table @option
  1055. @item level_in
  1056. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1057. @item level_out
  1058. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1059. @item mode
  1060. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1061. sawup or sawdown. Default is sine.
  1062. @item amount
  1063. Set modulation. Define how much of original signal is affected by the LFO.
  1064. @item offset_l
  1065. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1066. @item offset_r
  1067. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1068. @item width
  1069. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1070. @item timing
  1071. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1072. @item bpm
  1073. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1074. is set to bpm.
  1075. @item ms
  1076. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1077. is set to ms.
  1078. @item hz
  1079. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1080. if timing is set to hz.
  1081. @end table
  1082. @anchor{aresample}
  1083. @section aresample
  1084. Resample the input audio to the specified parameters, using the
  1085. libswresample library. If none are specified then the filter will
  1086. automatically convert between its input and output.
  1087. This filter is also able to stretch/squeeze the audio data to make it match
  1088. the timestamps or to inject silence / cut out audio to make it match the
  1089. timestamps, do a combination of both or do neither.
  1090. The filter accepts the syntax
  1091. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1092. expresses a sample rate and @var{resampler_options} is a list of
  1093. @var{key}=@var{value} pairs, separated by ":". See the
  1094. ffmpeg-resampler manual for the complete list of supported options.
  1095. @subsection Examples
  1096. @itemize
  1097. @item
  1098. Resample the input audio to 44100Hz:
  1099. @example
  1100. aresample=44100
  1101. @end example
  1102. @item
  1103. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1104. samples per second compensation:
  1105. @example
  1106. aresample=async=1000
  1107. @end example
  1108. @end itemize
  1109. @section areverse
  1110. Reverse an audio clip.
  1111. Warning: This filter requires memory to buffer the entire clip, so trimming
  1112. is suggested.
  1113. @subsection Examples
  1114. @itemize
  1115. @item
  1116. Take the first 5 seconds of a clip, and reverse it.
  1117. @example
  1118. atrim=end=5,areverse
  1119. @end example
  1120. @end itemize
  1121. @section asetnsamples
  1122. Set the number of samples per each output audio frame.
  1123. The last output packet may contain a different number of samples, as
  1124. the filter will flush all the remaining samples when the input audio
  1125. signals its end.
  1126. The filter accepts the following options:
  1127. @table @option
  1128. @item nb_out_samples, n
  1129. Set the number of frames per each output audio frame. The number is
  1130. intended as the number of samples @emph{per each channel}.
  1131. Default value is 1024.
  1132. @item pad, p
  1133. If set to 1, the filter will pad the last audio frame with zeroes, so
  1134. that the last frame will contain the same number of samples as the
  1135. previous ones. Default value is 1.
  1136. @end table
  1137. For example, to set the number of per-frame samples to 1234 and
  1138. disable padding for the last frame, use:
  1139. @example
  1140. asetnsamples=n=1234:p=0
  1141. @end example
  1142. @section asetrate
  1143. Set the sample rate without altering the PCM data.
  1144. This will result in a change of speed and pitch.
  1145. The filter accepts the following options:
  1146. @table @option
  1147. @item sample_rate, r
  1148. Set the output sample rate. Default is 44100 Hz.
  1149. @end table
  1150. @section ashowinfo
  1151. Show a line containing various information for each input audio frame.
  1152. The input audio is not modified.
  1153. The shown line contains a sequence of key/value pairs of the form
  1154. @var{key}:@var{value}.
  1155. The following values are shown in the output:
  1156. @table @option
  1157. @item n
  1158. The (sequential) number of the input frame, starting from 0.
  1159. @item pts
  1160. The presentation timestamp of the input frame, in time base units; the time base
  1161. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1162. @item pts_time
  1163. The presentation timestamp of the input frame in seconds.
  1164. @item pos
  1165. position of the frame in the input stream, -1 if this information in
  1166. unavailable and/or meaningless (for example in case of synthetic audio)
  1167. @item fmt
  1168. The sample format.
  1169. @item chlayout
  1170. The channel layout.
  1171. @item rate
  1172. The sample rate for the audio frame.
  1173. @item nb_samples
  1174. The number of samples (per channel) in the frame.
  1175. @item checksum
  1176. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1177. audio, the data is treated as if all the planes were concatenated.
  1178. @item plane_checksums
  1179. A list of Adler-32 checksums for each data plane.
  1180. @end table
  1181. @anchor{astats}
  1182. @section astats
  1183. Display time domain statistical information about the audio channels.
  1184. Statistics are calculated and displayed for each audio channel and,
  1185. where applicable, an overall figure is also given.
  1186. It accepts the following option:
  1187. @table @option
  1188. @item length
  1189. Short window length in seconds, used for peak and trough RMS measurement.
  1190. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.1 - 10]}.
  1191. @item metadata
  1192. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1193. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1194. disabled.
  1195. Available keys for each channel are:
  1196. DC_offset
  1197. Min_level
  1198. Max_level
  1199. Min_difference
  1200. Max_difference
  1201. Mean_difference
  1202. Peak_level
  1203. RMS_peak
  1204. RMS_trough
  1205. Crest_factor
  1206. Flat_factor
  1207. Peak_count
  1208. Bit_depth
  1209. and for Overall:
  1210. DC_offset
  1211. Min_level
  1212. Max_level
  1213. Min_difference
  1214. Max_difference
  1215. Mean_difference
  1216. Peak_level
  1217. RMS_level
  1218. RMS_peak
  1219. RMS_trough
  1220. Flat_factor
  1221. Peak_count
  1222. Bit_depth
  1223. Number_of_samples
  1224. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1225. this @code{lavfi.astats.Overall.Peak_count}.
  1226. For description what each key means read below.
  1227. @item reset
  1228. Set number of frame after which stats are going to be recalculated.
  1229. Default is disabled.
  1230. @end table
  1231. A description of each shown parameter follows:
  1232. @table @option
  1233. @item DC offset
  1234. Mean amplitude displacement from zero.
  1235. @item Min level
  1236. Minimal sample level.
  1237. @item Max level
  1238. Maximal sample level.
  1239. @item Min difference
  1240. Minimal difference between two consecutive samples.
  1241. @item Max difference
  1242. Maximal difference between two consecutive samples.
  1243. @item Mean difference
  1244. Mean difference between two consecutive samples.
  1245. The average of each difference between two consecutive samples.
  1246. @item Peak level dB
  1247. @item RMS level dB
  1248. Standard peak and RMS level measured in dBFS.
  1249. @item RMS peak dB
  1250. @item RMS trough dB
  1251. Peak and trough values for RMS level measured over a short window.
  1252. @item Crest factor
  1253. Standard ratio of peak to RMS level (note: not in dB).
  1254. @item Flat factor
  1255. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1256. (i.e. either @var{Min level} or @var{Max level}).
  1257. @item Peak count
  1258. Number of occasions (not the number of samples) that the signal attained either
  1259. @var{Min level} or @var{Max level}.
  1260. @item Bit depth
  1261. Overall bit depth of audio. Number of bits used for each sample.
  1262. @end table
  1263. @section asyncts
  1264. Synchronize audio data with timestamps by squeezing/stretching it and/or
  1265. dropping samples/adding silence when needed.
  1266. This filter is not built by default, please use @ref{aresample} to do squeezing/stretching.
  1267. It accepts the following parameters:
  1268. @table @option
  1269. @item compensate
  1270. Enable stretching/squeezing the data to make it match the timestamps. Disabled
  1271. by default. When disabled, time gaps are covered with silence.
  1272. @item min_delta
  1273. The minimum difference between timestamps and audio data (in seconds) to trigger
  1274. adding/dropping samples. The default value is 0.1. If you get an imperfect
  1275. sync with this filter, try setting this parameter to 0.
  1276. @item max_comp
  1277. The maximum compensation in samples per second. Only relevant with compensate=1.
  1278. The default value is 500.
  1279. @item first_pts
  1280. Assume that the first PTS should be this value. The time base is 1 / sample
  1281. rate. This allows for padding/trimming at the start of the stream. By default,
  1282. no assumption is made about the first frame's expected PTS, so no padding or
  1283. trimming is done. For example, this could be set to 0 to pad the beginning with
  1284. silence if an audio stream starts after the video stream or to trim any samples
  1285. with a negative PTS due to encoder delay.
  1286. @end table
  1287. @section atempo
  1288. Adjust audio tempo.
  1289. The filter accepts exactly one parameter, the audio tempo. If not
  1290. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1291. be in the [0.5, 2.0] range.
  1292. @subsection Examples
  1293. @itemize
  1294. @item
  1295. Slow down audio to 80% tempo:
  1296. @example
  1297. atempo=0.8
  1298. @end example
  1299. @item
  1300. To speed up audio to 125% tempo:
  1301. @example
  1302. atempo=1.25
  1303. @end example
  1304. @end itemize
  1305. @section atrim
  1306. Trim the input so that the output contains one continuous subpart of the input.
  1307. It accepts the following parameters:
  1308. @table @option
  1309. @item start
  1310. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1311. sample with the timestamp @var{start} will be the first sample in the output.
  1312. @item end
  1313. Specify time of the first audio sample that will be dropped, i.e. the
  1314. audio sample immediately preceding the one with the timestamp @var{end} will be
  1315. the last sample in the output.
  1316. @item start_pts
  1317. Same as @var{start}, except this option sets the start timestamp in samples
  1318. instead of seconds.
  1319. @item end_pts
  1320. Same as @var{end}, except this option sets the end timestamp in samples instead
  1321. of seconds.
  1322. @item duration
  1323. The maximum duration of the output in seconds.
  1324. @item start_sample
  1325. The number of the first sample that should be output.
  1326. @item end_sample
  1327. The number of the first sample that should be dropped.
  1328. @end table
  1329. @option{start}, @option{end}, and @option{duration} are expressed as time
  1330. duration specifications; see
  1331. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1332. Note that the first two sets of the start/end options and the @option{duration}
  1333. option look at the frame timestamp, while the _sample options simply count the
  1334. samples that pass through the filter. So start/end_pts and start/end_sample will
  1335. give different results when the timestamps are wrong, inexact or do not start at
  1336. zero. Also note that this filter does not modify the timestamps. If you wish
  1337. to have the output timestamps start at zero, insert the asetpts filter after the
  1338. atrim filter.
  1339. If multiple start or end options are set, this filter tries to be greedy and
  1340. keep all samples that match at least one of the specified constraints. To keep
  1341. only the part that matches all the constraints at once, chain multiple atrim
  1342. filters.
  1343. The defaults are such that all the input is kept. So it is possible to set e.g.
  1344. just the end values to keep everything before the specified time.
  1345. Examples:
  1346. @itemize
  1347. @item
  1348. Drop everything except the second minute of input:
  1349. @example
  1350. ffmpeg -i INPUT -af atrim=60:120
  1351. @end example
  1352. @item
  1353. Keep only the first 1000 samples:
  1354. @example
  1355. ffmpeg -i INPUT -af atrim=end_sample=1000
  1356. @end example
  1357. @end itemize
  1358. @section bandpass
  1359. Apply a two-pole Butterworth band-pass filter with central
  1360. frequency @var{frequency}, and (3dB-point) band-width width.
  1361. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1362. instead of the default: constant 0dB peak gain.
  1363. The filter roll off at 6dB per octave (20dB per decade).
  1364. The filter accepts the following options:
  1365. @table @option
  1366. @item frequency, f
  1367. Set the filter's central frequency. Default is @code{3000}.
  1368. @item csg
  1369. Constant skirt gain if set to 1. Defaults to 0.
  1370. @item width_type
  1371. Set method to specify band-width of filter.
  1372. @table @option
  1373. @item h
  1374. Hz
  1375. @item q
  1376. Q-Factor
  1377. @item o
  1378. octave
  1379. @item s
  1380. slope
  1381. @end table
  1382. @item width, w
  1383. Specify the band-width of a filter in width_type units.
  1384. @end table
  1385. @section bandreject
  1386. Apply a two-pole Butterworth band-reject filter with central
  1387. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1388. The filter roll off at 6dB per octave (20dB per decade).
  1389. The filter accepts the following options:
  1390. @table @option
  1391. @item frequency, f
  1392. Set the filter's central frequency. Default is @code{3000}.
  1393. @item width_type
  1394. Set method to specify band-width of filter.
  1395. @table @option
  1396. @item h
  1397. Hz
  1398. @item q
  1399. Q-Factor
  1400. @item o
  1401. octave
  1402. @item s
  1403. slope
  1404. @end table
  1405. @item width, w
  1406. Specify the band-width of a filter in width_type units.
  1407. @end table
  1408. @section bass
  1409. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1410. shelving filter with a response similar to that of a standard
  1411. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1412. The filter accepts the following options:
  1413. @table @option
  1414. @item gain, g
  1415. Give the gain at 0 Hz. Its useful range is about -20
  1416. (for a large cut) to +20 (for a large boost).
  1417. Beware of clipping when using a positive gain.
  1418. @item frequency, f
  1419. Set the filter's central frequency and so can be used
  1420. to extend or reduce the frequency range to be boosted or cut.
  1421. The default value is @code{100} Hz.
  1422. @item width_type
  1423. Set method to specify band-width of filter.
  1424. @table @option
  1425. @item h
  1426. Hz
  1427. @item q
  1428. Q-Factor
  1429. @item o
  1430. octave
  1431. @item s
  1432. slope
  1433. @end table
  1434. @item width, w
  1435. Determine how steep is the filter's shelf transition.
  1436. @end table
  1437. @section biquad
  1438. Apply a biquad IIR filter with the given coefficients.
  1439. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1440. are the numerator and denominator coefficients respectively.
  1441. @section bs2b
  1442. Bauer stereo to binaural transformation, which improves headphone listening of
  1443. stereo audio records.
  1444. It accepts the following parameters:
  1445. @table @option
  1446. @item profile
  1447. Pre-defined crossfeed level.
  1448. @table @option
  1449. @item default
  1450. Default level (fcut=700, feed=50).
  1451. @item cmoy
  1452. Chu Moy circuit (fcut=700, feed=60).
  1453. @item jmeier
  1454. Jan Meier circuit (fcut=650, feed=95).
  1455. @end table
  1456. @item fcut
  1457. Cut frequency (in Hz).
  1458. @item feed
  1459. Feed level (in Hz).
  1460. @end table
  1461. @section channelmap
  1462. Remap input channels to new locations.
  1463. It accepts the following parameters:
  1464. @table @option
  1465. @item channel_layout
  1466. The channel layout of the output stream.
  1467. @item map
  1468. Map channels from input to output. The argument is a '|'-separated list of
  1469. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1470. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1471. channel (e.g. FL for front left) or its index in the input channel layout.
  1472. @var{out_channel} is the name of the output channel or its index in the output
  1473. channel layout. If @var{out_channel} is not given then it is implicitly an
  1474. index, starting with zero and increasing by one for each mapping.
  1475. @end table
  1476. If no mapping is present, the filter will implicitly map input channels to
  1477. output channels, preserving indices.
  1478. For example, assuming a 5.1+downmix input MOV file,
  1479. @example
  1480. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1481. @end example
  1482. will create an output WAV file tagged as stereo from the downmix channels of
  1483. the input.
  1484. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1485. @example
  1486. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1487. @end example
  1488. @section channelsplit
  1489. Split each channel from an input audio stream into a separate output stream.
  1490. It accepts the following parameters:
  1491. @table @option
  1492. @item channel_layout
  1493. The channel layout of the input stream. The default is "stereo".
  1494. @end table
  1495. For example, assuming a stereo input MP3 file,
  1496. @example
  1497. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1498. @end example
  1499. will create an output Matroska file with two audio streams, one containing only
  1500. the left channel and the other the right channel.
  1501. Split a 5.1 WAV file into per-channel files:
  1502. @example
  1503. ffmpeg -i in.wav -filter_complex
  1504. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1505. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1506. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1507. side_right.wav
  1508. @end example
  1509. @section chorus
  1510. Add a chorus effect to the audio.
  1511. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1512. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1513. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1514. The modulation depth defines the range the modulated delay is played before or after
  1515. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1516. sound tuned around the original one, like in a chorus where some vocals are slightly
  1517. off key.
  1518. It accepts the following parameters:
  1519. @table @option
  1520. @item in_gain
  1521. Set input gain. Default is 0.4.
  1522. @item out_gain
  1523. Set output gain. Default is 0.4.
  1524. @item delays
  1525. Set delays. A typical delay is around 40ms to 60ms.
  1526. @item decays
  1527. Set decays.
  1528. @item speeds
  1529. Set speeds.
  1530. @item depths
  1531. Set depths.
  1532. @end table
  1533. @subsection Examples
  1534. @itemize
  1535. @item
  1536. A single delay:
  1537. @example
  1538. chorus=0.7:0.9:55:0.4:0.25:2
  1539. @end example
  1540. @item
  1541. Two delays:
  1542. @example
  1543. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1544. @end example
  1545. @item
  1546. Fuller sounding chorus with three delays:
  1547. @example
  1548. 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
  1549. @end example
  1550. @end itemize
  1551. @section compand
  1552. Compress or expand the audio's dynamic range.
  1553. It accepts the following parameters:
  1554. @table @option
  1555. @item attacks
  1556. @item decays
  1557. A list of times in seconds for each channel over which the instantaneous level
  1558. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1559. increase of volume and @var{decays} refers to decrease of volume. For most
  1560. situations, the attack time (response to the audio getting louder) should be
  1561. shorter than the decay time, because the human ear is more sensitive to sudden
  1562. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1563. a typical value for decay is 0.8 seconds.
  1564. If specified number of attacks & decays is lower than number of channels, the last
  1565. set attack/decay will be used for all remaining channels.
  1566. @item points
  1567. A list of points for the transfer function, specified in dB relative to the
  1568. maximum possible signal amplitude. Each key points list must be defined using
  1569. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1570. @code{x0/y0 x1/y1 x2/y2 ....}
  1571. The input values must be in strictly increasing order but the transfer function
  1572. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1573. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1574. function are @code{-70/-70|-60/-20}.
  1575. @item soft-knee
  1576. Set the curve radius in dB for all joints. It defaults to 0.01.
  1577. @item gain
  1578. Set the additional gain in dB to be applied at all points on the transfer
  1579. function. This allows for easy adjustment of the overall gain.
  1580. It defaults to 0.
  1581. @item volume
  1582. Set an initial volume, in dB, to be assumed for each channel when filtering
  1583. starts. This permits the user to supply a nominal level initially, so that, for
  1584. example, a very large gain is not applied to initial signal levels before the
  1585. companding has begun to operate. A typical value for audio which is initially
  1586. quiet is -90 dB. It defaults to 0.
  1587. @item delay
  1588. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1589. delayed before being fed to the volume adjuster. Specifying a delay
  1590. approximately equal to the attack/decay times allows the filter to effectively
  1591. operate in predictive rather than reactive mode. It defaults to 0.
  1592. @end table
  1593. @subsection Examples
  1594. @itemize
  1595. @item
  1596. Make music with both quiet and loud passages suitable for listening to in a
  1597. noisy environment:
  1598. @example
  1599. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1600. @end example
  1601. Another example for audio with whisper and explosion parts:
  1602. @example
  1603. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1604. @end example
  1605. @item
  1606. A noise gate for when the noise is at a lower level than the signal:
  1607. @example
  1608. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1609. @end example
  1610. @item
  1611. Here is another noise gate, this time for when the noise is at a higher level
  1612. than the signal (making it, in some ways, similar to squelch):
  1613. @example
  1614. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1615. @end example
  1616. @item
  1617. 2:1 compression starting at -6dB:
  1618. @example
  1619. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1620. @end example
  1621. @item
  1622. 2:1 compression starting at -9dB:
  1623. @example
  1624. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1625. @end example
  1626. @item
  1627. 2:1 compression starting at -12dB:
  1628. @example
  1629. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1630. @end example
  1631. @item
  1632. 2:1 compression starting at -18dB:
  1633. @example
  1634. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1635. @end example
  1636. @item
  1637. 3:1 compression starting at -15dB:
  1638. @example
  1639. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1640. @end example
  1641. @item
  1642. Compressor/Gate:
  1643. @example
  1644. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1645. @end example
  1646. @item
  1647. Expander:
  1648. @example
  1649. 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
  1650. @end example
  1651. @item
  1652. Hard limiter at -6dB:
  1653. @example
  1654. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1655. @end example
  1656. @item
  1657. Hard limiter at -12dB:
  1658. @example
  1659. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1660. @end example
  1661. @item
  1662. Hard noise gate at -35 dB:
  1663. @example
  1664. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1665. @end example
  1666. @item
  1667. Soft limiter:
  1668. @example
  1669. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  1670. @end example
  1671. @end itemize
  1672. @section compensationdelay
  1673. Compensation Delay Line is a metric based delay to compensate differing
  1674. positions of microphones or speakers.
  1675. For example, you have recorded guitar with two microphones placed in
  1676. different location. Because the front of sound wave has fixed speed in
  1677. normal conditions, the phasing of microphones can vary and depends on
  1678. their location and interposition. The best sound mix can be achieved when
  1679. these microphones are in phase (synchronized). Note that distance of
  1680. ~30 cm between microphones makes one microphone to capture signal in
  1681. antiphase to another microphone. That makes the final mix sounding moody.
  1682. This filter helps to solve phasing problems by adding different delays
  1683. to each microphone track and make them synchronized.
  1684. The best result can be reached when you take one track as base and
  1685. synchronize other tracks one by one with it.
  1686. Remember that synchronization/delay tolerance depends on sample rate, too.
  1687. Higher sample rates will give more tolerance.
  1688. It accepts the following parameters:
  1689. @table @option
  1690. @item mm
  1691. Set millimeters distance. This is compensation distance for fine tuning.
  1692. Default is 0.
  1693. @item cm
  1694. Set cm distance. This is compensation distance for tightening distance setup.
  1695. Default is 0.
  1696. @item m
  1697. Set meters distance. This is compensation distance for hard distance setup.
  1698. Default is 0.
  1699. @item dry
  1700. Set dry amount. Amount of unprocessed (dry) signal.
  1701. Default is 0.
  1702. @item wet
  1703. Set wet amount. Amount of processed (wet) signal.
  1704. Default is 1.
  1705. @item temp
  1706. Set temperature degree in Celsius. This is the temperature of the environment.
  1707. Default is 20.
  1708. @end table
  1709. @section crystalizer
  1710. Simple algorithm to expand audio dynamic range.
  1711. The filter accepts the following options:
  1712. @table @option
  1713. @item i
  1714. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  1715. (unchanged sound) to 10.0 (maximum effect).
  1716. @item c
  1717. Enable clipping. By default is enabled.
  1718. @end table
  1719. @section dcshift
  1720. Apply a DC shift to the audio.
  1721. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1722. in the recording chain) from the audio. The effect of a DC offset is reduced
  1723. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1724. a signal has a DC offset.
  1725. @table @option
  1726. @item shift
  1727. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1728. the audio.
  1729. @item limitergain
  1730. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1731. used to prevent clipping.
  1732. @end table
  1733. @section dynaudnorm
  1734. Dynamic Audio Normalizer.
  1735. This filter applies a certain amount of gain to the input audio in order
  1736. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  1737. contrast to more "simple" normalization algorithms, the Dynamic Audio
  1738. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  1739. This allows for applying extra gain to the "quiet" sections of the audio
  1740. while avoiding distortions or clipping the "loud" sections. In other words:
  1741. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  1742. sections, in the sense that the volume of each section is brought to the
  1743. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  1744. this goal *without* applying "dynamic range compressing". It will retain 100%
  1745. of the dynamic range *within* each section of the audio file.
  1746. @table @option
  1747. @item f
  1748. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  1749. Default is 500 milliseconds.
  1750. The Dynamic Audio Normalizer processes the input audio in small chunks,
  1751. referred to as frames. This is required, because a peak magnitude has no
  1752. meaning for just a single sample value. Instead, we need to determine the
  1753. peak magnitude for a contiguous sequence of sample values. While a "standard"
  1754. normalizer would simply use the peak magnitude of the complete file, the
  1755. Dynamic Audio Normalizer determines the peak magnitude individually for each
  1756. frame. The length of a frame is specified in milliseconds. By default, the
  1757. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  1758. been found to give good results with most files.
  1759. Note that the exact frame length, in number of samples, will be determined
  1760. automatically, based on the sampling rate of the individual input audio file.
  1761. @item g
  1762. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  1763. number. Default is 31.
  1764. Probably the most important parameter of the Dynamic Audio Normalizer is the
  1765. @code{window size} of the Gaussian smoothing filter. The filter's window size
  1766. is specified in frames, centered around the current frame. For the sake of
  1767. simplicity, this must be an odd number. Consequently, the default value of 31
  1768. takes into account the current frame, as well as the 15 preceding frames and
  1769. the 15 subsequent frames. Using a larger window results in a stronger
  1770. smoothing effect and thus in less gain variation, i.e. slower gain
  1771. adaptation. Conversely, using a smaller window results in a weaker smoothing
  1772. effect and thus in more gain variation, i.e. faster gain adaptation.
  1773. In other words, the more you increase this value, the more the Dynamic Audio
  1774. Normalizer will behave like a "traditional" normalization filter. On the
  1775. contrary, the more you decrease this value, the more the Dynamic Audio
  1776. Normalizer will behave like a dynamic range compressor.
  1777. @item p
  1778. Set the target peak value. This specifies the highest permissible magnitude
  1779. level for the normalized audio input. This filter will try to approach the
  1780. target peak magnitude as closely as possible, but at the same time it also
  1781. makes sure that the normalized signal will never exceed the peak magnitude.
  1782. A frame's maximum local gain factor is imposed directly by the target peak
  1783. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  1784. It is not recommended to go above this value.
  1785. @item m
  1786. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  1787. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  1788. factor for each input frame, i.e. the maximum gain factor that does not
  1789. result in clipping or distortion. The maximum gain factor is determined by
  1790. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  1791. additionally bounds the frame's maximum gain factor by a predetermined
  1792. (global) maximum gain factor. This is done in order to avoid excessive gain
  1793. factors in "silent" or almost silent frames. By default, the maximum gain
  1794. factor is 10.0, For most inputs the default value should be sufficient and
  1795. it usually is not recommended to increase this value. Though, for input
  1796. with an extremely low overall volume level, it may be necessary to allow even
  1797. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  1798. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  1799. Instead, a "sigmoid" threshold function will be applied. This way, the
  1800. gain factors will smoothly approach the threshold value, but never exceed that
  1801. value.
  1802. @item r
  1803. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  1804. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  1805. This means that the maximum local gain factor for each frame is defined
  1806. (only) by the frame's highest magnitude sample. This way, the samples can
  1807. be amplified as much as possible without exceeding the maximum signal
  1808. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  1809. Normalizer can also take into account the frame's root mean square,
  1810. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  1811. determine the power of a time-varying signal. It is therefore considered
  1812. that the RMS is a better approximation of the "perceived loudness" than
  1813. just looking at the signal's peak magnitude. Consequently, by adjusting all
  1814. frames to a constant RMS value, a uniform "perceived loudness" can be
  1815. established. If a target RMS value has been specified, a frame's local gain
  1816. factor is defined as the factor that would result in exactly that RMS value.
  1817. Note, however, that the maximum local gain factor is still restricted by the
  1818. frame's highest magnitude sample, in order to prevent clipping.
  1819. @item n
  1820. Enable channels coupling. By default is enabled.
  1821. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  1822. amount. This means the same gain factor will be applied to all channels, i.e.
  1823. the maximum possible gain factor is determined by the "loudest" channel.
  1824. However, in some recordings, it may happen that the volume of the different
  1825. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  1826. In this case, this option can be used to disable the channel coupling. This way,
  1827. the gain factor will be determined independently for each channel, depending
  1828. only on the individual channel's highest magnitude sample. This allows for
  1829. harmonizing the volume of the different channels.
  1830. @item c
  1831. Enable DC bias correction. By default is disabled.
  1832. An audio signal (in the time domain) is a sequence of sample values.
  1833. In the Dynamic Audio Normalizer these sample values are represented in the
  1834. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  1835. audio signal, or "waveform", should be centered around the zero point.
  1836. That means if we calculate the mean value of all samples in a file, or in a
  1837. single frame, then the result should be 0.0 or at least very close to that
  1838. value. If, however, there is a significant deviation of the mean value from
  1839. 0.0, in either positive or negative direction, this is referred to as a
  1840. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  1841. Audio Normalizer provides optional DC bias correction.
  1842. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  1843. the mean value, or "DC correction" offset, of each input frame and subtract
  1844. that value from all of the frame's sample values which ensures those samples
  1845. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  1846. boundaries, the DC correction offset values will be interpolated smoothly
  1847. between neighbouring frames.
  1848. @item b
  1849. Enable alternative boundary mode. By default is disabled.
  1850. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  1851. around each frame. This includes the preceding frames as well as the
  1852. subsequent frames. However, for the "boundary" frames, located at the very
  1853. beginning and at the very end of the audio file, not all neighbouring
  1854. frames are available. In particular, for the first few frames in the audio
  1855. file, the preceding frames are not known. And, similarly, for the last few
  1856. frames in the audio file, the subsequent frames are not known. Thus, the
  1857. question arises which gain factors should be assumed for the missing frames
  1858. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  1859. to deal with this situation. The default boundary mode assumes a gain factor
  1860. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  1861. "fade out" at the beginning and at the end of the input, respectively.
  1862. @item s
  1863. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  1864. By default, the Dynamic Audio Normalizer does not apply "traditional"
  1865. compression. This means that signal peaks will not be pruned and thus the
  1866. full dynamic range will be retained within each local neighbourhood. However,
  1867. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  1868. normalization algorithm with a more "traditional" compression.
  1869. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  1870. (thresholding) function. If (and only if) the compression feature is enabled,
  1871. all input frames will be processed by a soft knee thresholding function prior
  1872. to the actual normalization process. Put simply, the thresholding function is
  1873. going to prune all samples whose magnitude exceeds a certain threshold value.
  1874. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  1875. value. Instead, the threshold value will be adjusted for each individual
  1876. frame.
  1877. In general, smaller parameters result in stronger compression, and vice versa.
  1878. Values below 3.0 are not recommended, because audible distortion may appear.
  1879. @end table
  1880. @section earwax
  1881. Make audio easier to listen to on headphones.
  1882. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  1883. so that when listened to on headphones the stereo image is moved from
  1884. inside your head (standard for headphones) to outside and in front of
  1885. the listener (standard for speakers).
  1886. Ported from SoX.
  1887. @section equalizer
  1888. Apply a two-pole peaking equalisation (EQ) filter. With this
  1889. filter, the signal-level at and around a selected frequency can
  1890. be increased or decreased, whilst (unlike bandpass and bandreject
  1891. filters) that at all other frequencies is unchanged.
  1892. In order to produce complex equalisation curves, this filter can
  1893. be given several times, each with a different central frequency.
  1894. The filter accepts the following options:
  1895. @table @option
  1896. @item frequency, f
  1897. Set the filter's central frequency in Hz.
  1898. @item width_type
  1899. Set method to specify band-width of filter.
  1900. @table @option
  1901. @item h
  1902. Hz
  1903. @item q
  1904. Q-Factor
  1905. @item o
  1906. octave
  1907. @item s
  1908. slope
  1909. @end table
  1910. @item width, w
  1911. Specify the band-width of a filter in width_type units.
  1912. @item gain, g
  1913. Set the required gain or attenuation in dB.
  1914. Beware of clipping when using a positive gain.
  1915. @end table
  1916. @subsection Examples
  1917. @itemize
  1918. @item
  1919. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  1920. @example
  1921. equalizer=f=1000:width_type=h:width=200:g=-10
  1922. @end example
  1923. @item
  1924. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  1925. @example
  1926. equalizer=f=1000:width_type=q:width=1:g=2,equalizer=f=100:width_type=q:width=2:g=-5
  1927. @end example
  1928. @end itemize
  1929. @section extrastereo
  1930. Linearly increases the difference between left and right channels which
  1931. adds some sort of "live" effect to playback.
  1932. The filter accepts the following options:
  1933. @table @option
  1934. @item m
  1935. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  1936. (average of both channels), with 1.0 sound will be unchanged, with
  1937. -1.0 left and right channels will be swapped.
  1938. @item c
  1939. Enable clipping. By default is enabled.
  1940. @end table
  1941. @section firequalizer
  1942. Apply FIR Equalization using arbitrary frequency response.
  1943. The filter accepts the following option:
  1944. @table @option
  1945. @item gain
  1946. Set gain curve equation (in dB). The expression can contain variables:
  1947. @table @option
  1948. @item f
  1949. the evaluated frequency
  1950. @item sr
  1951. sample rate
  1952. @item ch
  1953. channel number, set to 0 when multichannels evaluation is disabled
  1954. @item chid
  1955. channel id, see libavutil/channel_layout.h, set to the first channel id when
  1956. multichannels evaluation is disabled
  1957. @item chs
  1958. number of channels
  1959. @item chlayout
  1960. channel_layout, see libavutil/channel_layout.h
  1961. @end table
  1962. and functions:
  1963. @table @option
  1964. @item gain_interpolate(f)
  1965. interpolate gain on frequency f based on gain_entry
  1966. @item cubic_interpolate(f)
  1967. same as gain_interpolate, but smoother
  1968. @end table
  1969. This option is also available as command. Default is @code{gain_interpolate(f)}.
  1970. @item gain_entry
  1971. Set gain entry for gain_interpolate function. The expression can
  1972. contain functions:
  1973. @table @option
  1974. @item entry(f, g)
  1975. store gain entry at frequency f with value g
  1976. @end table
  1977. This option is also available as command.
  1978. @item delay
  1979. Set filter delay in seconds. Higher value means more accurate.
  1980. Default is @code{0.01}.
  1981. @item accuracy
  1982. Set filter accuracy in Hz. Lower value means more accurate.
  1983. Default is @code{5}.
  1984. @item wfunc
  1985. Set window function. Acceptable values are:
  1986. @table @option
  1987. @item rectangular
  1988. rectangular window, useful when gain curve is already smooth
  1989. @item hann
  1990. hann window (default)
  1991. @item hamming
  1992. hamming window
  1993. @item blackman
  1994. blackman window
  1995. @item nuttall3
  1996. 3-terms continuous 1st derivative nuttall window
  1997. @item mnuttall3
  1998. minimum 3-terms discontinuous nuttall window
  1999. @item nuttall
  2000. 4-terms continuous 1st derivative nuttall window
  2001. @item bnuttall
  2002. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2003. @item bharris
  2004. blackman-harris window
  2005. @item tukey
  2006. tukey window
  2007. @end table
  2008. @item fixed
  2009. If enabled, use fixed number of audio samples. This improves speed when
  2010. filtering with large delay. Default is disabled.
  2011. @item multi
  2012. Enable multichannels evaluation on gain. Default is disabled.
  2013. @item zero_phase
  2014. Enable zero phase mode by subtracting timestamp to compensate delay.
  2015. Default is disabled.
  2016. @item scale
  2017. Set scale used by gain. Acceptable values are:
  2018. @table @option
  2019. @item linlin
  2020. linear frequency, linear gain
  2021. @item linlog
  2022. linear frequency, logarithmic (in dB) gain (default)
  2023. @item loglin
  2024. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2025. @item loglog
  2026. logarithmic frequency, logarithmic gain
  2027. @end table
  2028. @item dumpfile
  2029. Set file for dumping, suitable for gnuplot.
  2030. @item dumpscale
  2031. Set scale for dumpfile. Acceptable values are same with scale option.
  2032. Default is linlog.
  2033. @item fft2
  2034. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2035. Default is disabled.
  2036. @end table
  2037. @subsection Examples
  2038. @itemize
  2039. @item
  2040. lowpass at 1000 Hz:
  2041. @example
  2042. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2043. @end example
  2044. @item
  2045. lowpass at 1000 Hz with gain_entry:
  2046. @example
  2047. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2048. @end example
  2049. @item
  2050. custom equalization:
  2051. @example
  2052. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2053. @end example
  2054. @item
  2055. higher delay with zero phase to compensate delay:
  2056. @example
  2057. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2058. @end example
  2059. @item
  2060. lowpass on left channel, highpass on right channel:
  2061. @example
  2062. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2063. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2064. @end example
  2065. @end itemize
  2066. @section flanger
  2067. Apply a flanging effect to the audio.
  2068. The filter accepts the following options:
  2069. @table @option
  2070. @item delay
  2071. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2072. @item depth
  2073. Set added swep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2074. @item regen
  2075. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2076. Default value is 0.
  2077. @item width
  2078. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2079. Default value is 71.
  2080. @item speed
  2081. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2082. @item shape
  2083. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2084. Default value is @var{sinusoidal}.
  2085. @item phase
  2086. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2087. Default value is 25.
  2088. @item interp
  2089. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2090. Default is @var{linear}.
  2091. @end table
  2092. @section hdcd
  2093. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2094. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2095. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2096. of HDCD, and detects the Transient Filter flag.
  2097. @example
  2098. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2099. @end example
  2100. When using the filter with wav, note the default encoding for wav is 16-bit,
  2101. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2102. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2103. @example
  2104. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2105. ffmpeg -i HDCD16.wav -af hdcd -acodec pcm_s24le OUT24.wav
  2106. @end example
  2107. The filter accepts the following options:
  2108. @table @option
  2109. @item disable_autoconvert
  2110. Disable any automatic format conversion or resampling in the filter graph.
  2111. @item process_stereo
  2112. Process the stereo channels together. If target_gain does not match between
  2113. channels, consider it invalid and use the last valid target_gain.
  2114. @item cdt_ms
  2115. Set the code detect timer period in ms.
  2116. @item force_pe
  2117. Always extend peaks above -3dBFS even if PE isn't signaled.
  2118. @item analyze_mode
  2119. Replace audio with a solid tone and adjust the amplitude to signal some
  2120. specific aspect of the decoding process. The output file can be loaded in
  2121. an audio editor alongside the original to aid analysis.
  2122. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2123. Modes are:
  2124. @table @samp
  2125. @item 0, off
  2126. Disabled
  2127. @item 1, lle
  2128. Gain adjustment level at each sample
  2129. @item 2, pe
  2130. Samples where peak extend occurs
  2131. @item 3, cdt
  2132. Samples where the code detect timer is active
  2133. @item 4, tgm
  2134. Samples where the target gain does not match between channels
  2135. @end table
  2136. @end table
  2137. @section highpass
  2138. Apply a high-pass filter with 3dB point frequency.
  2139. The filter can be either single-pole, or double-pole (the default).
  2140. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2141. The filter accepts the following options:
  2142. @table @option
  2143. @item frequency, f
  2144. Set frequency in Hz. Default is 3000.
  2145. @item poles, p
  2146. Set number of poles. Default is 2.
  2147. @item width_type
  2148. Set method to specify band-width of filter.
  2149. @table @option
  2150. @item h
  2151. Hz
  2152. @item q
  2153. Q-Factor
  2154. @item o
  2155. octave
  2156. @item s
  2157. slope
  2158. @end table
  2159. @item width, w
  2160. Specify the band-width of a filter in width_type units.
  2161. Applies only to double-pole filter.
  2162. The default is 0.707q and gives a Butterworth response.
  2163. @end table
  2164. @section join
  2165. Join multiple input streams into one multi-channel stream.
  2166. It accepts the following parameters:
  2167. @table @option
  2168. @item inputs
  2169. The number of input streams. It defaults to 2.
  2170. @item channel_layout
  2171. The desired output channel layout. It defaults to stereo.
  2172. @item map
  2173. Map channels from inputs to output. The argument is a '|'-separated list of
  2174. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2175. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2176. can be either the name of the input channel (e.g. FL for front left) or its
  2177. index in the specified input stream. @var{out_channel} is the name of the output
  2178. channel.
  2179. @end table
  2180. The filter will attempt to guess the mappings when they are not specified
  2181. explicitly. It does so by first trying to find an unused matching input channel
  2182. and if that fails it picks the first unused input channel.
  2183. Join 3 inputs (with properly set channel layouts):
  2184. @example
  2185. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2186. @end example
  2187. Build a 5.1 output from 6 single-channel streams:
  2188. @example
  2189. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2190. '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'
  2191. out
  2192. @end example
  2193. @section ladspa
  2194. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2195. To enable compilation of this filter you need to configure FFmpeg with
  2196. @code{--enable-ladspa}.
  2197. @table @option
  2198. @item file, f
  2199. Specifies the name of LADSPA plugin library to load. If the environment
  2200. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2201. each one of the directories specified by the colon separated list in
  2202. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2203. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2204. @file{/usr/lib/ladspa/}.
  2205. @item plugin, p
  2206. Specifies the plugin within the library. Some libraries contain only
  2207. one plugin, but others contain many of them. If this is not set filter
  2208. will list all available plugins within the specified library.
  2209. @item controls, c
  2210. Set the '|' separated list of controls which are zero or more floating point
  2211. values that determine the behavior of the loaded plugin (for example delay,
  2212. threshold or gain).
  2213. Controls need to be defined using the following syntax:
  2214. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2215. @var{valuei} is the value set on the @var{i}-th control.
  2216. Alternatively they can be also defined using the following syntax:
  2217. @var{value0}|@var{value1}|@var{value2}|..., where
  2218. @var{valuei} is the value set on the @var{i}-th control.
  2219. If @option{controls} is set to @code{help}, all available controls and
  2220. their valid ranges are printed.
  2221. @item sample_rate, s
  2222. Specify the sample rate, default to 44100. Only used if plugin have
  2223. zero inputs.
  2224. @item nb_samples, n
  2225. Set the number of samples per channel per each output frame, default
  2226. is 1024. Only used if plugin have zero inputs.
  2227. @item duration, d
  2228. Set the minimum duration of the sourced audio. See
  2229. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2230. for the accepted syntax.
  2231. Note that the resulting duration may be greater than the specified duration,
  2232. as the generated audio is always cut at the end of a complete frame.
  2233. If not specified, or the expressed duration is negative, the audio is
  2234. supposed to be generated forever.
  2235. Only used if plugin have zero inputs.
  2236. @end table
  2237. @subsection Examples
  2238. @itemize
  2239. @item
  2240. List all available plugins within amp (LADSPA example plugin) library:
  2241. @example
  2242. ladspa=file=amp
  2243. @end example
  2244. @item
  2245. List all available controls and their valid ranges for @code{vcf_notch}
  2246. plugin from @code{VCF} library:
  2247. @example
  2248. ladspa=f=vcf:p=vcf_notch:c=help
  2249. @end example
  2250. @item
  2251. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2252. plugin library:
  2253. @example
  2254. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2255. @end example
  2256. @item
  2257. Add reverberation to the audio using TAP-plugins
  2258. (Tom's Audio Processing plugins):
  2259. @example
  2260. ladspa=file=tap_reverb:tap_reverb
  2261. @end example
  2262. @item
  2263. Generate white noise, with 0.2 amplitude:
  2264. @example
  2265. ladspa=file=cmt:noise_source_white:c=c0=.2
  2266. @end example
  2267. @item
  2268. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2269. @code{C* Audio Plugin Suite} (CAPS) library:
  2270. @example
  2271. ladspa=file=caps:Click:c=c1=20'
  2272. @end example
  2273. @item
  2274. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2275. @example
  2276. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2277. @end example
  2278. @item
  2279. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2280. @code{SWH Plugins} collection:
  2281. @example
  2282. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2283. @end example
  2284. @item
  2285. Attenuate low frequencies using Multiband EQ from Steve Harris
  2286. @code{SWH Plugins} collection:
  2287. @example
  2288. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2289. @end example
  2290. @end itemize
  2291. @subsection Commands
  2292. This filter supports the following commands:
  2293. @table @option
  2294. @item cN
  2295. Modify the @var{N}-th control value.
  2296. If the specified value is not valid, it is ignored and prior one is kept.
  2297. @end table
  2298. @section loudnorm
  2299. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2300. Support for both single pass (livestreams, files) and double pass (files) modes.
  2301. This algorithm can target IL, LRA, and maximum true peak.
  2302. The filter accepts the following options:
  2303. @table @option
  2304. @item I, i
  2305. Set integrated loudness target.
  2306. Range is -70.0 - -5.0. Default value is -24.0.
  2307. @item LRA, lra
  2308. Set loudness range target.
  2309. Range is 1.0 - 20.0. Default value is 7.0.
  2310. @item TP, tp
  2311. Set maximum true peak.
  2312. Range is -9.0 - +0.0. Default value is -2.0.
  2313. @item measured_I, measured_i
  2314. Measured IL of input file.
  2315. Range is -99.0 - +0.0.
  2316. @item measured_LRA, measured_lra
  2317. Measured LRA of input file.
  2318. Range is 0.0 - 99.0.
  2319. @item measured_TP, measured_tp
  2320. Measured true peak of input file.
  2321. Range is -99.0 - +99.0.
  2322. @item measured_thresh
  2323. Measured threshold of input file.
  2324. Range is -99.0 - +0.0.
  2325. @item offset
  2326. Set offset gain. Gain is applied before the true-peak limiter.
  2327. Range is -99.0 - +99.0. Default is +0.0.
  2328. @item linear
  2329. Normalize linearly if possible.
  2330. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2331. to be specified in order to use this mode.
  2332. Options are true or false. Default is true.
  2333. @item dual_mono
  2334. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2335. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2336. If set to @code{true}, this option will compensate for this effect.
  2337. Multi-channel input files are not affected by this option.
  2338. Options are true or false. Default is false.
  2339. @item print_format
  2340. Set print format for stats. Options are summary, json, or none.
  2341. Default value is none.
  2342. @end table
  2343. @section lowpass
  2344. Apply a low-pass filter with 3dB point frequency.
  2345. The filter can be either single-pole or double-pole (the default).
  2346. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2347. The filter accepts the following options:
  2348. @table @option
  2349. @item frequency, f
  2350. Set frequency in Hz. Default is 500.
  2351. @item poles, p
  2352. Set number of poles. Default is 2.
  2353. @item width_type
  2354. Set method to specify band-width of filter.
  2355. @table @option
  2356. @item h
  2357. Hz
  2358. @item q
  2359. Q-Factor
  2360. @item o
  2361. octave
  2362. @item s
  2363. slope
  2364. @end table
  2365. @item width, w
  2366. Specify the band-width of a filter in width_type units.
  2367. Applies only to double-pole filter.
  2368. The default is 0.707q and gives a Butterworth response.
  2369. @end table
  2370. @anchor{pan}
  2371. @section pan
  2372. Mix channels with specific gain levels. The filter accepts the output
  2373. channel layout followed by a set of channels definitions.
  2374. This filter is also designed to efficiently remap the channels of an audio
  2375. stream.
  2376. The filter accepts parameters of the form:
  2377. "@var{l}|@var{outdef}|@var{outdef}|..."
  2378. @table @option
  2379. @item l
  2380. output channel layout or number of channels
  2381. @item outdef
  2382. output channel specification, of the form:
  2383. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  2384. @item out_name
  2385. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2386. number (c0, c1, etc.)
  2387. @item gain
  2388. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2389. @item in_name
  2390. input channel to use, see out_name for details; it is not possible to mix
  2391. named and numbered input channels
  2392. @end table
  2393. If the `=' in a channel specification is replaced by `<', then the gains for
  2394. that specification will be renormalized so that the total is 1, thus
  2395. avoiding clipping noise.
  2396. @subsection Mixing examples
  2397. For example, if you want to down-mix from stereo to mono, but with a bigger
  2398. factor for the left channel:
  2399. @example
  2400. pan=1c|c0=0.9*c0+0.1*c1
  2401. @end example
  2402. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2403. 7-channels surround:
  2404. @example
  2405. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2406. @end example
  2407. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2408. that should be preferred (see "-ac" option) unless you have very specific
  2409. needs.
  2410. @subsection Remapping examples
  2411. The channel remapping will be effective if, and only if:
  2412. @itemize
  2413. @item gain coefficients are zeroes or ones,
  2414. @item only one input per channel output,
  2415. @end itemize
  2416. If all these conditions are satisfied, the filter will notify the user ("Pure
  2417. channel mapping detected"), and use an optimized and lossless method to do the
  2418. remapping.
  2419. For example, if you have a 5.1 source and want a stereo audio stream by
  2420. dropping the extra channels:
  2421. @example
  2422. pan="stereo| c0=FL | c1=FR"
  2423. @end example
  2424. Given the same source, you can also switch front left and front right channels
  2425. and keep the input channel layout:
  2426. @example
  2427. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2428. @end example
  2429. If the input is a stereo audio stream, you can mute the front left channel (and
  2430. still keep the stereo channel layout) with:
  2431. @example
  2432. pan="stereo|c1=c1"
  2433. @end example
  2434. Still with a stereo audio stream input, you can copy the right channel in both
  2435. front left and right:
  2436. @example
  2437. pan="stereo| c0=FR | c1=FR"
  2438. @end example
  2439. @section replaygain
  2440. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2441. outputs it unchanged.
  2442. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2443. @section resample
  2444. Convert the audio sample format, sample rate and channel layout. It is
  2445. not meant to be used directly.
  2446. @section rubberband
  2447. Apply time-stretching and pitch-shifting with librubberband.
  2448. The filter accepts the following options:
  2449. @table @option
  2450. @item tempo
  2451. Set tempo scale factor.
  2452. @item pitch
  2453. Set pitch scale factor.
  2454. @item transients
  2455. Set transients detector.
  2456. Possible values are:
  2457. @table @var
  2458. @item crisp
  2459. @item mixed
  2460. @item smooth
  2461. @end table
  2462. @item detector
  2463. Set detector.
  2464. Possible values are:
  2465. @table @var
  2466. @item compound
  2467. @item percussive
  2468. @item soft
  2469. @end table
  2470. @item phase
  2471. Set phase.
  2472. Possible values are:
  2473. @table @var
  2474. @item laminar
  2475. @item independent
  2476. @end table
  2477. @item window
  2478. Set processing window size.
  2479. Possible values are:
  2480. @table @var
  2481. @item standard
  2482. @item short
  2483. @item long
  2484. @end table
  2485. @item smoothing
  2486. Set smoothing.
  2487. Possible values are:
  2488. @table @var
  2489. @item off
  2490. @item on
  2491. @end table
  2492. @item formant
  2493. Enable formant preservation when shift pitching.
  2494. Possible values are:
  2495. @table @var
  2496. @item shifted
  2497. @item preserved
  2498. @end table
  2499. @item pitchq
  2500. Set pitch quality.
  2501. Possible values are:
  2502. @table @var
  2503. @item quality
  2504. @item speed
  2505. @item consistency
  2506. @end table
  2507. @item channels
  2508. Set channels.
  2509. Possible values are:
  2510. @table @var
  2511. @item apart
  2512. @item together
  2513. @end table
  2514. @end table
  2515. @section sidechaincompress
  2516. This filter acts like normal compressor but has the ability to compress
  2517. detected signal using second input signal.
  2518. It needs two input streams and returns one output stream.
  2519. First input stream will be processed depending on second stream signal.
  2520. The filtered signal then can be filtered with other filters in later stages of
  2521. processing. See @ref{pan} and @ref{amerge} filter.
  2522. The filter accepts the following options:
  2523. @table @option
  2524. @item level_in
  2525. Set input gain. Default is 1. Range is between 0.015625 and 64.
  2526. @item threshold
  2527. If a signal of second stream raises above this level it will affect the gain
  2528. reduction of first stream.
  2529. By default is 0.125. Range is between 0.00097563 and 1.
  2530. @item ratio
  2531. Set a ratio about which the signal is reduced. 1:2 means that if the level
  2532. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  2533. Default is 2. Range is between 1 and 20.
  2534. @item attack
  2535. Amount of milliseconds the signal has to rise above the threshold before gain
  2536. reduction starts. Default is 20. Range is between 0.01 and 2000.
  2537. @item release
  2538. Amount of milliseconds the signal has to fall below the threshold before
  2539. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  2540. @item makeup
  2541. Set the amount by how much signal will be amplified after processing.
  2542. Default is 2. Range is from 1 and 64.
  2543. @item knee
  2544. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2545. Default is 2.82843. Range is between 1 and 8.
  2546. @item link
  2547. Choose if the @code{average} level between all channels of side-chain stream
  2548. or the louder(@code{maximum}) channel of side-chain stream affects the
  2549. reduction. Default is @code{average}.
  2550. @item detection
  2551. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  2552. of @code{rms}. Default is @code{rms} which is mainly smoother.
  2553. @item level_sc
  2554. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  2555. @item mix
  2556. How much to use compressed signal in output. Default is 1.
  2557. Range is between 0 and 1.
  2558. @end table
  2559. @subsection Examples
  2560. @itemize
  2561. @item
  2562. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  2563. depending on the signal of 2nd input and later compressed signal to be
  2564. merged with 2nd input:
  2565. @example
  2566. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  2567. @end example
  2568. @end itemize
  2569. @section sidechaingate
  2570. A sidechain gate acts like a normal (wideband) gate but has the ability to
  2571. filter the detected signal before sending it to the gain reduction stage.
  2572. Normally a gate uses the full range signal to detect a level above the
  2573. threshold.
  2574. For example: If you cut all lower frequencies from your sidechain signal
  2575. the gate will decrease the volume of your track only if not enough highs
  2576. appear. With this technique you are able to reduce the resonation of a
  2577. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  2578. guitar.
  2579. It needs two input streams and returns one output stream.
  2580. First input stream will be processed depending on second stream signal.
  2581. The filter accepts the following options:
  2582. @table @option
  2583. @item level_in
  2584. Set input level before filtering.
  2585. Default is 1. Allowed range is from 0.015625 to 64.
  2586. @item range
  2587. Set the level of gain reduction when the signal is below the threshold.
  2588. Default is 0.06125. Allowed range is from 0 to 1.
  2589. @item threshold
  2590. If a signal rises above this level the gain reduction is released.
  2591. Default is 0.125. Allowed range is from 0 to 1.
  2592. @item ratio
  2593. Set a ratio about which the signal is reduced.
  2594. Default is 2. Allowed range is from 1 to 9000.
  2595. @item attack
  2596. Amount of milliseconds the signal has to rise above the threshold before gain
  2597. reduction stops.
  2598. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  2599. @item release
  2600. Amount of milliseconds the signal has to fall below the threshold before the
  2601. reduction is increased again. Default is 250 milliseconds.
  2602. Allowed range is from 0.01 to 9000.
  2603. @item makeup
  2604. Set amount of amplification of signal after processing.
  2605. Default is 1. Allowed range is from 1 to 64.
  2606. @item knee
  2607. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2608. Default is 2.828427125. Allowed range is from 1 to 8.
  2609. @item detection
  2610. Choose if exact signal should be taken for detection or an RMS like one.
  2611. Default is rms. Can be peak or rms.
  2612. @item link
  2613. Choose if the average level between all channels or the louder channel affects
  2614. the reduction.
  2615. Default is average. Can be average or maximum.
  2616. @item level_sc
  2617. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  2618. @end table
  2619. @section silencedetect
  2620. Detect silence in an audio stream.
  2621. This filter logs a message when it detects that the input audio volume is less
  2622. or equal to a noise tolerance value for a duration greater or equal to the
  2623. minimum detected noise duration.
  2624. The printed times and duration are expressed in seconds.
  2625. The filter accepts the following options:
  2626. @table @option
  2627. @item duration, d
  2628. Set silence duration until notification (default is 2 seconds).
  2629. @item noise, n
  2630. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  2631. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  2632. @end table
  2633. @subsection Examples
  2634. @itemize
  2635. @item
  2636. Detect 5 seconds of silence with -50dB noise tolerance:
  2637. @example
  2638. silencedetect=n=-50dB:d=5
  2639. @end example
  2640. @item
  2641. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  2642. tolerance in @file{silence.mp3}:
  2643. @example
  2644. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  2645. @end example
  2646. @end itemize
  2647. @section silenceremove
  2648. Remove silence from the beginning, middle or end of the audio.
  2649. The filter accepts the following options:
  2650. @table @option
  2651. @item start_periods
  2652. This value is used to indicate if audio should be trimmed at beginning of
  2653. the audio. A value of zero indicates no silence should be trimmed from the
  2654. beginning. When specifying a non-zero value, it trims audio up until it
  2655. finds non-silence. Normally, when trimming silence from beginning of audio
  2656. the @var{start_periods} will be @code{1} but it can be increased to higher
  2657. values to trim all audio up to specific count of non-silence periods.
  2658. Default value is @code{0}.
  2659. @item start_duration
  2660. Specify the amount of time that non-silence must be detected before it stops
  2661. trimming audio. By increasing the duration, bursts of noises can be treated
  2662. as silence and trimmed off. Default value is @code{0}.
  2663. @item start_threshold
  2664. This indicates what sample value should be treated as silence. For digital
  2665. audio, a value of @code{0} may be fine but for audio recorded from analog,
  2666. you may wish to increase the value to account for background noise.
  2667. Can be specified in dB (in case "dB" is appended to the specified value)
  2668. or amplitude ratio. Default value is @code{0}.
  2669. @item stop_periods
  2670. Set the count for trimming silence from the end of audio.
  2671. To remove silence from the middle of a file, specify a @var{stop_periods}
  2672. that is negative. This value is then treated as a positive value and is
  2673. used to indicate the effect should restart processing as specified by
  2674. @var{start_periods}, making it suitable for removing periods of silence
  2675. in the middle of the audio.
  2676. Default value is @code{0}.
  2677. @item stop_duration
  2678. Specify a duration of silence that must exist before audio is not copied any
  2679. more. By specifying a higher duration, silence that is wanted can be left in
  2680. the audio.
  2681. Default value is @code{0}.
  2682. @item stop_threshold
  2683. This is the same as @option{start_threshold} but for trimming silence from
  2684. the end of audio.
  2685. Can be specified in dB (in case "dB" is appended to the specified value)
  2686. or amplitude ratio. Default value is @code{0}.
  2687. @item leave_silence
  2688. This indicates that @var{stop_duration} length of audio should be left intact
  2689. at the beginning of each period of silence.
  2690. For example, if you want to remove long pauses between words but do not want
  2691. to remove the pauses completely. Default value is @code{0}.
  2692. @item detection
  2693. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  2694. and works better with digital silence which is exactly 0.
  2695. Default value is @code{rms}.
  2696. @item window
  2697. Set ratio used to calculate size of window for detecting silence.
  2698. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  2699. @end table
  2700. @subsection Examples
  2701. @itemize
  2702. @item
  2703. The following example shows how this filter can be used to start a recording
  2704. that does not contain the delay at the start which usually occurs between
  2705. pressing the record button and the start of the performance:
  2706. @example
  2707. silenceremove=1:5:0.02
  2708. @end example
  2709. @item
  2710. Trim all silence encountered from beginning to end where there is more than 1
  2711. second of silence in audio:
  2712. @example
  2713. silenceremove=0:0:0:-1:1:-90dB
  2714. @end example
  2715. @end itemize
  2716. @section sofalizer
  2717. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  2718. loudspeakers around the user for binaural listening via headphones (audio
  2719. formats up to 9 channels supported).
  2720. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  2721. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  2722. Austrian Academy of Sciences.
  2723. To enable compilation of this filter you need to configure FFmpeg with
  2724. @code{--enable-netcdf}.
  2725. The filter accepts the following options:
  2726. @table @option
  2727. @item sofa
  2728. Set the SOFA file used for rendering.
  2729. @item gain
  2730. Set gain applied to audio. Value is in dB. Default is 0.
  2731. @item rotation
  2732. Set rotation of virtual loudspeakers in deg. Default is 0.
  2733. @item elevation
  2734. Set elevation of virtual speakers in deg. Default is 0.
  2735. @item radius
  2736. Set distance in meters between loudspeakers and the listener with near-field
  2737. HRTFs. Default is 1.
  2738. @item type
  2739. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2740. processing audio in time domain which is slow.
  2741. @var{freq} is processing audio in frequency domain which is fast.
  2742. Default is @var{freq}.
  2743. @item speakers
  2744. Set custom positions of virtual loudspeakers. Syntax for this option is:
  2745. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  2746. Each virtual loudspeaker is described with short channel name following with
  2747. azimuth and elevation in degreees.
  2748. Each virtual loudspeaker description is separated by '|'.
  2749. For example to override front left and front right channel positions use:
  2750. 'speakers=FL 45 15|FR 345 15'.
  2751. Descriptions with unrecognised channel names are ignored.
  2752. @end table
  2753. @subsection Examples
  2754. @itemize
  2755. @item
  2756. Using ClubFritz6 sofa file:
  2757. @example
  2758. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  2759. @end example
  2760. @item
  2761. Using ClubFritz12 sofa file and bigger radius with small rotation:
  2762. @example
  2763. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  2764. @end example
  2765. @item
  2766. Similar as above but with custom speaker positions for front left, front right, rear left and rear right
  2767. and also with custom gain:
  2768. @example
  2769. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|RL 135|RR 225:gain=28"
  2770. @end example
  2771. @end itemize
  2772. @section stereotools
  2773. This filter has some handy utilities to manage stereo signals, for converting
  2774. M/S stereo recordings to L/R signal while having control over the parameters
  2775. or spreading the stereo image of master track.
  2776. The filter accepts the following options:
  2777. @table @option
  2778. @item level_in
  2779. Set input level before filtering for both channels. Defaults is 1.
  2780. Allowed range is from 0.015625 to 64.
  2781. @item level_out
  2782. Set output level after filtering for both channels. Defaults is 1.
  2783. Allowed range is from 0.015625 to 64.
  2784. @item balance_in
  2785. Set input balance between both channels. Default is 0.
  2786. Allowed range is from -1 to 1.
  2787. @item balance_out
  2788. Set output balance between both channels. Default is 0.
  2789. Allowed range is from -1 to 1.
  2790. @item softclip
  2791. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  2792. clipping. Disabled by default.
  2793. @item mutel
  2794. Mute the left channel. Disabled by default.
  2795. @item muter
  2796. Mute the right channel. Disabled by default.
  2797. @item phasel
  2798. Change the phase of the left channel. Disabled by default.
  2799. @item phaser
  2800. Change the phase of the right channel. Disabled by default.
  2801. @item mode
  2802. Set stereo mode. Available values are:
  2803. @table @samp
  2804. @item lr>lr
  2805. Left/Right to Left/Right, this is default.
  2806. @item lr>ms
  2807. Left/Right to Mid/Side.
  2808. @item ms>lr
  2809. Mid/Side to Left/Right.
  2810. @item lr>ll
  2811. Left/Right to Left/Left.
  2812. @item lr>rr
  2813. Left/Right to Right/Right.
  2814. @item lr>l+r
  2815. Left/Right to Left + Right.
  2816. @item lr>rl
  2817. Left/Right to Right/Left.
  2818. @end table
  2819. @item slev
  2820. Set level of side signal. Default is 1.
  2821. Allowed range is from 0.015625 to 64.
  2822. @item sbal
  2823. Set balance of side signal. Default is 0.
  2824. Allowed range is from -1 to 1.
  2825. @item mlev
  2826. Set level of the middle signal. Default is 1.
  2827. Allowed range is from 0.015625 to 64.
  2828. @item mpan
  2829. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  2830. @item base
  2831. Set stereo base between mono and inversed channels. Default is 0.
  2832. Allowed range is from -1 to 1.
  2833. @item delay
  2834. Set delay in milliseconds how much to delay left from right channel and
  2835. vice versa. Default is 0. Allowed range is from -20 to 20.
  2836. @item sclevel
  2837. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  2838. @item phase
  2839. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  2840. @end table
  2841. @subsection Examples
  2842. @itemize
  2843. @item
  2844. Apply karaoke like effect:
  2845. @example
  2846. stereotools=mlev=0.015625
  2847. @end example
  2848. @item
  2849. Convert M/S signal to L/R:
  2850. @example
  2851. "stereotools=mode=ms>lr"
  2852. @end example
  2853. @end itemize
  2854. @section stereowiden
  2855. This filter enhance the stereo effect by suppressing signal common to both
  2856. channels and by delaying the signal of left into right and vice versa,
  2857. thereby widening the stereo effect.
  2858. The filter accepts the following options:
  2859. @table @option
  2860. @item delay
  2861. Time in milliseconds of the delay of left signal into right and vice versa.
  2862. Default is 20 milliseconds.
  2863. @item feedback
  2864. Amount of gain in delayed signal into right and vice versa. Gives a delay
  2865. effect of left signal in right output and vice versa which gives widening
  2866. effect. Default is 0.3.
  2867. @item crossfeed
  2868. Cross feed of left into right with inverted phase. This helps in suppressing
  2869. the mono. If the value is 1 it will cancel all the signal common to both
  2870. channels. Default is 0.3.
  2871. @item drymix
  2872. Set level of input signal of original channel. Default is 0.8.
  2873. @end table
  2874. @section treble
  2875. Boost or cut treble (upper) frequencies of the audio using a two-pole
  2876. shelving filter with a response similar to that of a standard
  2877. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2878. The filter accepts the following options:
  2879. @table @option
  2880. @item gain, g
  2881. Give the gain at whichever is the lower of ~22 kHz and the
  2882. Nyquist frequency. Its useful range is about -20 (for a large cut)
  2883. to +20 (for a large boost). Beware of clipping when using a positive gain.
  2884. @item frequency, f
  2885. Set the filter's central frequency and so can be used
  2886. to extend or reduce the frequency range to be boosted or cut.
  2887. The default value is @code{3000} Hz.
  2888. @item width_type
  2889. Set method to specify band-width of filter.
  2890. @table @option
  2891. @item h
  2892. Hz
  2893. @item q
  2894. Q-Factor
  2895. @item o
  2896. octave
  2897. @item s
  2898. slope
  2899. @end table
  2900. @item width, w
  2901. Determine how steep is the filter's shelf transition.
  2902. @end table
  2903. @section tremolo
  2904. Sinusoidal amplitude modulation.
  2905. The filter accepts the following options:
  2906. @table @option
  2907. @item f
  2908. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  2909. (20 Hz or lower) will result in a tremolo effect.
  2910. This filter may also be used as a ring modulator by specifying
  2911. a modulation frequency higher than 20 Hz.
  2912. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2913. @item d
  2914. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2915. Default value is 0.5.
  2916. @end table
  2917. @section vibrato
  2918. Sinusoidal phase modulation.
  2919. The filter accepts the following options:
  2920. @table @option
  2921. @item f
  2922. Modulation frequency in Hertz.
  2923. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2924. @item d
  2925. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2926. Default value is 0.5.
  2927. @end table
  2928. @section volume
  2929. Adjust the input audio volume.
  2930. It accepts the following parameters:
  2931. @table @option
  2932. @item volume
  2933. Set audio volume expression.
  2934. Output values are clipped to the maximum value.
  2935. The output audio volume is given by the relation:
  2936. @example
  2937. @var{output_volume} = @var{volume} * @var{input_volume}
  2938. @end example
  2939. The default value for @var{volume} is "1.0".
  2940. @item precision
  2941. This parameter represents the mathematical precision.
  2942. It determines which input sample formats will be allowed, which affects the
  2943. precision of the volume scaling.
  2944. @table @option
  2945. @item fixed
  2946. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  2947. @item float
  2948. 32-bit floating-point; this limits input sample format to FLT. (default)
  2949. @item double
  2950. 64-bit floating-point; this limits input sample format to DBL.
  2951. @end table
  2952. @item replaygain
  2953. Choose the behaviour on encountering ReplayGain side data in input frames.
  2954. @table @option
  2955. @item drop
  2956. Remove ReplayGain side data, ignoring its contents (the default).
  2957. @item ignore
  2958. Ignore ReplayGain side data, but leave it in the frame.
  2959. @item track
  2960. Prefer the track gain, if present.
  2961. @item album
  2962. Prefer the album gain, if present.
  2963. @end table
  2964. @item replaygain_preamp
  2965. Pre-amplification gain in dB to apply to the selected replaygain gain.
  2966. Default value for @var{replaygain_preamp} is 0.0.
  2967. @item eval
  2968. Set when the volume expression is evaluated.
  2969. It accepts the following values:
  2970. @table @samp
  2971. @item once
  2972. only evaluate expression once during the filter initialization, or
  2973. when the @samp{volume} command is sent
  2974. @item frame
  2975. evaluate expression for each incoming frame
  2976. @end table
  2977. Default value is @samp{once}.
  2978. @end table
  2979. The volume expression can contain the following parameters.
  2980. @table @option
  2981. @item n
  2982. frame number (starting at zero)
  2983. @item nb_channels
  2984. number of channels
  2985. @item nb_consumed_samples
  2986. number of samples consumed by the filter
  2987. @item nb_samples
  2988. number of samples in the current frame
  2989. @item pos
  2990. original frame position in the file
  2991. @item pts
  2992. frame PTS
  2993. @item sample_rate
  2994. sample rate
  2995. @item startpts
  2996. PTS at start of stream
  2997. @item startt
  2998. time at start of stream
  2999. @item t
  3000. frame time
  3001. @item tb
  3002. timestamp timebase
  3003. @item volume
  3004. last set volume value
  3005. @end table
  3006. Note that when @option{eval} is set to @samp{once} only the
  3007. @var{sample_rate} and @var{tb} variables are available, all other
  3008. variables will evaluate to NAN.
  3009. @subsection Commands
  3010. This filter supports the following commands:
  3011. @table @option
  3012. @item volume
  3013. Modify the volume expression.
  3014. The command accepts the same syntax of the corresponding option.
  3015. If the specified expression is not valid, it is kept at its current
  3016. value.
  3017. @item replaygain_noclip
  3018. Prevent clipping by limiting the gain applied.
  3019. Default value for @var{replaygain_noclip} is 1.
  3020. @end table
  3021. @subsection Examples
  3022. @itemize
  3023. @item
  3024. Halve the input audio volume:
  3025. @example
  3026. volume=volume=0.5
  3027. volume=volume=1/2
  3028. volume=volume=-6.0206dB
  3029. @end example
  3030. In all the above example the named key for @option{volume} can be
  3031. omitted, for example like in:
  3032. @example
  3033. volume=0.5
  3034. @end example
  3035. @item
  3036. Increase input audio power by 6 decibels using fixed-point precision:
  3037. @example
  3038. volume=volume=6dB:precision=fixed
  3039. @end example
  3040. @item
  3041. Fade volume after time 10 with an annihilation period of 5 seconds:
  3042. @example
  3043. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3044. @end example
  3045. @end itemize
  3046. @section volumedetect
  3047. Detect the volume of the input video.
  3048. The filter has no parameters. The input is not modified. Statistics about
  3049. the volume will be printed in the log when the input stream end is reached.
  3050. In particular it will show the mean volume (root mean square), maximum
  3051. volume (on a per-sample basis), and the beginning of a histogram of the
  3052. registered volume values (from the maximum value to a cumulated 1/1000 of
  3053. the samples).
  3054. All volumes are in decibels relative to the maximum PCM value.
  3055. @subsection Examples
  3056. Here is an excerpt of the output:
  3057. @example
  3058. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3059. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3060. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3061. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3062. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3063. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3064. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3065. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3066. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3067. @end example
  3068. It means that:
  3069. @itemize
  3070. @item
  3071. The mean square energy is approximately -27 dB, or 10^-2.7.
  3072. @item
  3073. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3074. @item
  3075. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3076. @end itemize
  3077. In other words, raising the volume by +4 dB does not cause any clipping,
  3078. raising it by +5 dB causes clipping for 6 samples, etc.
  3079. @c man end AUDIO FILTERS
  3080. @chapter Audio Sources
  3081. @c man begin AUDIO SOURCES
  3082. Below is a description of the currently available audio sources.
  3083. @section abuffer
  3084. Buffer audio frames, and make them available to the filter chain.
  3085. This source is mainly intended for a programmatic use, in particular
  3086. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3087. It accepts the following parameters:
  3088. @table @option
  3089. @item time_base
  3090. The timebase which will be used for timestamps of submitted frames. It must be
  3091. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3092. @item sample_rate
  3093. The sample rate of the incoming audio buffers.
  3094. @item sample_fmt
  3095. The sample format of the incoming audio buffers.
  3096. Either a sample format name or its corresponding integer representation from
  3097. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3098. @item channel_layout
  3099. The channel layout of the incoming audio buffers.
  3100. Either a channel layout name from channel_layout_map in
  3101. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3102. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3103. @item channels
  3104. The number of channels of the incoming audio buffers.
  3105. If both @var{channels} and @var{channel_layout} are specified, then they
  3106. must be consistent.
  3107. @end table
  3108. @subsection Examples
  3109. @example
  3110. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3111. @end example
  3112. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3113. Since the sample format with name "s16p" corresponds to the number
  3114. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3115. equivalent to:
  3116. @example
  3117. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3118. @end example
  3119. @section aevalsrc
  3120. Generate an audio signal specified by an expression.
  3121. This source accepts in input one or more expressions (one for each
  3122. channel), which are evaluated and used to generate a corresponding
  3123. audio signal.
  3124. This source accepts the following options:
  3125. @table @option
  3126. @item exprs
  3127. Set the '|'-separated expressions list for each separate channel. In case the
  3128. @option{channel_layout} option is not specified, the selected channel layout
  3129. depends on the number of provided expressions. Otherwise the last
  3130. specified expression is applied to the remaining output channels.
  3131. @item channel_layout, c
  3132. Set the channel layout. The number of channels in the specified layout
  3133. must be equal to the number of specified expressions.
  3134. @item duration, d
  3135. Set the minimum duration of the sourced audio. See
  3136. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3137. for the accepted syntax.
  3138. Note that the resulting duration may be greater than the specified
  3139. duration, as the generated audio is always cut at the end of a
  3140. complete frame.
  3141. If not specified, or the expressed duration is negative, the audio is
  3142. supposed to be generated forever.
  3143. @item nb_samples, n
  3144. Set the number of samples per channel per each output frame,
  3145. default to 1024.
  3146. @item sample_rate, s
  3147. Specify the sample rate, default to 44100.
  3148. @end table
  3149. Each expression in @var{exprs} can contain the following constants:
  3150. @table @option
  3151. @item n
  3152. number of the evaluated sample, starting from 0
  3153. @item t
  3154. time of the evaluated sample expressed in seconds, starting from 0
  3155. @item s
  3156. sample rate
  3157. @end table
  3158. @subsection Examples
  3159. @itemize
  3160. @item
  3161. Generate silence:
  3162. @example
  3163. aevalsrc=0
  3164. @end example
  3165. @item
  3166. Generate a sin signal with frequency of 440 Hz, set sample rate to
  3167. 8000 Hz:
  3168. @example
  3169. aevalsrc="sin(440*2*PI*t):s=8000"
  3170. @end example
  3171. @item
  3172. Generate a two channels signal, specify the channel layout (Front
  3173. Center + Back Center) explicitly:
  3174. @example
  3175. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  3176. @end example
  3177. @item
  3178. Generate white noise:
  3179. @example
  3180. aevalsrc="-2+random(0)"
  3181. @end example
  3182. @item
  3183. Generate an amplitude modulated signal:
  3184. @example
  3185. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  3186. @end example
  3187. @item
  3188. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  3189. @example
  3190. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  3191. @end example
  3192. @end itemize
  3193. @section anullsrc
  3194. The null audio source, return unprocessed audio frames. It is mainly useful
  3195. as a template and to be employed in analysis / debugging tools, or as
  3196. the source for filters which ignore the input data (for example the sox
  3197. synth filter).
  3198. This source accepts the following options:
  3199. @table @option
  3200. @item channel_layout, cl
  3201. Specifies the channel layout, and can be either an integer or a string
  3202. representing a channel layout. The default value of @var{channel_layout}
  3203. is "stereo".
  3204. Check the channel_layout_map definition in
  3205. @file{libavutil/channel_layout.c} for the mapping between strings and
  3206. channel layout values.
  3207. @item sample_rate, r
  3208. Specifies the sample rate, and defaults to 44100.
  3209. @item nb_samples, n
  3210. Set the number of samples per requested frames.
  3211. @end table
  3212. @subsection Examples
  3213. @itemize
  3214. @item
  3215. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3216. @example
  3217. anullsrc=r=48000:cl=4
  3218. @end example
  3219. @item
  3220. Do the same operation with a more obvious syntax:
  3221. @example
  3222. anullsrc=r=48000:cl=mono
  3223. @end example
  3224. @end itemize
  3225. All the parameters need to be explicitly defined.
  3226. @section flite
  3227. Synthesize a voice utterance using the libflite library.
  3228. To enable compilation of this filter you need to configure FFmpeg with
  3229. @code{--enable-libflite}.
  3230. Note that the flite library is not thread-safe.
  3231. The filter accepts the following options:
  3232. @table @option
  3233. @item list_voices
  3234. If set to 1, list the names of the available voices and exit
  3235. immediately. Default value is 0.
  3236. @item nb_samples, n
  3237. Set the maximum number of samples per frame. Default value is 512.
  3238. @item textfile
  3239. Set the filename containing the text to speak.
  3240. @item text
  3241. Set the text to speak.
  3242. @item voice, v
  3243. Set the voice to use for the speech synthesis. Default value is
  3244. @code{kal}. See also the @var{list_voices} option.
  3245. @end table
  3246. @subsection Examples
  3247. @itemize
  3248. @item
  3249. Read from file @file{speech.txt}, and synthesize the text using the
  3250. standard flite voice:
  3251. @example
  3252. flite=textfile=speech.txt
  3253. @end example
  3254. @item
  3255. Read the specified text selecting the @code{slt} voice:
  3256. @example
  3257. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3258. @end example
  3259. @item
  3260. Input text to ffmpeg:
  3261. @example
  3262. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3263. @end example
  3264. @item
  3265. Make @file{ffplay} speak the specified text, using @code{flite} and
  3266. the @code{lavfi} device:
  3267. @example
  3268. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3269. @end example
  3270. @end itemize
  3271. For more information about libflite, check:
  3272. @url{http://www.speech.cs.cmu.edu/flite/}
  3273. @section anoisesrc
  3274. Generate a noise audio signal.
  3275. The filter accepts the following options:
  3276. @table @option
  3277. @item sample_rate, r
  3278. Specify the sample rate. Default value is 48000 Hz.
  3279. @item amplitude, a
  3280. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  3281. is 1.0.
  3282. @item duration, d
  3283. Specify the duration of the generated audio stream. Not specifying this option
  3284. results in noise with an infinite length.
  3285. @item color, colour, c
  3286. Specify the color of noise. Available noise colors are white, pink, and brown.
  3287. Default color is white.
  3288. @item seed, s
  3289. Specify a value used to seed the PRNG.
  3290. @item nb_samples, n
  3291. Set the number of samples per each output frame, default is 1024.
  3292. @end table
  3293. @subsection Examples
  3294. @itemize
  3295. @item
  3296. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  3297. @example
  3298. anoisesrc=d=60:c=pink:r=44100:a=0.5
  3299. @end example
  3300. @end itemize
  3301. @section sine
  3302. Generate an audio signal made of a sine wave with amplitude 1/8.
  3303. The audio signal is bit-exact.
  3304. The filter accepts the following options:
  3305. @table @option
  3306. @item frequency, f
  3307. Set the carrier frequency. Default is 440 Hz.
  3308. @item beep_factor, b
  3309. Enable a periodic beep every second with frequency @var{beep_factor} times
  3310. the carrier frequency. Default is 0, meaning the beep is disabled.
  3311. @item sample_rate, r
  3312. Specify the sample rate, default is 44100.
  3313. @item duration, d
  3314. Specify the duration of the generated audio stream.
  3315. @item samples_per_frame
  3316. Set the number of samples per output frame.
  3317. The expression can contain the following constants:
  3318. @table @option
  3319. @item n
  3320. The (sequential) number of the output audio frame, starting from 0.
  3321. @item pts
  3322. The PTS (Presentation TimeStamp) of the output audio frame,
  3323. expressed in @var{TB} units.
  3324. @item t
  3325. The PTS of the output audio frame, expressed in seconds.
  3326. @item TB
  3327. The timebase of the output audio frames.
  3328. @end table
  3329. Default is @code{1024}.
  3330. @end table
  3331. @subsection Examples
  3332. @itemize
  3333. @item
  3334. Generate a simple 440 Hz sine wave:
  3335. @example
  3336. sine
  3337. @end example
  3338. @item
  3339. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  3340. @example
  3341. sine=220:4:d=5
  3342. sine=f=220:b=4:d=5
  3343. sine=frequency=220:beep_factor=4:duration=5
  3344. @end example
  3345. @item
  3346. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  3347. pattern:
  3348. @example
  3349. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  3350. @end example
  3351. @end itemize
  3352. @c man end AUDIO SOURCES
  3353. @chapter Audio Sinks
  3354. @c man begin AUDIO SINKS
  3355. Below is a description of the currently available audio sinks.
  3356. @section abuffersink
  3357. Buffer audio frames, and make them available to the end of filter chain.
  3358. This sink is mainly intended for programmatic use, in particular
  3359. through the interface defined in @file{libavfilter/buffersink.h}
  3360. or the options system.
  3361. It accepts a pointer to an AVABufferSinkContext structure, which
  3362. defines the incoming buffers' formats, to be passed as the opaque
  3363. parameter to @code{avfilter_init_filter} for initialization.
  3364. @section anullsink
  3365. Null audio sink; do absolutely nothing with the input audio. It is
  3366. mainly useful as a template and for use in analysis / debugging
  3367. tools.
  3368. @c man end AUDIO SINKS
  3369. @chapter Video Filters
  3370. @c man begin VIDEO FILTERS
  3371. When you configure your FFmpeg build, you can disable any of the
  3372. existing filters using @code{--disable-filters}.
  3373. The configure output will show the video filters included in your
  3374. build.
  3375. Below is a description of the currently available video filters.
  3376. @section alphaextract
  3377. Extract the alpha component from the input as a grayscale video. This
  3378. is especially useful with the @var{alphamerge} filter.
  3379. @section alphamerge
  3380. Add or replace the alpha component of the primary input with the
  3381. grayscale value of a second input. This is intended for use with
  3382. @var{alphaextract} to allow the transmission or storage of frame
  3383. sequences that have alpha in a format that doesn't support an alpha
  3384. channel.
  3385. For example, to reconstruct full frames from a normal YUV-encoded video
  3386. and a separate video created with @var{alphaextract}, you might use:
  3387. @example
  3388. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  3389. @end example
  3390. Since this filter is designed for reconstruction, it operates on frame
  3391. sequences without considering timestamps, and terminates when either
  3392. input reaches end of stream. This will cause problems if your encoding
  3393. pipeline drops frames. If you're trying to apply an image as an
  3394. overlay to a video stream, consider the @var{overlay} filter instead.
  3395. @section ass
  3396. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  3397. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  3398. Substation Alpha) subtitles files.
  3399. This filter accepts the following option in addition to the common options from
  3400. the @ref{subtitles} filter:
  3401. @table @option
  3402. @item shaping
  3403. Set the shaping engine
  3404. Available values are:
  3405. @table @samp
  3406. @item auto
  3407. The default libass shaping engine, which is the best available.
  3408. @item simple
  3409. Fast, font-agnostic shaper that can do only substitutions
  3410. @item complex
  3411. Slower shaper using OpenType for substitutions and positioning
  3412. @end table
  3413. The default is @code{auto}.
  3414. @end table
  3415. @section atadenoise
  3416. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  3417. The filter accepts the following options:
  3418. @table @option
  3419. @item 0a
  3420. Set threshold A for 1st plane. Default is 0.02.
  3421. Valid range is 0 to 0.3.
  3422. @item 0b
  3423. Set threshold B for 1st plane. Default is 0.04.
  3424. Valid range is 0 to 5.
  3425. @item 1a
  3426. Set threshold A for 2nd plane. Default is 0.02.
  3427. Valid range is 0 to 0.3.
  3428. @item 1b
  3429. Set threshold B for 2nd plane. Default is 0.04.
  3430. Valid range is 0 to 5.
  3431. @item 2a
  3432. Set threshold A for 3rd plane. Default is 0.02.
  3433. Valid range is 0 to 0.3.
  3434. @item 2b
  3435. Set threshold B for 3rd plane. Default is 0.04.
  3436. Valid range is 0 to 5.
  3437. Threshold A is designed to react on abrupt changes in the input signal and
  3438. threshold B is designed to react on continuous changes in the input signal.
  3439. @item s
  3440. Set number of frames filter will use for averaging. Default is 33. Must be odd
  3441. number in range [5, 129].
  3442. @item p
  3443. Set what planes of frame filter will use for averaging. Default is all.
  3444. @end table
  3445. @section avgblur
  3446. Apply average blur filter.
  3447. The filter accepts the following options:
  3448. @table @option
  3449. @item sizeX
  3450. Set horizontal kernel size.
  3451. @item planes
  3452. Set which planes to filter. By default all planes are filtered.
  3453. @item sizeY
  3454. Set vertical kernel size, if zero it will be same as @code{sizeX}.
  3455. Default is @code{0}.
  3456. @end table
  3457. @section bbox
  3458. Compute the bounding box for the non-black pixels in the input frame
  3459. luminance plane.
  3460. This filter computes the bounding box containing all the pixels with a
  3461. luminance value greater than the minimum allowed value.
  3462. The parameters describing the bounding box are printed on the filter
  3463. log.
  3464. The filter accepts the following option:
  3465. @table @option
  3466. @item min_val
  3467. Set the minimal luminance value. Default is @code{16}.
  3468. @end table
  3469. @section bitplanenoise
  3470. Show and measure bit plane noise.
  3471. The filter accepts the following options:
  3472. @table @option
  3473. @item bitplane
  3474. Set which plane to analyze. Default is @code{1}.
  3475. @item filter
  3476. Filter out noisy pixels from @code{bitplane} set above.
  3477. Default is disabled.
  3478. @end table
  3479. @section blackdetect
  3480. Detect video intervals that are (almost) completely black. Can be
  3481. useful to detect chapter transitions, commercials, or invalid
  3482. recordings. Output lines contains the time for the start, end and
  3483. duration of the detected black interval expressed in seconds.
  3484. In order to display the output lines, you need to set the loglevel at
  3485. least to the AV_LOG_INFO value.
  3486. The filter accepts the following options:
  3487. @table @option
  3488. @item black_min_duration, d
  3489. Set the minimum detected black duration expressed in seconds. It must
  3490. be a non-negative floating point number.
  3491. Default value is 2.0.
  3492. @item picture_black_ratio_th, pic_th
  3493. Set the threshold for considering a picture "black".
  3494. Express the minimum value for the ratio:
  3495. @example
  3496. @var{nb_black_pixels} / @var{nb_pixels}
  3497. @end example
  3498. for which a picture is considered black.
  3499. Default value is 0.98.
  3500. @item pixel_black_th, pix_th
  3501. Set the threshold for considering a pixel "black".
  3502. The threshold expresses the maximum pixel luminance value for which a
  3503. pixel is considered "black". The provided value is scaled according to
  3504. the following equation:
  3505. @example
  3506. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  3507. @end example
  3508. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  3509. the input video format, the range is [0-255] for YUV full-range
  3510. formats and [16-235] for YUV non full-range formats.
  3511. Default value is 0.10.
  3512. @end table
  3513. The following example sets the maximum pixel threshold to the minimum
  3514. value, and detects only black intervals of 2 or more seconds:
  3515. @example
  3516. blackdetect=d=2:pix_th=0.00
  3517. @end example
  3518. @section blackframe
  3519. Detect frames that are (almost) completely black. Can be useful to
  3520. detect chapter transitions or commercials. Output lines consist of
  3521. the frame number of the detected frame, the percentage of blackness,
  3522. the position in the file if known or -1 and the timestamp in seconds.
  3523. In order to display the output lines, you need to set the loglevel at
  3524. least to the AV_LOG_INFO value.
  3525. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  3526. The value represents the percentage of pixels in the picture that
  3527. are below the threshold value.
  3528. It accepts the following parameters:
  3529. @table @option
  3530. @item amount
  3531. The percentage of the pixels that have to be below the threshold; it defaults to
  3532. @code{98}.
  3533. @item threshold, thresh
  3534. The threshold below which a pixel value is considered black; it defaults to
  3535. @code{32}.
  3536. @end table
  3537. @section blend, tblend
  3538. Blend two video frames into each other.
  3539. The @code{blend} filter takes two input streams and outputs one
  3540. stream, the first input is the "top" layer and second input is
  3541. "bottom" layer. By default, the output terminates when the longest input terminates.
  3542. The @code{tblend} (time blend) filter takes two consecutive frames
  3543. from one single stream, and outputs the result obtained by blending
  3544. the new frame on top of the old frame.
  3545. A description of the accepted options follows.
  3546. @table @option
  3547. @item c0_mode
  3548. @item c1_mode
  3549. @item c2_mode
  3550. @item c3_mode
  3551. @item all_mode
  3552. Set blend mode for specific pixel component or all pixel components in case
  3553. of @var{all_mode}. Default value is @code{normal}.
  3554. Available values for component modes are:
  3555. @table @samp
  3556. @item addition
  3557. @item addition128
  3558. @item and
  3559. @item average
  3560. @item burn
  3561. @item darken
  3562. @item difference
  3563. @item difference128
  3564. @item divide
  3565. @item dodge
  3566. @item freeze
  3567. @item exclusion
  3568. @item glow
  3569. @item hardlight
  3570. @item hardmix
  3571. @item heat
  3572. @item lighten
  3573. @item linearlight
  3574. @item multiply
  3575. @item multiply128
  3576. @item negation
  3577. @item normal
  3578. @item or
  3579. @item overlay
  3580. @item phoenix
  3581. @item pinlight
  3582. @item reflect
  3583. @item screen
  3584. @item softlight
  3585. @item subtract
  3586. @item vividlight
  3587. @item xor
  3588. @end table
  3589. @item c0_opacity
  3590. @item c1_opacity
  3591. @item c2_opacity
  3592. @item c3_opacity
  3593. @item all_opacity
  3594. Set blend opacity for specific pixel component or all pixel components in case
  3595. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  3596. @item c0_expr
  3597. @item c1_expr
  3598. @item c2_expr
  3599. @item c3_expr
  3600. @item all_expr
  3601. Set blend expression for specific pixel component or all pixel components in case
  3602. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  3603. The expressions can use the following variables:
  3604. @table @option
  3605. @item N
  3606. The sequential number of the filtered frame, starting from @code{0}.
  3607. @item X
  3608. @item Y
  3609. the coordinates of the current sample
  3610. @item W
  3611. @item H
  3612. the width and height of currently filtered plane
  3613. @item SW
  3614. @item SH
  3615. Width and height scale depending on the currently filtered plane. It is the
  3616. ratio between the corresponding luma plane number of pixels and the current
  3617. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  3618. @code{0.5,0.5} for chroma planes.
  3619. @item T
  3620. Time of the current frame, expressed in seconds.
  3621. @item TOP, A
  3622. Value of pixel component at current location for first video frame (top layer).
  3623. @item BOTTOM, B
  3624. Value of pixel component at current location for second video frame (bottom layer).
  3625. @end table
  3626. @item shortest
  3627. Force termination when the shortest input terminates. Default is
  3628. @code{0}. This option is only defined for the @code{blend} filter.
  3629. @item repeatlast
  3630. Continue applying the last bottom frame after the end of the stream. A value of
  3631. @code{0} disable the filter after the last frame of the bottom layer is reached.
  3632. Default is @code{1}. This option is only defined for the @code{blend} filter.
  3633. @end table
  3634. @subsection Examples
  3635. @itemize
  3636. @item
  3637. Apply transition from bottom layer to top layer in first 10 seconds:
  3638. @example
  3639. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  3640. @end example
  3641. @item
  3642. Apply 1x1 checkerboard effect:
  3643. @example
  3644. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  3645. @end example
  3646. @item
  3647. Apply uncover left effect:
  3648. @example
  3649. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  3650. @end example
  3651. @item
  3652. Apply uncover down effect:
  3653. @example
  3654. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  3655. @end example
  3656. @item
  3657. Apply uncover up-left effect:
  3658. @example
  3659. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  3660. @end example
  3661. @item
  3662. Split diagonally video and shows top and bottom layer on each side:
  3663. @example
  3664. blend=all_expr=if(gt(X,Y*(W/H)),A,B)
  3665. @end example
  3666. @item
  3667. Display differences between the current and the previous frame:
  3668. @example
  3669. tblend=all_mode=difference128
  3670. @end example
  3671. @end itemize
  3672. @section boxblur
  3673. Apply a boxblur algorithm to the input video.
  3674. It accepts the following parameters:
  3675. @table @option
  3676. @item luma_radius, lr
  3677. @item luma_power, lp
  3678. @item chroma_radius, cr
  3679. @item chroma_power, cp
  3680. @item alpha_radius, ar
  3681. @item alpha_power, ap
  3682. @end table
  3683. A description of the accepted options follows.
  3684. @table @option
  3685. @item luma_radius, lr
  3686. @item chroma_radius, cr
  3687. @item alpha_radius, ar
  3688. Set an expression for the box radius in pixels used for blurring the
  3689. corresponding input plane.
  3690. The radius value must be a non-negative number, and must not be
  3691. greater than the value of the expression @code{min(w,h)/2} for the
  3692. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  3693. planes.
  3694. Default value for @option{luma_radius} is "2". If not specified,
  3695. @option{chroma_radius} and @option{alpha_radius} default to the
  3696. corresponding value set for @option{luma_radius}.
  3697. The expressions can contain the following constants:
  3698. @table @option
  3699. @item w
  3700. @item h
  3701. The input width and height in pixels.
  3702. @item cw
  3703. @item ch
  3704. The input chroma image width and height in pixels.
  3705. @item hsub
  3706. @item vsub
  3707. The horizontal and vertical chroma subsample values. For example, for the
  3708. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  3709. @end table
  3710. @item luma_power, lp
  3711. @item chroma_power, cp
  3712. @item alpha_power, ap
  3713. Specify how many times the boxblur filter is applied to the
  3714. corresponding plane.
  3715. Default value for @option{luma_power} is 2. If not specified,
  3716. @option{chroma_power} and @option{alpha_power} default to the
  3717. corresponding value set for @option{luma_power}.
  3718. A value of 0 will disable the effect.
  3719. @end table
  3720. @subsection Examples
  3721. @itemize
  3722. @item
  3723. Apply a boxblur filter with the luma, chroma, and alpha radii
  3724. set to 2:
  3725. @example
  3726. boxblur=luma_radius=2:luma_power=1
  3727. boxblur=2:1
  3728. @end example
  3729. @item
  3730. Set the luma radius to 2, and alpha and chroma radius to 0:
  3731. @example
  3732. boxblur=2:1:cr=0:ar=0
  3733. @end example
  3734. @item
  3735. Set the luma and chroma radii to a fraction of the video dimension:
  3736. @example
  3737. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  3738. @end example
  3739. @end itemize
  3740. @section bwdif
  3741. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  3742. Deinterlacing Filter").
  3743. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  3744. interpolation algorithms.
  3745. It accepts the following parameters:
  3746. @table @option
  3747. @item mode
  3748. The interlacing mode to adopt. It accepts one of the following values:
  3749. @table @option
  3750. @item 0, send_frame
  3751. Output one frame for each frame.
  3752. @item 1, send_field
  3753. Output one frame for each field.
  3754. @end table
  3755. The default value is @code{send_field}.
  3756. @item parity
  3757. The picture field parity assumed for the input interlaced video. It accepts one
  3758. of the following values:
  3759. @table @option
  3760. @item 0, tff
  3761. Assume the top field is first.
  3762. @item 1, bff
  3763. Assume the bottom field is first.
  3764. @item -1, auto
  3765. Enable automatic detection of field parity.
  3766. @end table
  3767. The default value is @code{auto}.
  3768. If the interlacing is unknown or the decoder does not export this information,
  3769. top field first will be assumed.
  3770. @item deint
  3771. Specify which frames to deinterlace. Accept one of the following
  3772. values:
  3773. @table @option
  3774. @item 0, all
  3775. Deinterlace all frames.
  3776. @item 1, interlaced
  3777. Only deinterlace frames marked as interlaced.
  3778. @end table
  3779. The default value is @code{all}.
  3780. @end table
  3781. @section chromakey
  3782. YUV colorspace color/chroma keying.
  3783. The filter accepts the following options:
  3784. @table @option
  3785. @item color
  3786. The color which will be replaced with transparency.
  3787. @item similarity
  3788. Similarity percentage with the key color.
  3789. 0.01 matches only the exact key color, while 1.0 matches everything.
  3790. @item blend
  3791. Blend percentage.
  3792. 0.0 makes pixels either fully transparent, or not transparent at all.
  3793. Higher values result in semi-transparent pixels, with a higher transparency
  3794. the more similar the pixels color is to the key color.
  3795. @item yuv
  3796. Signals that the color passed is already in YUV instead of RGB.
  3797. Litteral colors like "green" or "red" don't make sense with this enabled anymore.
  3798. This can be used to pass exact YUV values as hexadecimal numbers.
  3799. @end table
  3800. @subsection Examples
  3801. @itemize
  3802. @item
  3803. Make every green pixel in the input image transparent:
  3804. @example
  3805. ffmpeg -i input.png -vf chromakey=green out.png
  3806. @end example
  3807. @item
  3808. Overlay a greenscreen-video on top of a static black background.
  3809. @example
  3810. 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
  3811. @end example
  3812. @end itemize
  3813. @section ciescope
  3814. Display CIE color diagram with pixels overlaid onto it.
  3815. The filter accepts the following options:
  3816. @table @option
  3817. @item system
  3818. Set color system.
  3819. @table @samp
  3820. @item ntsc, 470m
  3821. @item ebu, 470bg
  3822. @item smpte
  3823. @item 240m
  3824. @item apple
  3825. @item widergb
  3826. @item cie1931
  3827. @item rec709, hdtv
  3828. @item uhdtv, rec2020
  3829. @end table
  3830. @item cie
  3831. Set CIE system.
  3832. @table @samp
  3833. @item xyy
  3834. @item ucs
  3835. @item luv
  3836. @end table
  3837. @item gamuts
  3838. Set what gamuts to draw.
  3839. See @code{system} option for available values.
  3840. @item size, s
  3841. Set ciescope size, by default set to 512.
  3842. @item intensity, i
  3843. Set intensity used to map input pixel values to CIE diagram.
  3844. @item contrast
  3845. Set contrast used to draw tongue colors that are out of active color system gamut.
  3846. @item corrgamma
  3847. Correct gamma displayed on scope, by default enabled.
  3848. @item showwhite
  3849. Show white point on CIE diagram, by default disabled.
  3850. @item gamma
  3851. Set input gamma. Used only with XYZ input color space.
  3852. @end table
  3853. @section codecview
  3854. Visualize information exported by some codecs.
  3855. Some codecs can export information through frames using side-data or other
  3856. means. For example, some MPEG based codecs export motion vectors through the
  3857. @var{export_mvs} flag in the codec @option{flags2} option.
  3858. The filter accepts the following option:
  3859. @table @option
  3860. @item mv
  3861. Set motion vectors to visualize.
  3862. Available flags for @var{mv} are:
  3863. @table @samp
  3864. @item pf
  3865. forward predicted MVs of P-frames
  3866. @item bf
  3867. forward predicted MVs of B-frames
  3868. @item bb
  3869. backward predicted MVs of B-frames
  3870. @end table
  3871. @item qp
  3872. Display quantization parameters using the chroma planes.
  3873. @item mv_type, mvt
  3874. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  3875. Available flags for @var{mv_type} are:
  3876. @table @samp
  3877. @item fp
  3878. forward predicted MVs
  3879. @item bp
  3880. backward predicted MVs
  3881. @end table
  3882. @item frame_type, ft
  3883. Set frame type to visualize motion vectors of.
  3884. Available flags for @var{frame_type} are:
  3885. @table @samp
  3886. @item if
  3887. intra-coded frames (I-frames)
  3888. @item pf
  3889. predicted frames (P-frames)
  3890. @item bf
  3891. bi-directionally predicted frames (B-frames)
  3892. @end table
  3893. @end table
  3894. @subsection Examples
  3895. @itemize
  3896. @item
  3897. Visualize forward predicted MVs of all frames using @command{ffplay}:
  3898. @example
  3899. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  3900. @end example
  3901. @item
  3902. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  3903. @example
  3904. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  3905. @end example
  3906. @end itemize
  3907. @section colorbalance
  3908. Modify intensity of primary colors (red, green and blue) of input frames.
  3909. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  3910. regions for the red-cyan, green-magenta or blue-yellow balance.
  3911. A positive adjustment value shifts the balance towards the primary color, a negative
  3912. value towards the complementary color.
  3913. The filter accepts the following options:
  3914. @table @option
  3915. @item rs
  3916. @item gs
  3917. @item bs
  3918. Adjust red, green and blue shadows (darkest pixels).
  3919. @item rm
  3920. @item gm
  3921. @item bm
  3922. Adjust red, green and blue midtones (medium pixels).
  3923. @item rh
  3924. @item gh
  3925. @item bh
  3926. Adjust red, green and blue highlights (brightest pixels).
  3927. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3928. @end table
  3929. @subsection Examples
  3930. @itemize
  3931. @item
  3932. Add red color cast to shadows:
  3933. @example
  3934. colorbalance=rs=.3
  3935. @end example
  3936. @end itemize
  3937. @section colorkey
  3938. RGB colorspace color keying.
  3939. The filter accepts the following options:
  3940. @table @option
  3941. @item color
  3942. The color which will be replaced with transparency.
  3943. @item similarity
  3944. Similarity percentage with the key color.
  3945. 0.01 matches only the exact key color, while 1.0 matches everything.
  3946. @item blend
  3947. Blend percentage.
  3948. 0.0 makes pixels either fully transparent, or not transparent at all.
  3949. Higher values result in semi-transparent pixels, with a higher transparency
  3950. the more similar the pixels color is to the key color.
  3951. @end table
  3952. @subsection Examples
  3953. @itemize
  3954. @item
  3955. Make every green pixel in the input image transparent:
  3956. @example
  3957. ffmpeg -i input.png -vf colorkey=green out.png
  3958. @end example
  3959. @item
  3960. Overlay a greenscreen-video on top of a static background image.
  3961. @example
  3962. 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
  3963. @end example
  3964. @end itemize
  3965. @section colorlevels
  3966. Adjust video input frames using levels.
  3967. The filter accepts the following options:
  3968. @table @option
  3969. @item rimin
  3970. @item gimin
  3971. @item bimin
  3972. @item aimin
  3973. Adjust red, green, blue and alpha input black point.
  3974. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3975. @item rimax
  3976. @item gimax
  3977. @item bimax
  3978. @item aimax
  3979. Adjust red, green, blue and alpha input white point.
  3980. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  3981. Input levels are used to lighten highlights (bright tones), darken shadows
  3982. (dark tones), change the balance of bright and dark tones.
  3983. @item romin
  3984. @item gomin
  3985. @item bomin
  3986. @item aomin
  3987. Adjust red, green, blue and alpha output black point.
  3988. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  3989. @item romax
  3990. @item gomax
  3991. @item bomax
  3992. @item aomax
  3993. Adjust red, green, blue and alpha output white point.
  3994. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  3995. Output levels allows manual selection of a constrained output level range.
  3996. @end table
  3997. @subsection Examples
  3998. @itemize
  3999. @item
  4000. Make video output darker:
  4001. @example
  4002. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  4003. @end example
  4004. @item
  4005. Increase contrast:
  4006. @example
  4007. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  4008. @end example
  4009. @item
  4010. Make video output lighter:
  4011. @example
  4012. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  4013. @end example
  4014. @item
  4015. Increase brightness:
  4016. @example
  4017. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  4018. @end example
  4019. @end itemize
  4020. @section colorchannelmixer
  4021. Adjust video input frames by re-mixing color channels.
  4022. This filter modifies a color channel by adding the values associated to
  4023. the other channels of the same pixels. For example if the value to
  4024. modify is red, the output value will be:
  4025. @example
  4026. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  4027. @end example
  4028. The filter accepts the following options:
  4029. @table @option
  4030. @item rr
  4031. @item rg
  4032. @item rb
  4033. @item ra
  4034. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  4035. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  4036. @item gr
  4037. @item gg
  4038. @item gb
  4039. @item ga
  4040. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  4041. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  4042. @item br
  4043. @item bg
  4044. @item bb
  4045. @item ba
  4046. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  4047. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  4048. @item ar
  4049. @item ag
  4050. @item ab
  4051. @item aa
  4052. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  4053. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  4054. Allowed ranges for options are @code{[-2.0, 2.0]}.
  4055. @end table
  4056. @subsection Examples
  4057. @itemize
  4058. @item
  4059. Convert source to grayscale:
  4060. @example
  4061. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  4062. @end example
  4063. @item
  4064. Simulate sepia tones:
  4065. @example
  4066. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  4067. @end example
  4068. @end itemize
  4069. @section colormatrix
  4070. Convert color matrix.
  4071. The filter accepts the following options:
  4072. @table @option
  4073. @item src
  4074. @item dst
  4075. Specify the source and destination color matrix. Both values must be
  4076. specified.
  4077. The accepted values are:
  4078. @table @samp
  4079. @item bt709
  4080. BT.709
  4081. @item bt601
  4082. BT.601
  4083. @item smpte240m
  4084. SMPTE-240M
  4085. @item fcc
  4086. FCC
  4087. @item bt2020
  4088. BT.2020
  4089. @end table
  4090. @end table
  4091. For example to convert from BT.601 to SMPTE-240M, use the command:
  4092. @example
  4093. colormatrix=bt601:smpte240m
  4094. @end example
  4095. @section colorspace
  4096. Convert colorspace, transfer characteristics or color primaries.
  4097. The filter accepts the following options:
  4098. @table @option
  4099. @anchor{all}
  4100. @item all
  4101. Specify all color properties at once.
  4102. The accepted values are:
  4103. @table @samp
  4104. @item bt470m
  4105. BT.470M
  4106. @item bt470bg
  4107. BT.470BG
  4108. @item bt601-6-525
  4109. BT.601-6 525
  4110. @item bt601-6-625
  4111. BT.601-6 625
  4112. @item bt709
  4113. BT.709
  4114. @item smpte170m
  4115. SMPTE-170M
  4116. @item smpte240m
  4117. SMPTE-240M
  4118. @item bt2020
  4119. BT.2020
  4120. @end table
  4121. @anchor{space}
  4122. @item space
  4123. Specify output colorspace.
  4124. The accepted values are:
  4125. @table @samp
  4126. @item bt709
  4127. BT.709
  4128. @item fcc
  4129. FCC
  4130. @item bt470bg
  4131. BT.470BG or BT.601-6 625
  4132. @item smpte170m
  4133. SMPTE-170M or BT.601-6 525
  4134. @item smpte240m
  4135. SMPTE-240M
  4136. @item ycgco
  4137. YCgCo
  4138. @item bt2020ncl
  4139. BT.2020 with non-constant luminance
  4140. @end table
  4141. @anchor{trc}
  4142. @item trc
  4143. Specify output transfer characteristics.
  4144. The accepted values are:
  4145. @table @samp
  4146. @item bt709
  4147. BT.709
  4148. @item bt470m
  4149. BT.470M
  4150. @item bt470bg
  4151. BT.470BG
  4152. @item gamma22
  4153. Constant gamma of 2.2
  4154. @item gamma28
  4155. Constant gamma of 2.8
  4156. @item smpte170m
  4157. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  4158. @item smpte240m
  4159. SMPTE-240M
  4160. @item srgb
  4161. SRGB
  4162. @item iec61966-2-1
  4163. iec61966-2-1
  4164. @item iec61966-2-4
  4165. iec61966-2-4
  4166. @item xvycc
  4167. xvycc
  4168. @item bt2020-10
  4169. BT.2020 for 10-bits content
  4170. @item bt2020-12
  4171. BT.2020 for 12-bits content
  4172. @end table
  4173. @anchor{primaries}
  4174. @item primaries
  4175. Specify output color primaries.
  4176. The accepted values are:
  4177. @table @samp
  4178. @item bt709
  4179. BT.709
  4180. @item bt470m
  4181. BT.470M
  4182. @item bt470bg
  4183. BT.470BG or BT.601-6 625
  4184. @item smpte170m
  4185. SMPTE-170M or BT.601-6 525
  4186. @item smpte240m
  4187. SMPTE-240M
  4188. @item film
  4189. film
  4190. @item smpte431
  4191. SMPTE-431
  4192. @item smpte432
  4193. SMPTE-432
  4194. @item bt2020
  4195. BT.2020
  4196. @end table
  4197. @anchor{range}
  4198. @item range
  4199. Specify output color range.
  4200. The accepted values are:
  4201. @table @samp
  4202. @item tv
  4203. TV (restricted) range
  4204. @item mpeg
  4205. MPEG (restricted) range
  4206. @item pc
  4207. PC (full) range
  4208. @item jpeg
  4209. JPEG (full) range
  4210. @end table
  4211. @item format
  4212. Specify output color format.
  4213. The accepted values are:
  4214. @table @samp
  4215. @item yuv420p
  4216. YUV 4:2:0 planar 8-bits
  4217. @item yuv420p10
  4218. YUV 4:2:0 planar 10-bits
  4219. @item yuv420p12
  4220. YUV 4:2:0 planar 12-bits
  4221. @item yuv422p
  4222. YUV 4:2:2 planar 8-bits
  4223. @item yuv422p10
  4224. YUV 4:2:2 planar 10-bits
  4225. @item yuv422p12
  4226. YUV 4:2:2 planar 12-bits
  4227. @item yuv444p
  4228. YUV 4:4:4 planar 8-bits
  4229. @item yuv444p10
  4230. YUV 4:4:4 planar 10-bits
  4231. @item yuv444p12
  4232. YUV 4:4:4 planar 12-bits
  4233. @end table
  4234. @item fast
  4235. Do a fast conversion, which skips gamma/primary correction. This will take
  4236. significantly less CPU, but will be mathematically incorrect. To get output
  4237. compatible with that produced by the colormatrix filter, use fast=1.
  4238. @item dither
  4239. Specify dithering mode.
  4240. The accepted values are:
  4241. @table @samp
  4242. @item none
  4243. No dithering
  4244. @item fsb
  4245. Floyd-Steinberg dithering
  4246. @end table
  4247. @item wpadapt
  4248. Whitepoint adaptation mode.
  4249. The accepted values are:
  4250. @table @samp
  4251. @item bradford
  4252. Bradford whitepoint adaptation
  4253. @item vonkries
  4254. von Kries whitepoint adaptation
  4255. @item identity
  4256. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  4257. @end table
  4258. @item iall
  4259. Override all input properties at once. Same accepted values as @ref{all}.
  4260. @item ispace
  4261. Override input colorspace. Same accepted values as @ref{space}.
  4262. @item iprimaries
  4263. Override input color primaries. Same accepted values as @ref{primaries}.
  4264. @item itrc
  4265. Override input transfer characteristics. Same accepted values as @ref{trc}.
  4266. @item irange
  4267. Override input color range. Same accepted values as @ref{range}.
  4268. @end table
  4269. The filter converts the transfer characteristics, color space and color
  4270. primaries to the specified user values. The output value, if not specified,
  4271. is set to a default value based on the "all" property. If that property is
  4272. also not specified, the filter will log an error. The output color range and
  4273. format default to the same value as the input color range and format. The
  4274. input transfer characteristics, color space, color primaries and color range
  4275. should be set on the input data. If any of these are missing, the filter will
  4276. log an error and no conversion will take place.
  4277. For example to convert the input to SMPTE-240M, use the command:
  4278. @example
  4279. colorspace=smpte240m
  4280. @end example
  4281. @section convolution
  4282. Apply convolution 3x3 or 5x5 filter.
  4283. The filter accepts the following options:
  4284. @table @option
  4285. @item 0m
  4286. @item 1m
  4287. @item 2m
  4288. @item 3m
  4289. Set matrix for each plane.
  4290. Matrix is sequence of 9 or 25 signed integers.
  4291. @item 0rdiv
  4292. @item 1rdiv
  4293. @item 2rdiv
  4294. @item 3rdiv
  4295. Set multiplier for calculated value for each plane.
  4296. @item 0bias
  4297. @item 1bias
  4298. @item 2bias
  4299. @item 3bias
  4300. Set bias for each plane. This value is added to the result of the multiplication.
  4301. Useful for making the overall image brighter or darker. Default is 0.0.
  4302. @end table
  4303. @subsection Examples
  4304. @itemize
  4305. @item
  4306. Apply sharpen:
  4307. @example
  4308. 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"
  4309. @end example
  4310. @item
  4311. Apply blur:
  4312. @example
  4313. 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"
  4314. @end example
  4315. @item
  4316. Apply edge enhance:
  4317. @example
  4318. 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"
  4319. @end example
  4320. @item
  4321. Apply edge detect:
  4322. @example
  4323. 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"
  4324. @end example
  4325. @item
  4326. Apply emboss:
  4327. @example
  4328. 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"
  4329. @end example
  4330. @end itemize
  4331. @section copy
  4332. Copy the input source unchanged to the output. This is mainly useful for
  4333. testing purposes.
  4334. @anchor{coreimage}
  4335. @section coreimage
  4336. Video filtering on GPU using Apple's CoreImage API on OSX.
  4337. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  4338. processed by video hardware. However, software-based OpenGL implementations
  4339. exist which means there is no guarantee for hardware processing. It depends on
  4340. the respective OSX.
  4341. There are many filters and image generators provided by Apple that come with a
  4342. large variety of options. The filter has to be referenced by its name along
  4343. with its options.
  4344. The coreimage filter accepts the following options:
  4345. @table @option
  4346. @item list_filters
  4347. List all available filters and generators along with all their respective
  4348. options as well as possible minimum and maximum values along with the default
  4349. values.
  4350. @example
  4351. list_filters=true
  4352. @end example
  4353. @item filter
  4354. Specify all filters by their respective name and options.
  4355. Use @var{list_filters} to determine all valid filter names and options.
  4356. Numerical options are specified by a float value and are automatically clamped
  4357. to their respective value range. Vector and color options have to be specified
  4358. by a list of space separated float values. Character escaping has to be done.
  4359. A special option name @code{default} is available to use default options for a
  4360. filter.
  4361. It is required to specify either @code{default} or at least one of the filter options.
  4362. All omitted options are used with their default values.
  4363. The syntax of the filter string is as follows:
  4364. @example
  4365. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  4366. @end example
  4367. @item output_rect
  4368. Specify a rectangle where the output of the filter chain is copied into the
  4369. input image. It is given by a list of space separated float values:
  4370. @example
  4371. output_rect=x\ y\ width\ height
  4372. @end example
  4373. If not given, the output rectangle equals the dimensions of the input image.
  4374. The output rectangle is automatically cropped at the borders of the input
  4375. image. Negative values are valid for each component.
  4376. @example
  4377. output_rect=25\ 25\ 100\ 100
  4378. @end example
  4379. @end table
  4380. Several filters can be chained for successive processing without GPU-HOST
  4381. transfers allowing for fast processing of complex filter chains.
  4382. Currently, only filters with zero (generators) or exactly one (filters) input
  4383. image and one output image are supported. Also, transition filters are not yet
  4384. usable as intended.
  4385. Some filters generate output images with additional padding depending on the
  4386. respective filter kernel. The padding is automatically removed to ensure the
  4387. filter output has the same size as the input image.
  4388. For image generators, the size of the output image is determined by the
  4389. previous output image of the filter chain or the input image of the whole
  4390. filterchain, respectively. The generators do not use the pixel information of
  4391. this image to generate their output. However, the generated output is
  4392. blended onto this image, resulting in partial or complete coverage of the
  4393. output image.
  4394. The @ref{coreimagesrc} video source can be used for generating input images
  4395. which are directly fed into the filter chain. By using it, providing input
  4396. images by another video source or an input video is not required.
  4397. @subsection Examples
  4398. @itemize
  4399. @item
  4400. List all filters available:
  4401. @example
  4402. coreimage=list_filters=true
  4403. @end example
  4404. @item
  4405. Use the CIBoxBlur filter with default options to blur an image:
  4406. @example
  4407. coreimage=filter=CIBoxBlur@@default
  4408. @end example
  4409. @item
  4410. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  4411. its center at 100x100 and a radius of 50 pixels:
  4412. @example
  4413. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  4414. @end example
  4415. @item
  4416. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  4417. given as complete and escaped command-line for Apple's standard bash shell:
  4418. @example
  4419. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  4420. @end example
  4421. @end itemize
  4422. @section crop
  4423. Crop the input video to given dimensions.
  4424. It accepts the following parameters:
  4425. @table @option
  4426. @item w, out_w
  4427. The width of the output video. It defaults to @code{iw}.
  4428. This expression is evaluated only once during the filter
  4429. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  4430. @item h, out_h
  4431. The height of the output video. It defaults to @code{ih}.
  4432. This expression is evaluated only once during the filter
  4433. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  4434. @item x
  4435. The horizontal position, in the input video, of the left edge of the output
  4436. video. It defaults to @code{(in_w-out_w)/2}.
  4437. This expression is evaluated per-frame.
  4438. @item y
  4439. The vertical position, in the input video, of the top edge of the output video.
  4440. It defaults to @code{(in_h-out_h)/2}.
  4441. This expression is evaluated per-frame.
  4442. @item keep_aspect
  4443. If set to 1 will force the output display aspect ratio
  4444. to be the same of the input, by changing the output sample aspect
  4445. ratio. It defaults to 0.
  4446. @item exact
  4447. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  4448. width/height/x/y as specified and will not be rounded to nearest smaller value.
  4449. It defaults to 0.
  4450. @end table
  4451. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  4452. expressions containing the following constants:
  4453. @table @option
  4454. @item x
  4455. @item y
  4456. The computed values for @var{x} and @var{y}. They are evaluated for
  4457. each new frame.
  4458. @item in_w
  4459. @item in_h
  4460. The input width and height.
  4461. @item iw
  4462. @item ih
  4463. These are the same as @var{in_w} and @var{in_h}.
  4464. @item out_w
  4465. @item out_h
  4466. The output (cropped) width and height.
  4467. @item ow
  4468. @item oh
  4469. These are the same as @var{out_w} and @var{out_h}.
  4470. @item a
  4471. same as @var{iw} / @var{ih}
  4472. @item sar
  4473. input sample aspect ratio
  4474. @item dar
  4475. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  4476. @item hsub
  4477. @item vsub
  4478. horizontal and vertical chroma subsample values. For example for the
  4479. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4480. @item n
  4481. The number of the input frame, starting from 0.
  4482. @item pos
  4483. the position in the file of the input frame, NAN if unknown
  4484. @item t
  4485. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  4486. @end table
  4487. The expression for @var{out_w} may depend on the value of @var{out_h},
  4488. and the expression for @var{out_h} may depend on @var{out_w}, but they
  4489. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  4490. evaluated after @var{out_w} and @var{out_h}.
  4491. The @var{x} and @var{y} parameters specify the expressions for the
  4492. position of the top-left corner of the output (non-cropped) area. They
  4493. are evaluated for each frame. If the evaluated value is not valid, it
  4494. is approximated to the nearest valid value.
  4495. The expression for @var{x} may depend on @var{y}, and the expression
  4496. for @var{y} may depend on @var{x}.
  4497. @subsection Examples
  4498. @itemize
  4499. @item
  4500. Crop area with size 100x100 at position (12,34).
  4501. @example
  4502. crop=100:100:12:34
  4503. @end example
  4504. Using named options, the example above becomes:
  4505. @example
  4506. crop=w=100:h=100:x=12:y=34
  4507. @end example
  4508. @item
  4509. Crop the central input area with size 100x100:
  4510. @example
  4511. crop=100:100
  4512. @end example
  4513. @item
  4514. Crop the central input area with size 2/3 of the input video:
  4515. @example
  4516. crop=2/3*in_w:2/3*in_h
  4517. @end example
  4518. @item
  4519. Crop the input video central square:
  4520. @example
  4521. crop=out_w=in_h
  4522. crop=in_h
  4523. @end example
  4524. @item
  4525. Delimit the rectangle with the top-left corner placed at position
  4526. 100:100 and the right-bottom corner corresponding to the right-bottom
  4527. corner of the input image.
  4528. @example
  4529. crop=in_w-100:in_h-100:100:100
  4530. @end example
  4531. @item
  4532. Crop 10 pixels from the left and right borders, and 20 pixels from
  4533. the top and bottom borders
  4534. @example
  4535. crop=in_w-2*10:in_h-2*20
  4536. @end example
  4537. @item
  4538. Keep only the bottom right quarter of the input image:
  4539. @example
  4540. crop=in_w/2:in_h/2:in_w/2:in_h/2
  4541. @end example
  4542. @item
  4543. Crop height for getting Greek harmony:
  4544. @example
  4545. crop=in_w:1/PHI*in_w
  4546. @end example
  4547. @item
  4548. Apply trembling effect:
  4549. @example
  4550. 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)
  4551. @end example
  4552. @item
  4553. Apply erratic camera effect depending on timestamp:
  4554. @example
  4555. 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)"
  4556. @end example
  4557. @item
  4558. Set x depending on the value of y:
  4559. @example
  4560. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  4561. @end example
  4562. @end itemize
  4563. @subsection Commands
  4564. This filter supports the following commands:
  4565. @table @option
  4566. @item w, out_w
  4567. @item h, out_h
  4568. @item x
  4569. @item y
  4570. Set width/height of the output video and the horizontal/vertical position
  4571. in the input video.
  4572. The command accepts the same syntax of the corresponding option.
  4573. If the specified expression is not valid, it is kept at its current
  4574. value.
  4575. @end table
  4576. @section cropdetect
  4577. Auto-detect the crop size.
  4578. It calculates the necessary cropping parameters and prints the
  4579. recommended parameters via the logging system. The detected dimensions
  4580. correspond to the non-black area of the input video.
  4581. It accepts the following parameters:
  4582. @table @option
  4583. @item limit
  4584. Set higher black value threshold, which can be optionally specified
  4585. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  4586. value greater to the set value is considered non-black. It defaults to 24.
  4587. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  4588. on the bitdepth of the pixel format.
  4589. @item round
  4590. The value which the width/height should be divisible by. It defaults to
  4591. 16. The offset is automatically adjusted to center the video. Use 2 to
  4592. get only even dimensions (needed for 4:2:2 video). 16 is best when
  4593. encoding to most video codecs.
  4594. @item reset_count, reset
  4595. Set the counter that determines after how many frames cropdetect will
  4596. reset the previously detected largest video area and start over to
  4597. detect the current optimal crop area. Default value is 0.
  4598. This can be useful when channel logos distort the video area. 0
  4599. indicates 'never reset', and returns the largest area encountered during
  4600. playback.
  4601. @end table
  4602. @anchor{curves}
  4603. @section curves
  4604. Apply color adjustments using curves.
  4605. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  4606. component (red, green and blue) has its values defined by @var{N} key points
  4607. tied from each other using a smooth curve. The x-axis represents the pixel
  4608. values from the input frame, and the y-axis the new pixel values to be set for
  4609. the output frame.
  4610. By default, a component curve is defined by the two points @var{(0;0)} and
  4611. @var{(1;1)}. This creates a straight line where each original pixel value is
  4612. "adjusted" to its own value, which means no change to the image.
  4613. The filter allows you to redefine these two points and add some more. A new
  4614. curve (using a natural cubic spline interpolation) will be define to pass
  4615. smoothly through all these new coordinates. The new defined points needs to be
  4616. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  4617. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  4618. the vector spaces, the values will be clipped accordingly.
  4619. The filter accepts the following options:
  4620. @table @option
  4621. @item preset
  4622. Select one of the available color presets. This option can be used in addition
  4623. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  4624. options takes priority on the preset values.
  4625. Available presets are:
  4626. @table @samp
  4627. @item none
  4628. @item color_negative
  4629. @item cross_process
  4630. @item darker
  4631. @item increase_contrast
  4632. @item lighter
  4633. @item linear_contrast
  4634. @item medium_contrast
  4635. @item negative
  4636. @item strong_contrast
  4637. @item vintage
  4638. @end table
  4639. Default is @code{none}.
  4640. @item master, m
  4641. Set the master key points. These points will define a second pass mapping. It
  4642. is sometimes called a "luminance" or "value" mapping. It can be used with
  4643. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  4644. post-processing LUT.
  4645. @item red, r
  4646. Set the key points for the red component.
  4647. @item green, g
  4648. Set the key points for the green component.
  4649. @item blue, b
  4650. Set the key points for the blue component.
  4651. @item all
  4652. Set the key points for all components (not including master).
  4653. Can be used in addition to the other key points component
  4654. options. In this case, the unset component(s) will fallback on this
  4655. @option{all} setting.
  4656. @item psfile
  4657. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  4658. @item plot
  4659. Save Gnuplot script of the curves in specified file.
  4660. @end table
  4661. To avoid some filtergraph syntax conflicts, each key points list need to be
  4662. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  4663. @subsection Examples
  4664. @itemize
  4665. @item
  4666. Increase slightly the middle level of blue:
  4667. @example
  4668. curves=blue='0/0 0.5/0.58 1/1'
  4669. @end example
  4670. @item
  4671. Vintage effect:
  4672. @example
  4673. 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'
  4674. @end example
  4675. Here we obtain the following coordinates for each components:
  4676. @table @var
  4677. @item red
  4678. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  4679. @item green
  4680. @code{(0;0) (0.50;0.48) (1;1)}
  4681. @item blue
  4682. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  4683. @end table
  4684. @item
  4685. The previous example can also be achieved with the associated built-in preset:
  4686. @example
  4687. curves=preset=vintage
  4688. @end example
  4689. @item
  4690. Or simply:
  4691. @example
  4692. curves=vintage
  4693. @end example
  4694. @item
  4695. Use a Photoshop preset and redefine the points of the green component:
  4696. @example
  4697. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  4698. @end example
  4699. @item
  4700. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  4701. and @command{gnuplot}:
  4702. @example
  4703. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  4704. gnuplot -p /tmp/curves.plt
  4705. @end example
  4706. @end itemize
  4707. @section datascope
  4708. Video data analysis filter.
  4709. This filter shows hexadecimal pixel values of part of video.
  4710. The filter accepts the following options:
  4711. @table @option
  4712. @item size, s
  4713. Set output video size.
  4714. @item x
  4715. Set x offset from where to pick pixels.
  4716. @item y
  4717. Set y offset from where to pick pixels.
  4718. @item mode
  4719. Set scope mode, can be one of the following:
  4720. @table @samp
  4721. @item mono
  4722. Draw hexadecimal pixel values with white color on black background.
  4723. @item color
  4724. Draw hexadecimal pixel values with input video pixel color on black
  4725. background.
  4726. @item color2
  4727. Draw hexadecimal pixel values on color background picked from input video,
  4728. the text color is picked in such way so its always visible.
  4729. @end table
  4730. @item axis
  4731. Draw rows and columns numbers on left and top of video.
  4732. @item opacity
  4733. Set background opacity.
  4734. @end table
  4735. @section dctdnoiz
  4736. Denoise frames using 2D DCT (frequency domain filtering).
  4737. This filter is not designed for real time.
  4738. The filter accepts the following options:
  4739. @table @option
  4740. @item sigma, s
  4741. Set the noise sigma constant.
  4742. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  4743. coefficient (absolute value) below this threshold with be dropped.
  4744. If you need a more advanced filtering, see @option{expr}.
  4745. Default is @code{0}.
  4746. @item overlap
  4747. Set number overlapping pixels for each block. Since the filter can be slow, you
  4748. may want to reduce this value, at the cost of a less effective filter and the
  4749. risk of various artefacts.
  4750. If the overlapping value doesn't permit processing the whole input width or
  4751. height, a warning will be displayed and according borders won't be denoised.
  4752. Default value is @var{blocksize}-1, which is the best possible setting.
  4753. @item expr, e
  4754. Set the coefficient factor expression.
  4755. For each coefficient of a DCT block, this expression will be evaluated as a
  4756. multiplier value for the coefficient.
  4757. If this is option is set, the @option{sigma} option will be ignored.
  4758. The absolute value of the coefficient can be accessed through the @var{c}
  4759. variable.
  4760. @item n
  4761. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  4762. @var{blocksize}, which is the width and height of the processed blocks.
  4763. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  4764. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  4765. on the speed processing. Also, a larger block size does not necessarily means a
  4766. better de-noising.
  4767. @end table
  4768. @subsection Examples
  4769. Apply a denoise with a @option{sigma} of @code{4.5}:
  4770. @example
  4771. dctdnoiz=4.5
  4772. @end example
  4773. The same operation can be achieved using the expression system:
  4774. @example
  4775. dctdnoiz=e='gte(c, 4.5*3)'
  4776. @end example
  4777. Violent denoise using a block size of @code{16x16}:
  4778. @example
  4779. dctdnoiz=15:n=4
  4780. @end example
  4781. @section deband
  4782. Remove banding artifacts from input video.
  4783. It works by replacing banded pixels with average value of referenced pixels.
  4784. The filter accepts the following options:
  4785. @table @option
  4786. @item 1thr
  4787. @item 2thr
  4788. @item 3thr
  4789. @item 4thr
  4790. Set banding detection threshold for each plane. Default is 0.02.
  4791. Valid range is 0.00003 to 0.5.
  4792. If difference between current pixel and reference pixel is less than threshold,
  4793. it will be considered as banded.
  4794. @item range, r
  4795. Banding detection range in pixels. Default is 16. If positive, random number
  4796. in range 0 to set value will be used. If negative, exact absolute value
  4797. will be used.
  4798. The range defines square of four pixels around current pixel.
  4799. @item direction, d
  4800. Set direction in radians from which four pixel will be compared. If positive,
  4801. random direction from 0 to set direction will be picked. If negative, exact of
  4802. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  4803. will pick only pixels on same row and -PI/2 will pick only pixels on same
  4804. column.
  4805. @item blur
  4806. If enabled, current pixel is compared with average value of all four
  4807. surrounding pixels. The default is enabled. If disabled current pixel is
  4808. compared with all four surrounding pixels. The pixel is considered banded
  4809. if only all four differences with surrounding pixels are less than threshold.
  4810. @end table
  4811. @anchor{decimate}
  4812. @section decimate
  4813. Drop duplicated frames at regular intervals.
  4814. The filter accepts the following options:
  4815. @table @option
  4816. @item cycle
  4817. Set the number of frames from which one will be dropped. Setting this to
  4818. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  4819. Default is @code{5}.
  4820. @item dupthresh
  4821. Set the threshold for duplicate detection. If the difference metric for a frame
  4822. is less than or equal to this value, then it is declared as duplicate. Default
  4823. is @code{1.1}
  4824. @item scthresh
  4825. Set scene change threshold. Default is @code{15}.
  4826. @item blockx
  4827. @item blocky
  4828. Set the size of the x and y-axis blocks used during metric calculations.
  4829. Larger blocks give better noise suppression, but also give worse detection of
  4830. small movements. Must be a power of two. Default is @code{32}.
  4831. @item ppsrc
  4832. Mark main input as a pre-processed input and activate clean source input
  4833. stream. This allows the input to be pre-processed with various filters to help
  4834. the metrics calculation while keeping the frame selection lossless. When set to
  4835. @code{1}, the first stream is for the pre-processed input, and the second
  4836. stream is the clean source from where the kept frames are chosen. Default is
  4837. @code{0}.
  4838. @item chroma
  4839. Set whether or not chroma is considered in the metric calculations. Default is
  4840. @code{1}.
  4841. @end table
  4842. @section deflate
  4843. Apply deflate effect to the video.
  4844. This filter replaces the pixel by the local(3x3) average by taking into account
  4845. only values lower than the pixel.
  4846. It accepts the following options:
  4847. @table @option
  4848. @item threshold0
  4849. @item threshold1
  4850. @item threshold2
  4851. @item threshold3
  4852. Limit the maximum change for each plane, default is 65535.
  4853. If 0, plane will remain unchanged.
  4854. @end table
  4855. @section dejudder
  4856. Remove judder produced by partially interlaced telecined content.
  4857. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  4858. source was partially telecined content then the output of @code{pullup,dejudder}
  4859. will have a variable frame rate. May change the recorded frame rate of the
  4860. container. Aside from that change, this filter will not affect constant frame
  4861. rate video.
  4862. The option available in this filter is:
  4863. @table @option
  4864. @item cycle
  4865. Specify the length of the window over which the judder repeats.
  4866. Accepts any integer greater than 1. Useful values are:
  4867. @table @samp
  4868. @item 4
  4869. If the original was telecined from 24 to 30 fps (Film to NTSC).
  4870. @item 5
  4871. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  4872. @item 20
  4873. If a mixture of the two.
  4874. @end table
  4875. The default is @samp{4}.
  4876. @end table
  4877. @section delogo
  4878. Suppress a TV station logo by a simple interpolation of the surrounding
  4879. pixels. Just set a rectangle covering the logo and watch it disappear
  4880. (and sometimes something even uglier appear - your mileage may vary).
  4881. It accepts the following parameters:
  4882. @table @option
  4883. @item x
  4884. @item y
  4885. Specify the top left corner coordinates of the logo. They must be
  4886. specified.
  4887. @item w
  4888. @item h
  4889. Specify the width and height of the logo to clear. They must be
  4890. specified.
  4891. @item band, t
  4892. Specify the thickness of the fuzzy edge of the rectangle (added to
  4893. @var{w} and @var{h}). The default value is 1. This option is
  4894. deprecated, setting higher values should no longer be necessary and
  4895. is not recommended.
  4896. @item show
  4897. When set to 1, a green rectangle is drawn on the screen to simplify
  4898. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  4899. The default value is 0.
  4900. The rectangle is drawn on the outermost pixels which will be (partly)
  4901. replaced with interpolated values. The values of the next pixels
  4902. immediately outside this rectangle in each direction will be used to
  4903. compute the interpolated pixel values inside the rectangle.
  4904. @end table
  4905. @subsection Examples
  4906. @itemize
  4907. @item
  4908. Set a rectangle covering the area with top left corner coordinates 0,0
  4909. and size 100x77, and a band of size 10:
  4910. @example
  4911. delogo=x=0:y=0:w=100:h=77:band=10
  4912. @end example
  4913. @end itemize
  4914. @section deshake
  4915. Attempt to fix small changes in horizontal and/or vertical shift. This
  4916. filter helps remove camera shake from hand-holding a camera, bumping a
  4917. tripod, moving on a vehicle, etc.
  4918. The filter accepts the following options:
  4919. @table @option
  4920. @item x
  4921. @item y
  4922. @item w
  4923. @item h
  4924. Specify a rectangular area where to limit the search for motion
  4925. vectors.
  4926. If desired the search for motion vectors can be limited to a
  4927. rectangular area of the frame defined by its top left corner, width
  4928. and height. These parameters have the same meaning as the drawbox
  4929. filter which can be used to visualise the position of the bounding
  4930. box.
  4931. This is useful when simultaneous movement of subjects within the frame
  4932. might be confused for camera motion by the motion vector search.
  4933. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  4934. then the full frame is used. This allows later options to be set
  4935. without specifying the bounding box for the motion vector search.
  4936. Default - search the whole frame.
  4937. @item rx
  4938. @item ry
  4939. Specify the maximum extent of movement in x and y directions in the
  4940. range 0-64 pixels. Default 16.
  4941. @item edge
  4942. Specify how to generate pixels to fill blanks at the edge of the
  4943. frame. Available values are:
  4944. @table @samp
  4945. @item blank, 0
  4946. Fill zeroes at blank locations
  4947. @item original, 1
  4948. Original image at blank locations
  4949. @item clamp, 2
  4950. Extruded edge value at blank locations
  4951. @item mirror, 3
  4952. Mirrored edge at blank locations
  4953. @end table
  4954. Default value is @samp{mirror}.
  4955. @item blocksize
  4956. Specify the blocksize to use for motion search. Range 4-128 pixels,
  4957. default 8.
  4958. @item contrast
  4959. Specify the contrast threshold for blocks. Only blocks with more than
  4960. the specified contrast (difference between darkest and lightest
  4961. pixels) will be considered. Range 1-255, default 125.
  4962. @item search
  4963. Specify the search strategy. Available values are:
  4964. @table @samp
  4965. @item exhaustive, 0
  4966. Set exhaustive search
  4967. @item less, 1
  4968. Set less exhaustive search.
  4969. @end table
  4970. Default value is @samp{exhaustive}.
  4971. @item filename
  4972. If set then a detailed log of the motion search is written to the
  4973. specified file.
  4974. @item opencl
  4975. If set to 1, specify using OpenCL capabilities, only available if
  4976. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  4977. @end table
  4978. @section detelecine
  4979. Apply an exact inverse of the telecine operation. It requires a predefined
  4980. pattern specified using the pattern option which must be the same as that passed
  4981. to the telecine filter.
  4982. This filter accepts the following options:
  4983. @table @option
  4984. @item first_field
  4985. @table @samp
  4986. @item top, t
  4987. top field first
  4988. @item bottom, b
  4989. bottom field first
  4990. The default value is @code{top}.
  4991. @end table
  4992. @item pattern
  4993. A string of numbers representing the pulldown pattern you wish to apply.
  4994. The default value is @code{23}.
  4995. @item start_frame
  4996. A number representing position of the first frame with respect to the telecine
  4997. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  4998. @end table
  4999. @section dilation
  5000. Apply dilation effect to the video.
  5001. This filter replaces the pixel by the local(3x3) maximum.
  5002. It accepts the following options:
  5003. @table @option
  5004. @item threshold0
  5005. @item threshold1
  5006. @item threshold2
  5007. @item threshold3
  5008. Limit the maximum change for each plane, default is 65535.
  5009. If 0, plane will remain unchanged.
  5010. @item coordinates
  5011. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5012. pixels are used.
  5013. Flags to local 3x3 coordinates maps like this:
  5014. 1 2 3
  5015. 4 5
  5016. 6 7 8
  5017. @end table
  5018. @section displace
  5019. Displace pixels as indicated by second and third input stream.
  5020. It takes three input streams and outputs one stream, the first input is the
  5021. source, and second and third input are displacement maps.
  5022. The second input specifies how much to displace pixels along the
  5023. x-axis, while the third input specifies how much to displace pixels
  5024. along the y-axis.
  5025. If one of displacement map streams terminates, last frame from that
  5026. displacement map will be used.
  5027. Note that once generated, displacements maps can be reused over and over again.
  5028. A description of the accepted options follows.
  5029. @table @option
  5030. @item edge
  5031. Set displace behavior for pixels that are out of range.
  5032. Available values are:
  5033. @table @samp
  5034. @item blank
  5035. Missing pixels are replaced by black pixels.
  5036. @item smear
  5037. Adjacent pixels will spread out to replace missing pixels.
  5038. @item wrap
  5039. Out of range pixels are wrapped so they point to pixels of other side.
  5040. @end table
  5041. Default is @samp{smear}.
  5042. @end table
  5043. @subsection Examples
  5044. @itemize
  5045. @item
  5046. Add ripple effect to rgb input of video size hd720:
  5047. @example
  5048. 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
  5049. @end example
  5050. @item
  5051. Add wave effect to rgb input of video size hd720:
  5052. @example
  5053. 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
  5054. @end example
  5055. @end itemize
  5056. @section drawbox
  5057. Draw a colored box on the input image.
  5058. It accepts the following parameters:
  5059. @table @option
  5060. @item x
  5061. @item y
  5062. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  5063. @item width, w
  5064. @item height, h
  5065. The expressions which specify the width and height of the box; if 0 they are interpreted as
  5066. the input width and height. It defaults to 0.
  5067. @item color, c
  5068. Specify the color of the box to write. For the general syntax of this option,
  5069. check the "Color" section in the ffmpeg-utils manual. If the special
  5070. value @code{invert} is used, the box edge color is the same as the
  5071. video with inverted luma.
  5072. @item thickness, t
  5073. The expression which sets the thickness of the box edge. Default value is @code{3}.
  5074. See below for the list of accepted constants.
  5075. @end table
  5076. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5077. following constants:
  5078. @table @option
  5079. @item dar
  5080. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5081. @item hsub
  5082. @item vsub
  5083. horizontal and vertical chroma subsample values. For example for the
  5084. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5085. @item in_h, ih
  5086. @item in_w, iw
  5087. The input width and height.
  5088. @item sar
  5089. The input sample aspect ratio.
  5090. @item x
  5091. @item y
  5092. The x and y offset coordinates where the box is drawn.
  5093. @item w
  5094. @item h
  5095. The width and height of the drawn box.
  5096. @item t
  5097. The thickness of the drawn box.
  5098. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5099. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5100. @end table
  5101. @subsection Examples
  5102. @itemize
  5103. @item
  5104. Draw a black box around the edge of the input image:
  5105. @example
  5106. drawbox
  5107. @end example
  5108. @item
  5109. Draw a box with color red and an opacity of 50%:
  5110. @example
  5111. drawbox=10:20:200:60:red@@0.5
  5112. @end example
  5113. The previous example can be specified as:
  5114. @example
  5115. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  5116. @end example
  5117. @item
  5118. Fill the box with pink color:
  5119. @example
  5120. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
  5121. @end example
  5122. @item
  5123. Draw a 2-pixel red 2.40:1 mask:
  5124. @example
  5125. 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
  5126. @end example
  5127. @end itemize
  5128. @section drawgrid
  5129. Draw a grid on the input image.
  5130. It accepts the following parameters:
  5131. @table @option
  5132. @item x
  5133. @item y
  5134. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  5135. @item width, w
  5136. @item height, h
  5137. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  5138. input width and height, respectively, minus @code{thickness}, so image gets
  5139. framed. Default to 0.
  5140. @item color, c
  5141. Specify the color of the grid. For the general syntax of this option,
  5142. check the "Color" section in the ffmpeg-utils manual. If the special
  5143. value @code{invert} is used, the grid color is the same as the
  5144. video with inverted luma.
  5145. @item thickness, t
  5146. The expression which sets the thickness of the grid line. Default value is @code{1}.
  5147. See below for the list of accepted constants.
  5148. @end table
  5149. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5150. following constants:
  5151. @table @option
  5152. @item dar
  5153. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5154. @item hsub
  5155. @item vsub
  5156. horizontal and vertical chroma subsample values. For example for the
  5157. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5158. @item in_h, ih
  5159. @item in_w, iw
  5160. The input grid cell width and height.
  5161. @item sar
  5162. The input sample aspect ratio.
  5163. @item x
  5164. @item y
  5165. The x and y coordinates of some point of grid intersection (meant to configure offset).
  5166. @item w
  5167. @item h
  5168. The width and height of the drawn cell.
  5169. @item t
  5170. The thickness of the drawn cell.
  5171. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5172. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5173. @end table
  5174. @subsection Examples
  5175. @itemize
  5176. @item
  5177. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  5178. @example
  5179. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  5180. @end example
  5181. @item
  5182. Draw a white 3x3 grid with an opacity of 50%:
  5183. @example
  5184. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  5185. @end example
  5186. @end itemize
  5187. @anchor{drawtext}
  5188. @section drawtext
  5189. Draw a text string or text from a specified file on top of a video, using the
  5190. libfreetype library.
  5191. To enable compilation of this filter, you need to configure FFmpeg with
  5192. @code{--enable-libfreetype}.
  5193. To enable default font fallback and the @var{font} option you need to
  5194. configure FFmpeg with @code{--enable-libfontconfig}.
  5195. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  5196. @code{--enable-libfribidi}.
  5197. @subsection Syntax
  5198. It accepts the following parameters:
  5199. @table @option
  5200. @item box
  5201. Used to draw a box around text using the background color.
  5202. The value must be either 1 (enable) or 0 (disable).
  5203. The default value of @var{box} is 0.
  5204. @item boxborderw
  5205. Set the width of the border to be drawn around the box using @var{boxcolor}.
  5206. The default value of @var{boxborderw} is 0.
  5207. @item boxcolor
  5208. The color to be used for drawing box around text. For the syntax of this
  5209. option, check the "Color" section in the ffmpeg-utils manual.
  5210. The default value of @var{boxcolor} is "white".
  5211. @item borderw
  5212. Set the width of the border to be drawn around the text using @var{bordercolor}.
  5213. The default value of @var{borderw} is 0.
  5214. @item bordercolor
  5215. Set the color to be used for drawing border around text. For the syntax of this
  5216. option, check the "Color" section in the ffmpeg-utils manual.
  5217. The default value of @var{bordercolor} is "black".
  5218. @item expansion
  5219. Select how the @var{text} is expanded. Can be either @code{none},
  5220. @code{strftime} (deprecated) or
  5221. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  5222. below for details.
  5223. @item fix_bounds
  5224. If true, check and fix text coords to avoid clipping.
  5225. @item fontcolor
  5226. The color to be used for drawing fonts. For the syntax of this option, check
  5227. the "Color" section in the ffmpeg-utils manual.
  5228. The default value of @var{fontcolor} is "black".
  5229. @item fontcolor_expr
  5230. String which is expanded the same way as @var{text} to obtain dynamic
  5231. @var{fontcolor} value. By default this option has empty value and is not
  5232. processed. When this option is set, it overrides @var{fontcolor} option.
  5233. @item font
  5234. The font family to be used for drawing text. By default Sans.
  5235. @item fontfile
  5236. The font file to be used for drawing text. The path must be included.
  5237. This parameter is mandatory if the fontconfig support is disabled.
  5238. @item draw
  5239. This option does not exist, please see the timeline system
  5240. @item alpha
  5241. Draw the text applying alpha blending. The value can
  5242. be a number between 0.0 and 1.0.
  5243. The expression accepts the same variables @var{x, y} as well.
  5244. The default value is 1.
  5245. Please see @var{fontcolor_expr}.
  5246. @item fontsize
  5247. The font size to be used for drawing text.
  5248. The default value of @var{fontsize} is 16.
  5249. @item text_shaping
  5250. If set to 1, attempt to shape the text (for example, reverse the order of
  5251. right-to-left text and join Arabic characters) before drawing it.
  5252. Otherwise, just draw the text exactly as given.
  5253. By default 1 (if supported).
  5254. @item ft_load_flags
  5255. The flags to be used for loading the fonts.
  5256. The flags map the corresponding flags supported by libfreetype, and are
  5257. a combination of the following values:
  5258. @table @var
  5259. @item default
  5260. @item no_scale
  5261. @item no_hinting
  5262. @item render
  5263. @item no_bitmap
  5264. @item vertical_layout
  5265. @item force_autohint
  5266. @item crop_bitmap
  5267. @item pedantic
  5268. @item ignore_global_advance_width
  5269. @item no_recurse
  5270. @item ignore_transform
  5271. @item monochrome
  5272. @item linear_design
  5273. @item no_autohint
  5274. @end table
  5275. Default value is "default".
  5276. For more information consult the documentation for the FT_LOAD_*
  5277. libfreetype flags.
  5278. @item shadowcolor
  5279. The color to be used for drawing a shadow behind the drawn text. For the
  5280. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  5281. The default value of @var{shadowcolor} is "black".
  5282. @item shadowx
  5283. @item shadowy
  5284. The x and y offsets for the text shadow position with respect to the
  5285. position of the text. They can be either positive or negative
  5286. values. The default value for both is "0".
  5287. @item start_number
  5288. The starting frame number for the n/frame_num variable. The default value
  5289. is "0".
  5290. @item tabsize
  5291. The size in number of spaces to use for rendering the tab.
  5292. Default value is 4.
  5293. @item timecode
  5294. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  5295. format. It can be used with or without text parameter. @var{timecode_rate}
  5296. option must be specified.
  5297. @item timecode_rate, rate, r
  5298. Set the timecode frame rate (timecode only).
  5299. @item text
  5300. The text string to be drawn. The text must be a sequence of UTF-8
  5301. encoded characters.
  5302. This parameter is mandatory if no file is specified with the parameter
  5303. @var{textfile}.
  5304. @item textfile
  5305. A text file containing text to be drawn. The text must be a sequence
  5306. of UTF-8 encoded characters.
  5307. This parameter is mandatory if no text string is specified with the
  5308. parameter @var{text}.
  5309. If both @var{text} and @var{textfile} are specified, an error is thrown.
  5310. @item reload
  5311. If set to 1, the @var{textfile} will be reloaded before each frame.
  5312. Be sure to update it atomically, or it may be read partially, or even fail.
  5313. @item x
  5314. @item y
  5315. The expressions which specify the offsets where text will be drawn
  5316. within the video frame. They are relative to the top/left border of the
  5317. output image.
  5318. The default value of @var{x} and @var{y} is "0".
  5319. See below for the list of accepted constants and functions.
  5320. @end table
  5321. The parameters for @var{x} and @var{y} are expressions containing the
  5322. following constants and functions:
  5323. @table @option
  5324. @item dar
  5325. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  5326. @item hsub
  5327. @item vsub
  5328. horizontal and vertical chroma subsample values. For example for the
  5329. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5330. @item line_h, lh
  5331. the height of each text line
  5332. @item main_h, h, H
  5333. the input height
  5334. @item main_w, w, W
  5335. the input width
  5336. @item max_glyph_a, ascent
  5337. the maximum distance from the baseline to the highest/upper grid
  5338. coordinate used to place a glyph outline point, for all the rendered
  5339. glyphs.
  5340. It is a positive value, due to the grid's orientation with the Y axis
  5341. upwards.
  5342. @item max_glyph_d, descent
  5343. the maximum distance from the baseline to the lowest grid coordinate
  5344. used to place a glyph outline point, for all the rendered glyphs.
  5345. This is a negative value, due to the grid's orientation, with the Y axis
  5346. upwards.
  5347. @item max_glyph_h
  5348. maximum glyph height, that is the maximum height for all the glyphs
  5349. contained in the rendered text, it is equivalent to @var{ascent} -
  5350. @var{descent}.
  5351. @item max_glyph_w
  5352. maximum glyph width, that is the maximum width for all the glyphs
  5353. contained in the rendered text
  5354. @item n
  5355. the number of input frame, starting from 0
  5356. @item rand(min, max)
  5357. return a random number included between @var{min} and @var{max}
  5358. @item sar
  5359. The input sample aspect ratio.
  5360. @item t
  5361. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5362. @item text_h, th
  5363. the height of the rendered text
  5364. @item text_w, tw
  5365. the width of the rendered text
  5366. @item x
  5367. @item y
  5368. the x and y offset coordinates where the text is drawn.
  5369. These parameters allow the @var{x} and @var{y} expressions to refer
  5370. each other, so you can for example specify @code{y=x/dar}.
  5371. @end table
  5372. @anchor{drawtext_expansion}
  5373. @subsection Text expansion
  5374. If @option{expansion} is set to @code{strftime},
  5375. the filter recognizes strftime() sequences in the provided text and
  5376. expands them accordingly. Check the documentation of strftime(). This
  5377. feature is deprecated.
  5378. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  5379. If @option{expansion} is set to @code{normal} (which is the default),
  5380. the following expansion mechanism is used.
  5381. The backslash character @samp{\}, followed by any character, always expands to
  5382. the second character.
  5383. Sequences of the form @code{%@{...@}} are expanded. The text between the
  5384. braces is a function name, possibly followed by arguments separated by ':'.
  5385. If the arguments contain special characters or delimiters (':' or '@}'),
  5386. they should be escaped.
  5387. Note that they probably must also be escaped as the value for the
  5388. @option{text} option in the filter argument string and as the filter
  5389. argument in the filtergraph description, and possibly also for the shell,
  5390. that makes up to four levels of escaping; using a text file avoids these
  5391. problems.
  5392. The following functions are available:
  5393. @table @command
  5394. @item expr, e
  5395. The expression evaluation result.
  5396. It must take one argument specifying the expression to be evaluated,
  5397. which accepts the same constants and functions as the @var{x} and
  5398. @var{y} values. Note that not all constants should be used, for
  5399. example the text size is not known when evaluating the expression, so
  5400. the constants @var{text_w} and @var{text_h} will have an undefined
  5401. value.
  5402. @item expr_int_format, eif
  5403. Evaluate the expression's value and output as formatted integer.
  5404. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  5405. The second argument specifies the output format. Allowed values are @samp{x},
  5406. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  5407. @code{printf} function.
  5408. The third parameter is optional and sets the number of positions taken by the output.
  5409. It can be used to add padding with zeros from the left.
  5410. @item gmtime
  5411. The time at which the filter is running, expressed in UTC.
  5412. It can accept an argument: a strftime() format string.
  5413. @item localtime
  5414. The time at which the filter is running, expressed in the local time zone.
  5415. It can accept an argument: a strftime() format string.
  5416. @item metadata
  5417. Frame metadata. Takes one or two arguments.
  5418. The first argument is mandatory and specifies the metadata key.
  5419. The second argument is optional and specifies a default value, used when the
  5420. metadata key is not found or empty.
  5421. @item n, frame_num
  5422. The frame number, starting from 0.
  5423. @item pict_type
  5424. A 1 character description of the current picture type.
  5425. @item pts
  5426. The timestamp of the current frame.
  5427. It can take up to three arguments.
  5428. The first argument is the format of the timestamp; it defaults to @code{flt}
  5429. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  5430. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  5431. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  5432. @code{localtime} stands for the timestamp of the frame formatted as
  5433. local time zone time.
  5434. The second argument is an offset added to the timestamp.
  5435. If the format is set to @code{localtime} or @code{gmtime},
  5436. a third argument may be supplied: a strftime() format string.
  5437. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  5438. @end table
  5439. @subsection Examples
  5440. @itemize
  5441. @item
  5442. Draw "Test Text" with font FreeSerif, using the default values for the
  5443. optional parameters.
  5444. @example
  5445. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  5446. @end example
  5447. @item
  5448. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  5449. and y=50 (counting from the top-left corner of the screen), text is
  5450. yellow with a red box around it. Both the text and the box have an
  5451. opacity of 20%.
  5452. @example
  5453. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  5454. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  5455. @end example
  5456. Note that the double quotes are not necessary if spaces are not used
  5457. within the parameter list.
  5458. @item
  5459. Show the text at the center of the video frame:
  5460. @example
  5461. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  5462. @end example
  5463. @item
  5464. Show the text at a random position, switching to a new position every 30 seconds:
  5465. @example
  5466. 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)"
  5467. @end example
  5468. @item
  5469. Show a text line sliding from right to left in the last row of the video
  5470. frame. The file @file{LONG_LINE} is assumed to contain a single line
  5471. with no newlines.
  5472. @example
  5473. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  5474. @end example
  5475. @item
  5476. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  5477. @example
  5478. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  5479. @end example
  5480. @item
  5481. Draw a single green letter "g", at the center of the input video.
  5482. The glyph baseline is placed at half screen height.
  5483. @example
  5484. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  5485. @end example
  5486. @item
  5487. Show text for 1 second every 3 seconds:
  5488. @example
  5489. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  5490. @end example
  5491. @item
  5492. Use fontconfig to set the font. Note that the colons need to be escaped.
  5493. @example
  5494. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  5495. @end example
  5496. @item
  5497. Print the date of a real-time encoding (see strftime(3)):
  5498. @example
  5499. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  5500. @end example
  5501. @item
  5502. Show text fading in and out (appearing/disappearing):
  5503. @example
  5504. #!/bin/sh
  5505. DS=1.0 # display start
  5506. DE=10.0 # display end
  5507. FID=1.5 # fade in duration
  5508. FOD=5 # fade out duration
  5509. 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 @}"
  5510. @end example
  5511. @end itemize
  5512. For more information about libfreetype, check:
  5513. @url{http://www.freetype.org/}.
  5514. For more information about fontconfig, check:
  5515. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  5516. For more information about libfribidi, check:
  5517. @url{http://fribidi.org/}.
  5518. @section edgedetect
  5519. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  5520. The filter accepts the following options:
  5521. @table @option
  5522. @item low
  5523. @item high
  5524. Set low and high threshold values used by the Canny thresholding
  5525. algorithm.
  5526. The high threshold selects the "strong" edge pixels, which are then
  5527. connected through 8-connectivity with the "weak" edge pixels selected
  5528. by the low threshold.
  5529. @var{low} and @var{high} threshold values must be chosen in the range
  5530. [0,1], and @var{low} should be lesser or equal to @var{high}.
  5531. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  5532. is @code{50/255}.
  5533. @item mode
  5534. Define the drawing mode.
  5535. @table @samp
  5536. @item wires
  5537. Draw white/gray wires on black background.
  5538. @item colormix
  5539. Mix the colors to create a paint/cartoon effect.
  5540. @end table
  5541. Default value is @var{wires}.
  5542. @end table
  5543. @subsection Examples
  5544. @itemize
  5545. @item
  5546. Standard edge detection with custom values for the hysteresis thresholding:
  5547. @example
  5548. edgedetect=low=0.1:high=0.4
  5549. @end example
  5550. @item
  5551. Painting effect without thresholding:
  5552. @example
  5553. edgedetect=mode=colormix:high=0
  5554. @end example
  5555. @end itemize
  5556. @section eq
  5557. Set brightness, contrast, saturation and approximate gamma adjustment.
  5558. The filter accepts the following options:
  5559. @table @option
  5560. @item contrast
  5561. Set the contrast expression. The value must be a float value in range
  5562. @code{-2.0} to @code{2.0}. The default value is "1".
  5563. @item brightness
  5564. Set the brightness expression. The value must be a float value in
  5565. range @code{-1.0} to @code{1.0}. The default value is "0".
  5566. @item saturation
  5567. Set the saturation expression. The value must be a float in
  5568. range @code{0.0} to @code{3.0}. The default value is "1".
  5569. @item gamma
  5570. Set the gamma expression. The value must be a float in range
  5571. @code{0.1} to @code{10.0}. The default value is "1".
  5572. @item gamma_r
  5573. Set the gamma expression for red. The value must be a float in
  5574. range @code{0.1} to @code{10.0}. The default value is "1".
  5575. @item gamma_g
  5576. Set the gamma expression for green. The value must be a float in range
  5577. @code{0.1} to @code{10.0}. The default value is "1".
  5578. @item gamma_b
  5579. Set the gamma expression for blue. The value must be a float in range
  5580. @code{0.1} to @code{10.0}. The default value is "1".
  5581. @item gamma_weight
  5582. Set the gamma weight expression. It can be used to reduce the effect
  5583. of a high gamma value on bright image areas, e.g. keep them from
  5584. getting overamplified and just plain white. The value must be a float
  5585. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  5586. gamma correction all the way down while @code{1.0} leaves it at its
  5587. full strength. Default is "1".
  5588. @item eval
  5589. Set when the expressions for brightness, contrast, saturation and
  5590. gamma expressions are evaluated.
  5591. It accepts the following values:
  5592. @table @samp
  5593. @item init
  5594. only evaluate expressions once during the filter initialization or
  5595. when a command is processed
  5596. @item frame
  5597. evaluate expressions for each incoming frame
  5598. @end table
  5599. Default value is @samp{init}.
  5600. @end table
  5601. The expressions accept the following parameters:
  5602. @table @option
  5603. @item n
  5604. frame count of the input frame starting from 0
  5605. @item pos
  5606. byte position of the corresponding packet in the input file, NAN if
  5607. unspecified
  5608. @item r
  5609. frame rate of the input video, NAN if the input frame rate is unknown
  5610. @item t
  5611. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5612. @end table
  5613. @subsection Commands
  5614. The filter supports the following commands:
  5615. @table @option
  5616. @item contrast
  5617. Set the contrast expression.
  5618. @item brightness
  5619. Set the brightness expression.
  5620. @item saturation
  5621. Set the saturation expression.
  5622. @item gamma
  5623. Set the gamma expression.
  5624. @item gamma_r
  5625. Set the gamma_r expression.
  5626. @item gamma_g
  5627. Set gamma_g expression.
  5628. @item gamma_b
  5629. Set gamma_b expression.
  5630. @item gamma_weight
  5631. Set gamma_weight expression.
  5632. The command accepts the same syntax of the corresponding option.
  5633. If the specified expression is not valid, it is kept at its current
  5634. value.
  5635. @end table
  5636. @section erosion
  5637. Apply erosion effect to the video.
  5638. This filter replaces the pixel by the local(3x3) minimum.
  5639. It accepts the following options:
  5640. @table @option
  5641. @item threshold0
  5642. @item threshold1
  5643. @item threshold2
  5644. @item threshold3
  5645. Limit the maximum change for each plane, default is 65535.
  5646. If 0, plane will remain unchanged.
  5647. @item coordinates
  5648. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5649. pixels are used.
  5650. Flags to local 3x3 coordinates maps like this:
  5651. 1 2 3
  5652. 4 5
  5653. 6 7 8
  5654. @end table
  5655. @section extractplanes
  5656. Extract color channel components from input video stream into
  5657. separate grayscale video streams.
  5658. The filter accepts the following option:
  5659. @table @option
  5660. @item planes
  5661. Set plane(s) to extract.
  5662. Available values for planes are:
  5663. @table @samp
  5664. @item y
  5665. @item u
  5666. @item v
  5667. @item a
  5668. @item r
  5669. @item g
  5670. @item b
  5671. @end table
  5672. Choosing planes not available in the input will result in an error.
  5673. That means you cannot select @code{r}, @code{g}, @code{b} planes
  5674. with @code{y}, @code{u}, @code{v} planes at same time.
  5675. @end table
  5676. @subsection Examples
  5677. @itemize
  5678. @item
  5679. Extract luma, u and v color channel component from input video frame
  5680. into 3 grayscale outputs:
  5681. @example
  5682. 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
  5683. @end example
  5684. @end itemize
  5685. @section elbg
  5686. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  5687. For each input image, the filter will compute the optimal mapping from
  5688. the input to the output given the codebook length, that is the number
  5689. of distinct output colors.
  5690. This filter accepts the following options.
  5691. @table @option
  5692. @item codebook_length, l
  5693. Set codebook length. The value must be a positive integer, and
  5694. represents the number of distinct output colors. Default value is 256.
  5695. @item nb_steps, n
  5696. Set the maximum number of iterations to apply for computing the optimal
  5697. mapping. The higher the value the better the result and the higher the
  5698. computation time. Default value is 1.
  5699. @item seed, s
  5700. Set a random seed, must be an integer included between 0 and
  5701. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  5702. will try to use a good random seed on a best effort basis.
  5703. @item pal8
  5704. Set pal8 output pixel format. This option does not work with codebook
  5705. length greater than 256.
  5706. @end table
  5707. @section fade
  5708. Apply a fade-in/out effect to the input video.
  5709. It accepts the following parameters:
  5710. @table @option
  5711. @item type, t
  5712. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  5713. effect.
  5714. Default is @code{in}.
  5715. @item start_frame, s
  5716. Specify the number of the frame to start applying the fade
  5717. effect at. Default is 0.
  5718. @item nb_frames, n
  5719. The number of frames that the fade effect lasts. At the end of the
  5720. fade-in effect, the output video will have the same intensity as the input video.
  5721. At the end of the fade-out transition, the output video will be filled with the
  5722. selected @option{color}.
  5723. Default is 25.
  5724. @item alpha
  5725. If set to 1, fade only alpha channel, if one exists on the input.
  5726. Default value is 0.
  5727. @item start_time, st
  5728. Specify the timestamp (in seconds) of the frame to start to apply the fade
  5729. effect. If both start_frame and start_time are specified, the fade will start at
  5730. whichever comes last. Default is 0.
  5731. @item duration, d
  5732. The number of seconds for which the fade effect has to last. At the end of the
  5733. fade-in effect the output video will have the same intensity as the input video,
  5734. at the end of the fade-out transition the output video will be filled with the
  5735. selected @option{color}.
  5736. If both duration and nb_frames are specified, duration is used. Default is 0
  5737. (nb_frames is used by default).
  5738. @item color, c
  5739. Specify the color of the fade. Default is "black".
  5740. @end table
  5741. @subsection Examples
  5742. @itemize
  5743. @item
  5744. Fade in the first 30 frames of video:
  5745. @example
  5746. fade=in:0:30
  5747. @end example
  5748. The command above is equivalent to:
  5749. @example
  5750. fade=t=in:s=0:n=30
  5751. @end example
  5752. @item
  5753. Fade out the last 45 frames of a 200-frame video:
  5754. @example
  5755. fade=out:155:45
  5756. fade=type=out:start_frame=155:nb_frames=45
  5757. @end example
  5758. @item
  5759. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  5760. @example
  5761. fade=in:0:25, fade=out:975:25
  5762. @end example
  5763. @item
  5764. Make the first 5 frames yellow, then fade in from frame 5-24:
  5765. @example
  5766. fade=in:5:20:color=yellow
  5767. @end example
  5768. @item
  5769. Fade in alpha over first 25 frames of video:
  5770. @example
  5771. fade=in:0:25:alpha=1
  5772. @end example
  5773. @item
  5774. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  5775. @example
  5776. fade=t=in:st=5.5:d=0.5
  5777. @end example
  5778. @end itemize
  5779. @section fftfilt
  5780. Apply arbitrary expressions to samples in frequency domain
  5781. @table @option
  5782. @item dc_Y
  5783. Adjust the dc value (gain) of the luma plane of the image. The filter
  5784. accepts an integer value in range @code{0} to @code{1000}. The default
  5785. value is set to @code{0}.
  5786. @item dc_U
  5787. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  5788. filter accepts an integer value in range @code{0} to @code{1000}. The
  5789. default value is set to @code{0}.
  5790. @item dc_V
  5791. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  5792. filter accepts an integer value in range @code{0} to @code{1000}. The
  5793. default value is set to @code{0}.
  5794. @item weight_Y
  5795. Set the frequency domain weight expression for the luma plane.
  5796. @item weight_U
  5797. Set the frequency domain weight expression for the 1st chroma plane.
  5798. @item weight_V
  5799. Set the frequency domain weight expression for the 2nd chroma plane.
  5800. The filter accepts the following variables:
  5801. @item X
  5802. @item Y
  5803. The coordinates of the current sample.
  5804. @item W
  5805. @item H
  5806. The width and height of the image.
  5807. @end table
  5808. @subsection Examples
  5809. @itemize
  5810. @item
  5811. High-pass:
  5812. @example
  5813. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  5814. @end example
  5815. @item
  5816. Low-pass:
  5817. @example
  5818. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  5819. @end example
  5820. @item
  5821. Sharpen:
  5822. @example
  5823. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  5824. @end example
  5825. @item
  5826. Blur:
  5827. @example
  5828. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  5829. @end example
  5830. @end itemize
  5831. @section field
  5832. Extract a single field from an interlaced image using stride
  5833. arithmetic to avoid wasting CPU time. The output frames are marked as
  5834. non-interlaced.
  5835. The filter accepts the following options:
  5836. @table @option
  5837. @item type
  5838. Specify whether to extract the top (if the value is @code{0} or
  5839. @code{top}) or the bottom field (if the value is @code{1} or
  5840. @code{bottom}).
  5841. @end table
  5842. @section fieldhint
  5843. Create new frames by copying the top and bottom fields from surrounding frames
  5844. supplied as numbers by the hint file.
  5845. @table @option
  5846. @item hint
  5847. Set file containing hints: absolute/relative frame numbers.
  5848. There must be one line for each frame in a clip. Each line must contain two
  5849. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  5850. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  5851. is current frame number for @code{absolute} mode or out of [-1, 1] range
  5852. for @code{relative} mode. First number tells from which frame to pick up top
  5853. field and second number tells from which frame to pick up bottom field.
  5854. If optionally followed by @code{+} output frame will be marked as interlaced,
  5855. else if followed by @code{-} output frame will be marked as progressive, else
  5856. it will be marked same as input frame.
  5857. If line starts with @code{#} or @code{;} that line is skipped.
  5858. @item mode
  5859. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  5860. @end table
  5861. Example of first several lines of @code{hint} file for @code{relative} mode:
  5862. @example
  5863. 0,0 - # first frame
  5864. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  5865. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  5866. 1,0 -
  5867. 0,0 -
  5868. 0,0 -
  5869. 1,0 -
  5870. 1,0 -
  5871. 1,0 -
  5872. 0,0 -
  5873. 0,0 -
  5874. 1,0 -
  5875. 1,0 -
  5876. 1,0 -
  5877. 0,0 -
  5878. @end example
  5879. @section fieldmatch
  5880. Field matching filter for inverse telecine. It is meant to reconstruct the
  5881. progressive frames from a telecined stream. The filter does not drop duplicated
  5882. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  5883. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  5884. The separation of the field matching and the decimation is notably motivated by
  5885. the possibility of inserting a de-interlacing filter fallback between the two.
  5886. If the source has mixed telecined and real interlaced content,
  5887. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  5888. But these remaining combed frames will be marked as interlaced, and thus can be
  5889. de-interlaced by a later filter such as @ref{yadif} before decimation.
  5890. In addition to the various configuration options, @code{fieldmatch} can take an
  5891. optional second stream, activated through the @option{ppsrc} option. If
  5892. enabled, the frames reconstruction will be based on the fields and frames from
  5893. this second stream. This allows the first input to be pre-processed in order to
  5894. help the various algorithms of the filter, while keeping the output lossless
  5895. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  5896. or brightness/contrast adjustments can help.
  5897. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  5898. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  5899. which @code{fieldmatch} is based on. While the semantic and usage are very
  5900. close, some behaviour and options names can differ.
  5901. The @ref{decimate} filter currently only works for constant frame rate input.
  5902. If your input has mixed telecined (30fps) and progressive content with a lower
  5903. framerate like 24fps use the following filterchain to produce the necessary cfr
  5904. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  5905. The filter accepts the following options:
  5906. @table @option
  5907. @item order
  5908. Specify the assumed field order of the input stream. Available values are:
  5909. @table @samp
  5910. @item auto
  5911. Auto detect parity (use FFmpeg's internal parity value).
  5912. @item bff
  5913. Assume bottom field first.
  5914. @item tff
  5915. Assume top field first.
  5916. @end table
  5917. Note that it is sometimes recommended not to trust the parity announced by the
  5918. stream.
  5919. Default value is @var{auto}.
  5920. @item mode
  5921. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  5922. sense that it won't risk creating jerkiness due to duplicate frames when
  5923. possible, but if there are bad edits or blended fields it will end up
  5924. outputting combed frames when a good match might actually exist. On the other
  5925. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  5926. but will almost always find a good frame if there is one. The other values are
  5927. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  5928. jerkiness and creating duplicate frames versus finding good matches in sections
  5929. with bad edits, orphaned fields, blended fields, etc.
  5930. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  5931. Available values are:
  5932. @table @samp
  5933. @item pc
  5934. 2-way matching (p/c)
  5935. @item pc_n
  5936. 2-way matching, and trying 3rd match if still combed (p/c + n)
  5937. @item pc_u
  5938. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  5939. @item pc_n_ub
  5940. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  5941. still combed (p/c + n + u/b)
  5942. @item pcn
  5943. 3-way matching (p/c/n)
  5944. @item pcn_ub
  5945. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  5946. detected as combed (p/c/n + u/b)
  5947. @end table
  5948. The parenthesis at the end indicate the matches that would be used for that
  5949. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  5950. @var{top}).
  5951. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  5952. the slowest.
  5953. Default value is @var{pc_n}.
  5954. @item ppsrc
  5955. Mark the main input stream as a pre-processed input, and enable the secondary
  5956. input stream as the clean source to pick the fields from. See the filter
  5957. introduction for more details. It is similar to the @option{clip2} feature from
  5958. VFM/TFM.
  5959. Default value is @code{0} (disabled).
  5960. @item field
  5961. Set the field to match from. It is recommended to set this to the same value as
  5962. @option{order} unless you experience matching failures with that setting. In
  5963. certain circumstances changing the field that is used to match from can have a
  5964. large impact on matching performance. Available values are:
  5965. @table @samp
  5966. @item auto
  5967. Automatic (same value as @option{order}).
  5968. @item bottom
  5969. Match from the bottom field.
  5970. @item top
  5971. Match from the top field.
  5972. @end table
  5973. Default value is @var{auto}.
  5974. @item mchroma
  5975. Set whether or not chroma is included during the match comparisons. In most
  5976. cases it is recommended to leave this enabled. You should set this to @code{0}
  5977. only if your clip has bad chroma problems such as heavy rainbowing or other
  5978. artifacts. Setting this to @code{0} could also be used to speed things up at
  5979. the cost of some accuracy.
  5980. Default value is @code{1}.
  5981. @item y0
  5982. @item y1
  5983. These define an exclusion band which excludes the lines between @option{y0} and
  5984. @option{y1} from being included in the field matching decision. An exclusion
  5985. band can be used to ignore subtitles, a logo, or other things that may
  5986. interfere with the matching. @option{y0} sets the starting scan line and
  5987. @option{y1} sets the ending line; all lines in between @option{y0} and
  5988. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  5989. @option{y0} and @option{y1} to the same value will disable the feature.
  5990. @option{y0} and @option{y1} defaults to @code{0}.
  5991. @item scthresh
  5992. Set the scene change detection threshold as a percentage of maximum change on
  5993. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  5994. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  5995. @option{scthresh} is @code{[0.0, 100.0]}.
  5996. Default value is @code{12.0}.
  5997. @item combmatch
  5998. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  5999. account the combed scores of matches when deciding what match to use as the
  6000. final match. Available values are:
  6001. @table @samp
  6002. @item none
  6003. No final matching based on combed scores.
  6004. @item sc
  6005. Combed scores are only used when a scene change is detected.
  6006. @item full
  6007. Use combed scores all the time.
  6008. @end table
  6009. Default is @var{sc}.
  6010. @item combdbg
  6011. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  6012. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  6013. Available values are:
  6014. @table @samp
  6015. @item none
  6016. No forced calculation.
  6017. @item pcn
  6018. Force p/c/n calculations.
  6019. @item pcnub
  6020. Force p/c/n/u/b calculations.
  6021. @end table
  6022. Default value is @var{none}.
  6023. @item cthresh
  6024. This is the area combing threshold used for combed frame detection. This
  6025. essentially controls how "strong" or "visible" combing must be to be detected.
  6026. Larger values mean combing must be more visible and smaller values mean combing
  6027. can be less visible or strong and still be detected. Valid settings are from
  6028. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  6029. be detected as combed). This is basically a pixel difference value. A good
  6030. range is @code{[8, 12]}.
  6031. Default value is @code{9}.
  6032. @item chroma
  6033. Sets whether or not chroma is considered in the combed frame decision. Only
  6034. disable this if your source has chroma problems (rainbowing, etc.) that are
  6035. causing problems for the combed frame detection with chroma enabled. Actually,
  6036. using @option{chroma}=@var{0} is usually more reliable, except for the case
  6037. where there is chroma only combing in the source.
  6038. Default value is @code{0}.
  6039. @item blockx
  6040. @item blocky
  6041. Respectively set the x-axis and y-axis size of the window used during combed
  6042. frame detection. This has to do with the size of the area in which
  6043. @option{combpel} pixels are required to be detected as combed for a frame to be
  6044. declared combed. See the @option{combpel} parameter description for more info.
  6045. Possible values are any number that is a power of 2 starting at 4 and going up
  6046. to 512.
  6047. Default value is @code{16}.
  6048. @item combpel
  6049. The number of combed pixels inside any of the @option{blocky} by
  6050. @option{blockx} size blocks on the frame for the frame to be detected as
  6051. combed. While @option{cthresh} controls how "visible" the combing must be, this
  6052. setting controls "how much" combing there must be in any localized area (a
  6053. window defined by the @option{blockx} and @option{blocky} settings) on the
  6054. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  6055. which point no frames will ever be detected as combed). This setting is known
  6056. as @option{MI} in TFM/VFM vocabulary.
  6057. Default value is @code{80}.
  6058. @end table
  6059. @anchor{p/c/n/u/b meaning}
  6060. @subsection p/c/n/u/b meaning
  6061. @subsubsection p/c/n
  6062. We assume the following telecined stream:
  6063. @example
  6064. Top fields: 1 2 2 3 4
  6065. Bottom fields: 1 2 3 4 4
  6066. @end example
  6067. The numbers correspond to the progressive frame the fields relate to. Here, the
  6068. first two frames are progressive, the 3rd and 4th are combed, and so on.
  6069. When @code{fieldmatch} is configured to run a matching from bottom
  6070. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  6071. @example
  6072. Input stream:
  6073. T 1 2 2 3 4
  6074. B 1 2 3 4 4 <-- matching reference
  6075. Matches: c c n n c
  6076. Output stream:
  6077. T 1 2 3 4 4
  6078. B 1 2 3 4 4
  6079. @end example
  6080. As a result of the field matching, we can see that some frames get duplicated.
  6081. To perform a complete inverse telecine, you need to rely on a decimation filter
  6082. after this operation. See for instance the @ref{decimate} filter.
  6083. The same operation now matching from top fields (@option{field}=@var{top})
  6084. looks like this:
  6085. @example
  6086. Input stream:
  6087. T 1 2 2 3 4 <-- matching reference
  6088. B 1 2 3 4 4
  6089. Matches: c c p p c
  6090. Output stream:
  6091. T 1 2 2 3 4
  6092. B 1 2 2 3 4
  6093. @end example
  6094. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  6095. basically, they refer to the frame and field of the opposite parity:
  6096. @itemize
  6097. @item @var{p} matches the field of the opposite parity in the previous frame
  6098. @item @var{c} matches the field of the opposite parity in the current frame
  6099. @item @var{n} matches the field of the opposite parity in the next frame
  6100. @end itemize
  6101. @subsubsection u/b
  6102. The @var{u} and @var{b} matching are a bit special in the sense that they match
  6103. from the opposite parity flag. In the following examples, we assume that we are
  6104. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  6105. 'x' is placed above and below each matched fields.
  6106. With bottom matching (@option{field}=@var{bottom}):
  6107. @example
  6108. Match: c p n b u
  6109. x x x x x
  6110. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6111. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6112. x x x x x
  6113. Output frames:
  6114. 2 1 2 2 2
  6115. 2 2 2 1 3
  6116. @end example
  6117. With top matching (@option{field}=@var{top}):
  6118. @example
  6119. Match: c p n b u
  6120. x x x x x
  6121. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6122. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6123. x x x x x
  6124. Output frames:
  6125. 2 2 2 1 2
  6126. 2 1 3 2 2
  6127. @end example
  6128. @subsection Examples
  6129. Simple IVTC of a top field first telecined stream:
  6130. @example
  6131. fieldmatch=order=tff:combmatch=none, decimate
  6132. @end example
  6133. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  6134. @example
  6135. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  6136. @end example
  6137. @section fieldorder
  6138. Transform the field order of the input video.
  6139. It accepts the following parameters:
  6140. @table @option
  6141. @item order
  6142. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  6143. for bottom field first.
  6144. @end table
  6145. The default value is @samp{tff}.
  6146. The transformation is done by shifting the picture content up or down
  6147. by one line, and filling the remaining line with appropriate picture content.
  6148. This method is consistent with most broadcast field order converters.
  6149. If the input video is not flagged as being interlaced, or it is already
  6150. flagged as being of the required output field order, then this filter does
  6151. not alter the incoming video.
  6152. It is very useful when converting to or from PAL DV material,
  6153. which is bottom field first.
  6154. For example:
  6155. @example
  6156. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  6157. @end example
  6158. @section fifo, afifo
  6159. Buffer input images and send them when they are requested.
  6160. It is mainly useful when auto-inserted by the libavfilter
  6161. framework.
  6162. It does not take parameters.
  6163. @section find_rect
  6164. Find a rectangular object
  6165. It accepts the following options:
  6166. @table @option
  6167. @item object
  6168. Filepath of the object image, needs to be in gray8.
  6169. @item threshold
  6170. Detection threshold, default is 0.5.
  6171. @item mipmaps
  6172. Number of mipmaps, default is 3.
  6173. @item xmin, ymin, xmax, ymax
  6174. Specifies the rectangle in which to search.
  6175. @end table
  6176. @subsection Examples
  6177. @itemize
  6178. @item
  6179. Generate a representative palette of a given video using @command{ffmpeg}:
  6180. @example
  6181. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6182. @end example
  6183. @end itemize
  6184. @section cover_rect
  6185. Cover a rectangular object
  6186. It accepts the following options:
  6187. @table @option
  6188. @item cover
  6189. Filepath of the optional cover image, needs to be in yuv420.
  6190. @item mode
  6191. Set covering mode.
  6192. It accepts the following values:
  6193. @table @samp
  6194. @item cover
  6195. cover it by the supplied image
  6196. @item blur
  6197. cover it by interpolating the surrounding pixels
  6198. @end table
  6199. Default value is @var{blur}.
  6200. @end table
  6201. @subsection Examples
  6202. @itemize
  6203. @item
  6204. Generate a representative palette of a given video using @command{ffmpeg}:
  6205. @example
  6206. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6207. @end example
  6208. @end itemize
  6209. @anchor{format}
  6210. @section format
  6211. Convert the input video to one of the specified pixel formats.
  6212. Libavfilter will try to pick one that is suitable as input to
  6213. the next filter.
  6214. It accepts the following parameters:
  6215. @table @option
  6216. @item pix_fmts
  6217. A '|'-separated list of pixel format names, such as
  6218. "pix_fmts=yuv420p|monow|rgb24".
  6219. @end table
  6220. @subsection Examples
  6221. @itemize
  6222. @item
  6223. Convert the input video to the @var{yuv420p} format
  6224. @example
  6225. format=pix_fmts=yuv420p
  6226. @end example
  6227. Convert the input video to any of the formats in the list
  6228. @example
  6229. format=pix_fmts=yuv420p|yuv444p|yuv410p
  6230. @end example
  6231. @end itemize
  6232. @anchor{fps}
  6233. @section fps
  6234. Convert the video to specified constant frame rate by duplicating or dropping
  6235. frames as necessary.
  6236. It accepts the following parameters:
  6237. @table @option
  6238. @item fps
  6239. The desired output frame rate. The default is @code{25}.
  6240. @item round
  6241. Rounding method.
  6242. Possible values are:
  6243. @table @option
  6244. @item zero
  6245. zero round towards 0
  6246. @item inf
  6247. round away from 0
  6248. @item down
  6249. round towards -infinity
  6250. @item up
  6251. round towards +infinity
  6252. @item near
  6253. round to nearest
  6254. @end table
  6255. The default is @code{near}.
  6256. @item start_time
  6257. Assume the first PTS should be the given value, in seconds. This allows for
  6258. padding/trimming at the start of stream. By default, no assumption is made
  6259. about the first frame's expected PTS, so no padding or trimming is done.
  6260. For example, this could be set to 0 to pad the beginning with duplicates of
  6261. the first frame if a video stream starts after the audio stream or to trim any
  6262. frames with a negative PTS.
  6263. @end table
  6264. Alternatively, the options can be specified as a flat string:
  6265. @var{fps}[:@var{round}].
  6266. See also the @ref{setpts} filter.
  6267. @subsection Examples
  6268. @itemize
  6269. @item
  6270. A typical usage in order to set the fps to 25:
  6271. @example
  6272. fps=fps=25
  6273. @end example
  6274. @item
  6275. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  6276. @example
  6277. fps=fps=film:round=near
  6278. @end example
  6279. @end itemize
  6280. @section framepack
  6281. Pack two different video streams into a stereoscopic video, setting proper
  6282. metadata on supported codecs. The two views should have the same size and
  6283. framerate and processing will stop when the shorter video ends. Please note
  6284. that you may conveniently adjust view properties with the @ref{scale} and
  6285. @ref{fps} filters.
  6286. It accepts the following parameters:
  6287. @table @option
  6288. @item format
  6289. The desired packing format. Supported values are:
  6290. @table @option
  6291. @item sbs
  6292. The views are next to each other (default).
  6293. @item tab
  6294. The views are on top of each other.
  6295. @item lines
  6296. The views are packed by line.
  6297. @item columns
  6298. The views are packed by column.
  6299. @item frameseq
  6300. The views are temporally interleaved.
  6301. @end table
  6302. @end table
  6303. Some examples:
  6304. @example
  6305. # Convert left and right views into a frame-sequential video
  6306. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  6307. # Convert views into a side-by-side video with the same output resolution as the input
  6308. 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
  6309. @end example
  6310. @section framerate
  6311. Change the frame rate by interpolating new video output frames from the source
  6312. frames.
  6313. This filter is not designed to function correctly with interlaced media. If
  6314. you wish to change the frame rate of interlaced media then you are required
  6315. to deinterlace before this filter and re-interlace after this filter.
  6316. A description of the accepted options follows.
  6317. @table @option
  6318. @item fps
  6319. Specify the output frames per second. This option can also be specified
  6320. as a value alone. The default is @code{50}.
  6321. @item interp_start
  6322. Specify the start of a range where the output frame will be created as a
  6323. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6324. the default is @code{15}.
  6325. @item interp_end
  6326. Specify the end of a range where the output frame will be created as a
  6327. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6328. the default is @code{240}.
  6329. @item scene
  6330. Specify the level at which a scene change is detected as a value between
  6331. 0 and 100 to indicate a new scene; a low value reflects a low
  6332. probability for the current frame to introduce a new scene, while a higher
  6333. value means the current frame is more likely to be one.
  6334. The default is @code{7}.
  6335. @item flags
  6336. Specify flags influencing the filter process.
  6337. Available value for @var{flags} is:
  6338. @table @option
  6339. @item scene_change_detect, scd
  6340. Enable scene change detection using the value of the option @var{scene}.
  6341. This flag is enabled by default.
  6342. @end table
  6343. @end table
  6344. @section framestep
  6345. Select one frame every N-th frame.
  6346. This filter accepts the following option:
  6347. @table @option
  6348. @item step
  6349. Select frame after every @code{step} frames.
  6350. Allowed values are positive integers higher than 0. Default value is @code{1}.
  6351. @end table
  6352. @anchor{frei0r}
  6353. @section frei0r
  6354. Apply a frei0r effect to the input video.
  6355. To enable the compilation of this filter, you need to install the frei0r
  6356. header and configure FFmpeg with @code{--enable-frei0r}.
  6357. It accepts the following parameters:
  6358. @table @option
  6359. @item filter_name
  6360. The name of the frei0r effect to load. If the environment variable
  6361. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  6362. directories specified by the colon-separated list in @env{FREIOR_PATH}.
  6363. Otherwise, the standard frei0r paths are searched, in this order:
  6364. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  6365. @file{/usr/lib/frei0r-1/}.
  6366. @item filter_params
  6367. A '|'-separated list of parameters to pass to the frei0r effect.
  6368. @end table
  6369. A frei0r effect parameter can be a boolean (its value is either
  6370. "y" or "n"), a double, a color (specified as
  6371. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  6372. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  6373. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  6374. @var{X} and @var{Y} are floating point numbers) and/or a string.
  6375. The number and types of parameters depend on the loaded effect. If an
  6376. effect parameter is not specified, the default value is set.
  6377. @subsection Examples
  6378. @itemize
  6379. @item
  6380. Apply the distort0r effect, setting the first two double parameters:
  6381. @example
  6382. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  6383. @end example
  6384. @item
  6385. Apply the colordistance effect, taking a color as the first parameter:
  6386. @example
  6387. frei0r=colordistance:0.2/0.3/0.4
  6388. frei0r=colordistance:violet
  6389. frei0r=colordistance:0x112233
  6390. @end example
  6391. @item
  6392. Apply the perspective effect, specifying the top left and top right image
  6393. positions:
  6394. @example
  6395. frei0r=perspective:0.2/0.2|0.8/0.2
  6396. @end example
  6397. @end itemize
  6398. For more information, see
  6399. @url{http://frei0r.dyne.org}
  6400. @section fspp
  6401. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  6402. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  6403. processing filter, one of them is performed once per block, not per pixel.
  6404. This allows for much higher speed.
  6405. The filter accepts the following options:
  6406. @table @option
  6407. @item quality
  6408. Set quality. This option defines the number of levels for averaging. It accepts
  6409. an integer in the range 4-5. Default value is @code{4}.
  6410. @item qp
  6411. Force a constant quantization parameter. It accepts an integer in range 0-63.
  6412. If not set, the filter will use the QP from the video stream (if available).
  6413. @item strength
  6414. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  6415. more details but also more artifacts, while higher values make the image smoother
  6416. but also blurrier. Default value is @code{0} − PSNR optimal.
  6417. @item use_bframe_qp
  6418. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  6419. option may cause flicker since the B-Frames have often larger QP. Default is
  6420. @code{0} (not enabled).
  6421. @end table
  6422. @section gblur
  6423. Apply Gaussian blur filter.
  6424. The filter accepts the following options:
  6425. @table @option
  6426. @item sigma
  6427. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  6428. @item steps
  6429. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  6430. @item planes
  6431. Set which planes to filter. By default all planes are filtered.
  6432. @item sigmaV
  6433. Set vertical sigma, if negative it will be same as @code{sigma}.
  6434. Default is @code{-1}.
  6435. @end table
  6436. @section geq
  6437. The filter accepts the following options:
  6438. @table @option
  6439. @item lum_expr, lum
  6440. Set the luminance expression.
  6441. @item cb_expr, cb
  6442. Set the chrominance blue expression.
  6443. @item cr_expr, cr
  6444. Set the chrominance red expression.
  6445. @item alpha_expr, a
  6446. Set the alpha expression.
  6447. @item red_expr, r
  6448. Set the red expression.
  6449. @item green_expr, g
  6450. Set the green expression.
  6451. @item blue_expr, b
  6452. Set the blue expression.
  6453. @end table
  6454. The colorspace is selected according to the specified options. If one
  6455. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  6456. options is specified, the filter will automatically select a YCbCr
  6457. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  6458. @option{blue_expr} options is specified, it will select an RGB
  6459. colorspace.
  6460. If one of the chrominance expression is not defined, it falls back on the other
  6461. one. If no alpha expression is specified it will evaluate to opaque value.
  6462. If none of chrominance expressions are specified, they will evaluate
  6463. to the luminance expression.
  6464. The expressions can use the following variables and functions:
  6465. @table @option
  6466. @item N
  6467. The sequential number of the filtered frame, starting from @code{0}.
  6468. @item X
  6469. @item Y
  6470. The coordinates of the current sample.
  6471. @item W
  6472. @item H
  6473. The width and height of the image.
  6474. @item SW
  6475. @item SH
  6476. Width and height scale depending on the currently filtered plane. It is the
  6477. ratio between the corresponding luma plane number of pixels and the current
  6478. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  6479. @code{0.5,0.5} for chroma planes.
  6480. @item T
  6481. Time of the current frame, expressed in seconds.
  6482. @item p(x, y)
  6483. Return the value of the pixel at location (@var{x},@var{y}) of the current
  6484. plane.
  6485. @item lum(x, y)
  6486. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  6487. plane.
  6488. @item cb(x, y)
  6489. Return the value of the pixel at location (@var{x},@var{y}) of the
  6490. blue-difference chroma plane. Return 0 if there is no such plane.
  6491. @item cr(x, y)
  6492. Return the value of the pixel at location (@var{x},@var{y}) of the
  6493. red-difference chroma plane. Return 0 if there is no such plane.
  6494. @item r(x, y)
  6495. @item g(x, y)
  6496. @item b(x, y)
  6497. Return the value of the pixel at location (@var{x},@var{y}) of the
  6498. red/green/blue component. Return 0 if there is no such component.
  6499. @item alpha(x, y)
  6500. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  6501. plane. Return 0 if there is no such plane.
  6502. @end table
  6503. For functions, if @var{x} and @var{y} are outside the area, the value will be
  6504. automatically clipped to the closer edge.
  6505. @subsection Examples
  6506. @itemize
  6507. @item
  6508. Flip the image horizontally:
  6509. @example
  6510. geq=p(W-X\,Y)
  6511. @end example
  6512. @item
  6513. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  6514. wavelength of 100 pixels:
  6515. @example
  6516. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  6517. @end example
  6518. @item
  6519. Generate a fancy enigmatic moving light:
  6520. @example
  6521. 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
  6522. @end example
  6523. @item
  6524. Generate a quick emboss effect:
  6525. @example
  6526. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  6527. @end example
  6528. @item
  6529. Modify RGB components depending on pixel position:
  6530. @example
  6531. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  6532. @end example
  6533. @item
  6534. Create a radial gradient that is the same size as the input (also see
  6535. the @ref{vignette} filter):
  6536. @example
  6537. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  6538. @end example
  6539. @end itemize
  6540. @section gradfun
  6541. Fix the banding artifacts that are sometimes introduced into nearly flat
  6542. regions by truncation to 8-bit color depth.
  6543. Interpolate the gradients that should go where the bands are, and
  6544. dither them.
  6545. It is designed for playback only. Do not use it prior to
  6546. lossy compression, because compression tends to lose the dither and
  6547. bring back the bands.
  6548. It accepts the following parameters:
  6549. @table @option
  6550. @item strength
  6551. The maximum amount by which the filter will change any one pixel. This is also
  6552. the threshold for detecting nearly flat regions. Acceptable values range from
  6553. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  6554. valid range.
  6555. @item radius
  6556. The neighborhood to fit the gradient to. A larger radius makes for smoother
  6557. gradients, but also prevents the filter from modifying the pixels near detailed
  6558. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  6559. values will be clipped to the valid range.
  6560. @end table
  6561. Alternatively, the options can be specified as a flat string:
  6562. @var{strength}[:@var{radius}]
  6563. @subsection Examples
  6564. @itemize
  6565. @item
  6566. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  6567. @example
  6568. gradfun=3.5:8
  6569. @end example
  6570. @item
  6571. Specify radius, omitting the strength (which will fall-back to the default
  6572. value):
  6573. @example
  6574. gradfun=radius=8
  6575. @end example
  6576. @end itemize
  6577. @anchor{haldclut}
  6578. @section haldclut
  6579. Apply a Hald CLUT to a video stream.
  6580. First input is the video stream to process, and second one is the Hald CLUT.
  6581. The Hald CLUT input can be a simple picture or a complete video stream.
  6582. The filter accepts the following options:
  6583. @table @option
  6584. @item shortest
  6585. Force termination when the shortest input terminates. Default is @code{0}.
  6586. @item repeatlast
  6587. Continue applying the last CLUT after the end of the stream. A value of
  6588. @code{0} disable the filter after the last frame of the CLUT is reached.
  6589. Default is @code{1}.
  6590. @end table
  6591. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  6592. filters share the same internals).
  6593. More information about the Hald CLUT can be found on Eskil Steenberg's website
  6594. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  6595. @subsection Workflow examples
  6596. @subsubsection Hald CLUT video stream
  6597. Generate an identity Hald CLUT stream altered with various effects:
  6598. @example
  6599. 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
  6600. @end example
  6601. Note: make sure you use a lossless codec.
  6602. Then use it with @code{haldclut} to apply it on some random stream:
  6603. @example
  6604. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  6605. @end example
  6606. The Hald CLUT will be applied to the 10 first seconds (duration of
  6607. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  6608. to the remaining frames of the @code{mandelbrot} stream.
  6609. @subsubsection Hald CLUT with preview
  6610. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  6611. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  6612. biggest possible square starting at the top left of the picture. The remaining
  6613. padding pixels (bottom or right) will be ignored. This area can be used to add
  6614. a preview of the Hald CLUT.
  6615. Typically, the following generated Hald CLUT will be supported by the
  6616. @code{haldclut} filter:
  6617. @example
  6618. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  6619. pad=iw+320 [padded_clut];
  6620. smptebars=s=320x256, split [a][b];
  6621. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  6622. [main][b] overlay=W-320" -frames:v 1 clut.png
  6623. @end example
  6624. It contains the original and a preview of the effect of the CLUT: SMPTE color
  6625. bars are displayed on the right-top, and below the same color bars processed by
  6626. the color changes.
  6627. Then, the effect of this Hald CLUT can be visualized with:
  6628. @example
  6629. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  6630. @end example
  6631. @section hflip
  6632. Flip the input video horizontally.
  6633. For example, to horizontally flip the input video with @command{ffmpeg}:
  6634. @example
  6635. ffmpeg -i in.avi -vf "hflip" out.avi
  6636. @end example
  6637. @section histeq
  6638. This filter applies a global color histogram equalization on a
  6639. per-frame basis.
  6640. It can be used to correct video that has a compressed range of pixel
  6641. intensities. The filter redistributes the pixel intensities to
  6642. equalize their distribution across the intensity range. It may be
  6643. viewed as an "automatically adjusting contrast filter". This filter is
  6644. useful only for correcting degraded or poorly captured source
  6645. video.
  6646. The filter accepts the following options:
  6647. @table @option
  6648. @item strength
  6649. Determine the amount of equalization to be applied. As the strength
  6650. is reduced, the distribution of pixel intensities more-and-more
  6651. approaches that of the input frame. The value must be a float number
  6652. in the range [0,1] and defaults to 0.200.
  6653. @item intensity
  6654. Set the maximum intensity that can generated and scale the output
  6655. values appropriately. The strength should be set as desired and then
  6656. the intensity can be limited if needed to avoid washing-out. The value
  6657. must be a float number in the range [0,1] and defaults to 0.210.
  6658. @item antibanding
  6659. Set the antibanding level. If enabled the filter will randomly vary
  6660. the luminance of output pixels by a small amount to avoid banding of
  6661. the histogram. Possible values are @code{none}, @code{weak} or
  6662. @code{strong}. It defaults to @code{none}.
  6663. @end table
  6664. @section histogram
  6665. Compute and draw a color distribution histogram for the input video.
  6666. The computed histogram is a representation of the color component
  6667. distribution in an image.
  6668. Standard histogram displays the color components distribution in an image.
  6669. Displays color graph for each color component. Shows distribution of
  6670. the Y, U, V, A or R, G, B components, depending on input format, in the
  6671. current frame. Below each graph a color component scale meter is shown.
  6672. The filter accepts the following options:
  6673. @table @option
  6674. @item level_height
  6675. Set height of level. Default value is @code{200}.
  6676. Allowed range is [50, 2048].
  6677. @item scale_height
  6678. Set height of color scale. Default value is @code{12}.
  6679. Allowed range is [0, 40].
  6680. @item display_mode
  6681. Set display mode.
  6682. It accepts the following values:
  6683. @table @samp
  6684. @item parade
  6685. Per color component graphs are placed below each other.
  6686. @item overlay
  6687. Presents information identical to that in the @code{parade}, except
  6688. that the graphs representing color components are superimposed directly
  6689. over one another.
  6690. @end table
  6691. Default is @code{parade}.
  6692. @item levels_mode
  6693. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  6694. Default is @code{linear}.
  6695. @item components
  6696. Set what color components to display.
  6697. Default is @code{7}.
  6698. @item fgopacity
  6699. Set foreground opacity. Default is @code{0.7}.
  6700. @item bgopacity
  6701. Set background opacity. Default is @code{0.5}.
  6702. @end table
  6703. @subsection Examples
  6704. @itemize
  6705. @item
  6706. Calculate and draw histogram:
  6707. @example
  6708. ffplay -i input -vf histogram
  6709. @end example
  6710. @end itemize
  6711. @anchor{hqdn3d}
  6712. @section hqdn3d
  6713. This is a high precision/quality 3d denoise filter. It aims to reduce
  6714. image noise, producing smooth images and making still images really
  6715. still. It should enhance compressibility.
  6716. It accepts the following optional parameters:
  6717. @table @option
  6718. @item luma_spatial
  6719. A non-negative floating point number which specifies spatial luma strength.
  6720. It defaults to 4.0.
  6721. @item chroma_spatial
  6722. A non-negative floating point number which specifies spatial chroma strength.
  6723. It defaults to 3.0*@var{luma_spatial}/4.0.
  6724. @item luma_tmp
  6725. A floating point number which specifies luma temporal strength. It defaults to
  6726. 6.0*@var{luma_spatial}/4.0.
  6727. @item chroma_tmp
  6728. A floating point number which specifies chroma temporal strength. It defaults to
  6729. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  6730. @end table
  6731. @anchor{hwupload_cuda}
  6732. @section hwupload_cuda
  6733. Upload system memory frames to a CUDA device.
  6734. It accepts the following optional parameters:
  6735. @table @option
  6736. @item device
  6737. The number of the CUDA device to use
  6738. @end table
  6739. @section hqx
  6740. Apply a high-quality magnification filter designed for pixel art. This filter
  6741. was originally created by Maxim Stepin.
  6742. It accepts the following option:
  6743. @table @option
  6744. @item n
  6745. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  6746. @code{hq3x} and @code{4} for @code{hq4x}.
  6747. Default is @code{3}.
  6748. @end table
  6749. @section hstack
  6750. Stack input videos horizontally.
  6751. All streams must be of same pixel format and of same height.
  6752. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  6753. to create same output.
  6754. The filter accept the following option:
  6755. @table @option
  6756. @item inputs
  6757. Set number of input streams. Default is 2.
  6758. @item shortest
  6759. If set to 1, force the output to terminate when the shortest input
  6760. terminates. Default value is 0.
  6761. @end table
  6762. @section hue
  6763. Modify the hue and/or the saturation of the input.
  6764. It accepts the following parameters:
  6765. @table @option
  6766. @item h
  6767. Specify the hue angle as a number of degrees. It accepts an expression,
  6768. and defaults to "0".
  6769. @item s
  6770. Specify the saturation in the [-10,10] range. It accepts an expression and
  6771. defaults to "1".
  6772. @item H
  6773. Specify the hue angle as a number of radians. It accepts an
  6774. expression, and defaults to "0".
  6775. @item b
  6776. Specify the brightness in the [-10,10] range. It accepts an expression and
  6777. defaults to "0".
  6778. @end table
  6779. @option{h} and @option{H} are mutually exclusive, and can't be
  6780. specified at the same time.
  6781. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  6782. expressions containing the following constants:
  6783. @table @option
  6784. @item n
  6785. frame count of the input frame starting from 0
  6786. @item pts
  6787. presentation timestamp of the input frame expressed in time base units
  6788. @item r
  6789. frame rate of the input video, NAN if the input frame rate is unknown
  6790. @item t
  6791. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6792. @item tb
  6793. time base of the input video
  6794. @end table
  6795. @subsection Examples
  6796. @itemize
  6797. @item
  6798. Set the hue to 90 degrees and the saturation to 1.0:
  6799. @example
  6800. hue=h=90:s=1
  6801. @end example
  6802. @item
  6803. Same command but expressing the hue in radians:
  6804. @example
  6805. hue=H=PI/2:s=1
  6806. @end example
  6807. @item
  6808. Rotate hue and make the saturation swing between 0
  6809. and 2 over a period of 1 second:
  6810. @example
  6811. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  6812. @end example
  6813. @item
  6814. Apply a 3 seconds saturation fade-in effect starting at 0:
  6815. @example
  6816. hue="s=min(t/3\,1)"
  6817. @end example
  6818. The general fade-in expression can be written as:
  6819. @example
  6820. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  6821. @end example
  6822. @item
  6823. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  6824. @example
  6825. hue="s=max(0\, min(1\, (8-t)/3))"
  6826. @end example
  6827. The general fade-out expression can be written as:
  6828. @example
  6829. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  6830. @end example
  6831. @end itemize
  6832. @subsection Commands
  6833. This filter supports the following commands:
  6834. @table @option
  6835. @item b
  6836. @item s
  6837. @item h
  6838. @item H
  6839. Modify the hue and/or the saturation and/or brightness of the input video.
  6840. The command accepts the same syntax of the corresponding option.
  6841. If the specified expression is not valid, it is kept at its current
  6842. value.
  6843. @end table
  6844. @section hysteresis
  6845. Grow first stream into second stream by connecting components.
  6846. This makes it possible to build more robust edge masks.
  6847. This filter accepts the following options:
  6848. @table @option
  6849. @item planes
  6850. Set which planes will be processed as bitmap, unprocessed planes will be
  6851. copied from first stream.
  6852. By default value 0xf, all planes will be processed.
  6853. @item threshold
  6854. Set threshold which is used in filtering. If pixel component value is higher than
  6855. this value filter algorithm for connecting components is activated.
  6856. By default value is 0.
  6857. @end table
  6858. @section idet
  6859. Detect video interlacing type.
  6860. This filter tries to detect if the input frames are interlaced, progressive,
  6861. top or bottom field first. It will also try to detect fields that are
  6862. repeated between adjacent frames (a sign of telecine).
  6863. Single frame detection considers only immediately adjacent frames when classifying each frame.
  6864. Multiple frame detection incorporates the classification history of previous frames.
  6865. The filter will log these metadata values:
  6866. @table @option
  6867. @item single.current_frame
  6868. Detected type of current frame using single-frame detection. One of:
  6869. ``tff'' (top field first), ``bff'' (bottom field first),
  6870. ``progressive'', or ``undetermined''
  6871. @item single.tff
  6872. Cumulative number of frames detected as top field first using single-frame detection.
  6873. @item multiple.tff
  6874. Cumulative number of frames detected as top field first using multiple-frame detection.
  6875. @item single.bff
  6876. Cumulative number of frames detected as bottom field first using single-frame detection.
  6877. @item multiple.current_frame
  6878. Detected type of current frame using multiple-frame detection. One of:
  6879. ``tff'' (top field first), ``bff'' (bottom field first),
  6880. ``progressive'', or ``undetermined''
  6881. @item multiple.bff
  6882. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  6883. @item single.progressive
  6884. Cumulative number of frames detected as progressive using single-frame detection.
  6885. @item multiple.progressive
  6886. Cumulative number of frames detected as progressive using multiple-frame detection.
  6887. @item single.undetermined
  6888. Cumulative number of frames that could not be classified using single-frame detection.
  6889. @item multiple.undetermined
  6890. Cumulative number of frames that could not be classified using multiple-frame detection.
  6891. @item repeated.current_frame
  6892. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  6893. @item repeated.neither
  6894. Cumulative number of frames with no repeated field.
  6895. @item repeated.top
  6896. Cumulative number of frames with the top field repeated from the previous frame's top field.
  6897. @item repeated.bottom
  6898. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  6899. @end table
  6900. The filter accepts the following options:
  6901. @table @option
  6902. @item intl_thres
  6903. Set interlacing threshold.
  6904. @item prog_thres
  6905. Set progressive threshold.
  6906. @item rep_thres
  6907. Threshold for repeated field detection.
  6908. @item half_life
  6909. Number of frames after which a given frame's contribution to the
  6910. statistics is halved (i.e., it contributes only 0.5 to its
  6911. classification). The default of 0 means that all frames seen are given
  6912. full weight of 1.0 forever.
  6913. @item analyze_interlaced_flag
  6914. When this is not 0 then idet will use the specified number of frames to determine
  6915. if the interlaced flag is accurate, it will not count undetermined frames.
  6916. If the flag is found to be accurate it will be used without any further
  6917. computations, if it is found to be inaccurate it will be cleared without any
  6918. further computations. This allows inserting the idet filter as a low computational
  6919. method to clean up the interlaced flag
  6920. @end table
  6921. @section il
  6922. Deinterleave or interleave fields.
  6923. This filter allows one to process interlaced images fields without
  6924. deinterlacing them. Deinterleaving splits the input frame into 2
  6925. fields (so called half pictures). Odd lines are moved to the top
  6926. half of the output image, even lines to the bottom half.
  6927. You can process (filter) them independently and then re-interleave them.
  6928. The filter accepts the following options:
  6929. @table @option
  6930. @item luma_mode, l
  6931. @item chroma_mode, c
  6932. @item alpha_mode, a
  6933. Available values for @var{luma_mode}, @var{chroma_mode} and
  6934. @var{alpha_mode} are:
  6935. @table @samp
  6936. @item none
  6937. Do nothing.
  6938. @item deinterleave, d
  6939. Deinterleave fields, placing one above the other.
  6940. @item interleave, i
  6941. Interleave fields. Reverse the effect of deinterleaving.
  6942. @end table
  6943. Default value is @code{none}.
  6944. @item luma_swap, ls
  6945. @item chroma_swap, cs
  6946. @item alpha_swap, as
  6947. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  6948. @end table
  6949. @section inflate
  6950. Apply inflate effect to the video.
  6951. This filter replaces the pixel by the local(3x3) average by taking into account
  6952. only values higher than the pixel.
  6953. It accepts the following options:
  6954. @table @option
  6955. @item threshold0
  6956. @item threshold1
  6957. @item threshold2
  6958. @item threshold3
  6959. Limit the maximum change for each plane, default is 65535.
  6960. If 0, plane will remain unchanged.
  6961. @end table
  6962. @section interlace
  6963. Simple interlacing filter from progressive contents. This interleaves upper (or
  6964. lower) lines from odd frames with lower (or upper) lines from even frames,
  6965. halving the frame rate and preserving image height.
  6966. @example
  6967. Original Original New Frame
  6968. Frame 'j' Frame 'j+1' (tff)
  6969. ========== =========== ==================
  6970. Line 0 --------------------> Frame 'j' Line 0
  6971. Line 1 Line 1 ----> Frame 'j+1' Line 1
  6972. Line 2 ---------------------> Frame 'j' Line 2
  6973. Line 3 Line 3 ----> Frame 'j+1' Line 3
  6974. ... ... ...
  6975. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  6976. @end example
  6977. It accepts the following optional parameters:
  6978. @table @option
  6979. @item scan
  6980. This determines whether the interlaced frame is taken from the even
  6981. (tff - default) or odd (bff) lines of the progressive frame.
  6982. @item lowpass
  6983. Enable (default) or disable the vertical lowpass filter to avoid twitter
  6984. interlacing and reduce moire patterns.
  6985. @end table
  6986. @section kerndeint
  6987. Deinterlace input video by applying Donald Graft's adaptive kernel
  6988. deinterling. Work on interlaced parts of a video to produce
  6989. progressive frames.
  6990. The description of the accepted parameters follows.
  6991. @table @option
  6992. @item thresh
  6993. Set the threshold which affects the filter's tolerance when
  6994. determining if a pixel line must be processed. It must be an integer
  6995. in the range [0,255] and defaults to 10. A value of 0 will result in
  6996. applying the process on every pixels.
  6997. @item map
  6998. Paint pixels exceeding the threshold value to white if set to 1.
  6999. Default is 0.
  7000. @item order
  7001. Set the fields order. Swap fields if set to 1, leave fields alone if
  7002. 0. Default is 0.
  7003. @item sharp
  7004. Enable additional sharpening if set to 1. Default is 0.
  7005. @item twoway
  7006. Enable twoway sharpening if set to 1. Default is 0.
  7007. @end table
  7008. @subsection Examples
  7009. @itemize
  7010. @item
  7011. Apply default values:
  7012. @example
  7013. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  7014. @end example
  7015. @item
  7016. Enable additional sharpening:
  7017. @example
  7018. kerndeint=sharp=1
  7019. @end example
  7020. @item
  7021. Paint processed pixels in white:
  7022. @example
  7023. kerndeint=map=1
  7024. @end example
  7025. @end itemize
  7026. @section lenscorrection
  7027. Correct radial lens distortion
  7028. This filter can be used to correct for radial distortion as can result from the use
  7029. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  7030. one can use tools available for example as part of opencv or simply trial-and-error.
  7031. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  7032. and extract the k1 and k2 coefficients from the resulting matrix.
  7033. Note that effectively the same filter is available in the open-source tools Krita and
  7034. Digikam from the KDE project.
  7035. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  7036. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  7037. brightness distribution, so you may want to use both filters together in certain
  7038. cases, though you will have to take care of ordering, i.e. whether vignetting should
  7039. be applied before or after lens correction.
  7040. @subsection Options
  7041. The filter accepts the following options:
  7042. @table @option
  7043. @item cx
  7044. Relative x-coordinate of the focal point of the image, and thereby the center of the
  7045. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7046. width.
  7047. @item cy
  7048. Relative y-coordinate of the focal point of the image, and thereby the center of the
  7049. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7050. height.
  7051. @item k1
  7052. Coefficient of the quadratic correction term. 0.5 means no correction.
  7053. @item k2
  7054. Coefficient of the double quadratic correction term. 0.5 means no correction.
  7055. @end table
  7056. The formula that generates the correction is:
  7057. @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)
  7058. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  7059. distances from the focal point in the source and target images, respectively.
  7060. @section loop
  7061. Loop video frames.
  7062. The filter accepts the following options:
  7063. @table @option
  7064. @item loop
  7065. Set the number of loops.
  7066. @item size
  7067. Set maximal size in number of frames.
  7068. @item start
  7069. Set first frame of loop.
  7070. @end table
  7071. @anchor{lut3d}
  7072. @section lut3d
  7073. Apply a 3D LUT to an input video.
  7074. The filter accepts the following options:
  7075. @table @option
  7076. @item file
  7077. Set the 3D LUT file name.
  7078. Currently supported formats:
  7079. @table @samp
  7080. @item 3dl
  7081. AfterEffects
  7082. @item cube
  7083. Iridas
  7084. @item dat
  7085. DaVinci
  7086. @item m3d
  7087. Pandora
  7088. @end table
  7089. @item interp
  7090. Select interpolation mode.
  7091. Available values are:
  7092. @table @samp
  7093. @item nearest
  7094. Use values from the nearest defined point.
  7095. @item trilinear
  7096. Interpolate values using the 8 points defining a cube.
  7097. @item tetrahedral
  7098. Interpolate values using a tetrahedron.
  7099. @end table
  7100. @end table
  7101. @section lut, lutrgb, lutyuv
  7102. Compute a look-up table for binding each pixel component input value
  7103. to an output value, and apply it to the input video.
  7104. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  7105. to an RGB input video.
  7106. These filters accept the following parameters:
  7107. @table @option
  7108. @item c0
  7109. set first pixel component expression
  7110. @item c1
  7111. set second pixel component expression
  7112. @item c2
  7113. set third pixel component expression
  7114. @item c3
  7115. set fourth pixel component expression, corresponds to the alpha component
  7116. @item r
  7117. set red component expression
  7118. @item g
  7119. set green component expression
  7120. @item b
  7121. set blue component expression
  7122. @item a
  7123. alpha component expression
  7124. @item y
  7125. set Y/luminance component expression
  7126. @item u
  7127. set U/Cb component expression
  7128. @item v
  7129. set V/Cr component expression
  7130. @end table
  7131. Each of them specifies the expression to use for computing the lookup table for
  7132. the corresponding pixel component values.
  7133. The exact component associated to each of the @var{c*} options depends on the
  7134. format in input.
  7135. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  7136. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  7137. The expressions can contain the following constants and functions:
  7138. @table @option
  7139. @item w
  7140. @item h
  7141. The input width and height.
  7142. @item val
  7143. The input value for the pixel component.
  7144. @item clipval
  7145. The input value, clipped to the @var{minval}-@var{maxval} range.
  7146. @item maxval
  7147. The maximum value for the pixel component.
  7148. @item minval
  7149. The minimum value for the pixel component.
  7150. @item negval
  7151. The negated value for the pixel component value, clipped to the
  7152. @var{minval}-@var{maxval} range; it corresponds to the expression
  7153. "maxval-clipval+minval".
  7154. @item clip(val)
  7155. The computed value in @var{val}, clipped to the
  7156. @var{minval}-@var{maxval} range.
  7157. @item gammaval(gamma)
  7158. The computed gamma correction value of the pixel component value,
  7159. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  7160. expression
  7161. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  7162. @end table
  7163. All expressions default to "val".
  7164. @subsection Examples
  7165. @itemize
  7166. @item
  7167. Negate input video:
  7168. @example
  7169. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  7170. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  7171. @end example
  7172. The above is the same as:
  7173. @example
  7174. lutrgb="r=negval:g=negval:b=negval"
  7175. lutyuv="y=negval:u=negval:v=negval"
  7176. @end example
  7177. @item
  7178. Negate luminance:
  7179. @example
  7180. lutyuv=y=negval
  7181. @end example
  7182. @item
  7183. Remove chroma components, turning the video into a graytone image:
  7184. @example
  7185. lutyuv="u=128:v=128"
  7186. @end example
  7187. @item
  7188. Apply a luma burning effect:
  7189. @example
  7190. lutyuv="y=2*val"
  7191. @end example
  7192. @item
  7193. Remove green and blue components:
  7194. @example
  7195. lutrgb="g=0:b=0"
  7196. @end example
  7197. @item
  7198. Set a constant alpha channel value on input:
  7199. @example
  7200. format=rgba,lutrgb=a="maxval-minval/2"
  7201. @end example
  7202. @item
  7203. Correct luminance gamma by a factor of 0.5:
  7204. @example
  7205. lutyuv=y=gammaval(0.5)
  7206. @end example
  7207. @item
  7208. Discard least significant bits of luma:
  7209. @example
  7210. lutyuv=y='bitand(val, 128+64+32)'
  7211. @end example
  7212. @item
  7213. Technicolor like effect:
  7214. @example
  7215. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  7216. @end example
  7217. @end itemize
  7218. @section lut2
  7219. Compute and apply a lookup table from two video inputs.
  7220. This filter accepts the following parameters:
  7221. @table @option
  7222. @item c0
  7223. set first pixel component expression
  7224. @item c1
  7225. set second pixel component expression
  7226. @item c2
  7227. set third pixel component expression
  7228. @item c3
  7229. set fourth pixel component expression, corresponds to the alpha component
  7230. @end table
  7231. Each of them specifies the expression to use for computing the lookup table for
  7232. the corresponding pixel component values.
  7233. The exact component associated to each of the @var{c*} options depends on the
  7234. format in inputs.
  7235. The expressions can contain the following constants:
  7236. @table @option
  7237. @item w
  7238. @item h
  7239. The input width and height.
  7240. @item x
  7241. The first input value for the pixel component.
  7242. @item y
  7243. The second input value for the pixel component.
  7244. @item bdx
  7245. The first input video bit depth.
  7246. @item bdy
  7247. The second input video bit depth.
  7248. @end table
  7249. All expressions default to "x".
  7250. @subsection Examples
  7251. @itemize
  7252. @item
  7253. Highlight differences between two RGB video streams:
  7254. @example
  7255. 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)'
  7256. @end example
  7257. @item
  7258. Highlight differences between two YUV video streams:
  7259. @example
  7260. 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)'
  7261. @end example
  7262. @end itemize
  7263. @section maskedclamp
  7264. Clamp the first input stream with the second input and third input stream.
  7265. Returns the value of first stream to be between second input
  7266. stream - @code{undershoot} and third input stream + @code{overshoot}.
  7267. This filter accepts the following options:
  7268. @table @option
  7269. @item undershoot
  7270. Default value is @code{0}.
  7271. @item overshoot
  7272. Default value is @code{0}.
  7273. @item planes
  7274. Set which planes will be processed as bitmap, unprocessed planes will be
  7275. copied from first stream.
  7276. By default value 0xf, all planes will be processed.
  7277. @end table
  7278. @section maskedmerge
  7279. Merge the first input stream with the second input stream using per pixel
  7280. weights in the third input stream.
  7281. A value of 0 in the third stream pixel component means that pixel component
  7282. from first stream is returned unchanged, while maximum value (eg. 255 for
  7283. 8-bit videos) means that pixel component from second stream is returned
  7284. unchanged. Intermediate values define the amount of merging between both
  7285. input stream's pixel components.
  7286. This filter accepts the following options:
  7287. @table @option
  7288. @item planes
  7289. Set which planes will be processed as bitmap, unprocessed planes will be
  7290. copied from first stream.
  7291. By default value 0xf, all planes will be processed.
  7292. @end table
  7293. @section mcdeint
  7294. Apply motion-compensation deinterlacing.
  7295. It needs one field per frame as input and must thus be used together
  7296. with yadif=1/3 or equivalent.
  7297. This filter accepts the following options:
  7298. @table @option
  7299. @item mode
  7300. Set the deinterlacing mode.
  7301. It accepts one of the following values:
  7302. @table @samp
  7303. @item fast
  7304. @item medium
  7305. @item slow
  7306. use iterative motion estimation
  7307. @item extra_slow
  7308. like @samp{slow}, but use multiple reference frames.
  7309. @end table
  7310. Default value is @samp{fast}.
  7311. @item parity
  7312. Set the picture field parity assumed for the input video. It must be
  7313. one of the following values:
  7314. @table @samp
  7315. @item 0, tff
  7316. assume top field first
  7317. @item 1, bff
  7318. assume bottom field first
  7319. @end table
  7320. Default value is @samp{bff}.
  7321. @item qp
  7322. Set per-block quantization parameter (QP) used by the internal
  7323. encoder.
  7324. Higher values should result in a smoother motion vector field but less
  7325. optimal individual vectors. Default value is 1.
  7326. @end table
  7327. @section mergeplanes
  7328. Merge color channel components from several video streams.
  7329. The filter accepts up to 4 input streams, and merge selected input
  7330. planes to the output video.
  7331. This filter accepts the following options:
  7332. @table @option
  7333. @item mapping
  7334. Set input to output plane mapping. Default is @code{0}.
  7335. The mappings is specified as a bitmap. It should be specified as a
  7336. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  7337. mapping for the first plane of the output stream. 'A' sets the number of
  7338. the input stream to use (from 0 to 3), and 'a' the plane number of the
  7339. corresponding input to use (from 0 to 3). The rest of the mappings is
  7340. similar, 'Bb' describes the mapping for the output stream second
  7341. plane, 'Cc' describes the mapping for the output stream third plane and
  7342. 'Dd' describes the mapping for the output stream fourth plane.
  7343. @item format
  7344. Set output pixel format. Default is @code{yuva444p}.
  7345. @end table
  7346. @subsection Examples
  7347. @itemize
  7348. @item
  7349. Merge three gray video streams of same width and height into single video stream:
  7350. @example
  7351. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  7352. @end example
  7353. @item
  7354. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  7355. @example
  7356. [a0][a1]mergeplanes=0x00010210:yuva444p
  7357. @end example
  7358. @item
  7359. Swap Y and A plane in yuva444p stream:
  7360. @example
  7361. format=yuva444p,mergeplanes=0x03010200:yuva444p
  7362. @end example
  7363. @item
  7364. Swap U and V plane in yuv420p stream:
  7365. @example
  7366. format=yuv420p,mergeplanes=0x000201:yuv420p
  7367. @end example
  7368. @item
  7369. Cast a rgb24 clip to yuv444p:
  7370. @example
  7371. format=rgb24,mergeplanes=0x000102:yuv444p
  7372. @end example
  7373. @end itemize
  7374. @section mestimate
  7375. Estimate and export motion vectors using block matching algorithms.
  7376. Motion vectors are stored in frame side data to be used by other filters.
  7377. This filter accepts the following options:
  7378. @table @option
  7379. @item method
  7380. Specify the motion estimation method. Accepts one of the following values:
  7381. @table @samp
  7382. @item esa
  7383. Exhaustive search algorithm.
  7384. @item tss
  7385. Three step search algorithm.
  7386. @item tdls
  7387. Two dimensional logarithmic search algorithm.
  7388. @item ntss
  7389. New three step search algorithm.
  7390. @item fss
  7391. Four step search algorithm.
  7392. @item ds
  7393. Diamond search algorithm.
  7394. @item hexbs
  7395. Hexagon-based search algorithm.
  7396. @item epzs
  7397. Enhanced predictive zonal search algorithm.
  7398. @item umh
  7399. Uneven multi-hexagon search algorithm.
  7400. @end table
  7401. Default value is @samp{esa}.
  7402. @item mb_size
  7403. Macroblock size. Default @code{16}.
  7404. @item search_param
  7405. Search parameter. Default @code{7}.
  7406. @end table
  7407. @section minterpolate
  7408. Convert the video to specified frame rate using motion interpolation.
  7409. This filter accepts the following options:
  7410. @table @option
  7411. @item fps
  7412. 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}.
  7413. @item mi_mode
  7414. Motion interpolation mode. Following values are accepted:
  7415. @table @samp
  7416. @item dup
  7417. Duplicate previous or next frame for interpolating new ones.
  7418. @item blend
  7419. Blend source frames. Interpolated frame is mean of previous and next frames.
  7420. @item mci
  7421. Motion compensated interpolation. Following options are effective when this mode is selected:
  7422. @table @samp
  7423. @item mc_mode
  7424. Motion compensation mode. Following values are accepted:
  7425. @table @samp
  7426. @item obmc
  7427. Overlapped block motion compensation.
  7428. @item aobmc
  7429. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  7430. @end table
  7431. Default mode is @samp{obmc}.
  7432. @item me_mode
  7433. Motion estimation mode. Following values are accepted:
  7434. @table @samp
  7435. @item bidir
  7436. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  7437. @item bilat
  7438. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  7439. @end table
  7440. Default mode is @samp{bilat}.
  7441. @item me
  7442. The algorithm to be used for motion estimation. Following values are accepted:
  7443. @table @samp
  7444. @item esa
  7445. Exhaustive search algorithm.
  7446. @item tss
  7447. Three step search algorithm.
  7448. @item tdls
  7449. Two dimensional logarithmic search algorithm.
  7450. @item ntss
  7451. New three step search algorithm.
  7452. @item fss
  7453. Four step search algorithm.
  7454. @item ds
  7455. Diamond search algorithm.
  7456. @item hexbs
  7457. Hexagon-based search algorithm.
  7458. @item epzs
  7459. Enhanced predictive zonal search algorithm.
  7460. @item umh
  7461. Uneven multi-hexagon search algorithm.
  7462. @end table
  7463. Default algorithm is @samp{epzs}.
  7464. @item mb_size
  7465. Macroblock size. Default @code{16}.
  7466. @item search_param
  7467. Motion estimation search parameter. Default @code{32}.
  7468. @item vsmbc
  7469. 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).
  7470. @end table
  7471. @end table
  7472. @item scd
  7473. 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:
  7474. @table @samp
  7475. @item none
  7476. Disable scene change detection.
  7477. @item fdiff
  7478. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  7479. @end table
  7480. Default method is @samp{fdiff}.
  7481. @item scd_threshold
  7482. Scene change detection threshold. Default is @code{5.0}.
  7483. @end table
  7484. @section mpdecimate
  7485. Drop frames that do not differ greatly from the previous frame in
  7486. order to reduce frame rate.
  7487. The main use of this filter is for very-low-bitrate encoding
  7488. (e.g. streaming over dialup modem), but it could in theory be used for
  7489. fixing movies that were inverse-telecined incorrectly.
  7490. A description of the accepted options follows.
  7491. @table @option
  7492. @item max
  7493. Set the maximum number of consecutive frames which can be dropped (if
  7494. positive), or the minimum interval between dropped frames (if
  7495. negative). If the value is 0, the frame is dropped unregarding the
  7496. number of previous sequentially dropped frames.
  7497. Default value is 0.
  7498. @item hi
  7499. @item lo
  7500. @item frac
  7501. Set the dropping threshold values.
  7502. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  7503. represent actual pixel value differences, so a threshold of 64
  7504. corresponds to 1 unit of difference for each pixel, or the same spread
  7505. out differently over the block.
  7506. A frame is a candidate for dropping if no 8x8 blocks differ by more
  7507. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  7508. meaning the whole image) differ by more than a threshold of @option{lo}.
  7509. Default value for @option{hi} is 64*12, default value for @option{lo} is
  7510. 64*5, and default value for @option{frac} is 0.33.
  7511. @end table
  7512. @section negate
  7513. Negate input video.
  7514. It accepts an integer in input; if non-zero it negates the
  7515. alpha component (if available). The default value in input is 0.
  7516. @section nlmeans
  7517. Denoise frames using Non-Local Means algorithm.
  7518. Each pixel is adjusted by looking for other pixels with similar contexts. This
  7519. context similarity is defined by comparing their surrounding patches of size
  7520. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  7521. around the pixel.
  7522. Note that the research area defines centers for patches, which means some
  7523. patches will be made of pixels outside that research area.
  7524. The filter accepts the following options.
  7525. @table @option
  7526. @item s
  7527. Set denoising strength.
  7528. @item p
  7529. Set patch size.
  7530. @item pc
  7531. Same as @option{p} but for chroma planes.
  7532. The default value is @var{0} and means automatic.
  7533. @item r
  7534. Set research size.
  7535. @item rc
  7536. Same as @option{r} but for chroma planes.
  7537. The default value is @var{0} and means automatic.
  7538. @end table
  7539. @section nnedi
  7540. Deinterlace video using neural network edge directed interpolation.
  7541. This filter accepts the following options:
  7542. @table @option
  7543. @item weights
  7544. Mandatory option, without binary file filter can not work.
  7545. Currently file can be found here:
  7546. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  7547. @item deint
  7548. Set which frames to deinterlace, by default it is @code{all}.
  7549. Can be @code{all} or @code{interlaced}.
  7550. @item field
  7551. Set mode of operation.
  7552. Can be one of the following:
  7553. @table @samp
  7554. @item af
  7555. Use frame flags, both fields.
  7556. @item a
  7557. Use frame flags, single field.
  7558. @item t
  7559. Use top field only.
  7560. @item b
  7561. Use bottom field only.
  7562. @item tf
  7563. Use both fields, top first.
  7564. @item bf
  7565. Use both fields, bottom first.
  7566. @end table
  7567. @item planes
  7568. Set which planes to process, by default filter process all frames.
  7569. @item nsize
  7570. Set size of local neighborhood around each pixel, used by the predictor neural
  7571. network.
  7572. Can be one of the following:
  7573. @table @samp
  7574. @item s8x6
  7575. @item s16x6
  7576. @item s32x6
  7577. @item s48x6
  7578. @item s8x4
  7579. @item s16x4
  7580. @item s32x4
  7581. @end table
  7582. @item nns
  7583. Set the number of neurons in predicctor neural network.
  7584. Can be one of the following:
  7585. @table @samp
  7586. @item n16
  7587. @item n32
  7588. @item n64
  7589. @item n128
  7590. @item n256
  7591. @end table
  7592. @item qual
  7593. Controls the number of different neural network predictions that are blended
  7594. together to compute the final output value. Can be @code{fast}, default or
  7595. @code{slow}.
  7596. @item etype
  7597. Set which set of weights to use in the predictor.
  7598. Can be one of the following:
  7599. @table @samp
  7600. @item a
  7601. weights trained to minimize absolute error
  7602. @item s
  7603. weights trained to minimize squared error
  7604. @end table
  7605. @item pscrn
  7606. Controls whether or not the prescreener neural network is used to decide
  7607. which pixels should be processed by the predictor neural network and which
  7608. can be handled by simple cubic interpolation.
  7609. The prescreener is trained to know whether cubic interpolation will be
  7610. sufficient for a pixel or whether it should be predicted by the predictor nn.
  7611. The computational complexity of the prescreener nn is much less than that of
  7612. the predictor nn. Since most pixels can be handled by cubic interpolation,
  7613. using the prescreener generally results in much faster processing.
  7614. The prescreener is pretty accurate, so the difference between using it and not
  7615. using it is almost always unnoticeable.
  7616. Can be one of the following:
  7617. @table @samp
  7618. @item none
  7619. @item original
  7620. @item new
  7621. @end table
  7622. Default is @code{new}.
  7623. @item fapprox
  7624. Set various debugging flags.
  7625. @end table
  7626. @section noformat
  7627. Force libavfilter not to use any of the specified pixel formats for the
  7628. input to the next filter.
  7629. It accepts the following parameters:
  7630. @table @option
  7631. @item pix_fmts
  7632. A '|'-separated list of pixel format names, such as
  7633. apix_fmts=yuv420p|monow|rgb24".
  7634. @end table
  7635. @subsection Examples
  7636. @itemize
  7637. @item
  7638. Force libavfilter to use a format different from @var{yuv420p} for the
  7639. input to the vflip filter:
  7640. @example
  7641. noformat=pix_fmts=yuv420p,vflip
  7642. @end example
  7643. @item
  7644. Convert the input video to any of the formats not contained in the list:
  7645. @example
  7646. noformat=yuv420p|yuv444p|yuv410p
  7647. @end example
  7648. @end itemize
  7649. @section noise
  7650. Add noise on video input frame.
  7651. The filter accepts the following options:
  7652. @table @option
  7653. @item all_seed
  7654. @item c0_seed
  7655. @item c1_seed
  7656. @item c2_seed
  7657. @item c3_seed
  7658. Set noise seed for specific pixel component or all pixel components in case
  7659. of @var{all_seed}. Default value is @code{123457}.
  7660. @item all_strength, alls
  7661. @item c0_strength, c0s
  7662. @item c1_strength, c1s
  7663. @item c2_strength, c2s
  7664. @item c3_strength, c3s
  7665. Set noise strength for specific pixel component or all pixel components in case
  7666. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  7667. @item all_flags, allf
  7668. @item c0_flags, c0f
  7669. @item c1_flags, c1f
  7670. @item c2_flags, c2f
  7671. @item c3_flags, c3f
  7672. Set pixel component flags or set flags for all components if @var{all_flags}.
  7673. Available values for component flags are:
  7674. @table @samp
  7675. @item a
  7676. averaged temporal noise (smoother)
  7677. @item p
  7678. mix random noise with a (semi)regular pattern
  7679. @item t
  7680. temporal noise (noise pattern changes between frames)
  7681. @item u
  7682. uniform noise (gaussian otherwise)
  7683. @end table
  7684. @end table
  7685. @subsection Examples
  7686. Add temporal and uniform noise to input video:
  7687. @example
  7688. noise=alls=20:allf=t+u
  7689. @end example
  7690. @section null
  7691. Pass the video source unchanged to the output.
  7692. @section ocr
  7693. Optical Character Recognition
  7694. This filter uses Tesseract for optical character recognition.
  7695. It accepts the following options:
  7696. @table @option
  7697. @item datapath
  7698. Set datapath to tesseract data. Default is to use whatever was
  7699. set at installation.
  7700. @item language
  7701. Set language, default is "eng".
  7702. @item whitelist
  7703. Set character whitelist.
  7704. @item blacklist
  7705. Set character blacklist.
  7706. @end table
  7707. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  7708. @section ocv
  7709. Apply a video transform using libopencv.
  7710. To enable this filter, install the libopencv library and headers and
  7711. configure FFmpeg with @code{--enable-libopencv}.
  7712. It accepts the following parameters:
  7713. @table @option
  7714. @item filter_name
  7715. The name of the libopencv filter to apply.
  7716. @item filter_params
  7717. The parameters to pass to the libopencv filter. If not specified, the default
  7718. values are assumed.
  7719. @end table
  7720. Refer to the official libopencv documentation for more precise
  7721. information:
  7722. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  7723. Several libopencv filters are supported; see the following subsections.
  7724. @anchor{dilate}
  7725. @subsection dilate
  7726. Dilate an image by using a specific structuring element.
  7727. It corresponds to the libopencv function @code{cvDilate}.
  7728. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  7729. @var{struct_el} represents a structuring element, and has the syntax:
  7730. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  7731. @var{cols} and @var{rows} represent the number of columns and rows of
  7732. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  7733. point, and @var{shape} the shape for the structuring element. @var{shape}
  7734. must be "rect", "cross", "ellipse", or "custom".
  7735. If the value for @var{shape} is "custom", it must be followed by a
  7736. string of the form "=@var{filename}". The file with name
  7737. @var{filename} is assumed to represent a binary image, with each
  7738. printable character corresponding to a bright pixel. When a custom
  7739. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  7740. or columns and rows of the read file are assumed instead.
  7741. The default value for @var{struct_el} is "3x3+0x0/rect".
  7742. @var{nb_iterations} specifies the number of times the transform is
  7743. applied to the image, and defaults to 1.
  7744. Some examples:
  7745. @example
  7746. # Use the default values
  7747. ocv=dilate
  7748. # Dilate using a structuring element with a 5x5 cross, iterating two times
  7749. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  7750. # Read the shape from the file diamond.shape, iterating two times.
  7751. # The file diamond.shape may contain a pattern of characters like this
  7752. # *
  7753. # ***
  7754. # *****
  7755. # ***
  7756. # *
  7757. # The specified columns and rows are ignored
  7758. # but the anchor point coordinates are not
  7759. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  7760. @end example
  7761. @subsection erode
  7762. Erode an image by using a specific structuring element.
  7763. It corresponds to the libopencv function @code{cvErode}.
  7764. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  7765. with the same syntax and semantics as the @ref{dilate} filter.
  7766. @subsection smooth
  7767. Smooth the input video.
  7768. The filter takes the following parameters:
  7769. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  7770. @var{type} is the type of smooth filter to apply, and must be one of
  7771. the following values: "blur", "blur_no_scale", "median", "gaussian",
  7772. or "bilateral". The default value is "gaussian".
  7773. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  7774. depend on the smooth type. @var{param1} and
  7775. @var{param2} accept integer positive values or 0. @var{param3} and
  7776. @var{param4} accept floating point values.
  7777. The default value for @var{param1} is 3. The default value for the
  7778. other parameters is 0.
  7779. These parameters correspond to the parameters assigned to the
  7780. libopencv function @code{cvSmooth}.
  7781. @anchor{overlay}
  7782. @section overlay
  7783. Overlay one video on top of another.
  7784. It takes two inputs and has one output. The first input is the "main"
  7785. video on which the second input is overlaid.
  7786. It accepts the following parameters:
  7787. A description of the accepted options follows.
  7788. @table @option
  7789. @item x
  7790. @item y
  7791. Set the expression for the x and y coordinates of the overlaid video
  7792. on the main video. Default value is "0" for both expressions. In case
  7793. the expression is invalid, it is set to a huge value (meaning that the
  7794. overlay will not be displayed within the output visible area).
  7795. @item eof_action
  7796. The action to take when EOF is encountered on the secondary input; it accepts
  7797. one of the following values:
  7798. @table @option
  7799. @item repeat
  7800. Repeat the last frame (the default).
  7801. @item endall
  7802. End both streams.
  7803. @item pass
  7804. Pass the main input through.
  7805. @end table
  7806. @item eval
  7807. Set when the expressions for @option{x}, and @option{y} are evaluated.
  7808. It accepts the following values:
  7809. @table @samp
  7810. @item init
  7811. only evaluate expressions once during the filter initialization or
  7812. when a command is processed
  7813. @item frame
  7814. evaluate expressions for each incoming frame
  7815. @end table
  7816. Default value is @samp{frame}.
  7817. @item shortest
  7818. If set to 1, force the output to terminate when the shortest input
  7819. terminates. Default value is 0.
  7820. @item format
  7821. Set the format for the output video.
  7822. It accepts the following values:
  7823. @table @samp
  7824. @item yuv420
  7825. force YUV420 output
  7826. @item yuv422
  7827. force YUV422 output
  7828. @item yuv444
  7829. force YUV444 output
  7830. @item rgb
  7831. force RGB output
  7832. @end table
  7833. Default value is @samp{yuv420}.
  7834. @item rgb @emph{(deprecated)}
  7835. If set to 1, force the filter to accept inputs in the RGB
  7836. color space. Default value is 0. This option is deprecated, use
  7837. @option{format} instead.
  7838. @item repeatlast
  7839. If set to 1, force the filter to draw the last overlay frame over the
  7840. main input until the end of the stream. A value of 0 disables this
  7841. behavior. Default value is 1.
  7842. @end table
  7843. The @option{x}, and @option{y} expressions can contain the following
  7844. parameters.
  7845. @table @option
  7846. @item main_w, W
  7847. @item main_h, H
  7848. The main input width and height.
  7849. @item overlay_w, w
  7850. @item overlay_h, h
  7851. The overlay input width and height.
  7852. @item x
  7853. @item y
  7854. The computed values for @var{x} and @var{y}. They are evaluated for
  7855. each new frame.
  7856. @item hsub
  7857. @item vsub
  7858. horizontal and vertical chroma subsample values of the output
  7859. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  7860. @var{vsub} is 1.
  7861. @item n
  7862. the number of input frame, starting from 0
  7863. @item pos
  7864. the position in the file of the input frame, NAN if unknown
  7865. @item t
  7866. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  7867. @end table
  7868. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  7869. when evaluation is done @emph{per frame}, and will evaluate to NAN
  7870. when @option{eval} is set to @samp{init}.
  7871. Be aware that frames are taken from each input video in timestamp
  7872. order, hence, if their initial timestamps differ, it is a good idea
  7873. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  7874. have them begin in the same zero timestamp, as the example for
  7875. the @var{movie} filter does.
  7876. You can chain together more overlays but you should test the
  7877. efficiency of such approach.
  7878. @subsection Commands
  7879. This filter supports the following commands:
  7880. @table @option
  7881. @item x
  7882. @item y
  7883. Modify the x and y of the overlay input.
  7884. The command accepts the same syntax of the corresponding option.
  7885. If the specified expression is not valid, it is kept at its current
  7886. value.
  7887. @end table
  7888. @subsection Examples
  7889. @itemize
  7890. @item
  7891. Draw the overlay at 10 pixels from the bottom right corner of the main
  7892. video:
  7893. @example
  7894. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  7895. @end example
  7896. Using named options the example above becomes:
  7897. @example
  7898. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  7899. @end example
  7900. @item
  7901. Insert a transparent PNG logo in the bottom left corner of the input,
  7902. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  7903. @example
  7904. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  7905. @end example
  7906. @item
  7907. Insert 2 different transparent PNG logos (second logo on bottom
  7908. right corner) using the @command{ffmpeg} tool:
  7909. @example
  7910. 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
  7911. @end example
  7912. @item
  7913. Add a transparent color layer on top of the main video; @code{WxH}
  7914. must specify the size of the main input to the overlay filter:
  7915. @example
  7916. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  7917. @end example
  7918. @item
  7919. Play an original video and a filtered version (here with the deshake
  7920. filter) side by side using the @command{ffplay} tool:
  7921. @example
  7922. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  7923. @end example
  7924. The above command is the same as:
  7925. @example
  7926. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  7927. @end example
  7928. @item
  7929. Make a sliding overlay appearing from the left to the right top part of the
  7930. screen starting since time 2:
  7931. @example
  7932. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  7933. @end example
  7934. @item
  7935. Compose output by putting two input videos side to side:
  7936. @example
  7937. ffmpeg -i left.avi -i right.avi -filter_complex "
  7938. nullsrc=size=200x100 [background];
  7939. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  7940. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  7941. [background][left] overlay=shortest=1 [background+left];
  7942. [background+left][right] overlay=shortest=1:x=100 [left+right]
  7943. "
  7944. @end example
  7945. @item
  7946. Mask 10-20 seconds of a video by applying the delogo filter to a section
  7947. @example
  7948. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  7949. -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]'
  7950. masked.avi
  7951. @end example
  7952. @item
  7953. Chain several overlays in cascade:
  7954. @example
  7955. nullsrc=s=200x200 [bg];
  7956. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  7957. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  7958. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  7959. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  7960. [in3] null, [mid2] overlay=100:100 [out0]
  7961. @end example
  7962. @end itemize
  7963. @section owdenoise
  7964. Apply Overcomplete Wavelet denoiser.
  7965. The filter accepts the following options:
  7966. @table @option
  7967. @item depth
  7968. Set depth.
  7969. Larger depth values will denoise lower frequency components more, but
  7970. slow down filtering.
  7971. Must be an int in the range 8-16, default is @code{8}.
  7972. @item luma_strength, ls
  7973. Set luma strength.
  7974. Must be a double value in the range 0-1000, default is @code{1.0}.
  7975. @item chroma_strength, cs
  7976. Set chroma strength.
  7977. Must be a double value in the range 0-1000, default is @code{1.0}.
  7978. @end table
  7979. @anchor{pad}
  7980. @section pad
  7981. Add paddings to the input image, and place the original input at the
  7982. provided @var{x}, @var{y} coordinates.
  7983. It accepts the following parameters:
  7984. @table @option
  7985. @item width, w
  7986. @item height, h
  7987. Specify an expression for the size of the output image with the
  7988. paddings added. If the value for @var{width} or @var{height} is 0, the
  7989. corresponding input size is used for the output.
  7990. The @var{width} expression can reference the value set by the
  7991. @var{height} expression, and vice versa.
  7992. The default value of @var{width} and @var{height} is 0.
  7993. @item x
  7994. @item y
  7995. Specify the offsets to place the input image at within the padded area,
  7996. with respect to the top/left border of the output image.
  7997. The @var{x} expression can reference the value set by the @var{y}
  7998. expression, and vice versa.
  7999. The default value of @var{x} and @var{y} is 0.
  8000. @item color
  8001. Specify the color of the padded area. For the syntax of this option,
  8002. check the "Color" section in the ffmpeg-utils manual.
  8003. The default value of @var{color} is "black".
  8004. @end table
  8005. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  8006. options are expressions containing the following constants:
  8007. @table @option
  8008. @item in_w
  8009. @item in_h
  8010. The input video width and height.
  8011. @item iw
  8012. @item ih
  8013. These are the same as @var{in_w} and @var{in_h}.
  8014. @item out_w
  8015. @item out_h
  8016. The output width and height (the size of the padded area), as
  8017. specified by the @var{width} and @var{height} expressions.
  8018. @item ow
  8019. @item oh
  8020. These are the same as @var{out_w} and @var{out_h}.
  8021. @item x
  8022. @item y
  8023. The x and y offsets as specified by the @var{x} and @var{y}
  8024. expressions, or NAN if not yet specified.
  8025. @item a
  8026. same as @var{iw} / @var{ih}
  8027. @item sar
  8028. input sample aspect ratio
  8029. @item dar
  8030. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  8031. @item hsub
  8032. @item vsub
  8033. The horizontal and vertical chroma subsample values. For example for the
  8034. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8035. @end table
  8036. @subsection Examples
  8037. @itemize
  8038. @item
  8039. Add paddings with the color "violet" to the input video. The output video
  8040. size is 640x480, and the top-left corner of the input video is placed at
  8041. column 0, row 40
  8042. @example
  8043. pad=640:480:0:40:violet
  8044. @end example
  8045. The example above is equivalent to the following command:
  8046. @example
  8047. pad=width=640:height=480:x=0:y=40:color=violet
  8048. @end example
  8049. @item
  8050. Pad the input to get an output with dimensions increased by 3/2,
  8051. and put the input video at the center of the padded area:
  8052. @example
  8053. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  8054. @end example
  8055. @item
  8056. Pad the input to get a squared output with size equal to the maximum
  8057. value between the input width and height, and put the input video at
  8058. the center of the padded area:
  8059. @example
  8060. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  8061. @end example
  8062. @item
  8063. Pad the input to get a final w/h ratio of 16:9:
  8064. @example
  8065. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  8066. @end example
  8067. @item
  8068. In case of anamorphic video, in order to set the output display aspect
  8069. correctly, it is necessary to use @var{sar} in the expression,
  8070. according to the relation:
  8071. @example
  8072. (ih * X / ih) * sar = output_dar
  8073. X = output_dar / sar
  8074. @end example
  8075. Thus the previous example needs to be modified to:
  8076. @example
  8077. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  8078. @end example
  8079. @item
  8080. Double the output size and put the input video in the bottom-right
  8081. corner of the output padded area:
  8082. @example
  8083. pad="2*iw:2*ih:ow-iw:oh-ih"
  8084. @end example
  8085. @end itemize
  8086. @anchor{palettegen}
  8087. @section palettegen
  8088. Generate one palette for a whole video stream.
  8089. It accepts the following options:
  8090. @table @option
  8091. @item max_colors
  8092. Set the maximum number of colors to quantize in the palette.
  8093. Note: the palette will still contain 256 colors; the unused palette entries
  8094. will be black.
  8095. @item reserve_transparent
  8096. Create a palette of 255 colors maximum and reserve the last one for
  8097. transparency. Reserving the transparency color is useful for GIF optimization.
  8098. If not set, the maximum of colors in the palette will be 256. You probably want
  8099. to disable this option for a standalone image.
  8100. Set by default.
  8101. @item stats_mode
  8102. Set statistics mode.
  8103. It accepts the following values:
  8104. @table @samp
  8105. @item full
  8106. Compute full frame histograms.
  8107. @item diff
  8108. Compute histograms only for the part that differs from previous frame. This
  8109. might be relevant to give more importance to the moving part of your input if
  8110. the background is static.
  8111. @item single
  8112. Compute new histogram for each frame.
  8113. @end table
  8114. Default value is @var{full}.
  8115. @end table
  8116. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  8117. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  8118. color quantization of the palette. This information is also visible at
  8119. @var{info} logging level.
  8120. @subsection Examples
  8121. @itemize
  8122. @item
  8123. Generate a representative palette of a given video using @command{ffmpeg}:
  8124. @example
  8125. ffmpeg -i input.mkv -vf palettegen palette.png
  8126. @end example
  8127. @end itemize
  8128. @section paletteuse
  8129. Use a palette to downsample an input video stream.
  8130. The filter takes two inputs: one video stream and a palette. The palette must
  8131. be a 256 pixels image.
  8132. It accepts the following options:
  8133. @table @option
  8134. @item dither
  8135. Select dithering mode. Available algorithms are:
  8136. @table @samp
  8137. @item bayer
  8138. Ordered 8x8 bayer dithering (deterministic)
  8139. @item heckbert
  8140. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  8141. Note: this dithering is sometimes considered "wrong" and is included as a
  8142. reference.
  8143. @item floyd_steinberg
  8144. Floyd and Steingberg dithering (error diffusion)
  8145. @item sierra2
  8146. Frankie Sierra dithering v2 (error diffusion)
  8147. @item sierra2_4a
  8148. Frankie Sierra dithering v2 "Lite" (error diffusion)
  8149. @end table
  8150. Default is @var{sierra2_4a}.
  8151. @item bayer_scale
  8152. When @var{bayer} dithering is selected, this option defines the scale of the
  8153. pattern (how much the crosshatch pattern is visible). A low value means more
  8154. visible pattern for less banding, and higher value means less visible pattern
  8155. at the cost of more banding.
  8156. The option must be an integer value in the range [0,5]. Default is @var{2}.
  8157. @item diff_mode
  8158. If set, define the zone to process
  8159. @table @samp
  8160. @item rectangle
  8161. Only the changing rectangle will be reprocessed. This is similar to GIF
  8162. cropping/offsetting compression mechanism. This option can be useful for speed
  8163. if only a part of the image is changing, and has use cases such as limiting the
  8164. scope of the error diffusal @option{dither} to the rectangle that bounds the
  8165. moving scene (it leads to more deterministic output if the scene doesn't change
  8166. much, and as a result less moving noise and better GIF compression).
  8167. @end table
  8168. Default is @var{none}.
  8169. @item new
  8170. Take new palette for each output frame.
  8171. @end table
  8172. @subsection Examples
  8173. @itemize
  8174. @item
  8175. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  8176. using @command{ffmpeg}:
  8177. @example
  8178. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  8179. @end example
  8180. @end itemize
  8181. @section perspective
  8182. Correct perspective of video not recorded perpendicular to the screen.
  8183. A description of the accepted parameters follows.
  8184. @table @option
  8185. @item x0
  8186. @item y0
  8187. @item x1
  8188. @item y1
  8189. @item x2
  8190. @item y2
  8191. @item x3
  8192. @item y3
  8193. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  8194. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  8195. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  8196. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  8197. then the corners of the source will be sent to the specified coordinates.
  8198. The expressions can use the following variables:
  8199. @table @option
  8200. @item W
  8201. @item H
  8202. the width and height of video frame.
  8203. @item in
  8204. Input frame count.
  8205. @item on
  8206. Output frame count.
  8207. @end table
  8208. @item interpolation
  8209. Set interpolation for perspective correction.
  8210. It accepts the following values:
  8211. @table @samp
  8212. @item linear
  8213. @item cubic
  8214. @end table
  8215. Default value is @samp{linear}.
  8216. @item sense
  8217. Set interpretation of coordinate options.
  8218. It accepts the following values:
  8219. @table @samp
  8220. @item 0, source
  8221. Send point in the source specified by the given coordinates to
  8222. the corners of the destination.
  8223. @item 1, destination
  8224. Send the corners of the source to the point in the destination specified
  8225. by the given coordinates.
  8226. Default value is @samp{source}.
  8227. @end table
  8228. @item eval
  8229. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  8230. It accepts the following values:
  8231. @table @samp
  8232. @item init
  8233. only evaluate expressions once during the filter initialization or
  8234. when a command is processed
  8235. @item frame
  8236. evaluate expressions for each incoming frame
  8237. @end table
  8238. Default value is @samp{init}.
  8239. @end table
  8240. @section phase
  8241. Delay interlaced video by one field time so that the field order changes.
  8242. The intended use is to fix PAL movies that have been captured with the
  8243. opposite field order to the film-to-video transfer.
  8244. A description of the accepted parameters follows.
  8245. @table @option
  8246. @item mode
  8247. Set phase mode.
  8248. It accepts the following values:
  8249. @table @samp
  8250. @item t
  8251. Capture field order top-first, transfer bottom-first.
  8252. Filter will delay the bottom field.
  8253. @item b
  8254. Capture field order bottom-first, transfer top-first.
  8255. Filter will delay the top field.
  8256. @item p
  8257. Capture and transfer with the same field order. This mode only exists
  8258. for the documentation of the other options to refer to, but if you
  8259. actually select it, the filter will faithfully do nothing.
  8260. @item a
  8261. Capture field order determined automatically by field flags, transfer
  8262. opposite.
  8263. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  8264. basis using field flags. If no field information is available,
  8265. then this works just like @samp{u}.
  8266. @item u
  8267. Capture unknown or varying, transfer opposite.
  8268. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  8269. analyzing the images and selecting the alternative that produces best
  8270. match between the fields.
  8271. @item T
  8272. Capture top-first, transfer unknown or varying.
  8273. Filter selects among @samp{t} and @samp{p} using image analysis.
  8274. @item B
  8275. Capture bottom-first, transfer unknown or varying.
  8276. Filter selects among @samp{b} and @samp{p} using image analysis.
  8277. @item A
  8278. Capture determined by field flags, transfer unknown or varying.
  8279. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  8280. image analysis. If no field information is available, then this works just
  8281. like @samp{U}. This is the default mode.
  8282. @item U
  8283. Both capture and transfer unknown or varying.
  8284. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  8285. @end table
  8286. @end table
  8287. @section pixdesctest
  8288. Pixel format descriptor test filter, mainly useful for internal
  8289. testing. The output video should be equal to the input video.
  8290. For example:
  8291. @example
  8292. format=monow, pixdesctest
  8293. @end example
  8294. can be used to test the monowhite pixel format descriptor definition.
  8295. @section pp
  8296. Enable the specified chain of postprocessing subfilters using libpostproc. This
  8297. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  8298. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  8299. Each subfilter and some options have a short and a long name that can be used
  8300. interchangeably, i.e. dr/dering are the same.
  8301. The filters accept the following options:
  8302. @table @option
  8303. @item subfilters
  8304. Set postprocessing subfilters string.
  8305. @end table
  8306. All subfilters share common options to determine their scope:
  8307. @table @option
  8308. @item a/autoq
  8309. Honor the quality commands for this subfilter.
  8310. @item c/chrom
  8311. Do chrominance filtering, too (default).
  8312. @item y/nochrom
  8313. Do luminance filtering only (no chrominance).
  8314. @item n/noluma
  8315. Do chrominance filtering only (no luminance).
  8316. @end table
  8317. These options can be appended after the subfilter name, separated by a '|'.
  8318. Available subfilters are:
  8319. @table @option
  8320. @item hb/hdeblock[|difference[|flatness]]
  8321. Horizontal deblocking filter
  8322. @table @option
  8323. @item difference
  8324. Difference factor where higher values mean more deblocking (default: @code{32}).
  8325. @item flatness
  8326. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8327. @end table
  8328. @item vb/vdeblock[|difference[|flatness]]
  8329. Vertical deblocking filter
  8330. @table @option
  8331. @item difference
  8332. Difference factor where higher values mean more deblocking (default: @code{32}).
  8333. @item flatness
  8334. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8335. @end table
  8336. @item ha/hadeblock[|difference[|flatness]]
  8337. Accurate horizontal deblocking filter
  8338. @table @option
  8339. @item difference
  8340. Difference factor where higher values mean more deblocking (default: @code{32}).
  8341. @item flatness
  8342. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8343. @end table
  8344. @item va/vadeblock[|difference[|flatness]]
  8345. Accurate vertical deblocking filter
  8346. @table @option
  8347. @item difference
  8348. Difference factor where higher values mean more deblocking (default: @code{32}).
  8349. @item flatness
  8350. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8351. @end table
  8352. @end table
  8353. The horizontal and vertical deblocking filters share the difference and
  8354. flatness values so you cannot set different horizontal and vertical
  8355. thresholds.
  8356. @table @option
  8357. @item h1/x1hdeblock
  8358. Experimental horizontal deblocking filter
  8359. @item v1/x1vdeblock
  8360. Experimental vertical deblocking filter
  8361. @item dr/dering
  8362. Deringing filter
  8363. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  8364. @table @option
  8365. @item threshold1
  8366. larger -> stronger filtering
  8367. @item threshold2
  8368. larger -> stronger filtering
  8369. @item threshold3
  8370. larger -> stronger filtering
  8371. @end table
  8372. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  8373. @table @option
  8374. @item f/fullyrange
  8375. Stretch luminance to @code{0-255}.
  8376. @end table
  8377. @item lb/linblenddeint
  8378. Linear blend deinterlacing filter that deinterlaces the given block by
  8379. filtering all lines with a @code{(1 2 1)} filter.
  8380. @item li/linipoldeint
  8381. Linear interpolating deinterlacing filter that deinterlaces the given block by
  8382. linearly interpolating every second line.
  8383. @item ci/cubicipoldeint
  8384. Cubic interpolating deinterlacing filter deinterlaces the given block by
  8385. cubically interpolating every second line.
  8386. @item md/mediandeint
  8387. Median deinterlacing filter that deinterlaces the given block by applying a
  8388. median filter to every second line.
  8389. @item fd/ffmpegdeint
  8390. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  8391. second line with a @code{(-1 4 2 4 -1)} filter.
  8392. @item l5/lowpass5
  8393. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  8394. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  8395. @item fq/forceQuant[|quantizer]
  8396. Overrides the quantizer table from the input with the constant quantizer you
  8397. specify.
  8398. @table @option
  8399. @item quantizer
  8400. Quantizer to use
  8401. @end table
  8402. @item de/default
  8403. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  8404. @item fa/fast
  8405. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  8406. @item ac
  8407. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  8408. @end table
  8409. @subsection Examples
  8410. @itemize
  8411. @item
  8412. Apply horizontal and vertical deblocking, deringing and automatic
  8413. brightness/contrast:
  8414. @example
  8415. pp=hb/vb/dr/al
  8416. @end example
  8417. @item
  8418. Apply default filters without brightness/contrast correction:
  8419. @example
  8420. pp=de/-al
  8421. @end example
  8422. @item
  8423. Apply default filters and temporal denoiser:
  8424. @example
  8425. pp=default/tmpnoise|1|2|3
  8426. @end example
  8427. @item
  8428. Apply deblocking on luminance only, and switch vertical deblocking on or off
  8429. automatically depending on available CPU time:
  8430. @example
  8431. pp=hb|y/vb|a
  8432. @end example
  8433. @end itemize
  8434. @section pp7
  8435. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  8436. similar to spp = 6 with 7 point DCT, where only the center sample is
  8437. used after IDCT.
  8438. The filter accepts the following options:
  8439. @table @option
  8440. @item qp
  8441. Force a constant quantization parameter. It accepts an integer in range
  8442. 0 to 63. If not set, the filter will use the QP from the video stream
  8443. (if available).
  8444. @item mode
  8445. Set thresholding mode. Available modes are:
  8446. @table @samp
  8447. @item hard
  8448. Set hard thresholding.
  8449. @item soft
  8450. Set soft thresholding (better de-ringing effect, but likely blurrier).
  8451. @item medium
  8452. Set medium thresholding (good results, default).
  8453. @end table
  8454. @end table
  8455. @section prewitt
  8456. Apply prewitt operator to input video stream.
  8457. The filter accepts the following option:
  8458. @table @option
  8459. @item planes
  8460. Set which planes will be processed, unprocessed planes will be copied.
  8461. By default value 0xf, all planes will be processed.
  8462. @item scale
  8463. Set value which will be multiplied with filtered result.
  8464. @item delta
  8465. Set value which will be added to filtered result.
  8466. @end table
  8467. @section psnr
  8468. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  8469. Ratio) between two input videos.
  8470. This filter takes in input two input videos, the first input is
  8471. considered the "main" source and is passed unchanged to the
  8472. output. The second input is used as a "reference" video for computing
  8473. the PSNR.
  8474. Both video inputs must have the same resolution and pixel format for
  8475. this filter to work correctly. Also it assumes that both inputs
  8476. have the same number of frames, which are compared one by one.
  8477. The obtained average PSNR is printed through the logging system.
  8478. The filter stores the accumulated MSE (mean squared error) of each
  8479. frame, and at the end of the processing it is averaged across all frames
  8480. equally, and the following formula is applied to obtain the PSNR:
  8481. @example
  8482. PSNR = 10*log10(MAX^2/MSE)
  8483. @end example
  8484. Where MAX is the average of the maximum values of each component of the
  8485. image.
  8486. The description of the accepted parameters follows.
  8487. @table @option
  8488. @item stats_file, f
  8489. If specified the filter will use the named file to save the PSNR of
  8490. each individual frame. When filename equals "-" the data is sent to
  8491. standard output.
  8492. @item stats_version
  8493. Specifies which version of the stats file format to use. Details of
  8494. each format are written below.
  8495. Default value is 1.
  8496. @item stats_add_max
  8497. Determines whether the max value is output to the stats log.
  8498. Default value is 0.
  8499. Requires stats_version >= 2. If this is set and stats_version < 2,
  8500. the filter will return an error.
  8501. @end table
  8502. The file printed if @var{stats_file} is selected, contains a sequence of
  8503. key/value pairs of the form @var{key}:@var{value} for each compared
  8504. couple of frames.
  8505. If a @var{stats_version} greater than 1 is specified, a header line precedes
  8506. the list of per-frame-pair stats, with key value pairs following the frame
  8507. format with the following parameters:
  8508. @table @option
  8509. @item psnr_log_version
  8510. The version of the log file format. Will match @var{stats_version}.
  8511. @item fields
  8512. A comma separated list of the per-frame-pair parameters included in
  8513. the log.
  8514. @end table
  8515. A description of each shown per-frame-pair parameter follows:
  8516. @table @option
  8517. @item n
  8518. sequential number of the input frame, starting from 1
  8519. @item mse_avg
  8520. Mean Square Error pixel-by-pixel average difference of the compared
  8521. frames, averaged over all the image components.
  8522. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  8523. Mean Square Error pixel-by-pixel average difference of the compared
  8524. frames for the component specified by the suffix.
  8525. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  8526. Peak Signal to Noise ratio of the compared frames for the component
  8527. specified by the suffix.
  8528. @item max_avg, max_y, max_u, max_v
  8529. Maximum allowed value for each channel, and average over all
  8530. channels.
  8531. @end table
  8532. For example:
  8533. @example
  8534. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  8535. [main][ref] psnr="stats_file=stats.log" [out]
  8536. @end example
  8537. On this example the input file being processed is compared with the
  8538. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  8539. is stored in @file{stats.log}.
  8540. @anchor{pullup}
  8541. @section pullup
  8542. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  8543. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  8544. content.
  8545. The pullup filter is designed to take advantage of future context in making
  8546. its decisions. This filter is stateless in the sense that it does not lock
  8547. onto a pattern to follow, but it instead looks forward to the following
  8548. fields in order to identify matches and rebuild progressive frames.
  8549. To produce content with an even framerate, insert the fps filter after
  8550. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  8551. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  8552. The filter accepts the following options:
  8553. @table @option
  8554. @item jl
  8555. @item jr
  8556. @item jt
  8557. @item jb
  8558. These options set the amount of "junk" to ignore at the left, right, top, and
  8559. bottom of the image, respectively. Left and right are in units of 8 pixels,
  8560. while top and bottom are in units of 2 lines.
  8561. The default is 8 pixels on each side.
  8562. @item sb
  8563. Set the strict breaks. Setting this option to 1 will reduce the chances of
  8564. filter generating an occasional mismatched frame, but it may also cause an
  8565. excessive number of frames to be dropped during high motion sequences.
  8566. Conversely, setting it to -1 will make filter match fields more easily.
  8567. This may help processing of video where there is slight blurring between
  8568. the fields, but may also cause there to be interlaced frames in the output.
  8569. Default value is @code{0}.
  8570. @item mp
  8571. Set the metric plane to use. It accepts the following values:
  8572. @table @samp
  8573. @item l
  8574. Use luma plane.
  8575. @item u
  8576. Use chroma blue plane.
  8577. @item v
  8578. Use chroma red plane.
  8579. @end table
  8580. This option may be set to use chroma plane instead of the default luma plane
  8581. for doing filter's computations. This may improve accuracy on very clean
  8582. source material, but more likely will decrease accuracy, especially if there
  8583. is chroma noise (rainbow effect) or any grayscale video.
  8584. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  8585. load and make pullup usable in realtime on slow machines.
  8586. @end table
  8587. For best results (without duplicated frames in the output file) it is
  8588. necessary to change the output frame rate. For example, to inverse
  8589. telecine NTSC input:
  8590. @example
  8591. ffmpeg -i input -vf pullup -r 24000/1001 ...
  8592. @end example
  8593. @section qp
  8594. Change video quantization parameters (QP).
  8595. The filter accepts the following option:
  8596. @table @option
  8597. @item qp
  8598. Set expression for quantization parameter.
  8599. @end table
  8600. The expression is evaluated through the eval API and can contain, among others,
  8601. the following constants:
  8602. @table @var
  8603. @item known
  8604. 1 if index is not 129, 0 otherwise.
  8605. @item qp
  8606. Sequentional index starting from -129 to 128.
  8607. @end table
  8608. @subsection Examples
  8609. @itemize
  8610. @item
  8611. Some equation like:
  8612. @example
  8613. qp=2+2*sin(PI*qp)
  8614. @end example
  8615. @end itemize
  8616. @section random
  8617. Flush video frames from internal cache of frames into a random order.
  8618. No frame is discarded.
  8619. Inspired by @ref{frei0r} nervous filter.
  8620. @table @option
  8621. @item frames
  8622. Set size in number of frames of internal cache, in range from @code{2} to
  8623. @code{512}. Default is @code{30}.
  8624. @item seed
  8625. Set seed for random number generator, must be an integer included between
  8626. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  8627. less than @code{0}, the filter will try to use a good random seed on a
  8628. best effort basis.
  8629. @end table
  8630. @section readvitc
  8631. Read vertical interval timecode (VITC) information from the top lines of a
  8632. video frame.
  8633. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  8634. timecode value, if a valid timecode has been detected. Further metadata key
  8635. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  8636. timecode data has been found or not.
  8637. This filter accepts the following options:
  8638. @table @option
  8639. @item scan_max
  8640. Set the maximum number of lines to scan for VITC data. If the value is set to
  8641. @code{-1} the full video frame is scanned. Default is @code{45}.
  8642. @item thr_b
  8643. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  8644. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  8645. @item thr_w
  8646. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  8647. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  8648. @end table
  8649. @subsection Examples
  8650. @itemize
  8651. @item
  8652. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  8653. draw @code{--:--:--:--} as a placeholder:
  8654. @example
  8655. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  8656. @end example
  8657. @end itemize
  8658. @section remap
  8659. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  8660. Destination pixel at position (X, Y) will be picked from source (x, y) position
  8661. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  8662. value for pixel will be used for destination pixel.
  8663. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  8664. will have Xmap/Ymap video stream dimensions.
  8665. Xmap and Ymap input video streams are 16bit depth, single channel.
  8666. @section removegrain
  8667. The removegrain filter is a spatial denoiser for progressive video.
  8668. @table @option
  8669. @item m0
  8670. Set mode for the first plane.
  8671. @item m1
  8672. Set mode for the second plane.
  8673. @item m2
  8674. Set mode for the third plane.
  8675. @item m3
  8676. Set mode for the fourth plane.
  8677. @end table
  8678. Range of mode is from 0 to 24. Description of each mode follows:
  8679. @table @var
  8680. @item 0
  8681. Leave input plane unchanged. Default.
  8682. @item 1
  8683. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  8684. @item 2
  8685. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  8686. @item 3
  8687. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  8688. @item 4
  8689. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  8690. This is equivalent to a median filter.
  8691. @item 5
  8692. Line-sensitive clipping giving the minimal change.
  8693. @item 6
  8694. Line-sensitive clipping, intermediate.
  8695. @item 7
  8696. Line-sensitive clipping, intermediate.
  8697. @item 8
  8698. Line-sensitive clipping, intermediate.
  8699. @item 9
  8700. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  8701. @item 10
  8702. Replaces the target pixel with the closest neighbour.
  8703. @item 11
  8704. [1 2 1] horizontal and vertical kernel blur.
  8705. @item 12
  8706. Same as mode 11.
  8707. @item 13
  8708. Bob mode, interpolates top field from the line where the neighbours
  8709. pixels are the closest.
  8710. @item 14
  8711. Bob mode, interpolates bottom field from the line where the neighbours
  8712. pixels are the closest.
  8713. @item 15
  8714. Bob mode, interpolates top field. Same as 13 but with a more complicated
  8715. interpolation formula.
  8716. @item 16
  8717. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  8718. interpolation formula.
  8719. @item 17
  8720. Clips the pixel with the minimum and maximum of respectively the maximum and
  8721. minimum of each pair of opposite neighbour pixels.
  8722. @item 18
  8723. Line-sensitive clipping using opposite neighbours whose greatest distance from
  8724. the current pixel is minimal.
  8725. @item 19
  8726. Replaces the pixel with the average of its 8 neighbours.
  8727. @item 20
  8728. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  8729. @item 21
  8730. Clips pixels using the averages of opposite neighbour.
  8731. @item 22
  8732. Same as mode 21 but simpler and faster.
  8733. @item 23
  8734. Small edge and halo removal, but reputed useless.
  8735. @item 24
  8736. Similar as 23.
  8737. @end table
  8738. @section removelogo
  8739. Suppress a TV station logo, using an image file to determine which
  8740. pixels comprise the logo. It works by filling in the pixels that
  8741. comprise the logo with neighboring pixels.
  8742. The filter accepts the following options:
  8743. @table @option
  8744. @item filename, f
  8745. Set the filter bitmap file, which can be any image format supported by
  8746. libavformat. The width and height of the image file must match those of the
  8747. video stream being processed.
  8748. @end table
  8749. Pixels in the provided bitmap image with a value of zero are not
  8750. considered part of the logo, non-zero pixels are considered part of
  8751. the logo. If you use white (255) for the logo and black (0) for the
  8752. rest, you will be safe. For making the filter bitmap, it is
  8753. recommended to take a screen capture of a black frame with the logo
  8754. visible, and then using a threshold filter followed by the erode
  8755. filter once or twice.
  8756. If needed, little splotches can be fixed manually. Remember that if
  8757. logo pixels are not covered, the filter quality will be much
  8758. reduced. Marking too many pixels as part of the logo does not hurt as
  8759. much, but it will increase the amount of blurring needed to cover over
  8760. the image and will destroy more information than necessary, and extra
  8761. pixels will slow things down on a large logo.
  8762. @section repeatfields
  8763. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  8764. fields based on its value.
  8765. @section reverse
  8766. Reverse a video clip.
  8767. Warning: This filter requires memory to buffer the entire clip, so trimming
  8768. is suggested.
  8769. @subsection Examples
  8770. @itemize
  8771. @item
  8772. Take the first 5 seconds of a clip, and reverse it.
  8773. @example
  8774. trim=end=5,reverse
  8775. @end example
  8776. @end itemize
  8777. @section rotate
  8778. Rotate video by an arbitrary angle expressed in radians.
  8779. The filter accepts the following options:
  8780. A description of the optional parameters follows.
  8781. @table @option
  8782. @item angle, a
  8783. Set an expression for the angle by which to rotate the input video
  8784. clockwise, expressed as a number of radians. A negative value will
  8785. result in a counter-clockwise rotation. By default it is set to "0".
  8786. This expression is evaluated for each frame.
  8787. @item out_w, ow
  8788. Set the output width expression, default value is "iw".
  8789. This expression is evaluated just once during configuration.
  8790. @item out_h, oh
  8791. Set the output height expression, default value is "ih".
  8792. This expression is evaluated just once during configuration.
  8793. @item bilinear
  8794. Enable bilinear interpolation if set to 1, a value of 0 disables
  8795. it. Default value is 1.
  8796. @item fillcolor, c
  8797. Set the color used to fill the output area not covered by the rotated
  8798. image. For the general syntax of this option, check the "Color" section in the
  8799. ffmpeg-utils manual. If the special value "none" is selected then no
  8800. background is printed (useful for example if the background is never shown).
  8801. Default value is "black".
  8802. @end table
  8803. The expressions for the angle and the output size can contain the
  8804. following constants and functions:
  8805. @table @option
  8806. @item n
  8807. sequential number of the input frame, starting from 0. It is always NAN
  8808. before the first frame is filtered.
  8809. @item t
  8810. time in seconds of the input frame, it is set to 0 when the filter is
  8811. configured. It is always NAN before the first frame is filtered.
  8812. @item hsub
  8813. @item vsub
  8814. horizontal and vertical chroma subsample values. For example for the
  8815. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8816. @item in_w, iw
  8817. @item in_h, ih
  8818. the input video width and height
  8819. @item out_w, ow
  8820. @item out_h, oh
  8821. the output width and height, that is the size of the padded area as
  8822. specified by the @var{width} and @var{height} expressions
  8823. @item rotw(a)
  8824. @item roth(a)
  8825. the minimal width/height required for completely containing the input
  8826. video rotated by @var{a} radians.
  8827. These are only available when computing the @option{out_w} and
  8828. @option{out_h} expressions.
  8829. @end table
  8830. @subsection Examples
  8831. @itemize
  8832. @item
  8833. Rotate the input by PI/6 radians clockwise:
  8834. @example
  8835. rotate=PI/6
  8836. @end example
  8837. @item
  8838. Rotate the input by PI/6 radians counter-clockwise:
  8839. @example
  8840. rotate=-PI/6
  8841. @end example
  8842. @item
  8843. Rotate the input by 45 degrees clockwise:
  8844. @example
  8845. rotate=45*PI/180
  8846. @end example
  8847. @item
  8848. Apply a constant rotation with period T, starting from an angle of PI/3:
  8849. @example
  8850. rotate=PI/3+2*PI*t/T
  8851. @end example
  8852. @item
  8853. Make the input video rotation oscillating with a period of T
  8854. seconds and an amplitude of A radians:
  8855. @example
  8856. rotate=A*sin(2*PI/T*t)
  8857. @end example
  8858. @item
  8859. Rotate the video, output size is chosen so that the whole rotating
  8860. input video is always completely contained in the output:
  8861. @example
  8862. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  8863. @end example
  8864. @item
  8865. Rotate the video, reduce the output size so that no background is ever
  8866. shown:
  8867. @example
  8868. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  8869. @end example
  8870. @end itemize
  8871. @subsection Commands
  8872. The filter supports the following commands:
  8873. @table @option
  8874. @item a, angle
  8875. Set the angle expression.
  8876. The command accepts the same syntax of the corresponding option.
  8877. If the specified expression is not valid, it is kept at its current
  8878. value.
  8879. @end table
  8880. @section sab
  8881. Apply Shape Adaptive Blur.
  8882. The filter accepts the following options:
  8883. @table @option
  8884. @item luma_radius, lr
  8885. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  8886. value is 1.0. A greater value will result in a more blurred image, and
  8887. in slower processing.
  8888. @item luma_pre_filter_radius, lpfr
  8889. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  8890. value is 1.0.
  8891. @item luma_strength, ls
  8892. Set luma maximum difference between pixels to still be considered, must
  8893. be a value in the 0.1-100.0 range, default value is 1.0.
  8894. @item chroma_radius, cr
  8895. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  8896. greater value will result in a more blurred image, and in slower
  8897. processing.
  8898. @item chroma_pre_filter_radius, cpfr
  8899. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  8900. @item chroma_strength, cs
  8901. Set chroma maximum difference between pixels to still be considered,
  8902. must be a value in the -0.9-100.0 range.
  8903. @end table
  8904. Each chroma option value, if not explicitly specified, is set to the
  8905. corresponding luma option value.
  8906. @anchor{scale}
  8907. @section scale
  8908. Scale (resize) the input video, using the libswscale library.
  8909. The scale filter forces the output display aspect ratio to be the same
  8910. of the input, by changing the output sample aspect ratio.
  8911. If the input image format is different from the format requested by
  8912. the next filter, the scale filter will convert the input to the
  8913. requested format.
  8914. @subsection Options
  8915. The filter accepts the following options, or any of the options
  8916. supported by the libswscale scaler.
  8917. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  8918. the complete list of scaler options.
  8919. @table @option
  8920. @item width, w
  8921. @item height, h
  8922. Set the output video dimension expression. Default value is the input
  8923. dimension.
  8924. If the value is 0, the input width is used for the output.
  8925. If one of the values is -1, the scale filter will use a value that
  8926. maintains the aspect ratio of the input image, calculated from the
  8927. other specified dimension. If both of them are -1, the input size is
  8928. used
  8929. If one of the values is -n with n > 1, the scale filter will also use a value
  8930. that maintains the aspect ratio of the input image, calculated from the other
  8931. specified dimension. After that it will, however, make sure that the calculated
  8932. dimension is divisible by n and adjust the value if necessary.
  8933. See below for the list of accepted constants for use in the dimension
  8934. expression.
  8935. @item eval
  8936. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  8937. @table @samp
  8938. @item init
  8939. Only evaluate expressions once during the filter initialization or when a command is processed.
  8940. @item frame
  8941. Evaluate expressions for each incoming frame.
  8942. @end table
  8943. Default value is @samp{init}.
  8944. @item interl
  8945. Set the interlacing mode. It accepts the following values:
  8946. @table @samp
  8947. @item 1
  8948. Force interlaced aware scaling.
  8949. @item 0
  8950. Do not apply interlaced scaling.
  8951. @item -1
  8952. Select interlaced aware scaling depending on whether the source frames
  8953. are flagged as interlaced or not.
  8954. @end table
  8955. Default value is @samp{0}.
  8956. @item flags
  8957. Set libswscale scaling flags. See
  8958. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  8959. complete list of values. If not explicitly specified the filter applies
  8960. the default flags.
  8961. @item param0, param1
  8962. Set libswscale input parameters for scaling algorithms that need them. See
  8963. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  8964. complete documentation. If not explicitly specified the filter applies
  8965. empty parameters.
  8966. @item size, s
  8967. Set the video size. For the syntax of this option, check the
  8968. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8969. @item in_color_matrix
  8970. @item out_color_matrix
  8971. Set in/output YCbCr color space type.
  8972. This allows the autodetected value to be overridden as well as allows forcing
  8973. a specific value used for the output and encoder.
  8974. If not specified, the color space type depends on the pixel format.
  8975. Possible values:
  8976. @table @samp
  8977. @item auto
  8978. Choose automatically.
  8979. @item bt709
  8980. Format conforming to International Telecommunication Union (ITU)
  8981. Recommendation BT.709.
  8982. @item fcc
  8983. Set color space conforming to the United States Federal Communications
  8984. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  8985. @item bt601
  8986. Set color space conforming to:
  8987. @itemize
  8988. @item
  8989. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  8990. @item
  8991. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  8992. @item
  8993. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  8994. @end itemize
  8995. @item smpte240m
  8996. Set color space conforming to SMPTE ST 240:1999.
  8997. @end table
  8998. @item in_range
  8999. @item out_range
  9000. Set in/output YCbCr sample range.
  9001. This allows the autodetected value to be overridden as well as allows forcing
  9002. a specific value used for the output and encoder. If not specified, the
  9003. range depends on the pixel format. Possible values:
  9004. @table @samp
  9005. @item auto
  9006. Choose automatically.
  9007. @item jpeg/full/pc
  9008. Set full range (0-255 in case of 8-bit luma).
  9009. @item mpeg/tv
  9010. Set "MPEG" range (16-235 in case of 8-bit luma).
  9011. @end table
  9012. @item force_original_aspect_ratio
  9013. Enable decreasing or increasing output video width or height if necessary to
  9014. keep the original aspect ratio. Possible values:
  9015. @table @samp
  9016. @item disable
  9017. Scale the video as specified and disable this feature.
  9018. @item decrease
  9019. The output video dimensions will automatically be decreased if needed.
  9020. @item increase
  9021. The output video dimensions will automatically be increased if needed.
  9022. @end table
  9023. One useful instance of this option is that when you know a specific device's
  9024. maximum allowed resolution, you can use this to limit the output video to
  9025. that, while retaining the aspect ratio. For example, device A allows
  9026. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  9027. decrease) and specifying 1280x720 to the command line makes the output
  9028. 1280x533.
  9029. Please note that this is a different thing than specifying -1 for @option{w}
  9030. or @option{h}, you still need to specify the output resolution for this option
  9031. to work.
  9032. @end table
  9033. The values of the @option{w} and @option{h} options are expressions
  9034. containing the following constants:
  9035. @table @var
  9036. @item in_w
  9037. @item in_h
  9038. The input width and height
  9039. @item iw
  9040. @item ih
  9041. These are the same as @var{in_w} and @var{in_h}.
  9042. @item out_w
  9043. @item out_h
  9044. The output (scaled) width and height
  9045. @item ow
  9046. @item oh
  9047. These are the same as @var{out_w} and @var{out_h}
  9048. @item a
  9049. The same as @var{iw} / @var{ih}
  9050. @item sar
  9051. input sample aspect ratio
  9052. @item dar
  9053. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  9054. @item hsub
  9055. @item vsub
  9056. horizontal and vertical input chroma subsample values. For example for the
  9057. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9058. @item ohsub
  9059. @item ovsub
  9060. horizontal and vertical output chroma subsample values. For example for the
  9061. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9062. @end table
  9063. @subsection Examples
  9064. @itemize
  9065. @item
  9066. Scale the input video to a size of 200x100
  9067. @example
  9068. scale=w=200:h=100
  9069. @end example
  9070. This is equivalent to:
  9071. @example
  9072. scale=200:100
  9073. @end example
  9074. or:
  9075. @example
  9076. scale=200x100
  9077. @end example
  9078. @item
  9079. Specify a size abbreviation for the output size:
  9080. @example
  9081. scale=qcif
  9082. @end example
  9083. which can also be written as:
  9084. @example
  9085. scale=size=qcif
  9086. @end example
  9087. @item
  9088. Scale the input to 2x:
  9089. @example
  9090. scale=w=2*iw:h=2*ih
  9091. @end example
  9092. @item
  9093. The above is the same as:
  9094. @example
  9095. scale=2*in_w:2*in_h
  9096. @end example
  9097. @item
  9098. Scale the input to 2x with forced interlaced scaling:
  9099. @example
  9100. scale=2*iw:2*ih:interl=1
  9101. @end example
  9102. @item
  9103. Scale the input to half size:
  9104. @example
  9105. scale=w=iw/2:h=ih/2
  9106. @end example
  9107. @item
  9108. Increase the width, and set the height to the same size:
  9109. @example
  9110. scale=3/2*iw:ow
  9111. @end example
  9112. @item
  9113. Seek Greek harmony:
  9114. @example
  9115. scale=iw:1/PHI*iw
  9116. scale=ih*PHI:ih
  9117. @end example
  9118. @item
  9119. Increase the height, and set the width to 3/2 of the height:
  9120. @example
  9121. scale=w=3/2*oh:h=3/5*ih
  9122. @end example
  9123. @item
  9124. Increase the size, making the size a multiple of the chroma
  9125. subsample values:
  9126. @example
  9127. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  9128. @end example
  9129. @item
  9130. Increase the width to a maximum of 500 pixels,
  9131. keeping the same aspect ratio as the input:
  9132. @example
  9133. scale=w='min(500\, iw*3/2):h=-1'
  9134. @end example
  9135. @end itemize
  9136. @subsection Commands
  9137. This filter supports the following commands:
  9138. @table @option
  9139. @item width, w
  9140. @item height, h
  9141. Set the output video dimension expression.
  9142. The command accepts the same syntax of the corresponding option.
  9143. If the specified expression is not valid, it is kept at its current
  9144. value.
  9145. @end table
  9146. @section scale_npp
  9147. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  9148. format conversion on CUDA video frames. Setting the output width and height
  9149. works in the same way as for the @var{scale} filter.
  9150. The following additional options are accepted:
  9151. @table @option
  9152. @item format
  9153. The pixel format of the output CUDA frames. If set to the string "same" (the
  9154. default), the input format will be kept. Note that automatic format negotiation
  9155. and conversion is not yet supported for hardware frames
  9156. @item interp_algo
  9157. The interpolation algorithm used for resizing. One of the following:
  9158. @table @option
  9159. @item nn
  9160. Nearest neighbour.
  9161. @item linear
  9162. @item cubic
  9163. @item cubic2p_bspline
  9164. 2-parameter cubic (B=1, C=0)
  9165. @item cubic2p_catmullrom
  9166. 2-parameter cubic (B=0, C=1/2)
  9167. @item cubic2p_b05c03
  9168. 2-parameter cubic (B=1/2, C=3/10)
  9169. @item super
  9170. Supersampling
  9171. @item lanczos
  9172. @end table
  9173. @end table
  9174. @section scale2ref
  9175. Scale (resize) the input video, based on a reference video.
  9176. See the scale filter for available options, scale2ref supports the same but
  9177. uses the reference video instead of the main input as basis.
  9178. @subsection Examples
  9179. @itemize
  9180. @item
  9181. Scale a subtitle stream to match the main video in size before overlaying
  9182. @example
  9183. 'scale2ref[b][a];[a][b]overlay'
  9184. @end example
  9185. @end itemize
  9186. @anchor{selectivecolor}
  9187. @section selectivecolor
  9188. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  9189. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  9190. by the "purity" of the color (that is, how saturated it already is).
  9191. This filter is similar to the Adobe Photoshop Selective Color tool.
  9192. The filter accepts the following options:
  9193. @table @option
  9194. @item correction_method
  9195. Select color correction method.
  9196. Available values are:
  9197. @table @samp
  9198. @item absolute
  9199. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  9200. component value).
  9201. @item relative
  9202. Specified adjustments are relative to the original component value.
  9203. @end table
  9204. Default is @code{absolute}.
  9205. @item reds
  9206. Adjustments for red pixels (pixels where the red component is the maximum)
  9207. @item yellows
  9208. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  9209. @item greens
  9210. Adjustments for green pixels (pixels where the green component is the maximum)
  9211. @item cyans
  9212. Adjustments for cyan pixels (pixels where the red component is the minimum)
  9213. @item blues
  9214. Adjustments for blue pixels (pixels where the blue component is the maximum)
  9215. @item magentas
  9216. Adjustments for magenta pixels (pixels where the green component is the minimum)
  9217. @item whites
  9218. Adjustments for white pixels (pixels where all components are greater than 128)
  9219. @item neutrals
  9220. Adjustments for all pixels except pure black and pure white
  9221. @item blacks
  9222. Adjustments for black pixels (pixels where all components are lesser than 128)
  9223. @item psfile
  9224. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  9225. @end table
  9226. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  9227. 4 space separated floating point adjustment values in the [-1,1] range,
  9228. respectively to adjust the amount of cyan, magenta, yellow and black for the
  9229. pixels of its range.
  9230. @subsection Examples
  9231. @itemize
  9232. @item
  9233. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  9234. increase magenta by 27% in blue areas:
  9235. @example
  9236. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  9237. @end example
  9238. @item
  9239. Use a Photoshop selective color preset:
  9240. @example
  9241. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  9242. @end example
  9243. @end itemize
  9244. @anchor{separatefields}
  9245. @section separatefields
  9246. The @code{separatefields} takes a frame-based video input and splits
  9247. each frame into its components fields, producing a new half height clip
  9248. with twice the frame rate and twice the frame count.
  9249. This filter use field-dominance information in frame to decide which
  9250. of each pair of fields to place first in the output.
  9251. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  9252. @section setdar, setsar
  9253. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  9254. output video.
  9255. This is done by changing the specified Sample (aka Pixel) Aspect
  9256. Ratio, according to the following equation:
  9257. @example
  9258. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  9259. @end example
  9260. Keep in mind that the @code{setdar} filter does not modify the pixel
  9261. dimensions of the video frame. Also, the display aspect ratio set by
  9262. this filter may be changed by later filters in the filterchain,
  9263. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  9264. applied.
  9265. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  9266. the filter output video.
  9267. Note that as a consequence of the application of this filter, the
  9268. output display aspect ratio will change according to the equation
  9269. above.
  9270. Keep in mind that the sample aspect ratio set by the @code{setsar}
  9271. filter may be changed by later filters in the filterchain, e.g. if
  9272. another "setsar" or a "setdar" filter is applied.
  9273. It accepts the following parameters:
  9274. @table @option
  9275. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  9276. Set the aspect ratio used by the filter.
  9277. The parameter can be a floating point number string, an expression, or
  9278. a string of the form @var{num}:@var{den}, where @var{num} and
  9279. @var{den} are the numerator and denominator of the aspect ratio. If
  9280. the parameter is not specified, it is assumed the value "0".
  9281. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  9282. should be escaped.
  9283. @item max
  9284. Set the maximum integer value to use for expressing numerator and
  9285. denominator when reducing the expressed aspect ratio to a rational.
  9286. Default value is @code{100}.
  9287. @end table
  9288. The parameter @var{sar} is an expression containing
  9289. the following constants:
  9290. @table @option
  9291. @item E, PI, PHI
  9292. These are approximated values for the mathematical constants e
  9293. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  9294. @item w, h
  9295. The input width and height.
  9296. @item a
  9297. These are the same as @var{w} / @var{h}.
  9298. @item sar
  9299. The input sample aspect ratio.
  9300. @item dar
  9301. The input display aspect ratio. It is the same as
  9302. (@var{w} / @var{h}) * @var{sar}.
  9303. @item hsub, vsub
  9304. Horizontal and vertical chroma subsample values. For example, for the
  9305. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9306. @end table
  9307. @subsection Examples
  9308. @itemize
  9309. @item
  9310. To change the display aspect ratio to 16:9, specify one of the following:
  9311. @example
  9312. setdar=dar=1.77777
  9313. setdar=dar=16/9
  9314. @end example
  9315. @item
  9316. To change the sample aspect ratio to 10:11, specify:
  9317. @example
  9318. setsar=sar=10/11
  9319. @end example
  9320. @item
  9321. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  9322. 1000 in the aspect ratio reduction, use the command:
  9323. @example
  9324. setdar=ratio=16/9:max=1000
  9325. @end example
  9326. @end itemize
  9327. @anchor{setfield}
  9328. @section setfield
  9329. Force field for the output video frame.
  9330. The @code{setfield} filter marks the interlace type field for the
  9331. output frames. It does not change the input frame, but only sets the
  9332. corresponding property, which affects how the frame is treated by
  9333. following filters (e.g. @code{fieldorder} or @code{yadif}).
  9334. The filter accepts the following options:
  9335. @table @option
  9336. @item mode
  9337. Available values are:
  9338. @table @samp
  9339. @item auto
  9340. Keep the same field property.
  9341. @item bff
  9342. Mark the frame as bottom-field-first.
  9343. @item tff
  9344. Mark the frame as top-field-first.
  9345. @item prog
  9346. Mark the frame as progressive.
  9347. @end table
  9348. @end table
  9349. @section showinfo
  9350. Show a line containing various information for each input video frame.
  9351. The input video is not modified.
  9352. The shown line contains a sequence of key/value pairs of the form
  9353. @var{key}:@var{value}.
  9354. The following values are shown in the output:
  9355. @table @option
  9356. @item n
  9357. The (sequential) number of the input frame, starting from 0.
  9358. @item pts
  9359. The Presentation TimeStamp of the input frame, expressed as a number of
  9360. time base units. The time base unit depends on the filter input pad.
  9361. @item pts_time
  9362. The Presentation TimeStamp of the input frame, expressed as a number of
  9363. seconds.
  9364. @item pos
  9365. The position of the frame in the input stream, or -1 if this information is
  9366. unavailable and/or meaningless (for example in case of synthetic video).
  9367. @item fmt
  9368. The pixel format name.
  9369. @item sar
  9370. The sample aspect ratio of the input frame, expressed in the form
  9371. @var{num}/@var{den}.
  9372. @item s
  9373. The size of the input frame. For the syntax of this option, check the
  9374. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9375. @item i
  9376. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  9377. for bottom field first).
  9378. @item iskey
  9379. This is 1 if the frame is a key frame, 0 otherwise.
  9380. @item type
  9381. The picture type of the input frame ("I" for an I-frame, "P" for a
  9382. P-frame, "B" for a B-frame, or "?" for an unknown type).
  9383. Also refer to the documentation of the @code{AVPictureType} enum and of
  9384. the @code{av_get_picture_type_char} function defined in
  9385. @file{libavutil/avutil.h}.
  9386. @item checksum
  9387. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  9388. @item plane_checksum
  9389. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  9390. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  9391. @end table
  9392. @section showpalette
  9393. Displays the 256 colors palette of each frame. This filter is only relevant for
  9394. @var{pal8} pixel format frames.
  9395. It accepts the following option:
  9396. @table @option
  9397. @item s
  9398. Set the size of the box used to represent one palette color entry. Default is
  9399. @code{30} (for a @code{30x30} pixel box).
  9400. @end table
  9401. @section shuffleframes
  9402. Reorder and/or duplicate video frames.
  9403. It accepts the following parameters:
  9404. @table @option
  9405. @item mapping
  9406. Set the destination indexes of input frames.
  9407. This is space or '|' separated list of indexes that maps input frames to output
  9408. frames. Number of indexes also sets maximal value that each index may have.
  9409. @end table
  9410. The first frame has the index 0. The default is to keep the input unchanged.
  9411. @subsection Examples
  9412. @itemize
  9413. @item
  9414. Swap second and third frame of every three frames of the input:
  9415. @example
  9416. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  9417. @end example
  9418. @item
  9419. Swap 10th and 1st frame of every ten frames of the input:
  9420. @example
  9421. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  9422. @end example
  9423. @end itemize
  9424. @section shuffleplanes
  9425. Reorder and/or duplicate video planes.
  9426. It accepts the following parameters:
  9427. @table @option
  9428. @item map0
  9429. The index of the input plane to be used as the first output plane.
  9430. @item map1
  9431. The index of the input plane to be used as the second output plane.
  9432. @item map2
  9433. The index of the input plane to be used as the third output plane.
  9434. @item map3
  9435. The index of the input plane to be used as the fourth output plane.
  9436. @end table
  9437. The first plane has the index 0. The default is to keep the input unchanged.
  9438. @subsection Examples
  9439. @itemize
  9440. @item
  9441. Swap the second and third planes of the input:
  9442. @example
  9443. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  9444. @end example
  9445. @end itemize
  9446. @anchor{signalstats}
  9447. @section signalstats
  9448. Evaluate various visual metrics that assist in determining issues associated
  9449. with the digitization of analog video media.
  9450. By default the filter will log these metadata values:
  9451. @table @option
  9452. @item YMIN
  9453. Display the minimal Y value contained within the input frame. Expressed in
  9454. range of [0-255].
  9455. @item YLOW
  9456. Display the Y value at the 10% percentile within the input frame. Expressed in
  9457. range of [0-255].
  9458. @item YAVG
  9459. Display the average Y value within the input frame. Expressed in range of
  9460. [0-255].
  9461. @item YHIGH
  9462. Display the Y value at the 90% percentile within the input frame. Expressed in
  9463. range of [0-255].
  9464. @item YMAX
  9465. Display the maximum Y value contained within the input frame. Expressed in
  9466. range of [0-255].
  9467. @item UMIN
  9468. Display the minimal U value contained within the input frame. Expressed in
  9469. range of [0-255].
  9470. @item ULOW
  9471. Display the U value at the 10% percentile within the input frame. Expressed in
  9472. range of [0-255].
  9473. @item UAVG
  9474. Display the average U value within the input frame. Expressed in range of
  9475. [0-255].
  9476. @item UHIGH
  9477. Display the U value at the 90% percentile within the input frame. Expressed in
  9478. range of [0-255].
  9479. @item UMAX
  9480. Display the maximum U value contained within the input frame. Expressed in
  9481. range of [0-255].
  9482. @item VMIN
  9483. Display the minimal V value contained within the input frame. Expressed in
  9484. range of [0-255].
  9485. @item VLOW
  9486. Display the V value at the 10% percentile within the input frame. Expressed in
  9487. range of [0-255].
  9488. @item VAVG
  9489. Display the average V value within the input frame. Expressed in range of
  9490. [0-255].
  9491. @item VHIGH
  9492. Display the V value at the 90% percentile within the input frame. Expressed in
  9493. range of [0-255].
  9494. @item VMAX
  9495. Display the maximum V value contained within the input frame. Expressed in
  9496. range of [0-255].
  9497. @item SATMIN
  9498. Display the minimal saturation value contained within the input frame.
  9499. Expressed in range of [0-~181.02].
  9500. @item SATLOW
  9501. Display the saturation value at the 10% percentile within the input frame.
  9502. Expressed in range of [0-~181.02].
  9503. @item SATAVG
  9504. Display the average saturation value within the input frame. Expressed in range
  9505. of [0-~181.02].
  9506. @item SATHIGH
  9507. Display the saturation value at the 90% percentile within the input frame.
  9508. Expressed in range of [0-~181.02].
  9509. @item SATMAX
  9510. Display the maximum saturation value contained within the input frame.
  9511. Expressed in range of [0-~181.02].
  9512. @item HUEMED
  9513. Display the median value for hue within the input frame. Expressed in range of
  9514. [0-360].
  9515. @item HUEAVG
  9516. Display the average value for hue within the input frame. Expressed in range of
  9517. [0-360].
  9518. @item YDIF
  9519. Display the average of sample value difference between all values of the Y
  9520. plane in the current frame and corresponding values of the previous input frame.
  9521. Expressed in range of [0-255].
  9522. @item UDIF
  9523. Display the average of sample value difference between all values of the U
  9524. plane in the current frame and corresponding values of the previous input frame.
  9525. Expressed in range of [0-255].
  9526. @item VDIF
  9527. Display the average of sample value difference between all values of the V
  9528. plane in the current frame and corresponding values of the previous input frame.
  9529. Expressed in range of [0-255].
  9530. @item YBITDEPTH
  9531. Display bit depth of Y plane in current frame.
  9532. Expressed in range of [0-16].
  9533. @item UBITDEPTH
  9534. Display bit depth of U plane in current frame.
  9535. Expressed in range of [0-16].
  9536. @item VBITDEPTH
  9537. Display bit depth of V plane in current frame.
  9538. Expressed in range of [0-16].
  9539. @end table
  9540. The filter accepts the following options:
  9541. @table @option
  9542. @item stat
  9543. @item out
  9544. @option{stat} specify an additional form of image analysis.
  9545. @option{out} output video with the specified type of pixel highlighted.
  9546. Both options accept the following values:
  9547. @table @samp
  9548. @item tout
  9549. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  9550. unlike the neighboring pixels of the same field. Examples of temporal outliers
  9551. include the results of video dropouts, head clogs, or tape tracking issues.
  9552. @item vrep
  9553. Identify @var{vertical line repetition}. Vertical line repetition includes
  9554. similar rows of pixels within a frame. In born-digital video vertical line
  9555. repetition is common, but this pattern is uncommon in video digitized from an
  9556. analog source. When it occurs in video that results from the digitization of an
  9557. analog source it can indicate concealment from a dropout compensator.
  9558. @item brng
  9559. Identify pixels that fall outside of legal broadcast range.
  9560. @end table
  9561. @item color, c
  9562. Set the highlight color for the @option{out} option. The default color is
  9563. yellow.
  9564. @end table
  9565. @subsection Examples
  9566. @itemize
  9567. @item
  9568. Output data of various video metrics:
  9569. @example
  9570. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  9571. @end example
  9572. @item
  9573. Output specific data about the minimum and maximum values of the Y plane per frame:
  9574. @example
  9575. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  9576. @end example
  9577. @item
  9578. Playback video while highlighting pixels that are outside of broadcast range in red.
  9579. @example
  9580. ffplay example.mov -vf signalstats="out=brng:color=red"
  9581. @end example
  9582. @item
  9583. Playback video with signalstats metadata drawn over the frame.
  9584. @example
  9585. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  9586. @end example
  9587. The contents of signalstat_drawtext.txt used in the command are:
  9588. @example
  9589. time %@{pts:hms@}
  9590. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  9591. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  9592. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  9593. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  9594. @end example
  9595. @end itemize
  9596. @anchor{smartblur}
  9597. @section smartblur
  9598. Blur the input video without impacting the outlines.
  9599. It accepts the following options:
  9600. @table @option
  9601. @item luma_radius, lr
  9602. Set the luma radius. The option value must be a float number in
  9603. the range [0.1,5.0] that specifies the variance of the gaussian filter
  9604. used to blur the image (slower if larger). Default value is 1.0.
  9605. @item luma_strength, ls
  9606. Set the luma strength. The option value must be a float number
  9607. in the range [-1.0,1.0] that configures the blurring. A value included
  9608. in [0.0,1.0] will blur the image whereas a value included in
  9609. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  9610. @item luma_threshold, lt
  9611. Set the luma threshold used as a coefficient to determine
  9612. whether a pixel should be blurred or not. The option value must be an
  9613. integer in the range [-30,30]. A value of 0 will filter all the image,
  9614. a value included in [0,30] will filter flat areas and a value included
  9615. in [-30,0] will filter edges. Default value is 0.
  9616. @item chroma_radius, cr
  9617. Set the chroma radius. The option value must be a float number in
  9618. the range [0.1,5.0] that specifies the variance of the gaussian filter
  9619. used to blur the image (slower if larger). Default value is 1.0.
  9620. @item chroma_strength, cs
  9621. Set the chroma strength. The option value must be a float number
  9622. in the range [-1.0,1.0] that configures the blurring. A value included
  9623. in [0.0,1.0] will blur the image whereas a value included in
  9624. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  9625. @item chroma_threshold, ct
  9626. Set the chroma threshold used as a coefficient to determine
  9627. whether a pixel should be blurred or not. The option value must be an
  9628. integer in the range [-30,30]. A value of 0 will filter all the image,
  9629. a value included in [0,30] will filter flat areas and a value included
  9630. in [-30,0] will filter edges. Default value is 0.
  9631. @end table
  9632. If a chroma option is not explicitly set, the corresponding luma value
  9633. is set.
  9634. @section ssim
  9635. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  9636. This filter takes in input two input videos, the first input is
  9637. considered the "main" source and is passed unchanged to the
  9638. output. The second input is used as a "reference" video for computing
  9639. the SSIM.
  9640. Both video inputs must have the same resolution and pixel format for
  9641. this filter to work correctly. Also it assumes that both inputs
  9642. have the same number of frames, which are compared one by one.
  9643. The filter stores the calculated SSIM of each frame.
  9644. The description of the accepted parameters follows.
  9645. @table @option
  9646. @item stats_file, f
  9647. If specified the filter will use the named file to save the SSIM of
  9648. each individual frame. When filename equals "-" the data is sent to
  9649. standard output.
  9650. @end table
  9651. The file printed if @var{stats_file} is selected, contains a sequence of
  9652. key/value pairs of the form @var{key}:@var{value} for each compared
  9653. couple of frames.
  9654. A description of each shown parameter follows:
  9655. @table @option
  9656. @item n
  9657. sequential number of the input frame, starting from 1
  9658. @item Y, U, V, R, G, B
  9659. SSIM of the compared frames for the component specified by the suffix.
  9660. @item All
  9661. SSIM of the compared frames for the whole frame.
  9662. @item dB
  9663. Same as above but in dB representation.
  9664. @end table
  9665. For example:
  9666. @example
  9667. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  9668. [main][ref] ssim="stats_file=stats.log" [out]
  9669. @end example
  9670. On this example the input file being processed is compared with the
  9671. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  9672. is stored in @file{stats.log}.
  9673. Another example with both psnr and ssim at same time:
  9674. @example
  9675. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  9676. @end example
  9677. @section stereo3d
  9678. Convert between different stereoscopic image formats.
  9679. The filters accept the following options:
  9680. @table @option
  9681. @item in
  9682. Set stereoscopic image format of input.
  9683. Available values for input image formats are:
  9684. @table @samp
  9685. @item sbsl
  9686. side by side parallel (left eye left, right eye right)
  9687. @item sbsr
  9688. side by side crosseye (right eye left, left eye right)
  9689. @item sbs2l
  9690. side by side parallel with half width resolution
  9691. (left eye left, right eye right)
  9692. @item sbs2r
  9693. side by side crosseye with half width resolution
  9694. (right eye left, left eye right)
  9695. @item abl
  9696. above-below (left eye above, right eye below)
  9697. @item abr
  9698. above-below (right eye above, left eye below)
  9699. @item ab2l
  9700. above-below with half height resolution
  9701. (left eye above, right eye below)
  9702. @item ab2r
  9703. above-below with half height resolution
  9704. (right eye above, left eye below)
  9705. @item al
  9706. alternating frames (left eye first, right eye second)
  9707. @item ar
  9708. alternating frames (right eye first, left eye second)
  9709. @item irl
  9710. interleaved rows (left eye has top row, right eye starts on next row)
  9711. @item irr
  9712. interleaved rows (right eye has top row, left eye starts on next row)
  9713. @item icl
  9714. interleaved columns, left eye first
  9715. @item icr
  9716. interleaved columns, right eye first
  9717. Default value is @samp{sbsl}.
  9718. @end table
  9719. @item out
  9720. Set stereoscopic image format of output.
  9721. @table @samp
  9722. @item sbsl
  9723. side by side parallel (left eye left, right eye right)
  9724. @item sbsr
  9725. side by side crosseye (right eye left, left eye right)
  9726. @item sbs2l
  9727. side by side parallel with half width resolution
  9728. (left eye left, right eye right)
  9729. @item sbs2r
  9730. side by side crosseye with half width resolution
  9731. (right eye left, left eye right)
  9732. @item abl
  9733. above-below (left eye above, right eye below)
  9734. @item abr
  9735. above-below (right eye above, left eye below)
  9736. @item ab2l
  9737. above-below with half height resolution
  9738. (left eye above, right eye below)
  9739. @item ab2r
  9740. above-below with half height resolution
  9741. (right eye above, left eye below)
  9742. @item al
  9743. alternating frames (left eye first, right eye second)
  9744. @item ar
  9745. alternating frames (right eye first, left eye second)
  9746. @item irl
  9747. interleaved rows (left eye has top row, right eye starts on next row)
  9748. @item irr
  9749. interleaved rows (right eye has top row, left eye starts on next row)
  9750. @item arbg
  9751. anaglyph red/blue gray
  9752. (red filter on left eye, blue filter on right eye)
  9753. @item argg
  9754. anaglyph red/green gray
  9755. (red filter on left eye, green filter on right eye)
  9756. @item arcg
  9757. anaglyph red/cyan gray
  9758. (red filter on left eye, cyan filter on right eye)
  9759. @item arch
  9760. anaglyph red/cyan half colored
  9761. (red filter on left eye, cyan filter on right eye)
  9762. @item arcc
  9763. anaglyph red/cyan color
  9764. (red filter on left eye, cyan filter on right eye)
  9765. @item arcd
  9766. anaglyph red/cyan color optimized with the least squares projection of dubois
  9767. (red filter on left eye, cyan filter on right eye)
  9768. @item agmg
  9769. anaglyph green/magenta gray
  9770. (green filter on left eye, magenta filter on right eye)
  9771. @item agmh
  9772. anaglyph green/magenta half colored
  9773. (green filter on left eye, magenta filter on right eye)
  9774. @item agmc
  9775. anaglyph green/magenta colored
  9776. (green filter on left eye, magenta filter on right eye)
  9777. @item agmd
  9778. anaglyph green/magenta color optimized with the least squares projection of dubois
  9779. (green filter on left eye, magenta filter on right eye)
  9780. @item aybg
  9781. anaglyph yellow/blue gray
  9782. (yellow filter on left eye, blue filter on right eye)
  9783. @item aybh
  9784. anaglyph yellow/blue half colored
  9785. (yellow filter on left eye, blue filter on right eye)
  9786. @item aybc
  9787. anaglyph yellow/blue colored
  9788. (yellow filter on left eye, blue filter on right eye)
  9789. @item aybd
  9790. anaglyph yellow/blue color optimized with the least squares projection of dubois
  9791. (yellow filter on left eye, blue filter on right eye)
  9792. @item ml
  9793. mono output (left eye only)
  9794. @item mr
  9795. mono output (right eye only)
  9796. @item chl
  9797. checkerboard, left eye first
  9798. @item chr
  9799. checkerboard, right eye first
  9800. @item icl
  9801. interleaved columns, left eye first
  9802. @item icr
  9803. interleaved columns, right eye first
  9804. @item hdmi
  9805. HDMI frame pack
  9806. @end table
  9807. Default value is @samp{arcd}.
  9808. @end table
  9809. @subsection Examples
  9810. @itemize
  9811. @item
  9812. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  9813. @example
  9814. stereo3d=sbsl:aybd
  9815. @end example
  9816. @item
  9817. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  9818. @example
  9819. stereo3d=abl:sbsr
  9820. @end example
  9821. @end itemize
  9822. @section streamselect, astreamselect
  9823. Select video or audio streams.
  9824. The filter accepts the following options:
  9825. @table @option
  9826. @item inputs
  9827. Set number of inputs. Default is 2.
  9828. @item map
  9829. Set input indexes to remap to outputs.
  9830. @end table
  9831. @subsection Commands
  9832. The @code{streamselect} and @code{astreamselect} filter supports the following
  9833. commands:
  9834. @table @option
  9835. @item map
  9836. Set input indexes to remap to outputs.
  9837. @end table
  9838. @subsection Examples
  9839. @itemize
  9840. @item
  9841. Select first 5 seconds 1st stream and rest of time 2nd stream:
  9842. @example
  9843. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  9844. @end example
  9845. @item
  9846. Same as above, but for audio:
  9847. @example
  9848. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  9849. @end example
  9850. @end itemize
  9851. @section sobel
  9852. Apply sobel operator to input video stream.
  9853. The filter accepts the following option:
  9854. @table @option
  9855. @item planes
  9856. Set which planes will be processed, unprocessed planes will be copied.
  9857. By default value 0xf, all planes will be processed.
  9858. @item scale
  9859. Set value which will be multiplied with filtered result.
  9860. @item delta
  9861. Set value which will be added to filtered result.
  9862. @end table
  9863. @anchor{spp}
  9864. @section spp
  9865. Apply a simple postprocessing filter that compresses and decompresses the image
  9866. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  9867. and average the results.
  9868. The filter accepts the following options:
  9869. @table @option
  9870. @item quality
  9871. Set quality. This option defines the number of levels for averaging. It accepts
  9872. an integer in the range 0-6. If set to @code{0}, the filter will have no
  9873. effect. A value of @code{6} means the higher quality. For each increment of
  9874. that value the speed drops by a factor of approximately 2. Default value is
  9875. @code{3}.
  9876. @item qp
  9877. Force a constant quantization parameter. If not set, the filter will use the QP
  9878. from the video stream (if available).
  9879. @item mode
  9880. Set thresholding mode. Available modes are:
  9881. @table @samp
  9882. @item hard
  9883. Set hard thresholding (default).
  9884. @item soft
  9885. Set soft thresholding (better de-ringing effect, but likely blurrier).
  9886. @end table
  9887. @item use_bframe_qp
  9888. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  9889. option may cause flicker since the B-Frames have often larger QP. Default is
  9890. @code{0} (not enabled).
  9891. @end table
  9892. @anchor{subtitles}
  9893. @section subtitles
  9894. Draw subtitles on top of input video using the libass library.
  9895. To enable compilation of this filter you need to configure FFmpeg with
  9896. @code{--enable-libass}. This filter also requires a build with libavcodec and
  9897. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  9898. Alpha) subtitles format.
  9899. The filter accepts the following options:
  9900. @table @option
  9901. @item filename, f
  9902. Set the filename of the subtitle file to read. It must be specified.
  9903. @item original_size
  9904. Specify the size of the original video, the video for which the ASS file
  9905. was composed. For the syntax of this option, check the
  9906. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9907. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  9908. correctly scale the fonts if the aspect ratio has been changed.
  9909. @item fontsdir
  9910. Set a directory path containing fonts that can be used by the filter.
  9911. These fonts will be used in addition to whatever the font provider uses.
  9912. @item charenc
  9913. Set subtitles input character encoding. @code{subtitles} filter only. Only
  9914. useful if not UTF-8.
  9915. @item stream_index, si
  9916. Set subtitles stream index. @code{subtitles} filter only.
  9917. @item force_style
  9918. Override default style or script info parameters of the subtitles. It accepts a
  9919. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  9920. @end table
  9921. If the first key is not specified, it is assumed that the first value
  9922. specifies the @option{filename}.
  9923. For example, to render the file @file{sub.srt} on top of the input
  9924. video, use the command:
  9925. @example
  9926. subtitles=sub.srt
  9927. @end example
  9928. which is equivalent to:
  9929. @example
  9930. subtitles=filename=sub.srt
  9931. @end example
  9932. To render the default subtitles stream from file @file{video.mkv}, use:
  9933. @example
  9934. subtitles=video.mkv
  9935. @end example
  9936. To render the second subtitles stream from that file, use:
  9937. @example
  9938. subtitles=video.mkv:si=1
  9939. @end example
  9940. To make the subtitles stream from @file{sub.srt} appear in transparent green
  9941. @code{DejaVu Serif}, use:
  9942. @example
  9943. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  9944. @end example
  9945. @section super2xsai
  9946. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  9947. Interpolate) pixel art scaling algorithm.
  9948. Useful for enlarging pixel art images without reducing sharpness.
  9949. @section swaprect
  9950. Swap two rectangular objects in video.
  9951. This filter accepts the following options:
  9952. @table @option
  9953. @item w
  9954. Set object width.
  9955. @item h
  9956. Set object height.
  9957. @item x1
  9958. Set 1st rect x coordinate.
  9959. @item y1
  9960. Set 1st rect y coordinate.
  9961. @item x2
  9962. Set 2nd rect x coordinate.
  9963. @item y2
  9964. Set 2nd rect y coordinate.
  9965. All expressions are evaluated once for each frame.
  9966. @end table
  9967. The all options are expressions containing the following constants:
  9968. @table @option
  9969. @item w
  9970. @item h
  9971. The input width and height.
  9972. @item a
  9973. same as @var{w} / @var{h}
  9974. @item sar
  9975. input sample aspect ratio
  9976. @item dar
  9977. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  9978. @item n
  9979. The number of the input frame, starting from 0.
  9980. @item t
  9981. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  9982. @item pos
  9983. the position in the file of the input frame, NAN if unknown
  9984. @end table
  9985. @section swapuv
  9986. Swap U & V plane.
  9987. @section telecine
  9988. Apply telecine process to the video.
  9989. This filter accepts the following options:
  9990. @table @option
  9991. @item first_field
  9992. @table @samp
  9993. @item top, t
  9994. top field first
  9995. @item bottom, b
  9996. bottom field first
  9997. The default value is @code{top}.
  9998. @end table
  9999. @item pattern
  10000. A string of numbers representing the pulldown pattern you wish to apply.
  10001. The default value is @code{23}.
  10002. @end table
  10003. @example
  10004. Some typical patterns:
  10005. NTSC output (30i):
  10006. 27.5p: 32222
  10007. 24p: 23 (classic)
  10008. 24p: 2332 (preferred)
  10009. 20p: 33
  10010. 18p: 334
  10011. 16p: 3444
  10012. PAL output (25i):
  10013. 27.5p: 12222
  10014. 24p: 222222222223 ("Euro pulldown")
  10015. 16.67p: 33
  10016. 16p: 33333334
  10017. @end example
  10018. @section thumbnail
  10019. Select the most representative frame in a given sequence of consecutive frames.
  10020. The filter accepts the following options:
  10021. @table @option
  10022. @item n
  10023. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  10024. will pick one of them, and then handle the next batch of @var{n} frames until
  10025. the end. Default is @code{100}.
  10026. @end table
  10027. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  10028. value will result in a higher memory usage, so a high value is not recommended.
  10029. @subsection Examples
  10030. @itemize
  10031. @item
  10032. Extract one picture each 50 frames:
  10033. @example
  10034. thumbnail=50
  10035. @end example
  10036. @item
  10037. Complete example of a thumbnail creation with @command{ffmpeg}:
  10038. @example
  10039. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  10040. @end example
  10041. @end itemize
  10042. @section tile
  10043. Tile several successive frames together.
  10044. The filter accepts the following options:
  10045. @table @option
  10046. @item layout
  10047. Set the grid size (i.e. the number of lines and columns). For the syntax of
  10048. this option, check the
  10049. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10050. @item nb_frames
  10051. Set the maximum number of frames to render in the given area. It must be less
  10052. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  10053. the area will be used.
  10054. @item margin
  10055. Set the outer border margin in pixels.
  10056. @item padding
  10057. Set the inner border thickness (i.e. the number of pixels between frames). For
  10058. more advanced padding options (such as having different values for the edges),
  10059. refer to the pad video filter.
  10060. @item color
  10061. Specify the color of the unused area. For the syntax of this option, check the
  10062. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  10063. is "black".
  10064. @end table
  10065. @subsection Examples
  10066. @itemize
  10067. @item
  10068. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  10069. @example
  10070. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  10071. @end example
  10072. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  10073. duplicating each output frame to accommodate the originally detected frame
  10074. rate.
  10075. @item
  10076. Display @code{5} pictures in an area of @code{3x2} frames,
  10077. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  10078. mixed flat and named options:
  10079. @example
  10080. tile=3x2:nb_frames=5:padding=7:margin=2
  10081. @end example
  10082. @end itemize
  10083. @section tinterlace
  10084. Perform various types of temporal field interlacing.
  10085. Frames are counted starting from 1, so the first input frame is
  10086. considered odd.
  10087. The filter accepts the following options:
  10088. @table @option
  10089. @item mode
  10090. Specify the mode of the interlacing. This option can also be specified
  10091. as a value alone. See below for a list of values for this option.
  10092. Available values are:
  10093. @table @samp
  10094. @item merge, 0
  10095. Move odd frames into the upper field, even into the lower field,
  10096. generating a double height frame at half frame rate.
  10097. @example
  10098. ------> time
  10099. Input:
  10100. Frame 1 Frame 2 Frame 3 Frame 4
  10101. 11111 22222 33333 44444
  10102. 11111 22222 33333 44444
  10103. 11111 22222 33333 44444
  10104. 11111 22222 33333 44444
  10105. Output:
  10106. 11111 33333
  10107. 22222 44444
  10108. 11111 33333
  10109. 22222 44444
  10110. 11111 33333
  10111. 22222 44444
  10112. 11111 33333
  10113. 22222 44444
  10114. @end example
  10115. @item drop_even, 1
  10116. Only output odd frames, even frames are dropped, generating a frame with
  10117. unchanged height at half frame rate.
  10118. @example
  10119. ------> time
  10120. Input:
  10121. Frame 1 Frame 2 Frame 3 Frame 4
  10122. 11111 22222 33333 44444
  10123. 11111 22222 33333 44444
  10124. 11111 22222 33333 44444
  10125. 11111 22222 33333 44444
  10126. Output:
  10127. 11111 33333
  10128. 11111 33333
  10129. 11111 33333
  10130. 11111 33333
  10131. @end example
  10132. @item drop_odd, 2
  10133. Only output even frames, odd frames are dropped, generating a frame with
  10134. unchanged height at half frame rate.
  10135. @example
  10136. ------> time
  10137. Input:
  10138. Frame 1 Frame 2 Frame 3 Frame 4
  10139. 11111 22222 33333 44444
  10140. 11111 22222 33333 44444
  10141. 11111 22222 33333 44444
  10142. 11111 22222 33333 44444
  10143. Output:
  10144. 22222 44444
  10145. 22222 44444
  10146. 22222 44444
  10147. 22222 44444
  10148. @end example
  10149. @item pad, 3
  10150. Expand each frame to full height, but pad alternate lines with black,
  10151. generating a frame with double height at the same input frame rate.
  10152. @example
  10153. ------> time
  10154. Input:
  10155. Frame 1 Frame 2 Frame 3 Frame 4
  10156. 11111 22222 33333 44444
  10157. 11111 22222 33333 44444
  10158. 11111 22222 33333 44444
  10159. 11111 22222 33333 44444
  10160. Output:
  10161. 11111 ..... 33333 .....
  10162. ..... 22222 ..... 44444
  10163. 11111 ..... 33333 .....
  10164. ..... 22222 ..... 44444
  10165. 11111 ..... 33333 .....
  10166. ..... 22222 ..... 44444
  10167. 11111 ..... 33333 .....
  10168. ..... 22222 ..... 44444
  10169. @end example
  10170. @item interleave_top, 4
  10171. Interleave the upper field from odd frames with the lower field from
  10172. even frames, generating a frame with unchanged height at half frame rate.
  10173. @example
  10174. ------> time
  10175. Input:
  10176. Frame 1 Frame 2 Frame 3 Frame 4
  10177. 11111<- 22222 33333<- 44444
  10178. 11111 22222<- 33333 44444<-
  10179. 11111<- 22222 33333<- 44444
  10180. 11111 22222<- 33333 44444<-
  10181. Output:
  10182. 11111 33333
  10183. 22222 44444
  10184. 11111 33333
  10185. 22222 44444
  10186. @end example
  10187. @item interleave_bottom, 5
  10188. Interleave the lower field from odd frames with the upper field from
  10189. even frames, generating a frame with unchanged height at half frame rate.
  10190. @example
  10191. ------> time
  10192. Input:
  10193. Frame 1 Frame 2 Frame 3 Frame 4
  10194. 11111 22222<- 33333 44444<-
  10195. 11111<- 22222 33333<- 44444
  10196. 11111 22222<- 33333 44444<-
  10197. 11111<- 22222 33333<- 44444
  10198. Output:
  10199. 22222 44444
  10200. 11111 33333
  10201. 22222 44444
  10202. 11111 33333
  10203. @end example
  10204. @item interlacex2, 6
  10205. Double frame rate with unchanged height. Frames are inserted each
  10206. containing the second temporal field from the previous input frame and
  10207. the first temporal field from the next input frame. This mode relies on
  10208. the top_field_first flag. Useful for interlaced video displays with no
  10209. field synchronisation.
  10210. @example
  10211. ------> time
  10212. Input:
  10213. Frame 1 Frame 2 Frame 3 Frame 4
  10214. 11111 22222 33333 44444
  10215. 11111 22222 33333 44444
  10216. 11111 22222 33333 44444
  10217. 11111 22222 33333 44444
  10218. Output:
  10219. 11111 22222 22222 33333 33333 44444 44444
  10220. 11111 11111 22222 22222 33333 33333 44444
  10221. 11111 22222 22222 33333 33333 44444 44444
  10222. 11111 11111 22222 22222 33333 33333 44444
  10223. @end example
  10224. @item mergex2, 7
  10225. Move odd frames into the upper field, even into the lower field,
  10226. generating a double height frame at same frame rate.
  10227. @example
  10228. ------> time
  10229. Input:
  10230. Frame 1 Frame 2 Frame 3 Frame 4
  10231. 11111 22222 33333 44444
  10232. 11111 22222 33333 44444
  10233. 11111 22222 33333 44444
  10234. 11111 22222 33333 44444
  10235. Output:
  10236. 11111 33333 33333 55555
  10237. 22222 22222 44444 44444
  10238. 11111 33333 33333 55555
  10239. 22222 22222 44444 44444
  10240. 11111 33333 33333 55555
  10241. 22222 22222 44444 44444
  10242. 11111 33333 33333 55555
  10243. 22222 22222 44444 44444
  10244. @end example
  10245. @end table
  10246. Numeric values are deprecated but are accepted for backward
  10247. compatibility reasons.
  10248. Default mode is @code{merge}.
  10249. @item flags
  10250. Specify flags influencing the filter process.
  10251. Available value for @var{flags} is:
  10252. @table @option
  10253. @item low_pass_filter, vlfp
  10254. Enable vertical low-pass filtering in the filter.
  10255. Vertical low-pass filtering is required when creating an interlaced
  10256. destination from a progressive source which contains high-frequency
  10257. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  10258. patterning.
  10259. Vertical low-pass filtering can only be enabled for @option{mode}
  10260. @var{interleave_top} and @var{interleave_bottom}.
  10261. @end table
  10262. @end table
  10263. @section transpose
  10264. Transpose rows with columns in the input video and optionally flip it.
  10265. It accepts the following parameters:
  10266. @table @option
  10267. @item dir
  10268. Specify the transposition direction.
  10269. Can assume the following values:
  10270. @table @samp
  10271. @item 0, 4, cclock_flip
  10272. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  10273. @example
  10274. L.R L.l
  10275. . . -> . .
  10276. l.r R.r
  10277. @end example
  10278. @item 1, 5, clock
  10279. Rotate by 90 degrees clockwise, that is:
  10280. @example
  10281. L.R l.L
  10282. . . -> . .
  10283. l.r r.R
  10284. @end example
  10285. @item 2, 6, cclock
  10286. Rotate by 90 degrees counterclockwise, that is:
  10287. @example
  10288. L.R R.r
  10289. . . -> . .
  10290. l.r L.l
  10291. @end example
  10292. @item 3, 7, clock_flip
  10293. Rotate by 90 degrees clockwise and vertically flip, that is:
  10294. @example
  10295. L.R r.R
  10296. . . -> . .
  10297. l.r l.L
  10298. @end example
  10299. @end table
  10300. For values between 4-7, the transposition is only done if the input
  10301. video geometry is portrait and not landscape. These values are
  10302. deprecated, the @code{passthrough} option should be used instead.
  10303. Numerical values are deprecated, and should be dropped in favor of
  10304. symbolic constants.
  10305. @item passthrough
  10306. Do not apply the transposition if the input geometry matches the one
  10307. specified by the specified value. It accepts the following values:
  10308. @table @samp
  10309. @item none
  10310. Always apply transposition.
  10311. @item portrait
  10312. Preserve portrait geometry (when @var{height} >= @var{width}).
  10313. @item landscape
  10314. Preserve landscape geometry (when @var{width} >= @var{height}).
  10315. @end table
  10316. Default value is @code{none}.
  10317. @end table
  10318. For example to rotate by 90 degrees clockwise and preserve portrait
  10319. layout:
  10320. @example
  10321. transpose=dir=1:passthrough=portrait
  10322. @end example
  10323. The command above can also be specified as:
  10324. @example
  10325. transpose=1:portrait
  10326. @end example
  10327. @section trim
  10328. Trim the input so that the output contains one continuous subpart of the input.
  10329. It accepts the following parameters:
  10330. @table @option
  10331. @item start
  10332. Specify the time of the start of the kept section, i.e. the frame with the
  10333. timestamp @var{start} will be the first frame in the output.
  10334. @item end
  10335. Specify the time of the first frame that will be dropped, i.e. the frame
  10336. immediately preceding the one with the timestamp @var{end} will be the last
  10337. frame in the output.
  10338. @item start_pts
  10339. This is the same as @var{start}, except this option sets the start timestamp
  10340. in timebase units instead of seconds.
  10341. @item end_pts
  10342. This is the same as @var{end}, except this option sets the end timestamp
  10343. in timebase units instead of seconds.
  10344. @item duration
  10345. The maximum duration of the output in seconds.
  10346. @item start_frame
  10347. The number of the first frame that should be passed to the output.
  10348. @item end_frame
  10349. The number of the first frame that should be dropped.
  10350. @end table
  10351. @option{start}, @option{end}, and @option{duration} are expressed as time
  10352. duration specifications; see
  10353. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  10354. for the accepted syntax.
  10355. Note that the first two sets of the start/end options and the @option{duration}
  10356. option look at the frame timestamp, while the _frame variants simply count the
  10357. frames that pass through the filter. Also note that this filter does not modify
  10358. the timestamps. If you wish for the output timestamps to start at zero, insert a
  10359. setpts filter after the trim filter.
  10360. If multiple start or end options are set, this filter tries to be greedy and
  10361. keep all the frames that match at least one of the specified constraints. To keep
  10362. only the part that matches all the constraints at once, chain multiple trim
  10363. filters.
  10364. The defaults are such that all the input is kept. So it is possible to set e.g.
  10365. just the end values to keep everything before the specified time.
  10366. Examples:
  10367. @itemize
  10368. @item
  10369. Drop everything except the second minute of input:
  10370. @example
  10371. ffmpeg -i INPUT -vf trim=60:120
  10372. @end example
  10373. @item
  10374. Keep only the first second:
  10375. @example
  10376. ffmpeg -i INPUT -vf trim=duration=1
  10377. @end example
  10378. @end itemize
  10379. @anchor{unsharp}
  10380. @section unsharp
  10381. Sharpen or blur the input video.
  10382. It accepts the following parameters:
  10383. @table @option
  10384. @item luma_msize_x, lx
  10385. Set the luma matrix horizontal size. It must be an odd integer between
  10386. 3 and 23. The default value is 5.
  10387. @item luma_msize_y, ly
  10388. Set the luma matrix vertical size. It must be an odd integer between 3
  10389. and 23. The default value is 5.
  10390. @item luma_amount, la
  10391. Set the luma effect strength. It must be a floating point number, reasonable
  10392. values lay between -1.5 and 1.5.
  10393. Negative values will blur the input video, while positive values will
  10394. sharpen it, a value of zero will disable the effect.
  10395. Default value is 1.0.
  10396. @item chroma_msize_x, cx
  10397. Set the chroma matrix horizontal size. It must be an odd integer
  10398. between 3 and 23. The default value is 5.
  10399. @item chroma_msize_y, cy
  10400. Set the chroma matrix vertical size. It must be an odd integer
  10401. between 3 and 23. The default value is 5.
  10402. @item chroma_amount, ca
  10403. Set the chroma effect strength. It must be a floating point number, reasonable
  10404. values lay between -1.5 and 1.5.
  10405. Negative values will blur the input video, while positive values will
  10406. sharpen it, a value of zero will disable the effect.
  10407. Default value is 0.0.
  10408. @item opencl
  10409. If set to 1, specify using OpenCL capabilities, only available if
  10410. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  10411. @end table
  10412. All parameters are optional and default to the equivalent of the
  10413. string '5:5:1.0:5:5:0.0'.
  10414. @subsection Examples
  10415. @itemize
  10416. @item
  10417. Apply strong luma sharpen effect:
  10418. @example
  10419. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  10420. @end example
  10421. @item
  10422. Apply a strong blur of both luma and chroma parameters:
  10423. @example
  10424. unsharp=7:7:-2:7:7:-2
  10425. @end example
  10426. @end itemize
  10427. @section uspp
  10428. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  10429. the image at several (or - in the case of @option{quality} level @code{8} - all)
  10430. shifts and average the results.
  10431. The way this differs from the behavior of spp is that uspp actually encodes &
  10432. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  10433. DCT similar to MJPEG.
  10434. The filter accepts the following options:
  10435. @table @option
  10436. @item quality
  10437. Set quality. This option defines the number of levels for averaging. It accepts
  10438. an integer in the range 0-8. If set to @code{0}, the filter will have no
  10439. effect. A value of @code{8} means the higher quality. For each increment of
  10440. that value the speed drops by a factor of approximately 2. Default value is
  10441. @code{3}.
  10442. @item qp
  10443. Force a constant quantization parameter. If not set, the filter will use the QP
  10444. from the video stream (if available).
  10445. @end table
  10446. @section vaguedenoiser
  10447. Apply a wavelet based denoiser.
  10448. It transforms each frame from the video input into the wavelet domain,
  10449. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  10450. the obtained coefficients. It does an inverse wavelet transform after.
  10451. Due to wavelet properties, it should give a nice smoothed result, and
  10452. reduced noise, without blurring picture features.
  10453. This filter accepts the following options:
  10454. @table @option
  10455. @item threshold
  10456. The filtering strength. The higher, the more filtered the video will be.
  10457. Hard thresholding can use a higher threshold than soft thresholding
  10458. before the video looks overfiltered.
  10459. @item method
  10460. The filtering method the filter will use.
  10461. It accepts the following values:
  10462. @table @samp
  10463. @item hard
  10464. All values under the threshold will be zeroed.
  10465. @item soft
  10466. All values under the threshold will be zeroed. All values above will be
  10467. reduced by the threshold.
  10468. @item garrote
  10469. Scales or nullifies coefficients - intermediary between (more) soft and
  10470. (less) hard thresholding.
  10471. @end table
  10472. @item nsteps
  10473. Number of times, the wavelet will decompose the picture. Picture can't
  10474. be decomposed beyond a particular point (typically, 8 for a 640x480
  10475. frame - as 2^9 = 512 > 480)
  10476. @item percent
  10477. Partial of full denoising (limited coefficients shrinking), from 0 to 100.
  10478. @item planes
  10479. A list of the planes to process. By default all planes are processed.
  10480. @end table
  10481. @section vectorscope
  10482. Display 2 color component values in the two dimensional graph (which is called
  10483. a vectorscope).
  10484. This filter accepts the following options:
  10485. @table @option
  10486. @item mode, m
  10487. Set vectorscope mode.
  10488. It accepts the following values:
  10489. @table @samp
  10490. @item gray
  10491. Gray values are displayed on graph, higher brightness means more pixels have
  10492. same component color value on location in graph. This is the default mode.
  10493. @item color
  10494. Gray values are displayed on graph. Surrounding pixels values which are not
  10495. present in video frame are drawn in gradient of 2 color components which are
  10496. set by option @code{x} and @code{y}. The 3rd color component is static.
  10497. @item color2
  10498. Actual color components values present in video frame are displayed on graph.
  10499. @item color3
  10500. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  10501. on graph increases value of another color component, which is luminance by
  10502. default values of @code{x} and @code{y}.
  10503. @item color4
  10504. Actual colors present in video frame are displayed on graph. If two different
  10505. colors map to same position on graph then color with higher value of component
  10506. not present in graph is picked.
  10507. @item color5
  10508. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  10509. component picked from radial gradient.
  10510. @end table
  10511. @item x
  10512. Set which color component will be represented on X-axis. Default is @code{1}.
  10513. @item y
  10514. Set which color component will be represented on Y-axis. Default is @code{2}.
  10515. @item intensity, i
  10516. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  10517. of color component which represents frequency of (X, Y) location in graph.
  10518. @item envelope, e
  10519. @table @samp
  10520. @item none
  10521. No envelope, this is default.
  10522. @item instant
  10523. Instant envelope, even darkest single pixel will be clearly highlighted.
  10524. @item peak
  10525. Hold maximum and minimum values presented in graph over time. This way you
  10526. can still spot out of range values without constantly looking at vectorscope.
  10527. @item peak+instant
  10528. Peak and instant envelope combined together.
  10529. @end table
  10530. @item graticule, g
  10531. Set what kind of graticule to draw.
  10532. @table @samp
  10533. @item none
  10534. @item green
  10535. @item color
  10536. @end table
  10537. @item opacity, o
  10538. Set graticule opacity.
  10539. @item flags, f
  10540. Set graticule flags.
  10541. @table @samp
  10542. @item white
  10543. Draw graticule for white point.
  10544. @item black
  10545. Draw graticule for black point.
  10546. @item name
  10547. Draw color points short names.
  10548. @end table
  10549. @item bgopacity, b
  10550. Set background opacity.
  10551. @item lthreshold, l
  10552. Set low threshold for color component not represented on X or Y axis.
  10553. Values lower than this value will be ignored. Default is 0.
  10554. Note this value is multiplied with actual max possible value one pixel component
  10555. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  10556. is 0.1 * 255 = 25.
  10557. @item hthreshold, h
  10558. Set high threshold for color component not represented on X or Y axis.
  10559. Values higher than this value will be ignored. Default is 1.
  10560. Note this value is multiplied with actual max possible value one pixel component
  10561. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  10562. is 0.9 * 255 = 230.
  10563. @item colorspace, c
  10564. Set what kind of colorspace to use when drawing graticule.
  10565. @table @samp
  10566. @item auto
  10567. @item 601
  10568. @item 709
  10569. @end table
  10570. Default is auto.
  10571. @end table
  10572. @anchor{vidstabdetect}
  10573. @section vidstabdetect
  10574. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  10575. @ref{vidstabtransform} for pass 2.
  10576. This filter generates a file with relative translation and rotation
  10577. transform information about subsequent frames, which is then used by
  10578. the @ref{vidstabtransform} filter.
  10579. To enable compilation of this filter you need to configure FFmpeg with
  10580. @code{--enable-libvidstab}.
  10581. This filter accepts the following options:
  10582. @table @option
  10583. @item result
  10584. Set the path to the file used to write the transforms information.
  10585. Default value is @file{transforms.trf}.
  10586. @item shakiness
  10587. Set how shaky the video is and how quick the camera is. It accepts an
  10588. integer in the range 1-10, a value of 1 means little shakiness, a
  10589. value of 10 means strong shakiness. Default value is 5.
  10590. @item accuracy
  10591. Set the accuracy of the detection process. It must be a value in the
  10592. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  10593. accuracy. Default value is 15.
  10594. @item stepsize
  10595. Set stepsize of the search process. The region around minimum is
  10596. scanned with 1 pixel resolution. Default value is 6.
  10597. @item mincontrast
  10598. Set minimum contrast. Below this value a local measurement field is
  10599. discarded. Must be a floating point value in the range 0-1. Default
  10600. value is 0.3.
  10601. @item tripod
  10602. Set reference frame number for tripod mode.
  10603. If enabled, the motion of the frames is compared to a reference frame
  10604. in the filtered stream, identified by the specified number. The idea
  10605. is to compensate all movements in a more-or-less static scene and keep
  10606. the camera view absolutely still.
  10607. If set to 0, it is disabled. The frames are counted starting from 1.
  10608. @item show
  10609. Show fields and transforms in the resulting frames. It accepts an
  10610. integer in the range 0-2. Default value is 0, which disables any
  10611. visualization.
  10612. @end table
  10613. @subsection Examples
  10614. @itemize
  10615. @item
  10616. Use default values:
  10617. @example
  10618. vidstabdetect
  10619. @end example
  10620. @item
  10621. Analyze strongly shaky movie and put the results in file
  10622. @file{mytransforms.trf}:
  10623. @example
  10624. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  10625. @end example
  10626. @item
  10627. Visualize the result of internal transformations in the resulting
  10628. video:
  10629. @example
  10630. vidstabdetect=show=1
  10631. @end example
  10632. @item
  10633. Analyze a video with medium shakiness using @command{ffmpeg}:
  10634. @example
  10635. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  10636. @end example
  10637. @end itemize
  10638. @anchor{vidstabtransform}
  10639. @section vidstabtransform
  10640. Video stabilization/deshaking: pass 2 of 2,
  10641. see @ref{vidstabdetect} for pass 1.
  10642. Read a file with transform information for each frame and
  10643. apply/compensate them. Together with the @ref{vidstabdetect}
  10644. filter this can be used to deshake videos. See also
  10645. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  10646. the @ref{unsharp} filter, see below.
  10647. To enable compilation of this filter you need to configure FFmpeg with
  10648. @code{--enable-libvidstab}.
  10649. @subsection Options
  10650. @table @option
  10651. @item input
  10652. Set path to the file used to read the transforms. Default value is
  10653. @file{transforms.trf}.
  10654. @item smoothing
  10655. Set the number of frames (value*2 + 1) used for lowpass filtering the
  10656. camera movements. Default value is 10.
  10657. For example a number of 10 means that 21 frames are used (10 in the
  10658. past and 10 in the future) to smoothen the motion in the video. A
  10659. larger value leads to a smoother video, but limits the acceleration of
  10660. the camera (pan/tilt movements). 0 is a special case where a static
  10661. camera is simulated.
  10662. @item optalgo
  10663. Set the camera path optimization algorithm.
  10664. Accepted values are:
  10665. @table @samp
  10666. @item gauss
  10667. gaussian kernel low-pass filter on camera motion (default)
  10668. @item avg
  10669. averaging on transformations
  10670. @end table
  10671. @item maxshift
  10672. Set maximal number of pixels to translate frames. Default value is -1,
  10673. meaning no limit.
  10674. @item maxangle
  10675. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  10676. value is -1, meaning no limit.
  10677. @item crop
  10678. Specify how to deal with borders that may be visible due to movement
  10679. compensation.
  10680. Available values are:
  10681. @table @samp
  10682. @item keep
  10683. keep image information from previous frame (default)
  10684. @item black
  10685. fill the border black
  10686. @end table
  10687. @item invert
  10688. Invert transforms if set to 1. Default value is 0.
  10689. @item relative
  10690. Consider transforms as relative to previous frame if set to 1,
  10691. absolute if set to 0. Default value is 0.
  10692. @item zoom
  10693. Set percentage to zoom. A positive value will result in a zoom-in
  10694. effect, a negative value in a zoom-out effect. Default value is 0 (no
  10695. zoom).
  10696. @item optzoom
  10697. Set optimal zooming to avoid borders.
  10698. Accepted values are:
  10699. @table @samp
  10700. @item 0
  10701. disabled
  10702. @item 1
  10703. optimal static zoom value is determined (only very strong movements
  10704. will lead to visible borders) (default)
  10705. @item 2
  10706. optimal adaptive zoom value is determined (no borders will be
  10707. visible), see @option{zoomspeed}
  10708. @end table
  10709. Note that the value given at zoom is added to the one calculated here.
  10710. @item zoomspeed
  10711. Set percent to zoom maximally each frame (enabled when
  10712. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  10713. 0.25.
  10714. @item interpol
  10715. Specify type of interpolation.
  10716. Available values are:
  10717. @table @samp
  10718. @item no
  10719. no interpolation
  10720. @item linear
  10721. linear only horizontal
  10722. @item bilinear
  10723. linear in both directions (default)
  10724. @item bicubic
  10725. cubic in both directions (slow)
  10726. @end table
  10727. @item tripod
  10728. Enable virtual tripod mode if set to 1, which is equivalent to
  10729. @code{relative=0:smoothing=0}. Default value is 0.
  10730. Use also @code{tripod} option of @ref{vidstabdetect}.
  10731. @item debug
  10732. Increase log verbosity if set to 1. Also the detected global motions
  10733. are written to the temporary file @file{global_motions.trf}. Default
  10734. value is 0.
  10735. @end table
  10736. @subsection Examples
  10737. @itemize
  10738. @item
  10739. Use @command{ffmpeg} for a typical stabilization with default values:
  10740. @example
  10741. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  10742. @end example
  10743. Note the use of the @ref{unsharp} filter which is always recommended.
  10744. @item
  10745. Zoom in a bit more and load transform data from a given file:
  10746. @example
  10747. vidstabtransform=zoom=5:input="mytransforms.trf"
  10748. @end example
  10749. @item
  10750. Smoothen the video even more:
  10751. @example
  10752. vidstabtransform=smoothing=30
  10753. @end example
  10754. @end itemize
  10755. @section vflip
  10756. Flip the input video vertically.
  10757. For example, to vertically flip a video with @command{ffmpeg}:
  10758. @example
  10759. ffmpeg -i in.avi -vf "vflip" out.avi
  10760. @end example
  10761. @anchor{vignette}
  10762. @section vignette
  10763. Make or reverse a natural vignetting effect.
  10764. The filter accepts the following options:
  10765. @table @option
  10766. @item angle, a
  10767. Set lens angle expression as a number of radians.
  10768. The value is clipped in the @code{[0,PI/2]} range.
  10769. Default value: @code{"PI/5"}
  10770. @item x0
  10771. @item y0
  10772. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  10773. by default.
  10774. @item mode
  10775. Set forward/backward mode.
  10776. Available modes are:
  10777. @table @samp
  10778. @item forward
  10779. The larger the distance from the central point, the darker the image becomes.
  10780. @item backward
  10781. The larger the distance from the central point, the brighter the image becomes.
  10782. This can be used to reverse a vignette effect, though there is no automatic
  10783. detection to extract the lens @option{angle} and other settings (yet). It can
  10784. also be used to create a burning effect.
  10785. @end table
  10786. Default value is @samp{forward}.
  10787. @item eval
  10788. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  10789. It accepts the following values:
  10790. @table @samp
  10791. @item init
  10792. Evaluate expressions only once during the filter initialization.
  10793. @item frame
  10794. Evaluate expressions for each incoming frame. This is way slower than the
  10795. @samp{init} mode since it requires all the scalers to be re-computed, but it
  10796. allows advanced dynamic expressions.
  10797. @end table
  10798. Default value is @samp{init}.
  10799. @item dither
  10800. Set dithering to reduce the circular banding effects. Default is @code{1}
  10801. (enabled).
  10802. @item aspect
  10803. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  10804. Setting this value to the SAR of the input will make a rectangular vignetting
  10805. following the dimensions of the video.
  10806. Default is @code{1/1}.
  10807. @end table
  10808. @subsection Expressions
  10809. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  10810. following parameters.
  10811. @table @option
  10812. @item w
  10813. @item h
  10814. input width and height
  10815. @item n
  10816. the number of input frame, starting from 0
  10817. @item pts
  10818. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  10819. @var{TB} units, NAN if undefined
  10820. @item r
  10821. frame rate of the input video, NAN if the input frame rate is unknown
  10822. @item t
  10823. the PTS (Presentation TimeStamp) of the filtered video frame,
  10824. expressed in seconds, NAN if undefined
  10825. @item tb
  10826. time base of the input video
  10827. @end table
  10828. @subsection Examples
  10829. @itemize
  10830. @item
  10831. Apply simple strong vignetting effect:
  10832. @example
  10833. vignette=PI/4
  10834. @end example
  10835. @item
  10836. Make a flickering vignetting:
  10837. @example
  10838. vignette='PI/4+random(1)*PI/50':eval=frame
  10839. @end example
  10840. @end itemize
  10841. @section vstack
  10842. Stack input videos vertically.
  10843. All streams must be of same pixel format and of same width.
  10844. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  10845. to create same output.
  10846. The filter accept the following option:
  10847. @table @option
  10848. @item inputs
  10849. Set number of input streams. Default is 2.
  10850. @item shortest
  10851. If set to 1, force the output to terminate when the shortest input
  10852. terminates. Default value is 0.
  10853. @end table
  10854. @section w3fdif
  10855. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  10856. Deinterlacing Filter").
  10857. Based on the process described by Martin Weston for BBC R&D, and
  10858. implemented based on the de-interlace algorithm written by Jim
  10859. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  10860. uses filter coefficients calculated by BBC R&D.
  10861. There are two sets of filter coefficients, so called "simple":
  10862. and "complex". Which set of filter coefficients is used can
  10863. be set by passing an optional parameter:
  10864. @table @option
  10865. @item filter
  10866. Set the interlacing filter coefficients. Accepts one of the following values:
  10867. @table @samp
  10868. @item simple
  10869. Simple filter coefficient set.
  10870. @item complex
  10871. More-complex filter coefficient set.
  10872. @end table
  10873. Default value is @samp{complex}.
  10874. @item deint
  10875. Specify which frames to deinterlace. Accept one of the following values:
  10876. @table @samp
  10877. @item all
  10878. Deinterlace all frames,
  10879. @item interlaced
  10880. Only deinterlace frames marked as interlaced.
  10881. @end table
  10882. Default value is @samp{all}.
  10883. @end table
  10884. @section waveform
  10885. Video waveform monitor.
  10886. The waveform monitor plots color component intensity. By default luminance
  10887. only. Each column of the waveform corresponds to a column of pixels in the
  10888. source video.
  10889. It accepts the following options:
  10890. @table @option
  10891. @item mode, m
  10892. Can be either @code{row}, or @code{column}. Default is @code{column}.
  10893. In row mode, the graph on the left side represents color component value 0 and
  10894. the right side represents value = 255. In column mode, the top side represents
  10895. color component value = 0 and bottom side represents value = 255.
  10896. @item intensity, i
  10897. Set intensity. Smaller values are useful to find out how many values of the same
  10898. luminance are distributed across input rows/columns.
  10899. Default value is @code{0.04}. Allowed range is [0, 1].
  10900. @item mirror, r
  10901. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  10902. In mirrored mode, higher values will be represented on the left
  10903. side for @code{row} mode and at the top for @code{column} mode. Default is
  10904. @code{1} (mirrored).
  10905. @item display, d
  10906. Set display mode.
  10907. It accepts the following values:
  10908. @table @samp
  10909. @item overlay
  10910. Presents information identical to that in the @code{parade}, except
  10911. that the graphs representing color components are superimposed directly
  10912. over one another.
  10913. This display mode makes it easier to spot relative differences or similarities
  10914. in overlapping areas of the color components that are supposed to be identical,
  10915. such as neutral whites, grays, or blacks.
  10916. @item stack
  10917. Display separate graph for the color components side by side in
  10918. @code{row} mode or one below the other in @code{column} mode.
  10919. @item parade
  10920. Display separate graph for the color components side by side in
  10921. @code{column} mode or one below the other in @code{row} mode.
  10922. Using this display mode makes it easy to spot color casts in the highlights
  10923. and shadows of an image, by comparing the contours of the top and the bottom
  10924. graphs of each waveform. Since whites, grays, and blacks are characterized
  10925. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  10926. should display three waveforms of roughly equal width/height. If not, the
  10927. correction is easy to perform by making level adjustments the three waveforms.
  10928. @end table
  10929. Default is @code{stack}.
  10930. @item components, c
  10931. Set which color components to display. Default is 1, which means only luminance
  10932. or red color component if input is in RGB colorspace. If is set for example to
  10933. 7 it will display all 3 (if) available color components.
  10934. @item envelope, e
  10935. @table @samp
  10936. @item none
  10937. No envelope, this is default.
  10938. @item instant
  10939. Instant envelope, minimum and maximum values presented in graph will be easily
  10940. visible even with small @code{step} value.
  10941. @item peak
  10942. Hold minimum and maximum values presented in graph across time. This way you
  10943. can still spot out of range values without constantly looking at waveforms.
  10944. @item peak+instant
  10945. Peak and instant envelope combined together.
  10946. @end table
  10947. @item filter, f
  10948. @table @samp
  10949. @item lowpass
  10950. No filtering, this is default.
  10951. @item flat
  10952. Luma and chroma combined together.
  10953. @item aflat
  10954. Similar as above, but shows difference between blue and red chroma.
  10955. @item chroma
  10956. Displays only chroma.
  10957. @item color
  10958. Displays actual color value on waveform.
  10959. @item acolor
  10960. Similar as above, but with luma showing frequency of chroma values.
  10961. @end table
  10962. @item graticule, g
  10963. Set which graticule to display.
  10964. @table @samp
  10965. @item none
  10966. Do not display graticule.
  10967. @item green
  10968. Display green graticule showing legal broadcast ranges.
  10969. @end table
  10970. @item opacity, o
  10971. Set graticule opacity.
  10972. @item flags, fl
  10973. Set graticule flags.
  10974. @table @samp
  10975. @item numbers
  10976. Draw numbers above lines. By default enabled.
  10977. @item dots
  10978. Draw dots instead of lines.
  10979. @end table
  10980. @item scale, s
  10981. Set scale used for displaying graticule.
  10982. @table @samp
  10983. @item digital
  10984. @item millivolts
  10985. @item ire
  10986. @end table
  10987. Default is digital.
  10988. @item bgopacity, b
  10989. Set background opacity.
  10990. @end table
  10991. @section weave
  10992. The @code{weave} takes a field-based video input and join
  10993. each two sequential fields into single frame, producing a new double
  10994. height clip with half the frame rate and half the frame count.
  10995. It accepts the following option:
  10996. @table @option
  10997. @item first_field
  10998. Set first field. Available values are:
  10999. @table @samp
  11000. @item top, t
  11001. Set the frame as top-field-first.
  11002. @item bottom, b
  11003. Set the frame as bottom-field-first.
  11004. @end table
  11005. @end table
  11006. @subsection Examples
  11007. @itemize
  11008. @item
  11009. Interlace video using @ref{select} and @ref{separatefields} filter:
  11010. @example
  11011. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  11012. @end example
  11013. @end itemize
  11014. @section xbr
  11015. Apply the xBR high-quality magnification filter which is designed for pixel
  11016. art. It follows a set of edge-detection rules, see
  11017. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  11018. It accepts the following option:
  11019. @table @option
  11020. @item n
  11021. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  11022. @code{3xBR} and @code{4} for @code{4xBR}.
  11023. Default is @code{3}.
  11024. @end table
  11025. @anchor{yadif}
  11026. @section yadif
  11027. Deinterlace the input video ("yadif" means "yet another deinterlacing
  11028. filter").
  11029. It accepts the following parameters:
  11030. @table @option
  11031. @item mode
  11032. The interlacing mode to adopt. It accepts one of the following values:
  11033. @table @option
  11034. @item 0, send_frame
  11035. Output one frame for each frame.
  11036. @item 1, send_field
  11037. Output one frame for each field.
  11038. @item 2, send_frame_nospatial
  11039. Like @code{send_frame}, but it skips the spatial interlacing check.
  11040. @item 3, send_field_nospatial
  11041. Like @code{send_field}, but it skips the spatial interlacing check.
  11042. @end table
  11043. The default value is @code{send_frame}.
  11044. @item parity
  11045. The picture field parity assumed for the input interlaced video. It accepts one
  11046. of the following values:
  11047. @table @option
  11048. @item 0, tff
  11049. Assume the top field is first.
  11050. @item 1, bff
  11051. Assume the bottom field is first.
  11052. @item -1, auto
  11053. Enable automatic detection of field parity.
  11054. @end table
  11055. The default value is @code{auto}.
  11056. If the interlacing is unknown or the decoder does not export this information,
  11057. top field first will be assumed.
  11058. @item deint
  11059. Specify which frames to deinterlace. Accept one of the following
  11060. values:
  11061. @table @option
  11062. @item 0, all
  11063. Deinterlace all frames.
  11064. @item 1, interlaced
  11065. Only deinterlace frames marked as interlaced.
  11066. @end table
  11067. The default value is @code{all}.
  11068. @end table
  11069. @section zoompan
  11070. Apply Zoom & Pan effect.
  11071. This filter accepts the following options:
  11072. @table @option
  11073. @item zoom, z
  11074. Set the zoom expression. Default is 1.
  11075. @item x
  11076. @item y
  11077. Set the x and y expression. Default is 0.
  11078. @item d
  11079. Set the duration expression in number of frames.
  11080. This sets for how many number of frames effect will last for
  11081. single input image.
  11082. @item s
  11083. Set the output image size, default is 'hd720'.
  11084. @item fps
  11085. Set the output frame rate, default is '25'.
  11086. @end table
  11087. Each expression can contain the following constants:
  11088. @table @option
  11089. @item in_w, iw
  11090. Input width.
  11091. @item in_h, ih
  11092. Input height.
  11093. @item out_w, ow
  11094. Output width.
  11095. @item out_h, oh
  11096. Output height.
  11097. @item in
  11098. Input frame count.
  11099. @item on
  11100. Output frame count.
  11101. @item x
  11102. @item y
  11103. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  11104. for current input frame.
  11105. @item px
  11106. @item py
  11107. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  11108. not yet such frame (first input frame).
  11109. @item zoom
  11110. Last calculated zoom from 'z' expression for current input frame.
  11111. @item pzoom
  11112. Last calculated zoom of last output frame of previous input frame.
  11113. @item duration
  11114. Number of output frames for current input frame. Calculated from 'd' expression
  11115. for each input frame.
  11116. @item pduration
  11117. number of output frames created for previous input frame
  11118. @item a
  11119. Rational number: input width / input height
  11120. @item sar
  11121. sample aspect ratio
  11122. @item dar
  11123. display aspect ratio
  11124. @end table
  11125. @subsection Examples
  11126. @itemize
  11127. @item
  11128. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  11129. @example
  11130. 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
  11131. @end example
  11132. @item
  11133. Zoom-in up to 1.5 and pan always at center of picture:
  11134. @example
  11135. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  11136. @end example
  11137. @item
  11138. Same as above but without pausing:
  11139. @example
  11140. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  11141. @end example
  11142. @end itemize
  11143. @section zscale
  11144. Scale (resize) the input video, using the z.lib library:
  11145. https://github.com/sekrit-twc/zimg.
  11146. The zscale filter forces the output display aspect ratio to be the same
  11147. as the input, by changing the output sample aspect ratio.
  11148. If the input image format is different from the format requested by
  11149. the next filter, the zscale filter will convert the input to the
  11150. requested format.
  11151. @subsection Options
  11152. The filter accepts the following options.
  11153. @table @option
  11154. @item width, w
  11155. @item height, h
  11156. Set the output video dimension expression. Default value is the input
  11157. dimension.
  11158. If the @var{width} or @var{w} is 0, the input width is used for the output.
  11159. If the @var{height} or @var{h} is 0, the input height is used for the output.
  11160. If one of the values is -1, the zscale filter will use a value that
  11161. maintains the aspect ratio of the input image, calculated from the
  11162. other specified dimension. If both of them are -1, the input size is
  11163. used
  11164. If one of the values is -n with n > 1, the zscale filter will also use a value
  11165. that maintains the aspect ratio of the input image, calculated from the other
  11166. specified dimension. After that it will, however, make sure that the calculated
  11167. dimension is divisible by n and adjust the value if necessary.
  11168. See below for the list of accepted constants for use in the dimension
  11169. expression.
  11170. @item size, s
  11171. Set the video size. For the syntax of this option, check the
  11172. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11173. @item dither, d
  11174. Set the dither type.
  11175. Possible values are:
  11176. @table @var
  11177. @item none
  11178. @item ordered
  11179. @item random
  11180. @item error_diffusion
  11181. @end table
  11182. Default is none.
  11183. @item filter, f
  11184. Set the resize filter type.
  11185. Possible values are:
  11186. @table @var
  11187. @item point
  11188. @item bilinear
  11189. @item bicubic
  11190. @item spline16
  11191. @item spline36
  11192. @item lanczos
  11193. @end table
  11194. Default is bilinear.
  11195. @item range, r
  11196. Set the color range.
  11197. Possible values are:
  11198. @table @var
  11199. @item input
  11200. @item limited
  11201. @item full
  11202. @end table
  11203. Default is same as input.
  11204. @item primaries, p
  11205. Set the color primaries.
  11206. Possible values are:
  11207. @table @var
  11208. @item input
  11209. @item 709
  11210. @item unspecified
  11211. @item 170m
  11212. @item 240m
  11213. @item 2020
  11214. @end table
  11215. Default is same as input.
  11216. @item transfer, t
  11217. Set the transfer characteristics.
  11218. Possible values are:
  11219. @table @var
  11220. @item input
  11221. @item 709
  11222. @item unspecified
  11223. @item 601
  11224. @item linear
  11225. @item 2020_10
  11226. @item 2020_12
  11227. @item smpte2084
  11228. @item iec61966-2-1
  11229. @item arib-std-b67
  11230. @end table
  11231. Default is same as input.
  11232. @item matrix, m
  11233. Set the colorspace matrix.
  11234. Possible value are:
  11235. @table @var
  11236. @item input
  11237. @item 709
  11238. @item unspecified
  11239. @item 470bg
  11240. @item 170m
  11241. @item 2020_ncl
  11242. @item 2020_cl
  11243. @end table
  11244. Default is same as input.
  11245. @item rangein, rin
  11246. Set the input color range.
  11247. Possible values are:
  11248. @table @var
  11249. @item input
  11250. @item limited
  11251. @item full
  11252. @end table
  11253. Default is same as input.
  11254. @item primariesin, pin
  11255. Set the input color primaries.
  11256. Possible values are:
  11257. @table @var
  11258. @item input
  11259. @item 709
  11260. @item unspecified
  11261. @item 170m
  11262. @item 240m
  11263. @item 2020
  11264. @end table
  11265. Default is same as input.
  11266. @item transferin, tin
  11267. Set the input transfer characteristics.
  11268. Possible values are:
  11269. @table @var
  11270. @item input
  11271. @item 709
  11272. @item unspecified
  11273. @item 601
  11274. @item linear
  11275. @item 2020_10
  11276. @item 2020_12
  11277. @end table
  11278. Default is same as input.
  11279. @item matrixin, min
  11280. Set the input colorspace matrix.
  11281. Possible value are:
  11282. @table @var
  11283. @item input
  11284. @item 709
  11285. @item unspecified
  11286. @item 470bg
  11287. @item 170m
  11288. @item 2020_ncl
  11289. @item 2020_cl
  11290. @end table
  11291. @item chromal, c
  11292. Set the output chroma location.
  11293. Possible values are:
  11294. @table @var
  11295. @item input
  11296. @item left
  11297. @item center
  11298. @item topleft
  11299. @item top
  11300. @item bottomleft
  11301. @item bottom
  11302. @end table
  11303. @item chromalin, cin
  11304. Set the input chroma location.
  11305. Possible values are:
  11306. @table @var
  11307. @item input
  11308. @item left
  11309. @item center
  11310. @item topleft
  11311. @item top
  11312. @item bottomleft
  11313. @item bottom
  11314. @end table
  11315. @item npl
  11316. Set the nominal peak luminance.
  11317. @end table
  11318. The values of the @option{w} and @option{h} options are expressions
  11319. containing the following constants:
  11320. @table @var
  11321. @item in_w
  11322. @item in_h
  11323. The input width and height
  11324. @item iw
  11325. @item ih
  11326. These are the same as @var{in_w} and @var{in_h}.
  11327. @item out_w
  11328. @item out_h
  11329. The output (scaled) width and height
  11330. @item ow
  11331. @item oh
  11332. These are the same as @var{out_w} and @var{out_h}
  11333. @item a
  11334. The same as @var{iw} / @var{ih}
  11335. @item sar
  11336. input sample aspect ratio
  11337. @item dar
  11338. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  11339. @item hsub
  11340. @item vsub
  11341. horizontal and vertical input chroma subsample values. For example for the
  11342. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11343. @item ohsub
  11344. @item ovsub
  11345. horizontal and vertical output chroma subsample values. For example for the
  11346. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11347. @end table
  11348. @table @option
  11349. @end table
  11350. @c man end VIDEO FILTERS
  11351. @chapter Video Sources
  11352. @c man begin VIDEO SOURCES
  11353. Below is a description of the currently available video sources.
  11354. @section buffer
  11355. Buffer video frames, and make them available to the filter chain.
  11356. This source is mainly intended for a programmatic use, in particular
  11357. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  11358. It accepts the following parameters:
  11359. @table @option
  11360. @item video_size
  11361. Specify the size (width and height) of the buffered video frames. For the
  11362. syntax of this option, check the
  11363. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11364. @item width
  11365. The input video width.
  11366. @item height
  11367. The input video height.
  11368. @item pix_fmt
  11369. A string representing the pixel format of the buffered video frames.
  11370. It may be a number corresponding to a pixel format, or a pixel format
  11371. name.
  11372. @item time_base
  11373. Specify the timebase assumed by the timestamps of the buffered frames.
  11374. @item frame_rate
  11375. Specify the frame rate expected for the video stream.
  11376. @item pixel_aspect, sar
  11377. The sample (pixel) aspect ratio of the input video.
  11378. @item sws_param
  11379. Specify the optional parameters to be used for the scale filter which
  11380. is automatically inserted when an input change is detected in the
  11381. input size or format.
  11382. @item hw_frames_ctx
  11383. When using a hardware pixel format, this should be a reference to an
  11384. AVHWFramesContext describing input frames.
  11385. @end table
  11386. For example:
  11387. @example
  11388. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  11389. @end example
  11390. will instruct the source to accept video frames with size 320x240 and
  11391. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  11392. square pixels (1:1 sample aspect ratio).
  11393. Since the pixel format with name "yuv410p" corresponds to the number 6
  11394. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  11395. this example corresponds to:
  11396. @example
  11397. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  11398. @end example
  11399. Alternatively, the options can be specified as a flat string, but this
  11400. syntax is deprecated:
  11401. @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}]
  11402. @section cellauto
  11403. Create a pattern generated by an elementary cellular automaton.
  11404. The initial state of the cellular automaton can be defined through the
  11405. @option{filename} and @option{pattern} options. If such options are
  11406. not specified an initial state is created randomly.
  11407. At each new frame a new row in the video is filled with the result of
  11408. the cellular automaton next generation. The behavior when the whole
  11409. frame is filled is defined by the @option{scroll} option.
  11410. This source accepts the following options:
  11411. @table @option
  11412. @item filename, f
  11413. Read the initial cellular automaton state, i.e. the starting row, from
  11414. the specified file.
  11415. In the file, each non-whitespace character is considered an alive
  11416. cell, a newline will terminate the row, and further characters in the
  11417. file will be ignored.
  11418. @item pattern, p
  11419. Read the initial cellular automaton state, i.e. the starting row, from
  11420. the specified string.
  11421. Each non-whitespace character in the string is considered an alive
  11422. cell, a newline will terminate the row, and further characters in the
  11423. string will be ignored.
  11424. @item rate, r
  11425. Set the video rate, that is the number of frames generated per second.
  11426. Default is 25.
  11427. @item random_fill_ratio, ratio
  11428. Set the random fill ratio for the initial cellular automaton row. It
  11429. is a floating point number value ranging from 0 to 1, defaults to
  11430. 1/PHI.
  11431. This option is ignored when a file or a pattern is specified.
  11432. @item random_seed, seed
  11433. Set the seed for filling randomly the initial row, must be an integer
  11434. included between 0 and UINT32_MAX. If not specified, or if explicitly
  11435. set to -1, the filter will try to use a good random seed on a best
  11436. effort basis.
  11437. @item rule
  11438. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  11439. Default value is 110.
  11440. @item size, s
  11441. Set the size of the output video. For the syntax of this option, check the
  11442. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11443. If @option{filename} or @option{pattern} is specified, the size is set
  11444. by default to the width of the specified initial state row, and the
  11445. height is set to @var{width} * PHI.
  11446. If @option{size} is set, it must contain the width of the specified
  11447. pattern string, and the specified pattern will be centered in the
  11448. larger row.
  11449. If a filename or a pattern string is not specified, the size value
  11450. defaults to "320x518" (used for a randomly generated initial state).
  11451. @item scroll
  11452. If set to 1, scroll the output upward when all the rows in the output
  11453. have been already filled. If set to 0, the new generated row will be
  11454. written over the top row just after the bottom row is filled.
  11455. Defaults to 1.
  11456. @item start_full, full
  11457. If set to 1, completely fill the output with generated rows before
  11458. outputting the first frame.
  11459. This is the default behavior, for disabling set the value to 0.
  11460. @item stitch
  11461. If set to 1, stitch the left and right row edges together.
  11462. This is the default behavior, for disabling set the value to 0.
  11463. @end table
  11464. @subsection Examples
  11465. @itemize
  11466. @item
  11467. Read the initial state from @file{pattern}, and specify an output of
  11468. size 200x400.
  11469. @example
  11470. cellauto=f=pattern:s=200x400
  11471. @end example
  11472. @item
  11473. Generate a random initial row with a width of 200 cells, with a fill
  11474. ratio of 2/3:
  11475. @example
  11476. cellauto=ratio=2/3:s=200x200
  11477. @end example
  11478. @item
  11479. Create a pattern generated by rule 18 starting by a single alive cell
  11480. centered on an initial row with width 100:
  11481. @example
  11482. cellauto=p=@@:s=100x400:full=0:rule=18
  11483. @end example
  11484. @item
  11485. Specify a more elaborated initial pattern:
  11486. @example
  11487. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  11488. @end example
  11489. @end itemize
  11490. @anchor{coreimagesrc}
  11491. @section coreimagesrc
  11492. Video source generated on GPU using Apple's CoreImage API on OSX.
  11493. This video source is a specialized version of the @ref{coreimage} video filter.
  11494. Use a core image generator at the beginning of the applied filterchain to
  11495. generate the content.
  11496. The coreimagesrc video source accepts the following options:
  11497. @table @option
  11498. @item list_generators
  11499. List all available generators along with all their respective options as well as
  11500. possible minimum and maximum values along with the default values.
  11501. @example
  11502. list_generators=true
  11503. @end example
  11504. @item size, s
  11505. Specify the size of the sourced video. For the syntax of this option, check the
  11506. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11507. The default value is @code{320x240}.
  11508. @item rate, r
  11509. Specify the frame rate of the sourced video, as the number of frames
  11510. generated per second. It has to be a string in the format
  11511. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  11512. number or a valid video frame rate abbreviation. The default value is
  11513. "25".
  11514. @item sar
  11515. Set the sample aspect ratio of the sourced video.
  11516. @item duration, d
  11517. Set the duration of the sourced video. See
  11518. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11519. for the accepted syntax.
  11520. If not specified, or the expressed duration is negative, the video is
  11521. supposed to be generated forever.
  11522. @end table
  11523. Additionally, all options of the @ref{coreimage} video filter are accepted.
  11524. A complete filterchain can be used for further processing of the
  11525. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  11526. and examples for details.
  11527. @subsection Examples
  11528. @itemize
  11529. @item
  11530. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  11531. given as complete and escaped command-line for Apple's standard bash shell:
  11532. @example
  11533. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  11534. @end example
  11535. This example is equivalent to the QRCode example of @ref{coreimage} without the
  11536. need for a nullsrc video source.
  11537. @end itemize
  11538. @section mandelbrot
  11539. Generate a Mandelbrot set fractal, and progressively zoom towards the
  11540. point specified with @var{start_x} and @var{start_y}.
  11541. This source accepts the following options:
  11542. @table @option
  11543. @item end_pts
  11544. Set the terminal pts value. Default value is 400.
  11545. @item end_scale
  11546. Set the terminal scale value.
  11547. Must be a floating point value. Default value is 0.3.
  11548. @item inner
  11549. Set the inner coloring mode, that is the algorithm used to draw the
  11550. Mandelbrot fractal internal region.
  11551. It shall assume one of the following values:
  11552. @table @option
  11553. @item black
  11554. Set black mode.
  11555. @item convergence
  11556. Show time until convergence.
  11557. @item mincol
  11558. Set color based on point closest to the origin of the iterations.
  11559. @item period
  11560. Set period mode.
  11561. @end table
  11562. Default value is @var{mincol}.
  11563. @item bailout
  11564. Set the bailout value. Default value is 10.0.
  11565. @item maxiter
  11566. Set the maximum of iterations performed by the rendering
  11567. algorithm. Default value is 7189.
  11568. @item outer
  11569. Set outer coloring mode.
  11570. It shall assume one of following values:
  11571. @table @option
  11572. @item iteration_count
  11573. Set iteration cound mode.
  11574. @item normalized_iteration_count
  11575. set normalized iteration count mode.
  11576. @end table
  11577. Default value is @var{normalized_iteration_count}.
  11578. @item rate, r
  11579. Set frame rate, expressed as number of frames per second. Default
  11580. value is "25".
  11581. @item size, s
  11582. Set frame size. For the syntax of this option, check the "Video
  11583. size" section in the ffmpeg-utils manual. Default value is "640x480".
  11584. @item start_scale
  11585. Set the initial scale value. Default value is 3.0.
  11586. @item start_x
  11587. Set the initial x position. Must be a floating point value between
  11588. -100 and 100. Default value is -0.743643887037158704752191506114774.
  11589. @item start_y
  11590. Set the initial y position. Must be a floating point value between
  11591. -100 and 100. Default value is -0.131825904205311970493132056385139.
  11592. @end table
  11593. @section mptestsrc
  11594. Generate various test patterns, as generated by the MPlayer test filter.
  11595. The size of the generated video is fixed, and is 256x256.
  11596. This source is useful in particular for testing encoding features.
  11597. This source accepts the following options:
  11598. @table @option
  11599. @item rate, r
  11600. Specify the frame rate of the sourced video, as the number of frames
  11601. generated per second. It has to be a string in the format
  11602. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  11603. number or a valid video frame rate abbreviation. The default value is
  11604. "25".
  11605. @item duration, d
  11606. Set the duration of the sourced video. See
  11607. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11608. for the accepted syntax.
  11609. If not specified, or the expressed duration is negative, the video is
  11610. supposed to be generated forever.
  11611. @item test, t
  11612. Set the number or the name of the test to perform. Supported tests are:
  11613. @table @option
  11614. @item dc_luma
  11615. @item dc_chroma
  11616. @item freq_luma
  11617. @item freq_chroma
  11618. @item amp_luma
  11619. @item amp_chroma
  11620. @item cbp
  11621. @item mv
  11622. @item ring1
  11623. @item ring2
  11624. @item all
  11625. @end table
  11626. Default value is "all", which will cycle through the list of all tests.
  11627. @end table
  11628. Some examples:
  11629. @example
  11630. mptestsrc=t=dc_luma
  11631. @end example
  11632. will generate a "dc_luma" test pattern.
  11633. @section frei0r_src
  11634. Provide a frei0r source.
  11635. To enable compilation of this filter you need to install the frei0r
  11636. header and configure FFmpeg with @code{--enable-frei0r}.
  11637. This source accepts the following parameters:
  11638. @table @option
  11639. @item size
  11640. The size of the video to generate. For the syntax of this option, check the
  11641. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11642. @item framerate
  11643. The framerate of the generated video. It may be a string of the form
  11644. @var{num}/@var{den} or a frame rate abbreviation.
  11645. @item filter_name
  11646. The name to the frei0r source to load. For more information regarding frei0r and
  11647. how to set the parameters, read the @ref{frei0r} section in the video filters
  11648. documentation.
  11649. @item filter_params
  11650. A '|'-separated list of parameters to pass to the frei0r source.
  11651. @end table
  11652. For example, to generate a frei0r partik0l source with size 200x200
  11653. and frame rate 10 which is overlaid on the overlay filter main input:
  11654. @example
  11655. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  11656. @end example
  11657. @section life
  11658. Generate a life pattern.
  11659. This source is based on a generalization of John Conway's life game.
  11660. The sourced input represents a life grid, each pixel represents a cell
  11661. which can be in one of two possible states, alive or dead. Every cell
  11662. interacts with its eight neighbours, which are the cells that are
  11663. horizontally, vertically, or diagonally adjacent.
  11664. At each interaction the grid evolves according to the adopted rule,
  11665. which specifies the number of neighbor alive cells which will make a
  11666. cell stay alive or born. The @option{rule} option allows one to specify
  11667. the rule to adopt.
  11668. This source accepts the following options:
  11669. @table @option
  11670. @item filename, f
  11671. Set the file from which to read the initial grid state. In the file,
  11672. each non-whitespace character is considered an alive cell, and newline
  11673. is used to delimit the end of each row.
  11674. If this option is not specified, the initial grid is generated
  11675. randomly.
  11676. @item rate, r
  11677. Set the video rate, that is the number of frames generated per second.
  11678. Default is 25.
  11679. @item random_fill_ratio, ratio
  11680. Set the random fill ratio for the initial random grid. It is a
  11681. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  11682. It is ignored when a file is specified.
  11683. @item random_seed, seed
  11684. Set the seed for filling the initial random grid, must be an integer
  11685. included between 0 and UINT32_MAX. If not specified, or if explicitly
  11686. set to -1, the filter will try to use a good random seed on a best
  11687. effort basis.
  11688. @item rule
  11689. Set the life rule.
  11690. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  11691. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  11692. @var{NS} specifies the number of alive neighbor cells which make a
  11693. live cell stay alive, and @var{NB} the number of alive neighbor cells
  11694. which make a dead cell to become alive (i.e. to "born").
  11695. "s" and "b" can be used in place of "S" and "B", respectively.
  11696. Alternatively a rule can be specified by an 18-bits integer. The 9
  11697. high order bits are used to encode the next cell state if it is alive
  11698. for each number of neighbor alive cells, the low order bits specify
  11699. the rule for "borning" new cells. Higher order bits encode for an
  11700. higher number of neighbor cells.
  11701. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  11702. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  11703. Default value is "S23/B3", which is the original Conway's game of life
  11704. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  11705. cells, and will born a new cell if there are three alive cells around
  11706. a dead cell.
  11707. @item size, s
  11708. Set the size of the output video. For the syntax of this option, check the
  11709. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11710. If @option{filename} is specified, the size is set by default to the
  11711. same size of the input file. If @option{size} is set, it must contain
  11712. the size specified in the input file, and the initial grid defined in
  11713. that file is centered in the larger resulting area.
  11714. If a filename is not specified, the size value defaults to "320x240"
  11715. (used for a randomly generated initial grid).
  11716. @item stitch
  11717. If set to 1, stitch the left and right grid edges together, and the
  11718. top and bottom edges also. Defaults to 1.
  11719. @item mold
  11720. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  11721. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  11722. value from 0 to 255.
  11723. @item life_color
  11724. Set the color of living (or new born) cells.
  11725. @item death_color
  11726. Set the color of dead cells. If @option{mold} is set, this is the first color
  11727. used to represent a dead cell.
  11728. @item mold_color
  11729. Set mold color, for definitely dead and moldy cells.
  11730. For the syntax of these 3 color options, check the "Color" section in the
  11731. ffmpeg-utils manual.
  11732. @end table
  11733. @subsection Examples
  11734. @itemize
  11735. @item
  11736. Read a grid from @file{pattern}, and center it on a grid of size
  11737. 300x300 pixels:
  11738. @example
  11739. life=f=pattern:s=300x300
  11740. @end example
  11741. @item
  11742. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  11743. @example
  11744. life=ratio=2/3:s=200x200
  11745. @end example
  11746. @item
  11747. Specify a custom rule for evolving a randomly generated grid:
  11748. @example
  11749. life=rule=S14/B34
  11750. @end example
  11751. @item
  11752. Full example with slow death effect (mold) using @command{ffplay}:
  11753. @example
  11754. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  11755. @end example
  11756. @end itemize
  11757. @anchor{allrgb}
  11758. @anchor{allyuv}
  11759. @anchor{color}
  11760. @anchor{haldclutsrc}
  11761. @anchor{nullsrc}
  11762. @anchor{rgbtestsrc}
  11763. @anchor{smptebars}
  11764. @anchor{smptehdbars}
  11765. @anchor{testsrc}
  11766. @anchor{testsrc2}
  11767. @anchor{yuvtestsrc}
  11768. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  11769. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  11770. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  11771. The @code{color} source provides an uniformly colored input.
  11772. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  11773. @ref{haldclut} filter.
  11774. The @code{nullsrc} source returns unprocessed video frames. It is
  11775. mainly useful to be employed in analysis / debugging tools, or as the
  11776. source for filters which ignore the input data.
  11777. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  11778. detecting RGB vs BGR issues. You should see a red, green and blue
  11779. stripe from top to bottom.
  11780. The @code{smptebars} source generates a color bars pattern, based on
  11781. the SMPTE Engineering Guideline EG 1-1990.
  11782. The @code{smptehdbars} source generates a color bars pattern, based on
  11783. the SMPTE RP 219-2002.
  11784. The @code{testsrc} source generates a test video pattern, showing a
  11785. color pattern, a scrolling gradient and a timestamp. This is mainly
  11786. intended for testing purposes.
  11787. The @code{testsrc2} source is similar to testsrc, but supports more
  11788. pixel formats instead of just @code{rgb24}. This allows using it as an
  11789. input for other tests without requiring a format conversion.
  11790. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  11791. see a y, cb and cr stripe from top to bottom.
  11792. The sources accept the following parameters:
  11793. @table @option
  11794. @item color, c
  11795. Specify the color of the source, only available in the @code{color}
  11796. source. For the syntax of this option, check the "Color" section in the
  11797. ffmpeg-utils manual.
  11798. @item level
  11799. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  11800. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  11801. pixels to be used as identity matrix for 3D lookup tables. Each component is
  11802. coded on a @code{1/(N*N)} scale.
  11803. @item size, s
  11804. Specify the size of the sourced video. For the syntax of this option, check the
  11805. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11806. The default value is @code{320x240}.
  11807. This option is not available with the @code{haldclutsrc} filter.
  11808. @item rate, r
  11809. Specify the frame rate of the sourced video, as the number of frames
  11810. generated per second. It has to be a string in the format
  11811. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  11812. number or a valid video frame rate abbreviation. The default value is
  11813. "25".
  11814. @item sar
  11815. Set the sample aspect ratio of the sourced video.
  11816. @item duration, d
  11817. Set the duration of the sourced video. See
  11818. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11819. for the accepted syntax.
  11820. If not specified, or the expressed duration is negative, the video is
  11821. supposed to be generated forever.
  11822. @item decimals, n
  11823. Set the number of decimals to show in the timestamp, only available in the
  11824. @code{testsrc} source.
  11825. The displayed timestamp value will correspond to the original
  11826. timestamp value multiplied by the power of 10 of the specified
  11827. value. Default value is 0.
  11828. @end table
  11829. For example the following:
  11830. @example
  11831. testsrc=duration=5.3:size=qcif:rate=10
  11832. @end example
  11833. will generate a video with a duration of 5.3 seconds, with size
  11834. 176x144 and a frame rate of 10 frames per second.
  11835. The following graph description will generate a red source
  11836. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  11837. frames per second.
  11838. @example
  11839. color=c=red@@0.2:s=qcif:r=10
  11840. @end example
  11841. If the input content is to be ignored, @code{nullsrc} can be used. The
  11842. following command generates noise in the luminance plane by employing
  11843. the @code{geq} filter:
  11844. @example
  11845. nullsrc=s=256x256, geq=random(1)*255:128:128
  11846. @end example
  11847. @subsection Commands
  11848. The @code{color} source supports the following commands:
  11849. @table @option
  11850. @item c, color
  11851. Set the color of the created image. Accepts the same syntax of the
  11852. corresponding @option{color} option.
  11853. @end table
  11854. @c man end VIDEO SOURCES
  11855. @chapter Video Sinks
  11856. @c man begin VIDEO SINKS
  11857. Below is a description of the currently available video sinks.
  11858. @section buffersink
  11859. Buffer video frames, and make them available to the end of the filter
  11860. graph.
  11861. This sink is mainly intended for programmatic use, in particular
  11862. through the interface defined in @file{libavfilter/buffersink.h}
  11863. or the options system.
  11864. It accepts a pointer to an AVBufferSinkContext structure, which
  11865. defines the incoming buffers' formats, to be passed as the opaque
  11866. parameter to @code{avfilter_init_filter} for initialization.
  11867. @section nullsink
  11868. Null video sink: do absolutely nothing with the input video. It is
  11869. mainly useful as a template and for use in analysis / debugging
  11870. tools.
  11871. @c man end VIDEO SINKS
  11872. @chapter Multimedia Filters
  11873. @c man begin MULTIMEDIA FILTERS
  11874. Below is a description of the currently available multimedia filters.
  11875. @section ahistogram
  11876. Convert input audio to a video output, displaying the volume histogram.
  11877. The filter accepts the following options:
  11878. @table @option
  11879. @item dmode
  11880. Specify how histogram is calculated.
  11881. It accepts the following values:
  11882. @table @samp
  11883. @item single
  11884. Use single histogram for all channels.
  11885. @item separate
  11886. Use separate histogram for each channel.
  11887. @end table
  11888. Default is @code{single}.
  11889. @item rate, r
  11890. Set frame rate, expressed as number of frames per second. Default
  11891. value is "25".
  11892. @item size, s
  11893. Specify the video size for the output. For the syntax of this option, check the
  11894. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11895. Default value is @code{hd720}.
  11896. @item scale
  11897. Set display scale.
  11898. It accepts the following values:
  11899. @table @samp
  11900. @item log
  11901. logarithmic
  11902. @item sqrt
  11903. square root
  11904. @item cbrt
  11905. cubic root
  11906. @item lin
  11907. linear
  11908. @item rlog
  11909. reverse logarithmic
  11910. @end table
  11911. Default is @code{log}.
  11912. @item ascale
  11913. Set amplitude scale.
  11914. It accepts the following values:
  11915. @table @samp
  11916. @item log
  11917. logarithmic
  11918. @item lin
  11919. linear
  11920. @end table
  11921. Default is @code{log}.
  11922. @item acount
  11923. Set how much frames to accumulate in histogram.
  11924. Defauls is 1. Setting this to -1 accumulates all frames.
  11925. @item rheight
  11926. Set histogram ratio of window height.
  11927. @item slide
  11928. Set sonogram sliding.
  11929. It accepts the following values:
  11930. @table @samp
  11931. @item replace
  11932. replace old rows with new ones.
  11933. @item scroll
  11934. scroll from top to bottom.
  11935. @end table
  11936. Default is @code{replace}.
  11937. @end table
  11938. @section aphasemeter
  11939. Convert input audio to a video output, displaying the audio phase.
  11940. The filter accepts the following options:
  11941. @table @option
  11942. @item rate, r
  11943. Set the output frame rate. Default value is @code{25}.
  11944. @item size, s
  11945. Set the video size for the output. For the syntax of this option, check the
  11946. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11947. Default value is @code{800x400}.
  11948. @item rc
  11949. @item gc
  11950. @item bc
  11951. Specify the red, green, blue contrast. Default values are @code{2},
  11952. @code{7} and @code{1}.
  11953. Allowed range is @code{[0, 255]}.
  11954. @item mpc
  11955. Set color which will be used for drawing median phase. If color is
  11956. @code{none} which is default, no median phase value will be drawn.
  11957. @end table
  11958. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  11959. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  11960. The @code{-1} means left and right channels are completely out of phase and
  11961. @code{1} means channels are in phase.
  11962. @section avectorscope
  11963. Convert input audio to a video output, representing the audio vector
  11964. scope.
  11965. The filter is used to measure the difference between channels of stereo
  11966. audio stream. A monoaural signal, consisting of identical left and right
  11967. signal, results in straight vertical line. Any stereo separation is visible
  11968. as a deviation from this line, creating a Lissajous figure.
  11969. If the straight (or deviation from it) but horizontal line appears this
  11970. indicates that the left and right channels are out of phase.
  11971. The filter accepts the following options:
  11972. @table @option
  11973. @item mode, m
  11974. Set the vectorscope mode.
  11975. Available values are:
  11976. @table @samp
  11977. @item lissajous
  11978. Lissajous rotated by 45 degrees.
  11979. @item lissajous_xy
  11980. Same as above but not rotated.
  11981. @item polar
  11982. Shape resembling half of circle.
  11983. @end table
  11984. Default value is @samp{lissajous}.
  11985. @item size, s
  11986. Set the video size for the output. For the syntax of this option, check the
  11987. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11988. Default value is @code{400x400}.
  11989. @item rate, r
  11990. Set the output frame rate. Default value is @code{25}.
  11991. @item rc
  11992. @item gc
  11993. @item bc
  11994. @item ac
  11995. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  11996. @code{160}, @code{80} and @code{255}.
  11997. Allowed range is @code{[0, 255]}.
  11998. @item rf
  11999. @item gf
  12000. @item bf
  12001. @item af
  12002. Specify the red, green, blue and alpha fade. Default values are @code{15},
  12003. @code{10}, @code{5} and @code{5}.
  12004. Allowed range is @code{[0, 255]}.
  12005. @item zoom
  12006. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[1, 10]}.
  12007. @item draw
  12008. Set the vectorscope drawing mode.
  12009. Available values are:
  12010. @table @samp
  12011. @item dot
  12012. Draw dot for each sample.
  12013. @item line
  12014. Draw line between previous and current sample.
  12015. @end table
  12016. Default value is @samp{dot}.
  12017. @item scale
  12018. Specify amplitude scale of audio samples.
  12019. Available values are:
  12020. @table @samp
  12021. @item lin
  12022. Linear.
  12023. @item sqrt
  12024. Square root.
  12025. @item cbrt
  12026. Cubic root.
  12027. @item log
  12028. Logarithmic.
  12029. @end table
  12030. @end table
  12031. @subsection Examples
  12032. @itemize
  12033. @item
  12034. Complete example using @command{ffplay}:
  12035. @example
  12036. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  12037. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  12038. @end example
  12039. @end itemize
  12040. @section bench, abench
  12041. Benchmark part of a filtergraph.
  12042. The filter accepts the following options:
  12043. @table @option
  12044. @item action
  12045. Start or stop a timer.
  12046. Available values are:
  12047. @table @samp
  12048. @item start
  12049. Get the current time, set it as frame metadata (using the key
  12050. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  12051. @item stop
  12052. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  12053. the input frame metadata to get the time difference. Time difference, average,
  12054. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  12055. @code{min}) are then printed. The timestamps are expressed in seconds.
  12056. @end table
  12057. @end table
  12058. @subsection Examples
  12059. @itemize
  12060. @item
  12061. Benchmark @ref{selectivecolor} filter:
  12062. @example
  12063. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  12064. @end example
  12065. @end itemize
  12066. @section concat
  12067. Concatenate audio and video streams, joining them together one after the
  12068. other.
  12069. The filter works on segments of synchronized video and audio streams. All
  12070. segments must have the same number of streams of each type, and that will
  12071. also be the number of streams at output.
  12072. The filter accepts the following options:
  12073. @table @option
  12074. @item n
  12075. Set the number of segments. Default is 2.
  12076. @item v
  12077. Set the number of output video streams, that is also the number of video
  12078. streams in each segment. Default is 1.
  12079. @item a
  12080. Set the number of output audio streams, that is also the number of audio
  12081. streams in each segment. Default is 0.
  12082. @item unsafe
  12083. Activate unsafe mode: do not fail if segments have a different format.
  12084. @end table
  12085. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  12086. @var{a} audio outputs.
  12087. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  12088. segment, in the same order as the outputs, then the inputs for the second
  12089. segment, etc.
  12090. Related streams do not always have exactly the same duration, for various
  12091. reasons including codec frame size or sloppy authoring. For that reason,
  12092. related synchronized streams (e.g. a video and its audio track) should be
  12093. concatenated at once. The concat filter will use the duration of the longest
  12094. stream in each segment (except the last one), and if necessary pad shorter
  12095. audio streams with silence.
  12096. For this filter to work correctly, all segments must start at timestamp 0.
  12097. All corresponding streams must have the same parameters in all segments; the
  12098. filtering system will automatically select a common pixel format for video
  12099. streams, and a common sample format, sample rate and channel layout for
  12100. audio streams, but other settings, such as resolution, must be converted
  12101. explicitly by the user.
  12102. Different frame rates are acceptable but will result in variable frame rate
  12103. at output; be sure to configure the output file to handle it.
  12104. @subsection Examples
  12105. @itemize
  12106. @item
  12107. Concatenate an opening, an episode and an ending, all in bilingual version
  12108. (video in stream 0, audio in streams 1 and 2):
  12109. @example
  12110. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  12111. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  12112. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  12113. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  12114. @end example
  12115. @item
  12116. Concatenate two parts, handling audio and video separately, using the
  12117. (a)movie sources, and adjusting the resolution:
  12118. @example
  12119. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  12120. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  12121. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  12122. @end example
  12123. Note that a desync will happen at the stitch if the audio and video streams
  12124. do not have exactly the same duration in the first file.
  12125. @end itemize
  12126. @section drawgraph, adrawgraph
  12127. Draw a graph using input video or audio metadata.
  12128. It accepts the following parameters:
  12129. @table @option
  12130. @item m1
  12131. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  12132. @item fg1
  12133. Set 1st foreground color expression.
  12134. @item m2
  12135. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  12136. @item fg2
  12137. Set 2nd foreground color expression.
  12138. @item m3
  12139. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  12140. @item fg3
  12141. Set 3rd foreground color expression.
  12142. @item m4
  12143. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  12144. @item fg4
  12145. Set 4th foreground color expression.
  12146. @item min
  12147. Set minimal value of metadata value.
  12148. @item max
  12149. Set maximal value of metadata value.
  12150. @item bg
  12151. Set graph background color. Default is white.
  12152. @item mode
  12153. Set graph mode.
  12154. Available values for mode is:
  12155. @table @samp
  12156. @item bar
  12157. @item dot
  12158. @item line
  12159. @end table
  12160. Default is @code{line}.
  12161. @item slide
  12162. Set slide mode.
  12163. Available values for slide is:
  12164. @table @samp
  12165. @item frame
  12166. Draw new frame when right border is reached.
  12167. @item replace
  12168. Replace old columns with new ones.
  12169. @item scroll
  12170. Scroll from right to left.
  12171. @item rscroll
  12172. Scroll from left to right.
  12173. @item picture
  12174. Draw single picture.
  12175. @end table
  12176. Default is @code{frame}.
  12177. @item size
  12178. Set size of graph video. For the syntax of this option, check the
  12179. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12180. The default value is @code{900x256}.
  12181. The foreground color expressions can use the following variables:
  12182. @table @option
  12183. @item MIN
  12184. Minimal value of metadata value.
  12185. @item MAX
  12186. Maximal value of metadata value.
  12187. @item VAL
  12188. Current metadata key value.
  12189. @end table
  12190. The color is defined as 0xAABBGGRR.
  12191. @end table
  12192. Example using metadata from @ref{signalstats} filter:
  12193. @example
  12194. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  12195. @end example
  12196. Example using metadata from @ref{ebur128} filter:
  12197. @example
  12198. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  12199. @end example
  12200. @anchor{ebur128}
  12201. @section ebur128
  12202. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  12203. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  12204. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  12205. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  12206. The filter also has a video output (see the @var{video} option) with a real
  12207. time graph to observe the loudness evolution. The graphic contains the logged
  12208. message mentioned above, so it is not printed anymore when this option is set,
  12209. unless the verbose logging is set. The main graphing area contains the
  12210. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  12211. the momentary loudness (400 milliseconds).
  12212. More information about the Loudness Recommendation EBU R128 on
  12213. @url{http://tech.ebu.ch/loudness}.
  12214. The filter accepts the following options:
  12215. @table @option
  12216. @item video
  12217. Activate the video output. The audio stream is passed unchanged whether this
  12218. option is set or no. The video stream will be the first output stream if
  12219. activated. Default is @code{0}.
  12220. @item size
  12221. Set the video size. This option is for video only. For the syntax of this
  12222. option, check the
  12223. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12224. Default and minimum resolution is @code{640x480}.
  12225. @item meter
  12226. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  12227. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  12228. other integer value between this range is allowed.
  12229. @item metadata
  12230. Set metadata injection. If set to @code{1}, the audio input will be segmented
  12231. into 100ms output frames, each of them containing various loudness information
  12232. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  12233. Default is @code{0}.
  12234. @item framelog
  12235. Force the frame logging level.
  12236. Available values are:
  12237. @table @samp
  12238. @item info
  12239. information logging level
  12240. @item verbose
  12241. verbose logging level
  12242. @end table
  12243. By default, the logging level is set to @var{info}. If the @option{video} or
  12244. the @option{metadata} options are set, it switches to @var{verbose}.
  12245. @item peak
  12246. Set peak mode(s).
  12247. Available modes can be cumulated (the option is a @code{flag} type). Possible
  12248. values are:
  12249. @table @samp
  12250. @item none
  12251. Disable any peak mode (default).
  12252. @item sample
  12253. Enable sample-peak mode.
  12254. Simple peak mode looking for the higher sample value. It logs a message
  12255. for sample-peak (identified by @code{SPK}).
  12256. @item true
  12257. Enable true-peak mode.
  12258. If enabled, the peak lookup is done on an over-sampled version of the input
  12259. stream for better peak accuracy. It logs a message for true-peak.
  12260. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  12261. This mode requires a build with @code{libswresample}.
  12262. @end table
  12263. @item dualmono
  12264. Treat mono input files as "dual mono". If a mono file is intended for playback
  12265. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  12266. If set to @code{true}, this option will compensate for this effect.
  12267. Multi-channel input files are not affected by this option.
  12268. @item panlaw
  12269. Set a specific pan law to be used for the measurement of dual mono files.
  12270. This parameter is optional, and has a default value of -3.01dB.
  12271. @end table
  12272. @subsection Examples
  12273. @itemize
  12274. @item
  12275. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  12276. @example
  12277. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  12278. @end example
  12279. @item
  12280. Run an analysis with @command{ffmpeg}:
  12281. @example
  12282. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  12283. @end example
  12284. @end itemize
  12285. @section interleave, ainterleave
  12286. Temporally interleave frames from several inputs.
  12287. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  12288. These filters read frames from several inputs and send the oldest
  12289. queued frame to the output.
  12290. Input streams must have well defined, monotonically increasing frame
  12291. timestamp values.
  12292. In order to submit one frame to output, these filters need to enqueue
  12293. at least one frame for each input, so they cannot work in case one
  12294. input is not yet terminated and will not receive incoming frames.
  12295. For example consider the case when one input is a @code{select} filter
  12296. which always drops input frames. The @code{interleave} filter will keep
  12297. reading from that input, but it will never be able to send new frames
  12298. to output until the input sends an end-of-stream signal.
  12299. Also, depending on inputs synchronization, the filters will drop
  12300. frames in case one input receives more frames than the other ones, and
  12301. the queue is already filled.
  12302. These filters accept the following options:
  12303. @table @option
  12304. @item nb_inputs, n
  12305. Set the number of different inputs, it is 2 by default.
  12306. @end table
  12307. @subsection Examples
  12308. @itemize
  12309. @item
  12310. Interleave frames belonging to different streams using @command{ffmpeg}:
  12311. @example
  12312. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  12313. @end example
  12314. @item
  12315. Add flickering blur effect:
  12316. @example
  12317. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  12318. @end example
  12319. @end itemize
  12320. @section metadata, ametadata
  12321. Manipulate frame metadata.
  12322. This filter accepts the following options:
  12323. @table @option
  12324. @item mode
  12325. Set mode of operation of the filter.
  12326. Can be one of the following:
  12327. @table @samp
  12328. @item select
  12329. If both @code{value} and @code{key} is set, select frames
  12330. which have such metadata. If only @code{key} is set, select
  12331. every frame that has such key in metadata.
  12332. @item add
  12333. Add new metadata @code{key} and @code{value}. If key is already available
  12334. do nothing.
  12335. @item modify
  12336. Modify value of already present key.
  12337. @item delete
  12338. If @code{value} is set, delete only keys that have such value.
  12339. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  12340. the frame.
  12341. @item print
  12342. Print key and its value if metadata was found. If @code{key} is not set print all
  12343. metadata values available in frame.
  12344. @end table
  12345. @item key
  12346. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  12347. @item value
  12348. Set metadata value which will be used. This option is mandatory for
  12349. @code{modify} and @code{add} mode.
  12350. @item function
  12351. Which function to use when comparing metadata value and @code{value}.
  12352. Can be one of following:
  12353. @table @samp
  12354. @item same_str
  12355. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  12356. @item starts_with
  12357. Values are interpreted as strings, returns true if metadata value starts with
  12358. the @code{value} option string.
  12359. @item less
  12360. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  12361. @item equal
  12362. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  12363. @item greater
  12364. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  12365. @item expr
  12366. Values are interpreted as floats, returns true if expression from option @code{expr}
  12367. evaluates to true.
  12368. @end table
  12369. @item expr
  12370. Set expression which is used when @code{function} is set to @code{expr}.
  12371. The expression is evaluated through the eval API and can contain the following
  12372. constants:
  12373. @table @option
  12374. @item VALUE1
  12375. Float representation of @code{value} from metadata key.
  12376. @item VALUE2
  12377. Float representation of @code{value} as supplied by user in @code{value} option.
  12378. @item file
  12379. If specified in @code{print} mode, output is written to the named file. Instead of
  12380. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  12381. for standard output. If @code{file} option is not set, output is written to the log
  12382. with AV_LOG_INFO loglevel.
  12383. @end table
  12384. @end table
  12385. @subsection Examples
  12386. @itemize
  12387. @item
  12388. Print all metadata values for frames with key @code{lavfi.singnalstats.YDIF} with values
  12389. between 0 and 1.
  12390. @example
  12391. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  12392. @end example
  12393. @item
  12394. Print silencedetect output to file @file{metadata.txt}.
  12395. @example
  12396. silencedetect,ametadata=mode=print:file=metadata.txt
  12397. @end example
  12398. @item
  12399. Direct all metadata to a pipe with file descriptor 4.
  12400. @example
  12401. metadata=mode=print:file='pipe\:4'
  12402. @end example
  12403. @end itemize
  12404. @section perms, aperms
  12405. Set read/write permissions for the output frames.
  12406. These filters are mainly aimed at developers to test direct path in the
  12407. following filter in the filtergraph.
  12408. The filters accept the following options:
  12409. @table @option
  12410. @item mode
  12411. Select the permissions mode.
  12412. It accepts the following values:
  12413. @table @samp
  12414. @item none
  12415. Do nothing. This is the default.
  12416. @item ro
  12417. Set all the output frames read-only.
  12418. @item rw
  12419. Set all the output frames directly writable.
  12420. @item toggle
  12421. Make the frame read-only if writable, and writable if read-only.
  12422. @item random
  12423. Set each output frame read-only or writable randomly.
  12424. @end table
  12425. @item seed
  12426. Set the seed for the @var{random} mode, must be an integer included between
  12427. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  12428. @code{-1}, the filter will try to use a good random seed on a best effort
  12429. basis.
  12430. @end table
  12431. Note: in case of auto-inserted filter between the permission filter and the
  12432. following one, the permission might not be received as expected in that
  12433. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  12434. perms/aperms filter can avoid this problem.
  12435. @section realtime, arealtime
  12436. Slow down filtering to match real time approximatively.
  12437. These filters will pause the filtering for a variable amount of time to
  12438. match the output rate with the input timestamps.
  12439. They are similar to the @option{re} option to @code{ffmpeg}.
  12440. They accept the following options:
  12441. @table @option
  12442. @item limit
  12443. Time limit for the pauses. Any pause longer than that will be considered
  12444. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  12445. @end table
  12446. @anchor{select}
  12447. @section select, aselect
  12448. Select frames to pass in output.
  12449. This filter accepts the following options:
  12450. @table @option
  12451. @item expr, e
  12452. Set expression, which is evaluated for each input frame.
  12453. If the expression is evaluated to zero, the frame is discarded.
  12454. If the evaluation result is negative or NaN, the frame is sent to the
  12455. first output; otherwise it is sent to the output with index
  12456. @code{ceil(val)-1}, assuming that the input index starts from 0.
  12457. For example a value of @code{1.2} corresponds to the output with index
  12458. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  12459. @item outputs, n
  12460. Set the number of outputs. The output to which to send the selected
  12461. frame is based on the result of the evaluation. Default value is 1.
  12462. @end table
  12463. The expression can contain the following constants:
  12464. @table @option
  12465. @item n
  12466. The (sequential) number of the filtered frame, starting from 0.
  12467. @item selected_n
  12468. The (sequential) number of the selected frame, starting from 0.
  12469. @item prev_selected_n
  12470. The sequential number of the last selected frame. It's NAN if undefined.
  12471. @item TB
  12472. The timebase of the input timestamps.
  12473. @item pts
  12474. The PTS (Presentation TimeStamp) of the filtered video frame,
  12475. expressed in @var{TB} units. It's NAN if undefined.
  12476. @item t
  12477. The PTS of the filtered video frame,
  12478. expressed in seconds. It's NAN if undefined.
  12479. @item prev_pts
  12480. The PTS of the previously filtered video frame. It's NAN if undefined.
  12481. @item prev_selected_pts
  12482. The PTS of the last previously filtered video frame. It's NAN if undefined.
  12483. @item prev_selected_t
  12484. The PTS of the last previously selected video frame. It's NAN if undefined.
  12485. @item start_pts
  12486. The PTS of the first video frame in the video. It's NAN if undefined.
  12487. @item start_t
  12488. The time of the first video frame in the video. It's NAN if undefined.
  12489. @item pict_type @emph{(video only)}
  12490. The type of the filtered frame. It can assume one of the following
  12491. values:
  12492. @table @option
  12493. @item I
  12494. @item P
  12495. @item B
  12496. @item S
  12497. @item SI
  12498. @item SP
  12499. @item BI
  12500. @end table
  12501. @item interlace_type @emph{(video only)}
  12502. The frame interlace type. It can assume one of the following values:
  12503. @table @option
  12504. @item PROGRESSIVE
  12505. The frame is progressive (not interlaced).
  12506. @item TOPFIRST
  12507. The frame is top-field-first.
  12508. @item BOTTOMFIRST
  12509. The frame is bottom-field-first.
  12510. @end table
  12511. @item consumed_sample_n @emph{(audio only)}
  12512. the number of selected samples before the current frame
  12513. @item samples_n @emph{(audio only)}
  12514. the number of samples in the current frame
  12515. @item sample_rate @emph{(audio only)}
  12516. the input sample rate
  12517. @item key
  12518. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  12519. @item pos
  12520. the position in the file of the filtered frame, -1 if the information
  12521. is not available (e.g. for synthetic video)
  12522. @item scene @emph{(video only)}
  12523. value between 0 and 1 to indicate a new scene; a low value reflects a low
  12524. probability for the current frame to introduce a new scene, while a higher
  12525. value means the current frame is more likely to be one (see the example below)
  12526. @item concatdec_select
  12527. The concat demuxer can select only part of a concat input file by setting an
  12528. inpoint and an outpoint, but the output packets may not be entirely contained
  12529. in the selected interval. By using this variable, it is possible to skip frames
  12530. generated by the concat demuxer which are not exactly contained in the selected
  12531. interval.
  12532. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  12533. and the @var{lavf.concat.duration} packet metadata values which are also
  12534. present in the decoded frames.
  12535. The @var{concatdec_select} variable is -1 if the frame pts is at least
  12536. start_time and either the duration metadata is missing or the frame pts is less
  12537. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  12538. missing.
  12539. That basically means that an input frame is selected if its pts is within the
  12540. interval set by the concat demuxer.
  12541. @end table
  12542. The default value of the select expression is "1".
  12543. @subsection Examples
  12544. @itemize
  12545. @item
  12546. Select all frames in input:
  12547. @example
  12548. select
  12549. @end example
  12550. The example above is the same as:
  12551. @example
  12552. select=1
  12553. @end example
  12554. @item
  12555. Skip all frames:
  12556. @example
  12557. select=0
  12558. @end example
  12559. @item
  12560. Select only I-frames:
  12561. @example
  12562. select='eq(pict_type\,I)'
  12563. @end example
  12564. @item
  12565. Select one frame every 100:
  12566. @example
  12567. select='not(mod(n\,100))'
  12568. @end example
  12569. @item
  12570. Select only frames contained in the 10-20 time interval:
  12571. @example
  12572. select=between(t\,10\,20)
  12573. @end example
  12574. @item
  12575. Select only I-frames contained in the 10-20 time interval:
  12576. @example
  12577. select=between(t\,10\,20)*eq(pict_type\,I)
  12578. @end example
  12579. @item
  12580. Select frames with a minimum distance of 10 seconds:
  12581. @example
  12582. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  12583. @end example
  12584. @item
  12585. Use aselect to select only audio frames with samples number > 100:
  12586. @example
  12587. aselect='gt(samples_n\,100)'
  12588. @end example
  12589. @item
  12590. Create a mosaic of the first scenes:
  12591. @example
  12592. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  12593. @end example
  12594. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  12595. choice.
  12596. @item
  12597. Send even and odd frames to separate outputs, and compose them:
  12598. @example
  12599. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  12600. @end example
  12601. @item
  12602. Select useful frames from an ffconcat file which is using inpoints and
  12603. outpoints but where the source files are not intra frame only.
  12604. @example
  12605. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  12606. @end example
  12607. @end itemize
  12608. @section sendcmd, asendcmd
  12609. Send commands to filters in the filtergraph.
  12610. These filters read commands to be sent to other filters in the
  12611. filtergraph.
  12612. @code{sendcmd} must be inserted between two video filters,
  12613. @code{asendcmd} must be inserted between two audio filters, but apart
  12614. from that they act the same way.
  12615. The specification of commands can be provided in the filter arguments
  12616. with the @var{commands} option, or in a file specified by the
  12617. @var{filename} option.
  12618. These filters accept the following options:
  12619. @table @option
  12620. @item commands, c
  12621. Set the commands to be read and sent to the other filters.
  12622. @item filename, f
  12623. Set the filename of the commands to be read and sent to the other
  12624. filters.
  12625. @end table
  12626. @subsection Commands syntax
  12627. A commands description consists of a sequence of interval
  12628. specifications, comprising a list of commands to be executed when a
  12629. particular event related to that interval occurs. The occurring event
  12630. is typically the current frame time entering or leaving a given time
  12631. interval.
  12632. An interval is specified by the following syntax:
  12633. @example
  12634. @var{START}[-@var{END}] @var{COMMANDS};
  12635. @end example
  12636. The time interval is specified by the @var{START} and @var{END} times.
  12637. @var{END} is optional and defaults to the maximum time.
  12638. The current frame time is considered within the specified interval if
  12639. it is included in the interval [@var{START}, @var{END}), that is when
  12640. the time is greater or equal to @var{START} and is lesser than
  12641. @var{END}.
  12642. @var{COMMANDS} consists of a sequence of one or more command
  12643. specifications, separated by ",", relating to that interval. The
  12644. syntax of a command specification is given by:
  12645. @example
  12646. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  12647. @end example
  12648. @var{FLAGS} is optional and specifies the type of events relating to
  12649. the time interval which enable sending the specified command, and must
  12650. be a non-null sequence of identifier flags separated by "+" or "|" and
  12651. enclosed between "[" and "]".
  12652. The following flags are recognized:
  12653. @table @option
  12654. @item enter
  12655. The command is sent when the current frame timestamp enters the
  12656. specified interval. In other words, the command is sent when the
  12657. previous frame timestamp was not in the given interval, and the
  12658. current is.
  12659. @item leave
  12660. The command is sent when the current frame timestamp leaves the
  12661. specified interval. In other words, the command is sent when the
  12662. previous frame timestamp was in the given interval, and the
  12663. current is not.
  12664. @end table
  12665. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  12666. assumed.
  12667. @var{TARGET} specifies the target of the command, usually the name of
  12668. the filter class or a specific filter instance name.
  12669. @var{COMMAND} specifies the name of the command for the target filter.
  12670. @var{ARG} is optional and specifies the optional list of argument for
  12671. the given @var{COMMAND}.
  12672. Between one interval specification and another, whitespaces, or
  12673. sequences of characters starting with @code{#} until the end of line,
  12674. are ignored and can be used to annotate comments.
  12675. A simplified BNF description of the commands specification syntax
  12676. follows:
  12677. @example
  12678. @var{COMMAND_FLAG} ::= "enter" | "leave"
  12679. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  12680. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  12681. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  12682. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  12683. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  12684. @end example
  12685. @subsection Examples
  12686. @itemize
  12687. @item
  12688. Specify audio tempo change at second 4:
  12689. @example
  12690. asendcmd=c='4.0 atempo tempo 1.5',atempo
  12691. @end example
  12692. @item
  12693. Specify a list of drawtext and hue commands in a file.
  12694. @example
  12695. # show text in the interval 5-10
  12696. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  12697. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  12698. # desaturate the image in the interval 15-20
  12699. 15.0-20.0 [enter] hue s 0,
  12700. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  12701. [leave] hue s 1,
  12702. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  12703. # apply an exponential saturation fade-out effect, starting from time 25
  12704. 25 [enter] hue s exp(25-t)
  12705. @end example
  12706. A filtergraph allowing to read and process the above command list
  12707. stored in a file @file{test.cmd}, can be specified with:
  12708. @example
  12709. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  12710. @end example
  12711. @end itemize
  12712. @anchor{setpts}
  12713. @section setpts, asetpts
  12714. Change the PTS (presentation timestamp) of the input frames.
  12715. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  12716. This filter accepts the following options:
  12717. @table @option
  12718. @item expr
  12719. The expression which is evaluated for each frame to construct its timestamp.
  12720. @end table
  12721. The expression is evaluated through the eval API and can contain the following
  12722. constants:
  12723. @table @option
  12724. @item FRAME_RATE
  12725. frame rate, only defined for constant frame-rate video
  12726. @item PTS
  12727. The presentation timestamp in input
  12728. @item N
  12729. The count of the input frame for video or the number of consumed samples,
  12730. not including the current frame for audio, starting from 0.
  12731. @item NB_CONSUMED_SAMPLES
  12732. The number of consumed samples, not including the current frame (only
  12733. audio)
  12734. @item NB_SAMPLES, S
  12735. The number of samples in the current frame (only audio)
  12736. @item SAMPLE_RATE, SR
  12737. The audio sample rate.
  12738. @item STARTPTS
  12739. The PTS of the first frame.
  12740. @item STARTT
  12741. the time in seconds of the first frame
  12742. @item INTERLACED
  12743. State whether the current frame is interlaced.
  12744. @item T
  12745. the time in seconds of the current frame
  12746. @item POS
  12747. original position in the file of the frame, or undefined if undefined
  12748. for the current frame
  12749. @item PREV_INPTS
  12750. The previous input PTS.
  12751. @item PREV_INT
  12752. previous input time in seconds
  12753. @item PREV_OUTPTS
  12754. The previous output PTS.
  12755. @item PREV_OUTT
  12756. previous output time in seconds
  12757. @item RTCTIME
  12758. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  12759. instead.
  12760. @item RTCSTART
  12761. The wallclock (RTC) time at the start of the movie in microseconds.
  12762. @item TB
  12763. The timebase of the input timestamps.
  12764. @end table
  12765. @subsection Examples
  12766. @itemize
  12767. @item
  12768. Start counting PTS from zero
  12769. @example
  12770. setpts=PTS-STARTPTS
  12771. @end example
  12772. @item
  12773. Apply fast motion effect:
  12774. @example
  12775. setpts=0.5*PTS
  12776. @end example
  12777. @item
  12778. Apply slow motion effect:
  12779. @example
  12780. setpts=2.0*PTS
  12781. @end example
  12782. @item
  12783. Set fixed rate of 25 frames per second:
  12784. @example
  12785. setpts=N/(25*TB)
  12786. @end example
  12787. @item
  12788. Set fixed rate 25 fps with some jitter:
  12789. @example
  12790. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  12791. @end example
  12792. @item
  12793. Apply an offset of 10 seconds to the input PTS:
  12794. @example
  12795. setpts=PTS+10/TB
  12796. @end example
  12797. @item
  12798. Generate timestamps from a "live source" and rebase onto the current timebase:
  12799. @example
  12800. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  12801. @end example
  12802. @item
  12803. Generate timestamps by counting samples:
  12804. @example
  12805. asetpts=N/SR/TB
  12806. @end example
  12807. @end itemize
  12808. @section settb, asettb
  12809. Set the timebase to use for the output frames timestamps.
  12810. It is mainly useful for testing timebase configuration.
  12811. It accepts the following parameters:
  12812. @table @option
  12813. @item expr, tb
  12814. The expression which is evaluated into the output timebase.
  12815. @end table
  12816. The value for @option{tb} is an arithmetic expression representing a
  12817. rational. The expression can contain the constants "AVTB" (the default
  12818. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  12819. audio only). Default value is "intb".
  12820. @subsection Examples
  12821. @itemize
  12822. @item
  12823. Set the timebase to 1/25:
  12824. @example
  12825. settb=expr=1/25
  12826. @end example
  12827. @item
  12828. Set the timebase to 1/10:
  12829. @example
  12830. settb=expr=0.1
  12831. @end example
  12832. @item
  12833. Set the timebase to 1001/1000:
  12834. @example
  12835. settb=1+0.001
  12836. @end example
  12837. @item
  12838. Set the timebase to 2*intb:
  12839. @example
  12840. settb=2*intb
  12841. @end example
  12842. @item
  12843. Set the default timebase value:
  12844. @example
  12845. settb=AVTB
  12846. @end example
  12847. @end itemize
  12848. @section showcqt
  12849. Convert input audio to a video output representing frequency spectrum
  12850. logarithmically using Brown-Puckette constant Q transform algorithm with
  12851. direct frequency domain coefficient calculation (but the transform itself
  12852. is not really constant Q, instead the Q factor is actually variable/clamped),
  12853. with musical tone scale, from E0 to D#10.
  12854. The filter accepts the following options:
  12855. @table @option
  12856. @item size, s
  12857. Specify the video size for the output. It must be even. For the syntax of this option,
  12858. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12859. Default value is @code{1920x1080}.
  12860. @item fps, rate, r
  12861. Set the output frame rate. Default value is @code{25}.
  12862. @item bar_h
  12863. Set the bargraph height. It must be even. Default value is @code{-1} which
  12864. computes the bargraph height automatically.
  12865. @item axis_h
  12866. Set the axis height. It must be even. Default value is @code{-1} which computes
  12867. the axis height automatically.
  12868. @item sono_h
  12869. Set the sonogram height. It must be even. Default value is @code{-1} which
  12870. computes the sonogram height automatically.
  12871. @item fullhd
  12872. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  12873. instead. Default value is @code{1}.
  12874. @item sono_v, volume
  12875. Specify the sonogram volume expression. It can contain variables:
  12876. @table @option
  12877. @item bar_v
  12878. the @var{bar_v} evaluated expression
  12879. @item frequency, freq, f
  12880. the frequency where it is evaluated
  12881. @item timeclamp, tc
  12882. the value of @var{timeclamp} option
  12883. @end table
  12884. and functions:
  12885. @table @option
  12886. @item a_weighting(f)
  12887. A-weighting of equal loudness
  12888. @item b_weighting(f)
  12889. B-weighting of equal loudness
  12890. @item c_weighting(f)
  12891. C-weighting of equal loudness.
  12892. @end table
  12893. Default value is @code{16}.
  12894. @item bar_v, volume2
  12895. Specify the bargraph volume expression. It can contain variables:
  12896. @table @option
  12897. @item sono_v
  12898. the @var{sono_v} evaluated expression
  12899. @item frequency, freq, f
  12900. the frequency where it is evaluated
  12901. @item timeclamp, tc
  12902. the value of @var{timeclamp} option
  12903. @end table
  12904. and functions:
  12905. @table @option
  12906. @item a_weighting(f)
  12907. A-weighting of equal loudness
  12908. @item b_weighting(f)
  12909. B-weighting of equal loudness
  12910. @item c_weighting(f)
  12911. C-weighting of equal loudness.
  12912. @end table
  12913. Default value is @code{sono_v}.
  12914. @item sono_g, gamma
  12915. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  12916. higher gamma makes the spectrum having more range. Default value is @code{3}.
  12917. Acceptable range is @code{[1, 7]}.
  12918. @item bar_g, gamma2
  12919. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  12920. @code{[1, 7]}.
  12921. @item bar_t
  12922. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  12923. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  12924. @item timeclamp, tc
  12925. Specify the transform timeclamp. At low frequency, there is trade-off between
  12926. accuracy in time domain and frequency domain. If timeclamp is lower,
  12927. event in time domain is represented more accurately (such as fast bass drum),
  12928. otherwise event in frequency domain is represented more accurately
  12929. (such as bass guitar). Acceptable range is @code{[0.1, 1]}. Default value is @code{0.17}.
  12930. @item basefreq
  12931. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  12932. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  12933. @item endfreq
  12934. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  12935. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  12936. @item coeffclamp
  12937. This option is deprecated and ignored.
  12938. @item tlength
  12939. Specify the transform length in time domain. Use this option to control accuracy
  12940. trade-off between time domain and frequency domain at every frequency sample.
  12941. It can contain variables:
  12942. @table @option
  12943. @item frequency, freq, f
  12944. the frequency where it is evaluated
  12945. @item timeclamp, tc
  12946. the value of @var{timeclamp} option.
  12947. @end table
  12948. Default value is @code{384*tc/(384+tc*f)}.
  12949. @item count
  12950. Specify the transform count for every video frame. Default value is @code{6}.
  12951. Acceptable range is @code{[1, 30]}.
  12952. @item fcount
  12953. Specify the transform count for every single pixel. Default value is @code{0},
  12954. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  12955. @item fontfile
  12956. Specify font file for use with freetype to draw the axis. If not specified,
  12957. use embedded font. Note that drawing with font file or embedded font is not
  12958. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  12959. option instead.
  12960. @item font
  12961. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  12962. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  12963. @item fontcolor
  12964. Specify font color expression. This is arithmetic expression that should return
  12965. integer value 0xRRGGBB. It can contain variables:
  12966. @table @option
  12967. @item frequency, freq, f
  12968. the frequency where it is evaluated
  12969. @item timeclamp, tc
  12970. the value of @var{timeclamp} option
  12971. @end table
  12972. and functions:
  12973. @table @option
  12974. @item midi(f)
  12975. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  12976. @item r(x), g(x), b(x)
  12977. red, green, and blue value of intensity x.
  12978. @end table
  12979. Default value is @code{st(0, (midi(f)-59.5)/12);
  12980. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  12981. r(1-ld(1)) + b(ld(1))}.
  12982. @item axisfile
  12983. Specify image file to draw the axis. This option override @var{fontfile} and
  12984. @var{fontcolor} option.
  12985. @item axis, text
  12986. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  12987. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  12988. Default value is @code{1}.
  12989. @item csp
  12990. Set colorspace. The accepted values are:
  12991. @table @samp
  12992. @item unspecified
  12993. Unspecified (default)
  12994. @item bt709
  12995. BT.709
  12996. @item fcc
  12997. FCC
  12998. @item bt470bg
  12999. BT.470BG or BT.601-6 625
  13000. @item smpte170m
  13001. SMPTE-170M or BT.601-6 525
  13002. @item smpte240m
  13003. SMPTE-240M
  13004. @item bt2020ncl
  13005. BT.2020 with non-constant luminance
  13006. @end table
  13007. @item cscheme
  13008. Set spectrogram color scheme. This is list of floating point values with format
  13009. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  13010. The default is @code{1|0.5|0|0|0.5|1}.
  13011. @end table
  13012. @subsection Examples
  13013. @itemize
  13014. @item
  13015. Playing audio while showing the spectrum:
  13016. @example
  13017. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  13018. @end example
  13019. @item
  13020. Same as above, but with frame rate 30 fps:
  13021. @example
  13022. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  13023. @end example
  13024. @item
  13025. Playing at 1280x720:
  13026. @example
  13027. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  13028. @end example
  13029. @item
  13030. Disable sonogram display:
  13031. @example
  13032. sono_h=0
  13033. @end example
  13034. @item
  13035. A1 and its harmonics: A1, A2, (near)E3, A3:
  13036. @example
  13037. 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),
  13038. asplit[a][out1]; [a] showcqt [out0]'
  13039. @end example
  13040. @item
  13041. Same as above, but with more accuracy in frequency domain:
  13042. @example
  13043. 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),
  13044. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  13045. @end example
  13046. @item
  13047. Custom volume:
  13048. @example
  13049. bar_v=10:sono_v=bar_v*a_weighting(f)
  13050. @end example
  13051. @item
  13052. Custom gamma, now spectrum is linear to the amplitude.
  13053. @example
  13054. bar_g=2:sono_g=2
  13055. @end example
  13056. @item
  13057. Custom tlength equation:
  13058. @example
  13059. 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)))'
  13060. @end example
  13061. @item
  13062. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  13063. @example
  13064. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  13065. @end example
  13066. @item
  13067. Custom font using fontconfig:
  13068. @example
  13069. font='Courier New,Monospace,mono|bold'
  13070. @end example
  13071. @item
  13072. Custom frequency range with custom axis using image file:
  13073. @example
  13074. axisfile=myaxis.png:basefreq=40:endfreq=10000
  13075. @end example
  13076. @end itemize
  13077. @section showfreqs
  13078. Convert input audio to video output representing the audio power spectrum.
  13079. Audio amplitude is on Y-axis while frequency is on X-axis.
  13080. The filter accepts the following options:
  13081. @table @option
  13082. @item size, s
  13083. Specify size of video. For the syntax of this option, check the
  13084. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13085. Default is @code{1024x512}.
  13086. @item mode
  13087. Set display mode.
  13088. This set how each frequency bin will be represented.
  13089. It accepts the following values:
  13090. @table @samp
  13091. @item line
  13092. @item bar
  13093. @item dot
  13094. @end table
  13095. Default is @code{bar}.
  13096. @item ascale
  13097. Set amplitude scale.
  13098. It accepts the following values:
  13099. @table @samp
  13100. @item lin
  13101. Linear scale.
  13102. @item sqrt
  13103. Square root scale.
  13104. @item cbrt
  13105. Cubic root scale.
  13106. @item log
  13107. Logarithmic scale.
  13108. @end table
  13109. Default is @code{log}.
  13110. @item fscale
  13111. Set frequency scale.
  13112. It accepts the following values:
  13113. @table @samp
  13114. @item lin
  13115. Linear scale.
  13116. @item log
  13117. Logarithmic scale.
  13118. @item rlog
  13119. Reverse logarithmic scale.
  13120. @end table
  13121. Default is @code{lin}.
  13122. @item win_size
  13123. Set window size.
  13124. It accepts the following values:
  13125. @table @samp
  13126. @item w16
  13127. @item w32
  13128. @item w64
  13129. @item w128
  13130. @item w256
  13131. @item w512
  13132. @item w1024
  13133. @item w2048
  13134. @item w4096
  13135. @item w8192
  13136. @item w16384
  13137. @item w32768
  13138. @item w65536
  13139. @end table
  13140. Default is @code{w2048}
  13141. @item win_func
  13142. Set windowing function.
  13143. It accepts the following values:
  13144. @table @samp
  13145. @item rect
  13146. @item bartlett
  13147. @item hanning
  13148. @item hamming
  13149. @item blackman
  13150. @item welch
  13151. @item flattop
  13152. @item bharris
  13153. @item bnuttall
  13154. @item bhann
  13155. @item sine
  13156. @item nuttall
  13157. @item lanczos
  13158. @item gauss
  13159. @item tukey
  13160. @item dolph
  13161. @item cauchy
  13162. @item parzen
  13163. @item poisson
  13164. @end table
  13165. Default is @code{hanning}.
  13166. @item overlap
  13167. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  13168. which means optimal overlap for selected window function will be picked.
  13169. @item averaging
  13170. Set time averaging. Setting this to 0 will display current maximal peaks.
  13171. Default is @code{1}, which means time averaging is disabled.
  13172. @item colors
  13173. Specify list of colors separated by space or by '|' which will be used to
  13174. draw channel frequencies. Unrecognized or missing colors will be replaced
  13175. by white color.
  13176. @item cmode
  13177. Set channel display mode.
  13178. It accepts the following values:
  13179. @table @samp
  13180. @item combined
  13181. @item separate
  13182. @end table
  13183. Default is @code{combined}.
  13184. @item minamp
  13185. Set minimum amplitude used in @code{log} amplitude scaler.
  13186. @end table
  13187. @anchor{showspectrum}
  13188. @section showspectrum
  13189. Convert input audio to a video output, representing the audio frequency
  13190. spectrum.
  13191. The filter accepts the following options:
  13192. @table @option
  13193. @item size, s
  13194. Specify the video size for the output. For the syntax of this option, check the
  13195. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13196. Default value is @code{640x512}.
  13197. @item slide
  13198. Specify how the spectrum should slide along the window.
  13199. It accepts the following values:
  13200. @table @samp
  13201. @item replace
  13202. the samples start again on the left when they reach the right
  13203. @item scroll
  13204. the samples scroll from right to left
  13205. @item fullframe
  13206. frames are only produced when the samples reach the right
  13207. @item rscroll
  13208. the samples scroll from left to right
  13209. @end table
  13210. Default value is @code{replace}.
  13211. @item mode
  13212. Specify display mode.
  13213. It accepts the following values:
  13214. @table @samp
  13215. @item combined
  13216. all channels are displayed in the same row
  13217. @item separate
  13218. all channels are displayed in separate rows
  13219. @end table
  13220. Default value is @samp{combined}.
  13221. @item color
  13222. Specify display color mode.
  13223. It accepts the following values:
  13224. @table @samp
  13225. @item channel
  13226. each channel is displayed in a separate color
  13227. @item intensity
  13228. each channel is displayed using the same color scheme
  13229. @item rainbow
  13230. each channel is displayed using the rainbow color scheme
  13231. @item moreland
  13232. each channel is displayed using the moreland color scheme
  13233. @item nebulae
  13234. each channel is displayed using the nebulae color scheme
  13235. @item fire
  13236. each channel is displayed using the fire color scheme
  13237. @item fiery
  13238. each channel is displayed using the fiery color scheme
  13239. @item fruit
  13240. each channel is displayed using the fruit color scheme
  13241. @item cool
  13242. each channel is displayed using the cool color scheme
  13243. @end table
  13244. Default value is @samp{channel}.
  13245. @item scale
  13246. Specify scale used for calculating intensity color values.
  13247. It accepts the following values:
  13248. @table @samp
  13249. @item lin
  13250. linear
  13251. @item sqrt
  13252. square root, default
  13253. @item cbrt
  13254. cubic root
  13255. @item log
  13256. logarithmic
  13257. @item 4thrt
  13258. 4th root
  13259. @item 5thrt
  13260. 5th root
  13261. @end table
  13262. Default value is @samp{sqrt}.
  13263. @item saturation
  13264. Set saturation modifier for displayed colors. Negative values provide
  13265. alternative color scheme. @code{0} is no saturation at all.
  13266. Saturation must be in [-10.0, 10.0] range.
  13267. Default value is @code{1}.
  13268. @item win_func
  13269. Set window function.
  13270. It accepts the following values:
  13271. @table @samp
  13272. @item rect
  13273. @item bartlett
  13274. @item hann
  13275. @item hanning
  13276. @item hamming
  13277. @item blackman
  13278. @item welch
  13279. @item flattop
  13280. @item bharris
  13281. @item bnuttall
  13282. @item bhann
  13283. @item sine
  13284. @item nuttall
  13285. @item lanczos
  13286. @item gauss
  13287. @item tukey
  13288. @item dolph
  13289. @item cauchy
  13290. @item parzen
  13291. @item poisson
  13292. @end table
  13293. Default value is @code{hann}.
  13294. @item orientation
  13295. Set orientation of time vs frequency axis. Can be @code{vertical} or
  13296. @code{horizontal}. Default is @code{vertical}.
  13297. @item overlap
  13298. Set ratio of overlap window. Default value is @code{0}.
  13299. When value is @code{1} overlap is set to recommended size for specific
  13300. window function currently used.
  13301. @item gain
  13302. Set scale gain for calculating intensity color values.
  13303. Default value is @code{1}.
  13304. @item data
  13305. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  13306. @item rotation
  13307. Set color rotation, must be in [-1.0, 1.0] range.
  13308. Default value is @code{0}.
  13309. @end table
  13310. The usage is very similar to the showwaves filter; see the examples in that
  13311. section.
  13312. @subsection Examples
  13313. @itemize
  13314. @item
  13315. Large window with logarithmic color scaling:
  13316. @example
  13317. showspectrum=s=1280x480:scale=log
  13318. @end example
  13319. @item
  13320. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  13321. @example
  13322. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  13323. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  13324. @end example
  13325. @end itemize
  13326. @section showspectrumpic
  13327. Convert input audio to a single video frame, representing the audio frequency
  13328. spectrum.
  13329. The filter accepts the following options:
  13330. @table @option
  13331. @item size, s
  13332. Specify the video size for the output. For the syntax of this option, check the
  13333. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13334. Default value is @code{4096x2048}.
  13335. @item mode
  13336. Specify display mode.
  13337. It accepts the following values:
  13338. @table @samp
  13339. @item combined
  13340. all channels are displayed in the same row
  13341. @item separate
  13342. all channels are displayed in separate rows
  13343. @end table
  13344. Default value is @samp{combined}.
  13345. @item color
  13346. Specify display color mode.
  13347. It accepts the following values:
  13348. @table @samp
  13349. @item channel
  13350. each channel is displayed in a separate color
  13351. @item intensity
  13352. each channel is displayed using the same color scheme
  13353. @item rainbow
  13354. each channel is displayed using the rainbow color scheme
  13355. @item moreland
  13356. each channel is displayed using the moreland color scheme
  13357. @item nebulae
  13358. each channel is displayed using the nebulae color scheme
  13359. @item fire
  13360. each channel is displayed using the fire color scheme
  13361. @item fiery
  13362. each channel is displayed using the fiery color scheme
  13363. @item fruit
  13364. each channel is displayed using the fruit color scheme
  13365. @item cool
  13366. each channel is displayed using the cool color scheme
  13367. @end table
  13368. Default value is @samp{intensity}.
  13369. @item scale
  13370. Specify scale used for calculating intensity color values.
  13371. It accepts the following values:
  13372. @table @samp
  13373. @item lin
  13374. linear
  13375. @item sqrt
  13376. square root, default
  13377. @item cbrt
  13378. cubic root
  13379. @item log
  13380. logarithmic
  13381. @item 4thrt
  13382. 4th root
  13383. @item 5thrt
  13384. 5th root
  13385. @end table
  13386. Default value is @samp{log}.
  13387. @item saturation
  13388. Set saturation modifier for displayed colors. Negative values provide
  13389. alternative color scheme. @code{0} is no saturation at all.
  13390. Saturation must be in [-10.0, 10.0] range.
  13391. Default value is @code{1}.
  13392. @item win_func
  13393. Set window function.
  13394. It accepts the following values:
  13395. @table @samp
  13396. @item rect
  13397. @item bartlett
  13398. @item hann
  13399. @item hanning
  13400. @item hamming
  13401. @item blackman
  13402. @item welch
  13403. @item flattop
  13404. @item bharris
  13405. @item bnuttall
  13406. @item bhann
  13407. @item sine
  13408. @item nuttall
  13409. @item lanczos
  13410. @item gauss
  13411. @item tukey
  13412. @item dolph
  13413. @item cauchy
  13414. @item parzen
  13415. @item poisson
  13416. @end table
  13417. Default value is @code{hann}.
  13418. @item orientation
  13419. Set orientation of time vs frequency axis. Can be @code{vertical} or
  13420. @code{horizontal}. Default is @code{vertical}.
  13421. @item gain
  13422. Set scale gain for calculating intensity color values.
  13423. Default value is @code{1}.
  13424. @item legend
  13425. Draw time and frequency axes and legends. Default is enabled.
  13426. @item rotation
  13427. Set color rotation, must be in [-1.0, 1.0] range.
  13428. Default value is @code{0}.
  13429. @end table
  13430. @subsection Examples
  13431. @itemize
  13432. @item
  13433. Extract an audio spectrogram of a whole audio track
  13434. in a 1024x1024 picture using @command{ffmpeg}:
  13435. @example
  13436. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  13437. @end example
  13438. @end itemize
  13439. @section showvolume
  13440. Convert input audio volume to a video output.
  13441. The filter accepts the following options:
  13442. @table @option
  13443. @item rate, r
  13444. Set video rate.
  13445. @item b
  13446. Set border width, allowed range is [0, 5]. Default is 1.
  13447. @item w
  13448. Set channel width, allowed range is [80, 8192]. Default is 400.
  13449. @item h
  13450. Set channel height, allowed range is [1, 900]. Default is 20.
  13451. @item f
  13452. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  13453. @item c
  13454. Set volume color expression.
  13455. The expression can use the following variables:
  13456. @table @option
  13457. @item VOLUME
  13458. Current max volume of channel in dB.
  13459. @item PEAK
  13460. Current peak.
  13461. @item CHANNEL
  13462. Current channel number, starting from 0.
  13463. @end table
  13464. @item t
  13465. If set, displays channel names. Default is enabled.
  13466. @item v
  13467. If set, displays volume values. Default is enabled.
  13468. @item o
  13469. Set orientation, can be @code{horizontal} or @code{vertical},
  13470. default is @code{horizontal}.
  13471. @item s
  13472. Set step size, allowed range s [0, 5]. Default is 0, which means
  13473. step is disabled.
  13474. @end table
  13475. @section showwaves
  13476. Convert input audio to a video output, representing the samples waves.
  13477. The filter accepts the following options:
  13478. @table @option
  13479. @item size, s
  13480. Specify the video size for the output. For the syntax of this option, check the
  13481. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13482. Default value is @code{600x240}.
  13483. @item mode
  13484. Set display mode.
  13485. Available values are:
  13486. @table @samp
  13487. @item point
  13488. Draw a point for each sample.
  13489. @item line
  13490. Draw a vertical line for each sample.
  13491. @item p2p
  13492. Draw a point for each sample and a line between them.
  13493. @item cline
  13494. Draw a centered vertical line for each sample.
  13495. @end table
  13496. Default value is @code{point}.
  13497. @item n
  13498. Set the number of samples which are printed on the same column. A
  13499. larger value will decrease the frame rate. Must be a positive
  13500. integer. This option can be set only if the value for @var{rate}
  13501. is not explicitly specified.
  13502. @item rate, r
  13503. Set the (approximate) output frame rate. This is done by setting the
  13504. option @var{n}. Default value is "25".
  13505. @item split_channels
  13506. Set if channels should be drawn separately or overlap. Default value is 0.
  13507. @item colors
  13508. Set colors separated by '|' which are going to be used for drawing of each channel.
  13509. @item scale
  13510. Set amplitude scale.
  13511. Available values are:
  13512. @table @samp
  13513. @item lin
  13514. Linear.
  13515. @item log
  13516. Logarithmic.
  13517. @item sqrt
  13518. Square root.
  13519. @item cbrt
  13520. Cubic root.
  13521. @end table
  13522. Default is linear.
  13523. @end table
  13524. @subsection Examples
  13525. @itemize
  13526. @item
  13527. Output the input file audio and the corresponding video representation
  13528. at the same time:
  13529. @example
  13530. amovie=a.mp3,asplit[out0],showwaves[out1]
  13531. @end example
  13532. @item
  13533. Create a synthetic signal and show it with showwaves, forcing a
  13534. frame rate of 30 frames per second:
  13535. @example
  13536. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  13537. @end example
  13538. @end itemize
  13539. @section showwavespic
  13540. Convert input audio to a single video frame, representing the samples waves.
  13541. The filter accepts the following options:
  13542. @table @option
  13543. @item size, s
  13544. Specify the video size for the output. For the syntax of this option, check the
  13545. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13546. Default value is @code{600x240}.
  13547. @item split_channels
  13548. Set if channels should be drawn separately or overlap. Default value is 0.
  13549. @item colors
  13550. Set colors separated by '|' which are going to be used for drawing of each channel.
  13551. @item scale
  13552. Set amplitude scale. Can be linear @code{lin} or logarithmic @code{log}.
  13553. Default is linear.
  13554. @end table
  13555. @subsection Examples
  13556. @itemize
  13557. @item
  13558. Extract a channel split representation of the wave form of a whole audio track
  13559. in a 1024x800 picture using @command{ffmpeg}:
  13560. @example
  13561. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  13562. @end example
  13563. @end itemize
  13564. @section sidedata, asidedata
  13565. Delete frame side data, or select frames based on it.
  13566. This filter accepts the following options:
  13567. @table @option
  13568. @item mode
  13569. Set mode of operation of the filter.
  13570. Can be one of the following:
  13571. @table @samp
  13572. @item select
  13573. Select every frame with side data of @code{type}.
  13574. @item delete
  13575. Delete side data of @code{type}. If @code{type} is not set, delete all side
  13576. data in the frame.
  13577. @end table
  13578. @item type
  13579. Set side data type used with all modes. Must be set for @code{select} mode. For
  13580. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  13581. in @file{libavutil/frame.h}. For example, to choose
  13582. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  13583. @end table
  13584. @section spectrumsynth
  13585. Sythesize audio from 2 input video spectrums, first input stream represents
  13586. magnitude across time and second represents phase across time.
  13587. The filter will transform from frequency domain as displayed in videos back
  13588. to time domain as presented in audio output.
  13589. This filter is primarily created for reversing processed @ref{showspectrum}
  13590. filter outputs, but can synthesize sound from other spectrograms too.
  13591. But in such case results are going to be poor if the phase data is not
  13592. available, because in such cases phase data need to be recreated, usually
  13593. its just recreated from random noise.
  13594. For best results use gray only output (@code{channel} color mode in
  13595. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  13596. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  13597. @code{data} option. Inputs videos should generally use @code{fullframe}
  13598. slide mode as that saves resources needed for decoding video.
  13599. The filter accepts the following options:
  13600. @table @option
  13601. @item sample_rate
  13602. Specify sample rate of output audio, the sample rate of audio from which
  13603. spectrum was generated may differ.
  13604. @item channels
  13605. Set number of channels represented in input video spectrums.
  13606. @item scale
  13607. Set scale which was used when generating magnitude input spectrum.
  13608. Can be @code{lin} or @code{log}. Default is @code{log}.
  13609. @item slide
  13610. Set slide which was used when generating inputs spectrums.
  13611. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  13612. Default is @code{fullframe}.
  13613. @item win_func
  13614. Set window function used for resynthesis.
  13615. @item overlap
  13616. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  13617. which means optimal overlap for selected window function will be picked.
  13618. @item orientation
  13619. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  13620. Default is @code{vertical}.
  13621. @end table
  13622. @subsection Examples
  13623. @itemize
  13624. @item
  13625. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  13626. then resynthesize videos back to audio with spectrumsynth:
  13627. @example
  13628. 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
  13629. 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
  13630. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  13631. @end example
  13632. @end itemize
  13633. @section split, asplit
  13634. Split input into several identical outputs.
  13635. @code{asplit} works with audio input, @code{split} with video.
  13636. The filter accepts a single parameter which specifies the number of outputs. If
  13637. unspecified, it defaults to 2.
  13638. @subsection Examples
  13639. @itemize
  13640. @item
  13641. Create two separate outputs from the same input:
  13642. @example
  13643. [in] split [out0][out1]
  13644. @end example
  13645. @item
  13646. To create 3 or more outputs, you need to specify the number of
  13647. outputs, like in:
  13648. @example
  13649. [in] asplit=3 [out0][out1][out2]
  13650. @end example
  13651. @item
  13652. Create two separate outputs from the same input, one cropped and
  13653. one padded:
  13654. @example
  13655. [in] split [splitout1][splitout2];
  13656. [splitout1] crop=100:100:0:0 [cropout];
  13657. [splitout2] pad=200:200:100:100 [padout];
  13658. @end example
  13659. @item
  13660. Create 5 copies of the input audio with @command{ffmpeg}:
  13661. @example
  13662. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  13663. @end example
  13664. @end itemize
  13665. @section zmq, azmq
  13666. Receive commands sent through a libzmq client, and forward them to
  13667. filters in the filtergraph.
  13668. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  13669. must be inserted between two video filters, @code{azmq} between two
  13670. audio filters.
  13671. To enable these filters you need to install the libzmq library and
  13672. headers and configure FFmpeg with @code{--enable-libzmq}.
  13673. For more information about libzmq see:
  13674. @url{http://www.zeromq.org/}
  13675. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  13676. receives messages sent through a network interface defined by the
  13677. @option{bind_address} option.
  13678. The received message must be in the form:
  13679. @example
  13680. @var{TARGET} @var{COMMAND} [@var{ARG}]
  13681. @end example
  13682. @var{TARGET} specifies the target of the command, usually the name of
  13683. the filter class or a specific filter instance name.
  13684. @var{COMMAND} specifies the name of the command for the target filter.
  13685. @var{ARG} is optional and specifies the optional argument list for the
  13686. given @var{COMMAND}.
  13687. Upon reception, the message is processed and the corresponding command
  13688. is injected into the filtergraph. Depending on the result, the filter
  13689. will send a reply to the client, adopting the format:
  13690. @example
  13691. @var{ERROR_CODE} @var{ERROR_REASON}
  13692. @var{MESSAGE}
  13693. @end example
  13694. @var{MESSAGE} is optional.
  13695. @subsection Examples
  13696. Look at @file{tools/zmqsend} for an example of a zmq client which can
  13697. be used to send commands processed by these filters.
  13698. Consider the following filtergraph generated by @command{ffplay}
  13699. @example
  13700. ffplay -dumpgraph 1 -f lavfi "
  13701. color=s=100x100:c=red [l];
  13702. color=s=100x100:c=blue [r];
  13703. nullsrc=s=200x100, zmq [bg];
  13704. [bg][l] overlay [bg+l];
  13705. [bg+l][r] overlay=x=100 "
  13706. @end example
  13707. To change the color of the left side of the video, the following
  13708. command can be used:
  13709. @example
  13710. echo Parsed_color_0 c yellow | tools/zmqsend
  13711. @end example
  13712. To change the right side:
  13713. @example
  13714. echo Parsed_color_1 c pink | tools/zmqsend
  13715. @end example
  13716. @c man end MULTIMEDIA FILTERS
  13717. @chapter Multimedia Sources
  13718. @c man begin MULTIMEDIA SOURCES
  13719. Below is a description of the currently available multimedia sources.
  13720. @section amovie
  13721. This is the same as @ref{movie} source, except it selects an audio
  13722. stream by default.
  13723. @anchor{movie}
  13724. @section movie
  13725. Read audio and/or video stream(s) from a movie container.
  13726. It accepts the following parameters:
  13727. @table @option
  13728. @item filename
  13729. The name of the resource to read (not necessarily a file; it can also be a
  13730. device or a stream accessed through some protocol).
  13731. @item format_name, f
  13732. Specifies the format assumed for the movie to read, and can be either
  13733. the name of a container or an input device. If not specified, the
  13734. format is guessed from @var{movie_name} or by probing.
  13735. @item seek_point, sp
  13736. Specifies the seek point in seconds. The frames will be output
  13737. starting from this seek point. The parameter is evaluated with
  13738. @code{av_strtod}, so the numerical value may be suffixed by an IS
  13739. postfix. The default value is "0".
  13740. @item streams, s
  13741. Specifies the streams to read. Several streams can be specified,
  13742. separated by "+". The source will then have as many outputs, in the
  13743. same order. The syntax is explained in the ``Stream specifiers''
  13744. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  13745. respectively the default (best suited) video and audio stream. Default
  13746. is "dv", or "da" if the filter is called as "amovie".
  13747. @item stream_index, si
  13748. Specifies the index of the video stream to read. If the value is -1,
  13749. the most suitable video stream will be automatically selected. The default
  13750. value is "-1". Deprecated. If the filter is called "amovie", it will select
  13751. audio instead of video.
  13752. @item loop
  13753. Specifies how many times to read the stream in sequence.
  13754. If the value is less than 1, the stream will be read again and again.
  13755. Default value is "1".
  13756. Note that when the movie is looped the source timestamps are not
  13757. changed, so it will generate non monotonically increasing timestamps.
  13758. @item discontinuity
  13759. Specifies the time difference between frames above which the point is
  13760. considered a timestamp discontinuity which is removed by adjusting the later
  13761. timestamps.
  13762. @end table
  13763. It allows overlaying a second video on top of the main input of
  13764. a filtergraph, as shown in this graph:
  13765. @example
  13766. input -----------> deltapts0 --> overlay --> output
  13767. ^
  13768. |
  13769. movie --> scale--> deltapts1 -------+
  13770. @end example
  13771. @subsection Examples
  13772. @itemize
  13773. @item
  13774. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  13775. on top of the input labelled "in":
  13776. @example
  13777. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  13778. [in] setpts=PTS-STARTPTS [main];
  13779. [main][over] overlay=16:16 [out]
  13780. @end example
  13781. @item
  13782. Read from a video4linux2 device, and overlay it on top of the input
  13783. labelled "in":
  13784. @example
  13785. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  13786. [in] setpts=PTS-STARTPTS [main];
  13787. [main][over] overlay=16:16 [out]
  13788. @end example
  13789. @item
  13790. Read the first video stream and the audio stream with id 0x81 from
  13791. dvd.vob; the video is connected to the pad named "video" and the audio is
  13792. connected to the pad named "audio":
  13793. @example
  13794. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  13795. @end example
  13796. @end itemize
  13797. @subsection Commands
  13798. Both movie and amovie support the following commands:
  13799. @table @option
  13800. @item seek
  13801. Perform seek using "av_seek_frame".
  13802. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  13803. @itemize
  13804. @item
  13805. @var{stream_index}: If stream_index is -1, a default
  13806. stream is selected, and @var{timestamp} is automatically converted
  13807. from AV_TIME_BASE units to the stream specific time_base.
  13808. @item
  13809. @var{timestamp}: Timestamp in AVStream.time_base units
  13810. or, if no stream is specified, in AV_TIME_BASE units.
  13811. @item
  13812. @var{flags}: Flags which select direction and seeking mode.
  13813. @end itemize
  13814. @item get_duration
  13815. Get movie duration in AV_TIME_BASE units.
  13816. @end table
  13817. @c man end MULTIMEDIA SOURCES