filters.texi 429 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900
  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 adelay
  353. Delay one or more audio channels.
  354. Samples in delayed channel are filled with silence.
  355. The filter accepts the following option:
  356. @table @option
  357. @item delays
  358. Set list of delays in milliseconds for each channel separated by '|'.
  359. At least one delay greater than 0 should be provided.
  360. Unused delays will be silently ignored. If number of given delays is
  361. smaller than number of channels all remaining channels will not be delayed.
  362. @end table
  363. @subsection Examples
  364. @itemize
  365. @item
  366. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  367. the second channel (and any other channels that may be present) unchanged.
  368. @example
  369. adelay=1500|0|500
  370. @end example
  371. @end itemize
  372. @section aecho
  373. Apply echoing to the input audio.
  374. Echoes are reflected sound and can occur naturally amongst mountains
  375. (and sometimes large buildings) when talking or shouting; digital echo
  376. effects emulate this behaviour and are often used to help fill out the
  377. sound of a single instrument or vocal. The time difference between the
  378. original signal and the reflection is the @code{delay}, and the
  379. loudness of the reflected signal is the @code{decay}.
  380. Multiple echoes can have different delays and decays.
  381. A description of the accepted parameters follows.
  382. @table @option
  383. @item in_gain
  384. Set input gain of reflected signal. Default is @code{0.6}.
  385. @item out_gain
  386. Set output gain of reflected signal. Default is @code{0.3}.
  387. @item delays
  388. Set list of time intervals in milliseconds between original signal and reflections
  389. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  390. Default is @code{1000}.
  391. @item decays
  392. Set list of loudnesses of reflected signals separated by '|'.
  393. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  394. Default is @code{0.5}.
  395. @end table
  396. @subsection Examples
  397. @itemize
  398. @item
  399. Make it sound as if there are twice as many instruments as are actually playing:
  400. @example
  401. aecho=0.8:0.88:60:0.4
  402. @end example
  403. @item
  404. If delay is very short, then it sound like a (metallic) robot playing music:
  405. @example
  406. aecho=0.8:0.88:6:0.4
  407. @end example
  408. @item
  409. A longer delay will sound like an open air concert in the mountains:
  410. @example
  411. aecho=0.8:0.9:1000:0.3
  412. @end example
  413. @item
  414. Same as above but with one more mountain:
  415. @example
  416. aecho=0.8:0.9:1000|1800:0.3|0.25
  417. @end example
  418. @end itemize
  419. @section aemphasis
  420. Audio emphasis filter creates or restores material directly taken from LPs or
  421. emphased CDs with different filter curves. E.g. to store music on vinyl the
  422. signal has to be altered by a filter first to even out the disadvantages of
  423. this recording medium.
  424. Once the material is played back the inverse filter has to be applied to
  425. restore the distortion of the frequency response.
  426. The filter accepts the following options:
  427. @table @option
  428. @item level_in
  429. Set input gain.
  430. @item level_out
  431. Set output gain.
  432. @item mode
  433. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  434. use @code{production} mode. Default is @code{reproduction} mode.
  435. @item type
  436. Set filter type. Selects medium. Can be one of the following:
  437. @table @option
  438. @item col
  439. select Columbia.
  440. @item emi
  441. select EMI.
  442. @item bsi
  443. select BSI (78RPM).
  444. @item riaa
  445. select RIAA.
  446. @item cd
  447. select Compact Disc (CD).
  448. @item 50fm
  449. select 50µs (FM).
  450. @item 75fm
  451. select 75µs (FM).
  452. @item 50kf
  453. select 50µs (FM-KF).
  454. @item 75kf
  455. select 75µs (FM-KF).
  456. @end table
  457. @end table
  458. @section aeval
  459. Modify an audio signal according to the specified expressions.
  460. This filter accepts one or more expressions (one for each channel),
  461. which are evaluated and used to modify a corresponding audio signal.
  462. It accepts the following parameters:
  463. @table @option
  464. @item exprs
  465. Set the '|'-separated expressions list for each separate channel. If
  466. the number of input channels is greater than the number of
  467. expressions, the last specified expression is used for the remaining
  468. output channels.
  469. @item channel_layout, c
  470. Set output channel layout. If not specified, the channel layout is
  471. specified by the number of expressions. If set to @samp{same}, it will
  472. use by default the same input channel layout.
  473. @end table
  474. Each expression in @var{exprs} can contain the following constants and functions:
  475. @table @option
  476. @item ch
  477. channel number of the current expression
  478. @item n
  479. number of the evaluated sample, starting from 0
  480. @item s
  481. sample rate
  482. @item t
  483. time of the evaluated sample expressed in seconds
  484. @item nb_in_channels
  485. @item nb_out_channels
  486. input and output number of channels
  487. @item val(CH)
  488. the value of input channel with number @var{CH}
  489. @end table
  490. Note: this filter is slow. For faster processing you should use a
  491. dedicated filter.
  492. @subsection Examples
  493. @itemize
  494. @item
  495. Half volume:
  496. @example
  497. aeval=val(ch)/2:c=same
  498. @end example
  499. @item
  500. Invert phase of the second channel:
  501. @example
  502. aeval=val(0)|-val(1)
  503. @end example
  504. @end itemize
  505. @anchor{afade}
  506. @section afade
  507. Apply fade-in/out effect to input audio.
  508. A description of the accepted parameters follows.
  509. @table @option
  510. @item type, t
  511. Specify the effect type, can be either @code{in} for fade-in, or
  512. @code{out} for a fade-out effect. Default is @code{in}.
  513. @item start_sample, ss
  514. Specify the number of the start sample for starting to apply the fade
  515. effect. Default is 0.
  516. @item nb_samples, ns
  517. Specify the number of samples for which the fade effect has to last. At
  518. the end of the fade-in effect the output audio will have the same
  519. volume as the input audio, at the end of the fade-out transition
  520. the output audio will be silence. Default is 44100.
  521. @item start_time, st
  522. Specify the start time of the fade effect. Default is 0.
  523. The value must be specified as a time duration; see
  524. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  525. for the accepted syntax.
  526. If set this option is used instead of @var{start_sample}.
  527. @item duration, d
  528. Specify the duration of the fade effect. See
  529. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  530. for the accepted syntax.
  531. At the end of the fade-in effect the output audio will have the same
  532. volume as the input audio, at the end of the fade-out transition
  533. the output audio will be silence.
  534. By default the duration is determined by @var{nb_samples}.
  535. If set this option is used instead of @var{nb_samples}.
  536. @item curve
  537. Set curve for fade transition.
  538. It accepts the following values:
  539. @table @option
  540. @item tri
  541. select triangular, linear slope (default)
  542. @item qsin
  543. select quarter of sine wave
  544. @item hsin
  545. select half of sine wave
  546. @item esin
  547. select exponential sine wave
  548. @item log
  549. select logarithmic
  550. @item ipar
  551. select inverted parabola
  552. @item qua
  553. select quadratic
  554. @item cub
  555. select cubic
  556. @item squ
  557. select square root
  558. @item cbr
  559. select cubic root
  560. @item par
  561. select parabola
  562. @item exp
  563. select exponential
  564. @item iqsin
  565. select inverted quarter of sine wave
  566. @item ihsin
  567. select inverted half of sine wave
  568. @item dese
  569. select double-exponential seat
  570. @item desi
  571. select double-exponential sigmoid
  572. @end table
  573. @end table
  574. @subsection Examples
  575. @itemize
  576. @item
  577. Fade in first 15 seconds of audio:
  578. @example
  579. afade=t=in:ss=0:d=15
  580. @end example
  581. @item
  582. Fade out last 25 seconds of a 900 seconds audio:
  583. @example
  584. afade=t=out:st=875:d=25
  585. @end example
  586. @end itemize
  587. @section afftfilt
  588. Apply arbitrary expressions to samples in frequency domain.
  589. @table @option
  590. @item real
  591. Set frequency domain real expression for each separate channel separated
  592. by '|'. Default is "1".
  593. If the number of input channels is greater than the number of
  594. expressions, the last specified expression is used for the remaining
  595. output channels.
  596. @item imag
  597. Set frequency domain imaginary expression for each separate channel
  598. separated by '|'. If not set, @var{real} option is used.
  599. Each expression in @var{real} and @var{imag} can contain the following
  600. constants:
  601. @table @option
  602. @item sr
  603. sample rate
  604. @item b
  605. current frequency bin number
  606. @item nb
  607. number of available bins
  608. @item ch
  609. channel number of the current expression
  610. @item chs
  611. number of channels
  612. @item pts
  613. current frame pts
  614. @end table
  615. @item win_size
  616. Set window size.
  617. It accepts the following values:
  618. @table @samp
  619. @item w16
  620. @item w32
  621. @item w64
  622. @item w128
  623. @item w256
  624. @item w512
  625. @item w1024
  626. @item w2048
  627. @item w4096
  628. @item w8192
  629. @item w16384
  630. @item w32768
  631. @item w65536
  632. @end table
  633. Default is @code{w4096}
  634. @item win_func
  635. Set window function. Default is @code{hann}.
  636. @item overlap
  637. Set window overlap. If set to 1, the recommended overlap for selected
  638. window function will be picked. Default is @code{0.75}.
  639. @end table
  640. @subsection Examples
  641. @itemize
  642. @item
  643. Leave almost only low frequencies in audio:
  644. @example
  645. afftfilt="1-clip((b/nb)*b,0,1)"
  646. @end example
  647. @end itemize
  648. @anchor{aformat}
  649. @section aformat
  650. Set output format constraints for the input audio. The framework will
  651. negotiate the most appropriate format to minimize conversions.
  652. It accepts the following parameters:
  653. @table @option
  654. @item sample_fmts
  655. A '|'-separated list of requested sample formats.
  656. @item sample_rates
  657. A '|'-separated list of requested sample rates.
  658. @item channel_layouts
  659. A '|'-separated list of requested channel layouts.
  660. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  661. for the required syntax.
  662. @end table
  663. If a parameter is omitted, all values are allowed.
  664. Force the output to either unsigned 8-bit or signed 16-bit stereo
  665. @example
  666. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  667. @end example
  668. @section agate
  669. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  670. processing reduces disturbing noise between useful signals.
  671. Gating is done by detecting the volume below a chosen level @var{threshold}
  672. and divide it by the factor set with @var{ratio}. The bottom of the noise
  673. floor is set via @var{range}. Because an exact manipulation of the signal
  674. would cause distortion of the waveform the reduction can be levelled over
  675. time. This is done by setting @var{attack} and @var{release}.
  676. @var{attack} determines how long the signal has to fall below the threshold
  677. before any reduction will occur and @var{release} sets the time the signal
  678. has to raise above the threshold to reduce the reduction again.
  679. Shorter signals than the chosen attack time will be left untouched.
  680. @table @option
  681. @item level_in
  682. Set input level before filtering.
  683. Default is 1. Allowed range is from 0.015625 to 64.
  684. @item range
  685. Set the level of gain reduction when the signal is below the threshold.
  686. Default is 0.06125. Allowed range is from 0 to 1.
  687. @item threshold
  688. If a signal rises above this level the gain reduction is released.
  689. Default is 0.125. Allowed range is from 0 to 1.
  690. @item ratio
  691. Set a ratio about which the signal is reduced.
  692. Default is 2. Allowed range is from 1 to 9000.
  693. @item attack
  694. Amount of milliseconds the signal has to rise above the threshold before gain
  695. reduction stops.
  696. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  697. @item release
  698. Amount of milliseconds the signal has to fall below the threshold before the
  699. reduction is increased again. Default is 250 milliseconds.
  700. Allowed range is from 0.01 to 9000.
  701. @item makeup
  702. Set amount of amplification of signal after processing.
  703. Default is 1. Allowed range is from 1 to 64.
  704. @item knee
  705. Curve the sharp knee around the threshold to enter gain reduction more softly.
  706. Default is 2.828427125. Allowed range is from 1 to 8.
  707. @item detection
  708. Choose if exact signal should be taken for detection or an RMS like one.
  709. Default is rms. Can be peak or rms.
  710. @item link
  711. Choose if the average level between all channels or the louder channel affects
  712. the reduction.
  713. Default is average. Can be average or maximum.
  714. @end table
  715. @section alimiter
  716. The limiter prevents input signal from raising over a desired threshold.
  717. This limiter uses lookahead technology to prevent your signal from distorting.
  718. It means that there is a small delay after signal is processed. Keep in mind
  719. that the delay it produces is the attack time you set.
  720. The filter accepts the following options:
  721. @table @option
  722. @item level_in
  723. Set input gain. Default is 1.
  724. @item level_out
  725. Set output gain. Default is 1.
  726. @item limit
  727. Don't let signals above this level pass the limiter. Default is 1.
  728. @item attack
  729. The limiter will reach its attenuation level in this amount of time in
  730. milliseconds. Default is 5 milliseconds.
  731. @item release
  732. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  733. Default is 50 milliseconds.
  734. @item asc
  735. When gain reduction is always needed ASC takes care of releasing to an
  736. average reduction level rather than reaching a reduction of 0 in the release
  737. time.
  738. @item asc_level
  739. Select how much the release time is affected by ASC, 0 means nearly no changes
  740. in release time while 1 produces higher release times.
  741. @item level
  742. Auto level output signal. Default is enabled.
  743. This normalizes audio back to 0dB if enabled.
  744. @end table
  745. Depending on picked setting it is recommended to upsample input 2x or 4x times
  746. with @ref{aresample} before applying this filter.
  747. @section allpass
  748. Apply a two-pole all-pass filter with central frequency (in Hz)
  749. @var{frequency}, and filter-width @var{width}.
  750. An all-pass filter changes the audio's frequency to phase relationship
  751. without changing its frequency to amplitude relationship.
  752. The filter accepts the following options:
  753. @table @option
  754. @item frequency, f
  755. Set frequency in Hz.
  756. @item width_type
  757. Set method to specify band-width of filter.
  758. @table @option
  759. @item h
  760. Hz
  761. @item q
  762. Q-Factor
  763. @item o
  764. octave
  765. @item s
  766. slope
  767. @end table
  768. @item width, w
  769. Specify the band-width of a filter in width_type units.
  770. @end table
  771. @anchor{amerge}
  772. @section amerge
  773. Merge two or more audio streams into a single multi-channel stream.
  774. The filter accepts the following options:
  775. @table @option
  776. @item inputs
  777. Set the number of inputs. Default is 2.
  778. @end table
  779. If the channel layouts of the inputs are disjoint, and therefore compatible,
  780. the channel layout of the output will be set accordingly and the channels
  781. will be reordered as necessary. If the channel layouts of the inputs are not
  782. disjoint, the output will have all the channels of the first input then all
  783. the channels of the second input, in that order, and the channel layout of
  784. the output will be the default value corresponding to the total number of
  785. channels.
  786. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  787. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  788. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  789. first input, b1 is the first channel of the second input).
  790. On the other hand, if both input are in stereo, the output channels will be
  791. in the default order: a1, a2, b1, b2, and the channel layout will be
  792. arbitrarily set to 4.0, which may or may not be the expected value.
  793. All inputs must have the same sample rate, and format.
  794. If inputs do not have the same duration, the output will stop with the
  795. shortest.
  796. @subsection Examples
  797. @itemize
  798. @item
  799. Merge two mono files into a stereo stream:
  800. @example
  801. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  802. @end example
  803. @item
  804. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  805. @example
  806. 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
  807. @end example
  808. @end itemize
  809. @section amix
  810. Mixes multiple audio inputs into a single output.
  811. Note that this filter only supports float samples (the @var{amerge}
  812. and @var{pan} audio filters support many formats). If the @var{amix}
  813. input has integer samples then @ref{aresample} will be automatically
  814. inserted to perform the conversion to float samples.
  815. For example
  816. @example
  817. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  818. @end example
  819. will mix 3 input audio streams to a single output with the same duration as the
  820. first input and a dropout transition time of 3 seconds.
  821. It accepts the following parameters:
  822. @table @option
  823. @item inputs
  824. The number of inputs. If unspecified, it defaults to 2.
  825. @item duration
  826. How to determine the end-of-stream.
  827. @table @option
  828. @item longest
  829. The duration of the longest input. (default)
  830. @item shortest
  831. The duration of the shortest input.
  832. @item first
  833. The duration of the first input.
  834. @end table
  835. @item dropout_transition
  836. The transition time, in seconds, for volume renormalization when an input
  837. stream ends. The default value is 2 seconds.
  838. @end table
  839. @section anequalizer
  840. High-order parametric multiband equalizer for each channel.
  841. It accepts the following parameters:
  842. @table @option
  843. @item params
  844. This option string is in format:
  845. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  846. Each equalizer band is separated by '|'.
  847. @table @option
  848. @item chn
  849. Set channel number to which equalization will be applied.
  850. If input doesn't have that channel the entry is ignored.
  851. @item cf
  852. Set central frequency for band.
  853. If input doesn't have that frequency the entry is ignored.
  854. @item w
  855. Set band width in hertz.
  856. @item g
  857. Set band gain in dB.
  858. @item f
  859. Set filter type for band, optional, can be:
  860. @table @samp
  861. @item 0
  862. Butterworth, this is default.
  863. @item 1
  864. Chebyshev type 1.
  865. @item 2
  866. Chebyshev type 2.
  867. @end table
  868. @end table
  869. @item curves
  870. With this option activated frequency response of anequalizer is displayed
  871. in video stream.
  872. @item size
  873. Set video stream size. Only useful if curves option is activated.
  874. @item mgain
  875. Set max gain that will be displayed. Only useful if curves option is activated.
  876. Setting this to reasonable value allows to display gain which is derived from
  877. neighbour bands which are too close to each other and thus produce higher gain
  878. when both are activated.
  879. @item fscale
  880. Set frequency scale used to draw frequency response in video output.
  881. Can be linear or logarithmic. Default is logarithmic.
  882. @item colors
  883. Set color for each channel curve which is going to be displayed in video stream.
  884. This is list of color names separated by space or by '|'.
  885. Unrecognised or missing colors will be replaced by white color.
  886. @end table
  887. @subsection Examples
  888. @itemize
  889. @item
  890. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  891. for first 2 channels using Chebyshev type 1 filter:
  892. @example
  893. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  894. @end example
  895. @end itemize
  896. @subsection Commands
  897. This filter supports the following commands:
  898. @table @option
  899. @item change
  900. Alter existing filter parameters.
  901. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  902. @var{fN} is existing filter number, starting from 0, if no such filter is available
  903. error is returned.
  904. @var{freq} set new frequency parameter.
  905. @var{width} set new width parameter in herz.
  906. @var{gain} set new gain parameter in dB.
  907. Full filter invocation with asendcmd may look like this:
  908. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  909. @end table
  910. @section anull
  911. Pass the audio source unchanged to the output.
  912. @section apad
  913. Pad the end of an audio stream with silence.
  914. This can be used together with @command{ffmpeg} @option{-shortest} to
  915. extend audio streams to the same length as the video stream.
  916. A description of the accepted options follows.
  917. @table @option
  918. @item packet_size
  919. Set silence packet size. Default value is 4096.
  920. @item pad_len
  921. Set the number of samples of silence to add to the end. After the
  922. value is reached, the stream is terminated. This option is mutually
  923. exclusive with @option{whole_len}.
  924. @item whole_len
  925. Set the minimum total number of samples in the output audio stream. If
  926. the value is longer than the input audio length, silence is added to
  927. the end, until the value is reached. This option is mutually exclusive
  928. with @option{pad_len}.
  929. @end table
  930. If neither the @option{pad_len} nor the @option{whole_len} option is
  931. set, the filter will add silence to the end of the input stream
  932. indefinitely.
  933. @subsection Examples
  934. @itemize
  935. @item
  936. Add 1024 samples of silence to the end of the input:
  937. @example
  938. apad=pad_len=1024
  939. @end example
  940. @item
  941. Make sure the audio output will contain at least 10000 samples, pad
  942. the input with silence if required:
  943. @example
  944. apad=whole_len=10000
  945. @end example
  946. @item
  947. Use @command{ffmpeg} to pad the audio input with silence, so that the
  948. video stream will always result the shortest and will be converted
  949. until the end in the output file when using the @option{shortest}
  950. option:
  951. @example
  952. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  953. @end example
  954. @end itemize
  955. @section aphaser
  956. Add a phasing effect to the input audio.
  957. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  958. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  959. A description of the accepted parameters follows.
  960. @table @option
  961. @item in_gain
  962. Set input gain. Default is 0.4.
  963. @item out_gain
  964. Set output gain. Default is 0.74
  965. @item delay
  966. Set delay in milliseconds. Default is 3.0.
  967. @item decay
  968. Set decay. Default is 0.4.
  969. @item speed
  970. Set modulation speed in Hz. Default is 0.5.
  971. @item type
  972. Set modulation type. Default is triangular.
  973. It accepts the following values:
  974. @table @samp
  975. @item triangular, t
  976. @item sinusoidal, s
  977. @end table
  978. @end table
  979. @section apulsator
  980. Audio pulsator is something between an autopanner and a tremolo.
  981. But it can produce funny stereo effects as well. Pulsator changes the volume
  982. of the left and right channel based on a LFO (low frequency oscillator) with
  983. different waveforms and shifted phases.
  984. This filter have the ability to define an offset between left and right
  985. channel. An offset of 0 means that both LFO shapes match each other.
  986. The left and right channel are altered equally - a conventional tremolo.
  987. An offset of 50% means that the shape of the right channel is exactly shifted
  988. in phase (or moved backwards about half of the frequency) - pulsator acts as
  989. an autopanner. At 1 both curves match again. Every setting in between moves the
  990. phase shift gapless between all stages and produces some "bypassing" sounds with
  991. sine and triangle waveforms. The more you set the offset near 1 (starting from
  992. the 0.5) the faster the signal passes from the left to the right speaker.
  993. The filter accepts the following options:
  994. @table @option
  995. @item level_in
  996. Set input gain. By default it is 1. Range is [0.015625 - 64].
  997. @item level_out
  998. Set output gain. By default it is 1. Range is [0.015625 - 64].
  999. @item mode
  1000. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1001. sawup or sawdown. Default is sine.
  1002. @item amount
  1003. Set modulation. Define how much of original signal is affected by the LFO.
  1004. @item offset_l
  1005. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1006. @item offset_r
  1007. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1008. @item width
  1009. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1010. @item timing
  1011. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1012. @item bpm
  1013. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1014. is set to bpm.
  1015. @item ms
  1016. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1017. is set to ms.
  1018. @item hz
  1019. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1020. if timing is set to hz.
  1021. @end table
  1022. @anchor{aresample}
  1023. @section aresample
  1024. Resample the input audio to the specified parameters, using the
  1025. libswresample library. If none are specified then the filter will
  1026. automatically convert between its input and output.
  1027. This filter is also able to stretch/squeeze the audio data to make it match
  1028. the timestamps or to inject silence / cut out audio to make it match the
  1029. timestamps, do a combination of both or do neither.
  1030. The filter accepts the syntax
  1031. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1032. expresses a sample rate and @var{resampler_options} is a list of
  1033. @var{key}=@var{value} pairs, separated by ":". See the
  1034. ffmpeg-resampler manual for the complete list of supported options.
  1035. @subsection Examples
  1036. @itemize
  1037. @item
  1038. Resample the input audio to 44100Hz:
  1039. @example
  1040. aresample=44100
  1041. @end example
  1042. @item
  1043. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1044. samples per second compensation:
  1045. @example
  1046. aresample=async=1000
  1047. @end example
  1048. @end itemize
  1049. @section asetnsamples
  1050. Set the number of samples per each output audio frame.
  1051. The last output packet may contain a different number of samples, as
  1052. the filter will flush all the remaining samples when the input audio
  1053. signal its end.
  1054. The filter accepts the following options:
  1055. @table @option
  1056. @item nb_out_samples, n
  1057. Set the number of frames per each output audio frame. The number is
  1058. intended as the number of samples @emph{per each channel}.
  1059. Default value is 1024.
  1060. @item pad, p
  1061. If set to 1, the filter will pad the last audio frame with zeroes, so
  1062. that the last frame will contain the same number of samples as the
  1063. previous ones. Default value is 1.
  1064. @end table
  1065. For example, to set the number of per-frame samples to 1234 and
  1066. disable padding for the last frame, use:
  1067. @example
  1068. asetnsamples=n=1234:p=0
  1069. @end example
  1070. @section asetrate
  1071. Set the sample rate without altering the PCM data.
  1072. This will result in a change of speed and pitch.
  1073. The filter accepts the following options:
  1074. @table @option
  1075. @item sample_rate, r
  1076. Set the output sample rate. Default is 44100 Hz.
  1077. @end table
  1078. @section ashowinfo
  1079. Show a line containing various information for each input audio frame.
  1080. The input audio is not modified.
  1081. The shown line contains a sequence of key/value pairs of the form
  1082. @var{key}:@var{value}.
  1083. The following values are shown in the output:
  1084. @table @option
  1085. @item n
  1086. The (sequential) number of the input frame, starting from 0.
  1087. @item pts
  1088. The presentation timestamp of the input frame, in time base units; the time base
  1089. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1090. @item pts_time
  1091. The presentation timestamp of the input frame in seconds.
  1092. @item pos
  1093. position of the frame in the input stream, -1 if this information in
  1094. unavailable and/or meaningless (for example in case of synthetic audio)
  1095. @item fmt
  1096. The sample format.
  1097. @item chlayout
  1098. The channel layout.
  1099. @item rate
  1100. The sample rate for the audio frame.
  1101. @item nb_samples
  1102. The number of samples (per channel) in the frame.
  1103. @item checksum
  1104. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1105. audio, the data is treated as if all the planes were concatenated.
  1106. @item plane_checksums
  1107. A list of Adler-32 checksums for each data plane.
  1108. @end table
  1109. @anchor{astats}
  1110. @section astats
  1111. Display time domain statistical information about the audio channels.
  1112. Statistics are calculated and displayed for each audio channel and,
  1113. where applicable, an overall figure is also given.
  1114. It accepts the following option:
  1115. @table @option
  1116. @item length
  1117. Short window length in seconds, used for peak and trough RMS measurement.
  1118. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.1 - 10]}.
  1119. @item metadata
  1120. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1121. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1122. disabled.
  1123. Available keys for each channel are:
  1124. DC_offset
  1125. Min_level
  1126. Max_level
  1127. Min_difference
  1128. Max_difference
  1129. Mean_difference
  1130. Peak_level
  1131. RMS_peak
  1132. RMS_trough
  1133. Crest_factor
  1134. Flat_factor
  1135. Peak_count
  1136. Bit_depth
  1137. and for Overall:
  1138. DC_offset
  1139. Min_level
  1140. Max_level
  1141. Min_difference
  1142. Max_difference
  1143. Mean_difference
  1144. Peak_level
  1145. RMS_level
  1146. RMS_peak
  1147. RMS_trough
  1148. Flat_factor
  1149. Peak_count
  1150. Bit_depth
  1151. Number_of_samples
  1152. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1153. this @code{lavfi.astats.Overall.Peak_count}.
  1154. For description what each key means read below.
  1155. @item reset
  1156. Set number of frame after which stats are going to be recalculated.
  1157. Default is disabled.
  1158. @end table
  1159. A description of each shown parameter follows:
  1160. @table @option
  1161. @item DC offset
  1162. Mean amplitude displacement from zero.
  1163. @item Min level
  1164. Minimal sample level.
  1165. @item Max level
  1166. Maximal sample level.
  1167. @item Min difference
  1168. Minimal difference between two consecutive samples.
  1169. @item Max difference
  1170. Maximal difference between two consecutive samples.
  1171. @item Mean difference
  1172. Mean difference between two consecutive samples.
  1173. The average of each difference between two consecutive samples.
  1174. @item Peak level dB
  1175. @item RMS level dB
  1176. Standard peak and RMS level measured in dBFS.
  1177. @item RMS peak dB
  1178. @item RMS trough dB
  1179. Peak and trough values for RMS level measured over a short window.
  1180. @item Crest factor
  1181. Standard ratio of peak to RMS level (note: not in dB).
  1182. @item Flat factor
  1183. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1184. (i.e. either @var{Min level} or @var{Max level}).
  1185. @item Peak count
  1186. Number of occasions (not the number of samples) that the signal attained either
  1187. @var{Min level} or @var{Max level}.
  1188. @item Bit depth
  1189. Overall bit depth of audio. Number of bits used for each sample.
  1190. @end table
  1191. @section asyncts
  1192. Synchronize audio data with timestamps by squeezing/stretching it and/or
  1193. dropping samples/adding silence when needed.
  1194. This filter is not built by default, please use @ref{aresample} to do squeezing/stretching.
  1195. It accepts the following parameters:
  1196. @table @option
  1197. @item compensate
  1198. Enable stretching/squeezing the data to make it match the timestamps. Disabled
  1199. by default. When disabled, time gaps are covered with silence.
  1200. @item min_delta
  1201. The minimum difference between timestamps and audio data (in seconds) to trigger
  1202. adding/dropping samples. The default value is 0.1. If you get an imperfect
  1203. sync with this filter, try setting this parameter to 0.
  1204. @item max_comp
  1205. The maximum compensation in samples per second. Only relevant with compensate=1.
  1206. The default value is 500.
  1207. @item first_pts
  1208. Assume that the first PTS should be this value. The time base is 1 / sample
  1209. rate. This allows for padding/trimming at the start of the stream. By default,
  1210. no assumption is made about the first frame's expected PTS, so no padding or
  1211. trimming is done. For example, this could be set to 0 to pad the beginning with
  1212. silence if an audio stream starts after the video stream or to trim any samples
  1213. with a negative PTS due to encoder delay.
  1214. @end table
  1215. @section atempo
  1216. Adjust audio tempo.
  1217. The filter accepts exactly one parameter, the audio tempo. If not
  1218. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1219. be in the [0.5, 2.0] range.
  1220. @subsection Examples
  1221. @itemize
  1222. @item
  1223. Slow down audio to 80% tempo:
  1224. @example
  1225. atempo=0.8
  1226. @end example
  1227. @item
  1228. To speed up audio to 125% tempo:
  1229. @example
  1230. atempo=1.25
  1231. @end example
  1232. @end itemize
  1233. @section atrim
  1234. Trim the input so that the output contains one continuous subpart of the input.
  1235. It accepts the following parameters:
  1236. @table @option
  1237. @item start
  1238. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1239. sample with the timestamp @var{start} will be the first sample in the output.
  1240. @item end
  1241. Specify time of the first audio sample that will be dropped, i.e. the
  1242. audio sample immediately preceding the one with the timestamp @var{end} will be
  1243. the last sample in the output.
  1244. @item start_pts
  1245. Same as @var{start}, except this option sets the start timestamp in samples
  1246. instead of seconds.
  1247. @item end_pts
  1248. Same as @var{end}, except this option sets the end timestamp in samples instead
  1249. of seconds.
  1250. @item duration
  1251. The maximum duration of the output in seconds.
  1252. @item start_sample
  1253. The number of the first sample that should be output.
  1254. @item end_sample
  1255. The number of the first sample that should be dropped.
  1256. @end table
  1257. @option{start}, @option{end}, and @option{duration} are expressed as time
  1258. duration specifications; see
  1259. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1260. Note that the first two sets of the start/end options and the @option{duration}
  1261. option look at the frame timestamp, while the _sample options simply count the
  1262. samples that pass through the filter. So start/end_pts and start/end_sample will
  1263. give different results when the timestamps are wrong, inexact or do not start at
  1264. zero. Also note that this filter does not modify the timestamps. If you wish
  1265. to have the output timestamps start at zero, insert the asetpts filter after the
  1266. atrim filter.
  1267. If multiple start or end options are set, this filter tries to be greedy and
  1268. keep all samples that match at least one of the specified constraints. To keep
  1269. only the part that matches all the constraints at once, chain multiple atrim
  1270. filters.
  1271. The defaults are such that all the input is kept. So it is possible to set e.g.
  1272. just the end values to keep everything before the specified time.
  1273. Examples:
  1274. @itemize
  1275. @item
  1276. Drop everything except the second minute of input:
  1277. @example
  1278. ffmpeg -i INPUT -af atrim=60:120
  1279. @end example
  1280. @item
  1281. Keep only the first 1000 samples:
  1282. @example
  1283. ffmpeg -i INPUT -af atrim=end_sample=1000
  1284. @end example
  1285. @end itemize
  1286. @section bandpass
  1287. Apply a two-pole Butterworth band-pass filter with central
  1288. frequency @var{frequency}, and (3dB-point) band-width width.
  1289. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1290. instead of the default: constant 0dB peak gain.
  1291. The filter roll off at 6dB per octave (20dB per decade).
  1292. The filter accepts the following options:
  1293. @table @option
  1294. @item frequency, f
  1295. Set the filter's central frequency. Default is @code{3000}.
  1296. @item csg
  1297. Constant skirt gain if set to 1. Defaults to 0.
  1298. @item width_type
  1299. Set method to specify band-width of filter.
  1300. @table @option
  1301. @item h
  1302. Hz
  1303. @item q
  1304. Q-Factor
  1305. @item o
  1306. octave
  1307. @item s
  1308. slope
  1309. @end table
  1310. @item width, w
  1311. Specify the band-width of a filter in width_type units.
  1312. @end table
  1313. @section bandreject
  1314. Apply a two-pole Butterworth band-reject filter with central
  1315. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1316. The filter roll off at 6dB per octave (20dB per decade).
  1317. The filter accepts the following options:
  1318. @table @option
  1319. @item frequency, f
  1320. Set the filter's central frequency. Default is @code{3000}.
  1321. @item width_type
  1322. Set method to specify band-width of filter.
  1323. @table @option
  1324. @item h
  1325. Hz
  1326. @item q
  1327. Q-Factor
  1328. @item o
  1329. octave
  1330. @item s
  1331. slope
  1332. @end table
  1333. @item width, w
  1334. Specify the band-width of a filter in width_type units.
  1335. @end table
  1336. @section bass
  1337. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1338. shelving filter with a response similar to that of a standard
  1339. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1340. The filter accepts the following options:
  1341. @table @option
  1342. @item gain, g
  1343. Give the gain at 0 Hz. Its useful range is about -20
  1344. (for a large cut) to +20 (for a large boost).
  1345. Beware of clipping when using a positive gain.
  1346. @item frequency, f
  1347. Set the filter's central frequency and so can be used
  1348. to extend or reduce the frequency range to be boosted or cut.
  1349. The default value is @code{100} Hz.
  1350. @item width_type
  1351. Set method to specify band-width of filter.
  1352. @table @option
  1353. @item h
  1354. Hz
  1355. @item q
  1356. Q-Factor
  1357. @item o
  1358. octave
  1359. @item s
  1360. slope
  1361. @end table
  1362. @item width, w
  1363. Determine how steep is the filter's shelf transition.
  1364. @end table
  1365. @section biquad
  1366. Apply a biquad IIR filter with the given coefficients.
  1367. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1368. are the numerator and denominator coefficients respectively.
  1369. @section bs2b
  1370. Bauer stereo to binaural transformation, which improves headphone listening of
  1371. stereo audio records.
  1372. It accepts the following parameters:
  1373. @table @option
  1374. @item profile
  1375. Pre-defined crossfeed level.
  1376. @table @option
  1377. @item default
  1378. Default level (fcut=700, feed=50).
  1379. @item cmoy
  1380. Chu Moy circuit (fcut=700, feed=60).
  1381. @item jmeier
  1382. Jan Meier circuit (fcut=650, feed=95).
  1383. @end table
  1384. @item fcut
  1385. Cut frequency (in Hz).
  1386. @item feed
  1387. Feed level (in Hz).
  1388. @end table
  1389. @section channelmap
  1390. Remap input channels to new locations.
  1391. It accepts the following parameters:
  1392. @table @option
  1393. @item channel_layout
  1394. The channel layout of the output stream.
  1395. @item map
  1396. Map channels from input to output. The argument is a '|'-separated list of
  1397. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1398. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1399. channel (e.g. FL for front left) or its index in the input channel layout.
  1400. @var{out_channel} is the name of the output channel or its index in the output
  1401. channel layout. If @var{out_channel} is not given then it is implicitly an
  1402. index, starting with zero and increasing by one for each mapping.
  1403. @end table
  1404. If no mapping is present, the filter will implicitly map input channels to
  1405. output channels, preserving indices.
  1406. For example, assuming a 5.1+downmix input MOV file,
  1407. @example
  1408. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1409. @end example
  1410. will create an output WAV file tagged as stereo from the downmix channels of
  1411. the input.
  1412. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1413. @example
  1414. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1415. @end example
  1416. @section channelsplit
  1417. Split each channel from an input audio stream into a separate output stream.
  1418. It accepts the following parameters:
  1419. @table @option
  1420. @item channel_layout
  1421. The channel layout of the input stream. The default is "stereo".
  1422. @end table
  1423. For example, assuming a stereo input MP3 file,
  1424. @example
  1425. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1426. @end example
  1427. will create an output Matroska file with two audio streams, one containing only
  1428. the left channel and the other the right channel.
  1429. Split a 5.1 WAV file into per-channel files:
  1430. @example
  1431. ffmpeg -i in.wav -filter_complex
  1432. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1433. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1434. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1435. side_right.wav
  1436. @end example
  1437. @section chorus
  1438. Add a chorus effect to the audio.
  1439. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1440. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1441. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1442. The modulation depth defines the range the modulated delay is played before or after
  1443. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1444. sound tuned around the original one, like in a chorus where some vocals are slightly
  1445. off key.
  1446. It accepts the following parameters:
  1447. @table @option
  1448. @item in_gain
  1449. Set input gain. Default is 0.4.
  1450. @item out_gain
  1451. Set output gain. Default is 0.4.
  1452. @item delays
  1453. Set delays. A typical delay is around 40ms to 60ms.
  1454. @item decays
  1455. Set decays.
  1456. @item speeds
  1457. Set speeds.
  1458. @item depths
  1459. Set depths.
  1460. @end table
  1461. @subsection Examples
  1462. @itemize
  1463. @item
  1464. A single delay:
  1465. @example
  1466. chorus=0.7:0.9:55:0.4:0.25:2
  1467. @end example
  1468. @item
  1469. Two delays:
  1470. @example
  1471. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1472. @end example
  1473. @item
  1474. Fuller sounding chorus with three delays:
  1475. @example
  1476. 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
  1477. @end example
  1478. @end itemize
  1479. @section compand
  1480. Compress or expand the audio's dynamic range.
  1481. It accepts the following parameters:
  1482. @table @option
  1483. @item attacks
  1484. @item decays
  1485. A list of times in seconds for each channel over which the instantaneous level
  1486. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1487. increase of volume and @var{decays} refers to decrease of volume. For most
  1488. situations, the attack time (response to the audio getting louder) should be
  1489. shorter than the decay time, because the human ear is more sensitive to sudden
  1490. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1491. a typical value for decay is 0.8 seconds.
  1492. If specified number of attacks & decays is lower than number of channels, the last
  1493. set attack/decay will be used for all remaining channels.
  1494. @item points
  1495. A list of points for the transfer function, specified in dB relative to the
  1496. maximum possible signal amplitude. Each key points list must be defined using
  1497. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1498. @code{x0/y0 x1/y1 x2/y2 ....}
  1499. The input values must be in strictly increasing order but the transfer function
  1500. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1501. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1502. function are @code{-70/-70|-60/-20}.
  1503. @item soft-knee
  1504. Set the curve radius in dB for all joints. It defaults to 0.01.
  1505. @item gain
  1506. Set the additional gain in dB to be applied at all points on the transfer
  1507. function. This allows for easy adjustment of the overall gain.
  1508. It defaults to 0.
  1509. @item volume
  1510. Set an initial volume, in dB, to be assumed for each channel when filtering
  1511. starts. This permits the user to supply a nominal level initially, so that, for
  1512. example, a very large gain is not applied to initial signal levels before the
  1513. companding has begun to operate. A typical value for audio which is initially
  1514. quiet is -90 dB. It defaults to 0.
  1515. @item delay
  1516. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1517. delayed before being fed to the volume adjuster. Specifying a delay
  1518. approximately equal to the attack/decay times allows the filter to effectively
  1519. operate in predictive rather than reactive mode. It defaults to 0.
  1520. @end table
  1521. @subsection Examples
  1522. @itemize
  1523. @item
  1524. Make music with both quiet and loud passages suitable for listening to in a
  1525. noisy environment:
  1526. @example
  1527. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1528. @end example
  1529. Another example for audio with whisper and explosion parts:
  1530. @example
  1531. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1532. @end example
  1533. @item
  1534. A noise gate for when the noise is at a lower level than the signal:
  1535. @example
  1536. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1537. @end example
  1538. @item
  1539. Here is another noise gate, this time for when the noise is at a higher level
  1540. than the signal (making it, in some ways, similar to squelch):
  1541. @example
  1542. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1543. @end example
  1544. @item
  1545. 2:1 compression starting at -6dB:
  1546. @example
  1547. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1548. @end example
  1549. @item
  1550. 2:1 compression starting at -9dB:
  1551. @example
  1552. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1553. @end example
  1554. @item
  1555. 2:1 compression starting at -12dB:
  1556. @example
  1557. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1558. @end example
  1559. @item
  1560. 2:1 compression starting at -18dB:
  1561. @example
  1562. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1563. @end example
  1564. @item
  1565. 3:1 compression starting at -15dB:
  1566. @example
  1567. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1568. @end example
  1569. @item
  1570. Compressor/Gate:
  1571. @example
  1572. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1573. @end example
  1574. @item
  1575. Expander:
  1576. @example
  1577. 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
  1578. @end example
  1579. @item
  1580. Hard limiter at -6dB:
  1581. @example
  1582. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1583. @end example
  1584. @item
  1585. Hard limiter at -12dB:
  1586. @example
  1587. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1588. @end example
  1589. @item
  1590. Hard noise gate at -35 dB:
  1591. @example
  1592. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1593. @end example
  1594. @item
  1595. Soft limiter:
  1596. @example
  1597. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  1598. @end example
  1599. @end itemize
  1600. @section compensationdelay
  1601. Compensation Delay Line is a metric based delay to compensate differing
  1602. positions of microphones or speakers.
  1603. For example, you have recorded guitar with two microphones placed in
  1604. different location. Because the front of sound wave has fixed speed in
  1605. normal conditions, the phasing of microphones can vary and depends on
  1606. their location and interposition. The best sound mix can be achieved when
  1607. these microphones are in phase (synchronized). Note that distance of
  1608. ~30 cm between microphones makes one microphone to capture signal in
  1609. antiphase to another microphone. That makes the final mix sounding moody.
  1610. This filter helps to solve phasing problems by adding different delays
  1611. to each microphone track and make them synchronized.
  1612. The best result can be reached when you take one track as base and
  1613. synchronize other tracks one by one with it.
  1614. Remember that synchronization/delay tolerance depends on sample rate, too.
  1615. Higher sample rates will give more tolerance.
  1616. It accepts the following parameters:
  1617. @table @option
  1618. @item mm
  1619. Set millimeters distance. This is compensation distance for fine tuning.
  1620. Default is 0.
  1621. @item cm
  1622. Set cm distance. This is compensation distance for tightening distance setup.
  1623. Default is 0.
  1624. @item m
  1625. Set meters distance. This is compensation distance for hard distance setup.
  1626. Default is 0.
  1627. @item dry
  1628. Set dry amount. Amount of unprocessed (dry) signal.
  1629. Default is 0.
  1630. @item wet
  1631. Set wet amount. Amount of processed (wet) signal.
  1632. Default is 1.
  1633. @item temp
  1634. Set temperature degree in Celsius. This is the temperature of the environment.
  1635. Default is 20.
  1636. @end table
  1637. @section dcshift
  1638. Apply a DC shift to the audio.
  1639. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1640. in the recording chain) from the audio. The effect of a DC offset is reduced
  1641. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1642. a signal has a DC offset.
  1643. @table @option
  1644. @item shift
  1645. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1646. the audio.
  1647. @item limitergain
  1648. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1649. used to prevent clipping.
  1650. @end table
  1651. @section dynaudnorm
  1652. Dynamic Audio Normalizer.
  1653. This filter applies a certain amount of gain to the input audio in order
  1654. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  1655. contrast to more "simple" normalization algorithms, the Dynamic Audio
  1656. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  1657. This allows for applying extra gain to the "quiet" sections of the audio
  1658. while avoiding distortions or clipping the "loud" sections. In other words:
  1659. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  1660. sections, in the sense that the volume of each section is brought to the
  1661. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  1662. this goal *without* applying "dynamic range compressing". It will retain 100%
  1663. of the dynamic range *within* each section of the audio file.
  1664. @table @option
  1665. @item f
  1666. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  1667. Default is 500 milliseconds.
  1668. The Dynamic Audio Normalizer processes the input audio in small chunks,
  1669. referred to as frames. This is required, because a peak magnitude has no
  1670. meaning for just a single sample value. Instead, we need to determine the
  1671. peak magnitude for a contiguous sequence of sample values. While a "standard"
  1672. normalizer would simply use the peak magnitude of the complete file, the
  1673. Dynamic Audio Normalizer determines the peak magnitude individually for each
  1674. frame. The length of a frame is specified in milliseconds. By default, the
  1675. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  1676. been found to give good results with most files.
  1677. Note that the exact frame length, in number of samples, will be determined
  1678. automatically, based on the sampling rate of the individual input audio file.
  1679. @item g
  1680. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  1681. number. Default is 31.
  1682. Probably the most important parameter of the Dynamic Audio Normalizer is the
  1683. @code{window size} of the Gaussian smoothing filter. The filter's window size
  1684. is specified in frames, centered around the current frame. For the sake of
  1685. simplicity, this must be an odd number. Consequently, the default value of 31
  1686. takes into account the current frame, as well as the 15 preceding frames and
  1687. the 15 subsequent frames. Using a larger window results in a stronger
  1688. smoothing effect and thus in less gain variation, i.e. slower gain
  1689. adaptation. Conversely, using a smaller window results in a weaker smoothing
  1690. effect and thus in more gain variation, i.e. faster gain adaptation.
  1691. In other words, the more you increase this value, the more the Dynamic Audio
  1692. Normalizer will behave like a "traditional" normalization filter. On the
  1693. contrary, the more you decrease this value, the more the Dynamic Audio
  1694. Normalizer will behave like a dynamic range compressor.
  1695. @item p
  1696. Set the target peak value. This specifies the highest permissible magnitude
  1697. level for the normalized audio input. This filter will try to approach the
  1698. target peak magnitude as closely as possible, but at the same time it also
  1699. makes sure that the normalized signal will never exceed the peak magnitude.
  1700. A frame's maximum local gain factor is imposed directly by the target peak
  1701. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  1702. It is not recommended to go above this value.
  1703. @item m
  1704. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  1705. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  1706. factor for each input frame, i.e. the maximum gain factor that does not
  1707. result in clipping or distortion. The maximum gain factor is determined by
  1708. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  1709. additionally bounds the frame's maximum gain factor by a predetermined
  1710. (global) maximum gain factor. This is done in order to avoid excessive gain
  1711. factors in "silent" or almost silent frames. By default, the maximum gain
  1712. factor is 10.0, For most inputs the default value should be sufficient and
  1713. it usually is not recommended to increase this value. Though, for input
  1714. with an extremely low overall volume level, it may be necessary to allow even
  1715. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  1716. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  1717. Instead, a "sigmoid" threshold function will be applied. This way, the
  1718. gain factors will smoothly approach the threshold value, but never exceed that
  1719. value.
  1720. @item r
  1721. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  1722. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  1723. This means that the maximum local gain factor for each frame is defined
  1724. (only) by the frame's highest magnitude sample. This way, the samples can
  1725. be amplified as much as possible without exceeding the maximum signal
  1726. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  1727. Normalizer can also take into account the frame's root mean square,
  1728. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  1729. determine the power of a time-varying signal. It is therefore considered
  1730. that the RMS is a better approximation of the "perceived loudness" than
  1731. just looking at the signal's peak magnitude. Consequently, by adjusting all
  1732. frames to a constant RMS value, a uniform "perceived loudness" can be
  1733. established. If a target RMS value has been specified, a frame's local gain
  1734. factor is defined as the factor that would result in exactly that RMS value.
  1735. Note, however, that the maximum local gain factor is still restricted by the
  1736. frame's highest magnitude sample, in order to prevent clipping.
  1737. @item n
  1738. Enable channels coupling. By default is enabled.
  1739. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  1740. amount. This means the same gain factor will be applied to all channels, i.e.
  1741. the maximum possible gain factor is determined by the "loudest" channel.
  1742. However, in some recordings, it may happen that the volume of the different
  1743. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  1744. In this case, this option can be used to disable the channel coupling. This way,
  1745. the gain factor will be determined independently for each channel, depending
  1746. only on the individual channel's highest magnitude sample. This allows for
  1747. harmonizing the volume of the different channels.
  1748. @item c
  1749. Enable DC bias correction. By default is disabled.
  1750. An audio signal (in the time domain) is a sequence of sample values.
  1751. In the Dynamic Audio Normalizer these sample values are represented in the
  1752. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  1753. audio signal, or "waveform", should be centered around the zero point.
  1754. That means if we calculate the mean value of all samples in a file, or in a
  1755. single frame, then the result should be 0.0 or at least very close to that
  1756. value. If, however, there is a significant deviation of the mean value from
  1757. 0.0, in either positive or negative direction, this is referred to as a
  1758. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  1759. Audio Normalizer provides optional DC bias correction.
  1760. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  1761. the mean value, or "DC correction" offset, of each input frame and subtract
  1762. that value from all of the frame's sample values which ensures those samples
  1763. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  1764. boundaries, the DC correction offset values will be interpolated smoothly
  1765. between neighbouring frames.
  1766. @item b
  1767. Enable alternative boundary mode. By default is disabled.
  1768. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  1769. around each frame. This includes the preceding frames as well as the
  1770. subsequent frames. However, for the "boundary" frames, located at the very
  1771. beginning and at the very end of the audio file, not all neighbouring
  1772. frames are available. In particular, for the first few frames in the audio
  1773. file, the preceding frames are not known. And, similarly, for the last few
  1774. frames in the audio file, the subsequent frames are not known. Thus, the
  1775. question arises which gain factors should be assumed for the missing frames
  1776. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  1777. to deal with this situation. The default boundary mode assumes a gain factor
  1778. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  1779. "fade out" at the beginning and at the end of the input, respectively.
  1780. @item s
  1781. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  1782. By default, the Dynamic Audio Normalizer does not apply "traditional"
  1783. compression. This means that signal peaks will not be pruned and thus the
  1784. full dynamic range will be retained within each local neighbourhood. However,
  1785. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  1786. normalization algorithm with a more "traditional" compression.
  1787. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  1788. (thresholding) function. If (and only if) the compression feature is enabled,
  1789. all input frames will be processed by a soft knee thresholding function prior
  1790. to the actual normalization process. Put simply, the thresholding function is
  1791. going to prune all samples whose magnitude exceeds a certain threshold value.
  1792. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  1793. value. Instead, the threshold value will be adjusted for each individual
  1794. frame.
  1795. In general, smaller parameters result in stronger compression, and vice versa.
  1796. Values below 3.0 are not recommended, because audible distortion may appear.
  1797. @end table
  1798. @section earwax
  1799. Make audio easier to listen to on headphones.
  1800. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  1801. so that when listened to on headphones the stereo image is moved from
  1802. inside your head (standard for headphones) to outside and in front of
  1803. the listener (standard for speakers).
  1804. Ported from SoX.
  1805. @section equalizer
  1806. Apply a two-pole peaking equalisation (EQ) filter. With this
  1807. filter, the signal-level at and around a selected frequency can
  1808. be increased or decreased, whilst (unlike bandpass and bandreject
  1809. filters) that at all other frequencies is unchanged.
  1810. In order to produce complex equalisation curves, this filter can
  1811. be given several times, each with a different central frequency.
  1812. The filter accepts the following options:
  1813. @table @option
  1814. @item frequency, f
  1815. Set the filter's central frequency in Hz.
  1816. @item width_type
  1817. Set method to specify band-width of filter.
  1818. @table @option
  1819. @item h
  1820. Hz
  1821. @item q
  1822. Q-Factor
  1823. @item o
  1824. octave
  1825. @item s
  1826. slope
  1827. @end table
  1828. @item width, w
  1829. Specify the band-width of a filter in width_type units.
  1830. @item gain, g
  1831. Set the required gain or attenuation in dB.
  1832. Beware of clipping when using a positive gain.
  1833. @end table
  1834. @subsection Examples
  1835. @itemize
  1836. @item
  1837. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  1838. @example
  1839. equalizer=f=1000:width_type=h:width=200:g=-10
  1840. @end example
  1841. @item
  1842. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  1843. @example
  1844. equalizer=f=1000:width_type=q:width=1:g=2,equalizer=f=100:width_type=q:width=2:g=-5
  1845. @end example
  1846. @end itemize
  1847. @section extrastereo
  1848. Linearly increases the difference between left and right channels which
  1849. adds some sort of "live" effect to playback.
  1850. The filter accepts the following option:
  1851. @table @option
  1852. @item m
  1853. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  1854. (average of both channels), with 1.0 sound will be unchanged, with
  1855. -1.0 left and right channels will be swapped.
  1856. @item c
  1857. Enable clipping. By default is enabled.
  1858. @end table
  1859. @section flanger
  1860. Apply a flanging effect to the audio.
  1861. The filter accepts the following options:
  1862. @table @option
  1863. @item delay
  1864. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  1865. @item depth
  1866. Set added swep delay in milliseconds. Range from 0 to 10. Default value is 2.
  1867. @item regen
  1868. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  1869. Default value is 0.
  1870. @item width
  1871. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  1872. Default value is 71.
  1873. @item speed
  1874. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  1875. @item shape
  1876. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  1877. Default value is @var{sinusoidal}.
  1878. @item phase
  1879. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  1880. Default value is 25.
  1881. @item interp
  1882. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  1883. Default is @var{linear}.
  1884. @end table
  1885. @section highpass
  1886. Apply a high-pass filter with 3dB point frequency.
  1887. The filter can be either single-pole, or double-pole (the default).
  1888. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  1889. The filter accepts the following options:
  1890. @table @option
  1891. @item frequency, f
  1892. Set frequency in Hz. Default is 3000.
  1893. @item poles, p
  1894. Set number of poles. Default is 2.
  1895. @item width_type
  1896. Set method to specify band-width of filter.
  1897. @table @option
  1898. @item h
  1899. Hz
  1900. @item q
  1901. Q-Factor
  1902. @item o
  1903. octave
  1904. @item s
  1905. slope
  1906. @end table
  1907. @item width, w
  1908. Specify the band-width of a filter in width_type units.
  1909. Applies only to double-pole filter.
  1910. The default is 0.707q and gives a Butterworth response.
  1911. @end table
  1912. @section join
  1913. Join multiple input streams into one multi-channel stream.
  1914. It accepts the following parameters:
  1915. @table @option
  1916. @item inputs
  1917. The number of input streams. It defaults to 2.
  1918. @item channel_layout
  1919. The desired output channel layout. It defaults to stereo.
  1920. @item map
  1921. Map channels from inputs to output. The argument is a '|'-separated list of
  1922. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  1923. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  1924. can be either the name of the input channel (e.g. FL for front left) or its
  1925. index in the specified input stream. @var{out_channel} is the name of the output
  1926. channel.
  1927. @end table
  1928. The filter will attempt to guess the mappings when they are not specified
  1929. explicitly. It does so by first trying to find an unused matching input channel
  1930. and if that fails it picks the first unused input channel.
  1931. Join 3 inputs (with properly set channel layouts):
  1932. @example
  1933. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  1934. @end example
  1935. Build a 5.1 output from 6 single-channel streams:
  1936. @example
  1937. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  1938. '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'
  1939. out
  1940. @end example
  1941. @section ladspa
  1942. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  1943. To enable compilation of this filter you need to configure FFmpeg with
  1944. @code{--enable-ladspa}.
  1945. @table @option
  1946. @item file, f
  1947. Specifies the name of LADSPA plugin library to load. If the environment
  1948. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  1949. each one of the directories specified by the colon separated list in
  1950. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  1951. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  1952. @file{/usr/lib/ladspa/}.
  1953. @item plugin, p
  1954. Specifies the plugin within the library. Some libraries contain only
  1955. one plugin, but others contain many of them. If this is not set filter
  1956. will list all available plugins within the specified library.
  1957. @item controls, c
  1958. Set the '|' separated list of controls which are zero or more floating point
  1959. values that determine the behavior of the loaded plugin (for example delay,
  1960. threshold or gain).
  1961. Controls need to be defined using the following syntax:
  1962. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  1963. @var{valuei} is the value set on the @var{i}-th control.
  1964. Alternatively they can be also defined using the following syntax:
  1965. @var{value0}|@var{value1}|@var{value2}|..., where
  1966. @var{valuei} is the value set on the @var{i}-th control.
  1967. If @option{controls} is set to @code{help}, all available controls and
  1968. their valid ranges are printed.
  1969. @item sample_rate, s
  1970. Specify the sample rate, default to 44100. Only used if plugin have
  1971. zero inputs.
  1972. @item nb_samples, n
  1973. Set the number of samples per channel per each output frame, default
  1974. is 1024. Only used if plugin have zero inputs.
  1975. @item duration, d
  1976. Set the minimum duration of the sourced audio. See
  1977. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1978. for the accepted syntax.
  1979. Note that the resulting duration may be greater than the specified duration,
  1980. as the generated audio is always cut at the end of a complete frame.
  1981. If not specified, or the expressed duration is negative, the audio is
  1982. supposed to be generated forever.
  1983. Only used if plugin have zero inputs.
  1984. @end table
  1985. @subsection Examples
  1986. @itemize
  1987. @item
  1988. List all available plugins within amp (LADSPA example plugin) library:
  1989. @example
  1990. ladspa=file=amp
  1991. @end example
  1992. @item
  1993. List all available controls and their valid ranges for @code{vcf_notch}
  1994. plugin from @code{VCF} library:
  1995. @example
  1996. ladspa=f=vcf:p=vcf_notch:c=help
  1997. @end example
  1998. @item
  1999. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2000. plugin library:
  2001. @example
  2002. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2003. @end example
  2004. @item
  2005. Add reverberation to the audio using TAP-plugins
  2006. (Tom's Audio Processing plugins):
  2007. @example
  2008. ladspa=file=tap_reverb:tap_reverb
  2009. @end example
  2010. @item
  2011. Generate white noise, with 0.2 amplitude:
  2012. @example
  2013. ladspa=file=cmt:noise_source_white:c=c0=.2
  2014. @end example
  2015. @item
  2016. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2017. @code{C* Audio Plugin Suite} (CAPS) library:
  2018. @example
  2019. ladspa=file=caps:Click:c=c1=20'
  2020. @end example
  2021. @item
  2022. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2023. @example
  2024. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2025. @end example
  2026. @item
  2027. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2028. @code{SWH Plugins} collection:
  2029. @example
  2030. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2031. @end example
  2032. @item
  2033. Attenuate low frequencies using Multiband EQ from Steve Harris
  2034. @code{SWH Plugins} collection:
  2035. @example
  2036. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2037. @end example
  2038. @end itemize
  2039. @subsection Commands
  2040. This filter supports the following commands:
  2041. @table @option
  2042. @item cN
  2043. Modify the @var{N}-th control value.
  2044. If the specified value is not valid, it is ignored and prior one is kept.
  2045. @end table
  2046. @section lowpass
  2047. Apply a low-pass filter with 3dB point frequency.
  2048. The filter can be either single-pole or double-pole (the default).
  2049. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2050. The filter accepts the following options:
  2051. @table @option
  2052. @item frequency, f
  2053. Set frequency in Hz. Default is 500.
  2054. @item poles, p
  2055. Set number of poles. Default is 2.
  2056. @item width_type
  2057. Set method to specify band-width of filter.
  2058. @table @option
  2059. @item h
  2060. Hz
  2061. @item q
  2062. Q-Factor
  2063. @item o
  2064. octave
  2065. @item s
  2066. slope
  2067. @end table
  2068. @item width, w
  2069. Specify the band-width of a filter in width_type units.
  2070. Applies only to double-pole filter.
  2071. The default is 0.707q and gives a Butterworth response.
  2072. @end table
  2073. @anchor{pan}
  2074. @section pan
  2075. Mix channels with specific gain levels. The filter accepts the output
  2076. channel layout followed by a set of channels definitions.
  2077. This filter is also designed to efficiently remap the channels of an audio
  2078. stream.
  2079. The filter accepts parameters of the form:
  2080. "@var{l}|@var{outdef}|@var{outdef}|..."
  2081. @table @option
  2082. @item l
  2083. output channel layout or number of channels
  2084. @item outdef
  2085. output channel specification, of the form:
  2086. "@var{out_name}=[@var{gain}*]@var{in_name}[+[@var{gain}*]@var{in_name}...]"
  2087. @item out_name
  2088. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2089. number (c0, c1, etc.)
  2090. @item gain
  2091. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2092. @item in_name
  2093. input channel to use, see out_name for details; it is not possible to mix
  2094. named and numbered input channels
  2095. @end table
  2096. If the `=' in a channel specification is replaced by `<', then the gains for
  2097. that specification will be renormalized so that the total is 1, thus
  2098. avoiding clipping noise.
  2099. @subsection Mixing examples
  2100. For example, if you want to down-mix from stereo to mono, but with a bigger
  2101. factor for the left channel:
  2102. @example
  2103. pan=1c|c0=0.9*c0+0.1*c1
  2104. @end example
  2105. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2106. 7-channels surround:
  2107. @example
  2108. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2109. @end example
  2110. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2111. that should be preferred (see "-ac" option) unless you have very specific
  2112. needs.
  2113. @subsection Remapping examples
  2114. The channel remapping will be effective if, and only if:
  2115. @itemize
  2116. @item gain coefficients are zeroes or ones,
  2117. @item only one input per channel output,
  2118. @end itemize
  2119. If all these conditions are satisfied, the filter will notify the user ("Pure
  2120. channel mapping detected"), and use an optimized and lossless method to do the
  2121. remapping.
  2122. For example, if you have a 5.1 source and want a stereo audio stream by
  2123. dropping the extra channels:
  2124. @example
  2125. pan="stereo| c0=FL | c1=FR"
  2126. @end example
  2127. Given the same source, you can also switch front left and front right channels
  2128. and keep the input channel layout:
  2129. @example
  2130. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2131. @end example
  2132. If the input is a stereo audio stream, you can mute the front left channel (and
  2133. still keep the stereo channel layout) with:
  2134. @example
  2135. pan="stereo|c1=c1"
  2136. @end example
  2137. Still with a stereo audio stream input, you can copy the right channel in both
  2138. front left and right:
  2139. @example
  2140. pan="stereo| c0=FR | c1=FR"
  2141. @end example
  2142. @section replaygain
  2143. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2144. outputs it unchanged.
  2145. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2146. @section resample
  2147. Convert the audio sample format, sample rate and channel layout. It is
  2148. not meant to be used directly.
  2149. @section rubberband
  2150. Apply time-stretching and pitch-shifting with librubberband.
  2151. The filter accepts the following options:
  2152. @table @option
  2153. @item tempo
  2154. Set tempo scale factor.
  2155. @item pitch
  2156. Set pitch scale factor.
  2157. @item transients
  2158. Set transients detector.
  2159. Possible values are:
  2160. @table @var
  2161. @item crisp
  2162. @item mixed
  2163. @item smooth
  2164. @end table
  2165. @item detector
  2166. Set detector.
  2167. Possible values are:
  2168. @table @var
  2169. @item compound
  2170. @item percussive
  2171. @item soft
  2172. @end table
  2173. @item phase
  2174. Set phase.
  2175. Possible values are:
  2176. @table @var
  2177. @item laminar
  2178. @item independent
  2179. @end table
  2180. @item window
  2181. Set processing window size.
  2182. Possible values are:
  2183. @table @var
  2184. @item standard
  2185. @item short
  2186. @item long
  2187. @end table
  2188. @item smoothing
  2189. Set smoothing.
  2190. Possible values are:
  2191. @table @var
  2192. @item off
  2193. @item on
  2194. @end table
  2195. @item formant
  2196. Enable formant preservation when shift pitching.
  2197. Possible values are:
  2198. @table @var
  2199. @item shifted
  2200. @item preserved
  2201. @end table
  2202. @item pitchq
  2203. Set pitch quality.
  2204. Possible values are:
  2205. @table @var
  2206. @item quality
  2207. @item speed
  2208. @item consistency
  2209. @end table
  2210. @item channels
  2211. Set channels.
  2212. Possible values are:
  2213. @table @var
  2214. @item apart
  2215. @item together
  2216. @end table
  2217. @end table
  2218. @section sidechaincompress
  2219. This filter acts like normal compressor but has the ability to compress
  2220. detected signal using second input signal.
  2221. It needs two input streams and returns one output stream.
  2222. First input stream will be processed depending on second stream signal.
  2223. The filtered signal then can be filtered with other filters in later stages of
  2224. processing. See @ref{pan} and @ref{amerge} filter.
  2225. The filter accepts the following options:
  2226. @table @option
  2227. @item level_in
  2228. Set input gain. Default is 1. Range is between 0.015625 and 64.
  2229. @item threshold
  2230. If a signal of second stream raises above this level it will affect the gain
  2231. reduction of first stream.
  2232. By default is 0.125. Range is between 0.00097563 and 1.
  2233. @item ratio
  2234. Set a ratio about which the signal is reduced. 1:2 means that if the level
  2235. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  2236. Default is 2. Range is between 1 and 20.
  2237. @item attack
  2238. Amount of milliseconds the signal has to rise above the threshold before gain
  2239. reduction starts. Default is 20. Range is between 0.01 and 2000.
  2240. @item release
  2241. Amount of milliseconds the signal has to fall below the threshold before
  2242. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  2243. @item makeup
  2244. Set the amount by how much signal will be amplified after processing.
  2245. Default is 2. Range is from 1 and 64.
  2246. @item knee
  2247. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2248. Default is 2.82843. Range is between 1 and 8.
  2249. @item link
  2250. Choose if the @code{average} level between all channels of side-chain stream
  2251. or the louder(@code{maximum}) channel of side-chain stream affects the
  2252. reduction. Default is @code{average}.
  2253. @item detection
  2254. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  2255. of @code{rms}. Default is @code{rms} which is mainly smoother.
  2256. @item level_sc
  2257. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  2258. @item mix
  2259. How much to use compressed signal in output. Default is 1.
  2260. Range is between 0 and 1.
  2261. @end table
  2262. @subsection Examples
  2263. @itemize
  2264. @item
  2265. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  2266. depending on the signal of 2nd input and later compressed signal to be
  2267. merged with 2nd input:
  2268. @example
  2269. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  2270. @end example
  2271. @end itemize
  2272. @section sidechaingate
  2273. A sidechain gate acts like a normal (wideband) gate but has the ability to
  2274. filter the detected signal before sending it to the gain reduction stage.
  2275. Normally a gate uses the full range signal to detect a level above the
  2276. threshold.
  2277. For example: If you cut all lower frequencies from your sidechain signal
  2278. the gate will decrease the volume of your track only if not enough highs
  2279. appear. With this technique you are able to reduce the resonation of a
  2280. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  2281. guitar.
  2282. It needs two input streams and returns one output stream.
  2283. First input stream will be processed depending on second stream signal.
  2284. The filter accepts the following options:
  2285. @table @option
  2286. @item level_in
  2287. Set input level before filtering.
  2288. Default is 1. Allowed range is from 0.015625 to 64.
  2289. @item range
  2290. Set the level of gain reduction when the signal is below the threshold.
  2291. Default is 0.06125. Allowed range is from 0 to 1.
  2292. @item threshold
  2293. If a signal rises above this level the gain reduction is released.
  2294. Default is 0.125. Allowed range is from 0 to 1.
  2295. @item ratio
  2296. Set a ratio about which the signal is reduced.
  2297. Default is 2. Allowed range is from 1 to 9000.
  2298. @item attack
  2299. Amount of milliseconds the signal has to rise above the threshold before gain
  2300. reduction stops.
  2301. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  2302. @item release
  2303. Amount of milliseconds the signal has to fall below the threshold before the
  2304. reduction is increased again. Default is 250 milliseconds.
  2305. Allowed range is from 0.01 to 9000.
  2306. @item makeup
  2307. Set amount of amplification of signal after processing.
  2308. Default is 1. Allowed range is from 1 to 64.
  2309. @item knee
  2310. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2311. Default is 2.828427125. Allowed range is from 1 to 8.
  2312. @item detection
  2313. Choose if exact signal should be taken for detection or an RMS like one.
  2314. Default is rms. Can be peak or rms.
  2315. @item link
  2316. Choose if the average level between all channels or the louder channel affects
  2317. the reduction.
  2318. Default is average. Can be average or maximum.
  2319. @item level_sc
  2320. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  2321. @end table
  2322. @section silencedetect
  2323. Detect silence in an audio stream.
  2324. This filter logs a message when it detects that the input audio volume is less
  2325. or equal to a noise tolerance value for a duration greater or equal to the
  2326. minimum detected noise duration.
  2327. The printed times and duration are expressed in seconds.
  2328. The filter accepts the following options:
  2329. @table @option
  2330. @item duration, d
  2331. Set silence duration until notification (default is 2 seconds).
  2332. @item noise, n
  2333. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  2334. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  2335. @end table
  2336. @subsection Examples
  2337. @itemize
  2338. @item
  2339. Detect 5 seconds of silence with -50dB noise tolerance:
  2340. @example
  2341. silencedetect=n=-50dB:d=5
  2342. @end example
  2343. @item
  2344. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  2345. tolerance in @file{silence.mp3}:
  2346. @example
  2347. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  2348. @end example
  2349. @end itemize
  2350. @section silenceremove
  2351. Remove silence from the beginning, middle or end of the audio.
  2352. The filter accepts the following options:
  2353. @table @option
  2354. @item start_periods
  2355. This value is used to indicate if audio should be trimmed at beginning of
  2356. the audio. A value of zero indicates no silence should be trimmed from the
  2357. beginning. When specifying a non-zero value, it trims audio up until it
  2358. finds non-silence. Normally, when trimming silence from beginning of audio
  2359. the @var{start_periods} will be @code{1} but it can be increased to higher
  2360. values to trim all audio up to specific count of non-silence periods.
  2361. Default value is @code{0}.
  2362. @item start_duration
  2363. Specify the amount of time that non-silence must be detected before it stops
  2364. trimming audio. By increasing the duration, bursts of noises can be treated
  2365. as silence and trimmed off. Default value is @code{0}.
  2366. @item start_threshold
  2367. This indicates what sample value should be treated as silence. For digital
  2368. audio, a value of @code{0} may be fine but for audio recorded from analog,
  2369. you may wish to increase the value to account for background noise.
  2370. Can be specified in dB (in case "dB" is appended to the specified value)
  2371. or amplitude ratio. Default value is @code{0}.
  2372. @item stop_periods
  2373. Set the count for trimming silence from the end of audio.
  2374. To remove silence from the middle of a file, specify a @var{stop_periods}
  2375. that is negative. This value is then treated as a positive value and is
  2376. used to indicate the effect should restart processing as specified by
  2377. @var{start_periods}, making it suitable for removing periods of silence
  2378. in the middle of the audio.
  2379. Default value is @code{0}.
  2380. @item stop_duration
  2381. Specify a duration of silence that must exist before audio is not copied any
  2382. more. By specifying a higher duration, silence that is wanted can be left in
  2383. the audio.
  2384. Default value is @code{0}.
  2385. @item stop_threshold
  2386. This is the same as @option{start_threshold} but for trimming silence from
  2387. the end of audio.
  2388. Can be specified in dB (in case "dB" is appended to the specified value)
  2389. or amplitude ratio. Default value is @code{0}.
  2390. @item leave_silence
  2391. This indicate that @var{stop_duration} length of audio should be left intact
  2392. at the beginning of each period of silence.
  2393. For example, if you want to remove long pauses between words but do not want
  2394. to remove the pauses completely. Default value is @code{0}.
  2395. @item detection
  2396. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  2397. and works better with digital silence which is exactly 0.
  2398. Default value is @code{rms}.
  2399. @item window
  2400. Set ratio used to calculate size of window for detecting silence.
  2401. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  2402. @end table
  2403. @subsection Examples
  2404. @itemize
  2405. @item
  2406. The following example shows how this filter can be used to start a recording
  2407. that does not contain the delay at the start which usually occurs between
  2408. pressing the record button and the start of the performance:
  2409. @example
  2410. silenceremove=1:5:0.02
  2411. @end example
  2412. @item
  2413. Trim all silence encountered from begining to end where there is more than 1
  2414. second of silence in audio:
  2415. @example
  2416. silenceremove=0:0:0:-1:1:-90dB
  2417. @end example
  2418. @end itemize
  2419. @section sofalizer
  2420. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  2421. loudspeakers around the user for binaural listening via headphones (audio
  2422. formats up to 9 channels supported).
  2423. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  2424. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  2425. Austrian Academy of Sciences.
  2426. To enable compilation of this filter you need to configure FFmpeg with
  2427. @code{--enable-netcdf}.
  2428. The filter accepts the following options:
  2429. @table @option
  2430. @item sofa
  2431. Set the SOFA file used for rendering.
  2432. @item gain
  2433. Set gain applied to audio. Value is in dB. Default is 0.
  2434. @item rotation
  2435. Set rotation of virtual loudspeakers in deg. Default is 0.
  2436. @item elevation
  2437. Set elevation of virtual speakers in deg. Default is 0.
  2438. @item radius
  2439. Set distance in meters between loudspeakers and the listener with near-field
  2440. HRTFs. Default is 1.
  2441. @item type
  2442. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2443. processing audio in time domain which is slow but gives high quality output.
  2444. @var{freq} is processing audio in frequency domain which is fast but gives
  2445. mediocre output. Default is @var{freq}.
  2446. @end table
  2447. @section stereotools
  2448. This filter has some handy utilities to manage stereo signals, for converting
  2449. M/S stereo recordings to L/R signal while having control over the parameters
  2450. or spreading the stereo image of master track.
  2451. The filter accepts the following options:
  2452. @table @option
  2453. @item level_in
  2454. Set input level before filtering for both channels. Defaults is 1.
  2455. Allowed range is from 0.015625 to 64.
  2456. @item level_out
  2457. Set output level after filtering for both channels. Defaults is 1.
  2458. Allowed range is from 0.015625 to 64.
  2459. @item balance_in
  2460. Set input balance between both channels. Default is 0.
  2461. Allowed range is from -1 to 1.
  2462. @item balance_out
  2463. Set output balance between both channels. Default is 0.
  2464. Allowed range is from -1 to 1.
  2465. @item softclip
  2466. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  2467. clipping. Disabled by default.
  2468. @item mutel
  2469. Mute the left channel. Disabled by default.
  2470. @item muter
  2471. Mute the right channel. Disabled by default.
  2472. @item phasel
  2473. Change the phase of the left channel. Disabled by default.
  2474. @item phaser
  2475. Change the phase of the right channel. Disabled by default.
  2476. @item mode
  2477. Set stereo mode. Available values are:
  2478. @table @samp
  2479. @item lr>lr
  2480. Left/Right to Left/Right, this is default.
  2481. @item lr>ms
  2482. Left/Right to Mid/Side.
  2483. @item ms>lr
  2484. Mid/Side to Left/Right.
  2485. @item lr>ll
  2486. Left/Right to Left/Left.
  2487. @item lr>rr
  2488. Left/Right to Right/Right.
  2489. @item lr>l+r
  2490. Left/Right to Left + Right.
  2491. @item lr>rl
  2492. Left/Right to Right/Left.
  2493. @end table
  2494. @item slev
  2495. Set level of side signal. Default is 1.
  2496. Allowed range is from 0.015625 to 64.
  2497. @item sbal
  2498. Set balance of side signal. Default is 0.
  2499. Allowed range is from -1 to 1.
  2500. @item mlev
  2501. Set level of the middle signal. Default is 1.
  2502. Allowed range is from 0.015625 to 64.
  2503. @item mpan
  2504. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  2505. @item base
  2506. Set stereo base between mono and inversed channels. Default is 0.
  2507. Allowed range is from -1 to 1.
  2508. @item delay
  2509. Set delay in milliseconds how much to delay left from right channel and
  2510. vice versa. Default is 0. Allowed range is from -20 to 20.
  2511. @item sclevel
  2512. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  2513. @item phase
  2514. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  2515. @end table
  2516. @section stereowiden
  2517. This filter enhance the stereo effect by suppressing signal common to both
  2518. channels and by delaying the signal of left into right and vice versa,
  2519. thereby widening the stereo effect.
  2520. The filter accepts the following options:
  2521. @table @option
  2522. @item delay
  2523. Time in milliseconds of the delay of left signal into right and vice versa.
  2524. Default is 20 milliseconds.
  2525. @item feedback
  2526. Amount of gain in delayed signal into right and vice versa. Gives a delay
  2527. effect of left signal in right output and vice versa which gives widening
  2528. effect. Default is 0.3.
  2529. @item crossfeed
  2530. Cross feed of left into right with inverted phase. This helps in suppressing
  2531. the mono. If the value is 1 it will cancel all the signal common to both
  2532. channels. Default is 0.3.
  2533. @item drymix
  2534. Set level of input signal of original channel. Default is 0.8.
  2535. @end table
  2536. @section treble
  2537. Boost or cut treble (upper) frequencies of the audio using a two-pole
  2538. shelving filter with a response similar to that of a standard
  2539. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2540. The filter accepts the following options:
  2541. @table @option
  2542. @item gain, g
  2543. Give the gain at whichever is the lower of ~22 kHz and the
  2544. Nyquist frequency. Its useful range is about -20 (for a large cut)
  2545. to +20 (for a large boost). Beware of clipping when using a positive gain.
  2546. @item frequency, f
  2547. Set the filter's central frequency and so can be used
  2548. to extend or reduce the frequency range to be boosted or cut.
  2549. The default value is @code{3000} Hz.
  2550. @item width_type
  2551. Set method to specify band-width of filter.
  2552. @table @option
  2553. @item h
  2554. Hz
  2555. @item q
  2556. Q-Factor
  2557. @item o
  2558. octave
  2559. @item s
  2560. slope
  2561. @end table
  2562. @item width, w
  2563. Determine how steep is the filter's shelf transition.
  2564. @end table
  2565. @section tremolo
  2566. Sinusoidal amplitude modulation.
  2567. The filter accepts the following options:
  2568. @table @option
  2569. @item f
  2570. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  2571. (20 Hz or lower) will result in a tremolo effect.
  2572. This filter may also be used as a ring modulator by specifying
  2573. a modulation frequency higher than 20 Hz.
  2574. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2575. @item d
  2576. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2577. Default value is 0.5.
  2578. @end table
  2579. @section vibrato
  2580. Sinusoidal phase modulation.
  2581. The filter accepts the following options:
  2582. @table @option
  2583. @item f
  2584. Modulation frequency in Hertz.
  2585. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2586. @item d
  2587. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2588. Default value is 0.5.
  2589. @end table
  2590. @section volume
  2591. Adjust the input audio volume.
  2592. It accepts the following parameters:
  2593. @table @option
  2594. @item volume
  2595. Set audio volume expression.
  2596. Output values are clipped to the maximum value.
  2597. The output audio volume is given by the relation:
  2598. @example
  2599. @var{output_volume} = @var{volume} * @var{input_volume}
  2600. @end example
  2601. The default value for @var{volume} is "1.0".
  2602. @item precision
  2603. This parameter represents the mathematical precision.
  2604. It determines which input sample formats will be allowed, which affects the
  2605. precision of the volume scaling.
  2606. @table @option
  2607. @item fixed
  2608. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  2609. @item float
  2610. 32-bit floating-point; this limits input sample format to FLT. (default)
  2611. @item double
  2612. 64-bit floating-point; this limits input sample format to DBL.
  2613. @end table
  2614. @item replaygain
  2615. Choose the behaviour on encountering ReplayGain side data in input frames.
  2616. @table @option
  2617. @item drop
  2618. Remove ReplayGain side data, ignoring its contents (the default).
  2619. @item ignore
  2620. Ignore ReplayGain side data, but leave it in the frame.
  2621. @item track
  2622. Prefer the track gain, if present.
  2623. @item album
  2624. Prefer the album gain, if present.
  2625. @end table
  2626. @item replaygain_preamp
  2627. Pre-amplification gain in dB to apply to the selected replaygain gain.
  2628. Default value for @var{replaygain_preamp} is 0.0.
  2629. @item eval
  2630. Set when the volume expression is evaluated.
  2631. It accepts the following values:
  2632. @table @samp
  2633. @item once
  2634. only evaluate expression once during the filter initialization, or
  2635. when the @samp{volume} command is sent
  2636. @item frame
  2637. evaluate expression for each incoming frame
  2638. @end table
  2639. Default value is @samp{once}.
  2640. @end table
  2641. The volume expression can contain the following parameters.
  2642. @table @option
  2643. @item n
  2644. frame number (starting at zero)
  2645. @item nb_channels
  2646. number of channels
  2647. @item nb_consumed_samples
  2648. number of samples consumed by the filter
  2649. @item nb_samples
  2650. number of samples in the current frame
  2651. @item pos
  2652. original frame position in the file
  2653. @item pts
  2654. frame PTS
  2655. @item sample_rate
  2656. sample rate
  2657. @item startpts
  2658. PTS at start of stream
  2659. @item startt
  2660. time at start of stream
  2661. @item t
  2662. frame time
  2663. @item tb
  2664. timestamp timebase
  2665. @item volume
  2666. last set volume value
  2667. @end table
  2668. Note that when @option{eval} is set to @samp{once} only the
  2669. @var{sample_rate} and @var{tb} variables are available, all other
  2670. variables will evaluate to NAN.
  2671. @subsection Commands
  2672. This filter supports the following commands:
  2673. @table @option
  2674. @item volume
  2675. Modify the volume expression.
  2676. The command accepts the same syntax of the corresponding option.
  2677. If the specified expression is not valid, it is kept at its current
  2678. value.
  2679. @item replaygain_noclip
  2680. Prevent clipping by limiting the gain applied.
  2681. Default value for @var{replaygain_noclip} is 1.
  2682. @end table
  2683. @subsection Examples
  2684. @itemize
  2685. @item
  2686. Halve the input audio volume:
  2687. @example
  2688. volume=volume=0.5
  2689. volume=volume=1/2
  2690. volume=volume=-6.0206dB
  2691. @end example
  2692. In all the above example the named key for @option{volume} can be
  2693. omitted, for example like in:
  2694. @example
  2695. volume=0.5
  2696. @end example
  2697. @item
  2698. Increase input audio power by 6 decibels using fixed-point precision:
  2699. @example
  2700. volume=volume=6dB:precision=fixed
  2701. @end example
  2702. @item
  2703. Fade volume after time 10 with an annihilation period of 5 seconds:
  2704. @example
  2705. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  2706. @end example
  2707. @end itemize
  2708. @section volumedetect
  2709. Detect the volume of the input video.
  2710. The filter has no parameters. The input is not modified. Statistics about
  2711. the volume will be printed in the log when the input stream end is reached.
  2712. In particular it will show the mean volume (root mean square), maximum
  2713. volume (on a per-sample basis), and the beginning of a histogram of the
  2714. registered volume values (from the maximum value to a cumulated 1/1000 of
  2715. the samples).
  2716. All volumes are in decibels relative to the maximum PCM value.
  2717. @subsection Examples
  2718. Here is an excerpt of the output:
  2719. @example
  2720. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  2721. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  2722. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  2723. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  2724. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  2725. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  2726. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  2727. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  2728. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  2729. @end example
  2730. It means that:
  2731. @itemize
  2732. @item
  2733. The mean square energy is approximately -27 dB, or 10^-2.7.
  2734. @item
  2735. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  2736. @item
  2737. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  2738. @end itemize
  2739. In other words, raising the volume by +4 dB does not cause any clipping,
  2740. raising it by +5 dB causes clipping for 6 samples, etc.
  2741. @c man end AUDIO FILTERS
  2742. @chapter Audio Sources
  2743. @c man begin AUDIO SOURCES
  2744. Below is a description of the currently available audio sources.
  2745. @section abuffer
  2746. Buffer audio frames, and make them available to the filter chain.
  2747. This source is mainly intended for a programmatic use, in particular
  2748. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  2749. It accepts the following parameters:
  2750. @table @option
  2751. @item time_base
  2752. The timebase which will be used for timestamps of submitted frames. It must be
  2753. either a floating-point number or in @var{numerator}/@var{denominator} form.
  2754. @item sample_rate
  2755. The sample rate of the incoming audio buffers.
  2756. @item sample_fmt
  2757. The sample format of the incoming audio buffers.
  2758. Either a sample format name or its corresponding integer representation from
  2759. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  2760. @item channel_layout
  2761. The channel layout of the incoming audio buffers.
  2762. Either a channel layout name from channel_layout_map in
  2763. @file{libavutil/channel_layout.c} or its corresponding integer representation
  2764. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  2765. @item channels
  2766. The number of channels of the incoming audio buffers.
  2767. If both @var{channels} and @var{channel_layout} are specified, then they
  2768. must be consistent.
  2769. @end table
  2770. @subsection Examples
  2771. @example
  2772. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  2773. @end example
  2774. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  2775. Since the sample format with name "s16p" corresponds to the number
  2776. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  2777. equivalent to:
  2778. @example
  2779. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  2780. @end example
  2781. @section aevalsrc
  2782. Generate an audio signal specified by an expression.
  2783. This source accepts in input one or more expressions (one for each
  2784. channel), which are evaluated and used to generate a corresponding
  2785. audio signal.
  2786. This source accepts the following options:
  2787. @table @option
  2788. @item exprs
  2789. Set the '|'-separated expressions list for each separate channel. In case the
  2790. @option{channel_layout} option is not specified, the selected channel layout
  2791. depends on the number of provided expressions. Otherwise the last
  2792. specified expression is applied to the remaining output channels.
  2793. @item channel_layout, c
  2794. Set the channel layout. The number of channels in the specified layout
  2795. must be equal to the number of specified expressions.
  2796. @item duration, d
  2797. Set the minimum duration of the sourced audio. See
  2798. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2799. for the accepted syntax.
  2800. Note that the resulting duration may be greater than the specified
  2801. duration, as the generated audio is always cut at the end of a
  2802. complete frame.
  2803. If not specified, or the expressed duration is negative, the audio is
  2804. supposed to be generated forever.
  2805. @item nb_samples, n
  2806. Set the number of samples per channel per each output frame,
  2807. default to 1024.
  2808. @item sample_rate, s
  2809. Specify the sample rate, default to 44100.
  2810. @end table
  2811. Each expression in @var{exprs} can contain the following constants:
  2812. @table @option
  2813. @item n
  2814. number of the evaluated sample, starting from 0
  2815. @item t
  2816. time of the evaluated sample expressed in seconds, starting from 0
  2817. @item s
  2818. sample rate
  2819. @end table
  2820. @subsection Examples
  2821. @itemize
  2822. @item
  2823. Generate silence:
  2824. @example
  2825. aevalsrc=0
  2826. @end example
  2827. @item
  2828. Generate a sin signal with frequency of 440 Hz, set sample rate to
  2829. 8000 Hz:
  2830. @example
  2831. aevalsrc="sin(440*2*PI*t):s=8000"
  2832. @end example
  2833. @item
  2834. Generate a two channels signal, specify the channel layout (Front
  2835. Center + Back Center) explicitly:
  2836. @example
  2837. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  2838. @end example
  2839. @item
  2840. Generate white noise:
  2841. @example
  2842. aevalsrc="-2+random(0)"
  2843. @end example
  2844. @item
  2845. Generate an amplitude modulated signal:
  2846. @example
  2847. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  2848. @end example
  2849. @item
  2850. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  2851. @example
  2852. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  2853. @end example
  2854. @end itemize
  2855. @section anullsrc
  2856. The null audio source, return unprocessed audio frames. It is mainly useful
  2857. as a template and to be employed in analysis / debugging tools, or as
  2858. the source for filters which ignore the input data (for example the sox
  2859. synth filter).
  2860. This source accepts the following options:
  2861. @table @option
  2862. @item channel_layout, cl
  2863. Specifies the channel layout, and can be either an integer or a string
  2864. representing a channel layout. The default value of @var{channel_layout}
  2865. is "stereo".
  2866. Check the channel_layout_map definition in
  2867. @file{libavutil/channel_layout.c} for the mapping between strings and
  2868. channel layout values.
  2869. @item sample_rate, r
  2870. Specifies the sample rate, and defaults to 44100.
  2871. @item nb_samples, n
  2872. Set the number of samples per requested frames.
  2873. @end table
  2874. @subsection Examples
  2875. @itemize
  2876. @item
  2877. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  2878. @example
  2879. anullsrc=r=48000:cl=4
  2880. @end example
  2881. @item
  2882. Do the same operation with a more obvious syntax:
  2883. @example
  2884. anullsrc=r=48000:cl=mono
  2885. @end example
  2886. @end itemize
  2887. All the parameters need to be explicitly defined.
  2888. @section flite
  2889. Synthesize a voice utterance using the libflite library.
  2890. To enable compilation of this filter you need to configure FFmpeg with
  2891. @code{--enable-libflite}.
  2892. Note that the flite library is not thread-safe.
  2893. The filter accepts the following options:
  2894. @table @option
  2895. @item list_voices
  2896. If set to 1, list the names of the available voices and exit
  2897. immediately. Default value is 0.
  2898. @item nb_samples, n
  2899. Set the maximum number of samples per frame. Default value is 512.
  2900. @item textfile
  2901. Set the filename containing the text to speak.
  2902. @item text
  2903. Set the text to speak.
  2904. @item voice, v
  2905. Set the voice to use for the speech synthesis. Default value is
  2906. @code{kal}. See also the @var{list_voices} option.
  2907. @end table
  2908. @subsection Examples
  2909. @itemize
  2910. @item
  2911. Read from file @file{speech.txt}, and synthesize the text using the
  2912. standard flite voice:
  2913. @example
  2914. flite=textfile=speech.txt
  2915. @end example
  2916. @item
  2917. Read the specified text selecting the @code{slt} voice:
  2918. @example
  2919. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  2920. @end example
  2921. @item
  2922. Input text to ffmpeg:
  2923. @example
  2924. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  2925. @end example
  2926. @item
  2927. Make @file{ffplay} speak the specified text, using @code{flite} and
  2928. the @code{lavfi} device:
  2929. @example
  2930. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  2931. @end example
  2932. @end itemize
  2933. For more information about libflite, check:
  2934. @url{http://www.speech.cs.cmu.edu/flite/}
  2935. @section anoisesrc
  2936. Generate a noise audio signal.
  2937. The filter accepts the following options:
  2938. @table @option
  2939. @item sample_rate, r
  2940. Specify the sample rate. Default value is 48000 Hz.
  2941. @item amplitude, a
  2942. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  2943. is 1.0.
  2944. @item duration, d
  2945. Specify the duration of the generated audio stream. Not specifying this option
  2946. results in noise with an infinite length.
  2947. @item color, colour, c
  2948. Specify the color of noise. Available noise colors are white, pink, and brown.
  2949. Default color is white.
  2950. @item seed, s
  2951. Specify a value used to seed the PRNG.
  2952. @item nb_samples, n
  2953. Set the number of samples per each output frame, default is 1024.
  2954. @end table
  2955. @subsection Examples
  2956. @itemize
  2957. @item
  2958. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  2959. @example
  2960. anoisesrc=d=60:c=pink:r=44100:a=0.5
  2961. @end example
  2962. @end itemize
  2963. @section sine
  2964. Generate an audio signal made of a sine wave with amplitude 1/8.
  2965. The audio signal is bit-exact.
  2966. The filter accepts the following options:
  2967. @table @option
  2968. @item frequency, f
  2969. Set the carrier frequency. Default is 440 Hz.
  2970. @item beep_factor, b
  2971. Enable a periodic beep every second with frequency @var{beep_factor} times
  2972. the carrier frequency. Default is 0, meaning the beep is disabled.
  2973. @item sample_rate, r
  2974. Specify the sample rate, default is 44100.
  2975. @item duration, d
  2976. Specify the duration of the generated audio stream.
  2977. @item samples_per_frame
  2978. Set the number of samples per output frame.
  2979. The expression can contain the following constants:
  2980. @table @option
  2981. @item n
  2982. The (sequential) number of the output audio frame, starting from 0.
  2983. @item pts
  2984. The PTS (Presentation TimeStamp) of the output audio frame,
  2985. expressed in @var{TB} units.
  2986. @item t
  2987. The PTS of the output audio frame, expressed in seconds.
  2988. @item TB
  2989. The timebase of the output audio frames.
  2990. @end table
  2991. Default is @code{1024}.
  2992. @end table
  2993. @subsection Examples
  2994. @itemize
  2995. @item
  2996. Generate a simple 440 Hz sine wave:
  2997. @example
  2998. sine
  2999. @end example
  3000. @item
  3001. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  3002. @example
  3003. sine=220:4:d=5
  3004. sine=f=220:b=4:d=5
  3005. sine=frequency=220:beep_factor=4:duration=5
  3006. @end example
  3007. @item
  3008. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  3009. pattern:
  3010. @example
  3011. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  3012. @end example
  3013. @end itemize
  3014. @c man end AUDIO SOURCES
  3015. @chapter Audio Sinks
  3016. @c man begin AUDIO SINKS
  3017. Below is a description of the currently available audio sinks.
  3018. @section abuffersink
  3019. Buffer audio frames, and make them available to the end of filter chain.
  3020. This sink is mainly intended for programmatic use, in particular
  3021. through the interface defined in @file{libavfilter/buffersink.h}
  3022. or the options system.
  3023. It accepts a pointer to an AVABufferSinkContext structure, which
  3024. defines the incoming buffers' formats, to be passed as the opaque
  3025. parameter to @code{avfilter_init_filter} for initialization.
  3026. @section anullsink
  3027. Null audio sink; do absolutely nothing with the input audio. It is
  3028. mainly useful as a template and for use in analysis / debugging
  3029. tools.
  3030. @c man end AUDIO SINKS
  3031. @chapter Video Filters
  3032. @c man begin VIDEO FILTERS
  3033. When you configure your FFmpeg build, you can disable any of the
  3034. existing filters using @code{--disable-filters}.
  3035. The configure output will show the video filters included in your
  3036. build.
  3037. Below is a description of the currently available video filters.
  3038. @section alphaextract
  3039. Extract the alpha component from the input as a grayscale video. This
  3040. is especially useful with the @var{alphamerge} filter.
  3041. @section alphamerge
  3042. Add or replace the alpha component of the primary input with the
  3043. grayscale value of a second input. This is intended for use with
  3044. @var{alphaextract} to allow the transmission or storage of frame
  3045. sequences that have alpha in a format that doesn't support an alpha
  3046. channel.
  3047. For example, to reconstruct full frames from a normal YUV-encoded video
  3048. and a separate video created with @var{alphaextract}, you might use:
  3049. @example
  3050. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  3051. @end example
  3052. Since this filter is designed for reconstruction, it operates on frame
  3053. sequences without considering timestamps, and terminates when either
  3054. input reaches end of stream. This will cause problems if your encoding
  3055. pipeline drops frames. If you're trying to apply an image as an
  3056. overlay to a video stream, consider the @var{overlay} filter instead.
  3057. @section ass
  3058. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  3059. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  3060. Substation Alpha) subtitles files.
  3061. This filter accepts the following option in addition to the common options from
  3062. the @ref{subtitles} filter:
  3063. @table @option
  3064. @item shaping
  3065. Set the shaping engine
  3066. Available values are:
  3067. @table @samp
  3068. @item auto
  3069. The default libass shaping engine, which is the best available.
  3070. @item simple
  3071. Fast, font-agnostic shaper that can do only substitutions
  3072. @item complex
  3073. Slower shaper using OpenType for substitutions and positioning
  3074. @end table
  3075. The default is @code{auto}.
  3076. @end table
  3077. @section atadenoise
  3078. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  3079. The filter accepts the following options:
  3080. @table @option
  3081. @item 0a
  3082. Set threshold A for 1st plane. Default is 0.02.
  3083. Valid range is 0 to 0.3.
  3084. @item 0b
  3085. Set threshold B for 1st plane. Default is 0.04.
  3086. Valid range is 0 to 5.
  3087. @item 1a
  3088. Set threshold A for 2nd plane. Default is 0.02.
  3089. Valid range is 0 to 0.3.
  3090. @item 1b
  3091. Set threshold B for 2nd plane. Default is 0.04.
  3092. Valid range is 0 to 5.
  3093. @item 2a
  3094. Set threshold A for 3rd plane. Default is 0.02.
  3095. Valid range is 0 to 0.3.
  3096. @item 2b
  3097. Set threshold B for 3rd plane. Default is 0.04.
  3098. Valid range is 0 to 5.
  3099. Threshold A is designed to react on abrupt changes in the input signal and
  3100. threshold B is designed to react on continuous changes in the input signal.
  3101. @item s
  3102. Set number of frames filter will use for averaging. Default is 33. Must be odd
  3103. number in range [5, 129].
  3104. @end table
  3105. @section bbox
  3106. Compute the bounding box for the non-black pixels in the input frame
  3107. luminance plane.
  3108. This filter computes the bounding box containing all the pixels with a
  3109. luminance value greater than the minimum allowed value.
  3110. The parameters describing the bounding box are printed on the filter
  3111. log.
  3112. The filter accepts the following option:
  3113. @table @option
  3114. @item min_val
  3115. Set the minimal luminance value. Default is @code{16}.
  3116. @end table
  3117. @section blackdetect
  3118. Detect video intervals that are (almost) completely black. Can be
  3119. useful to detect chapter transitions, commercials, or invalid
  3120. recordings. Output lines contains the time for the start, end and
  3121. duration of the detected black interval expressed in seconds.
  3122. In order to display the output lines, you need to set the loglevel at
  3123. least to the AV_LOG_INFO value.
  3124. The filter accepts the following options:
  3125. @table @option
  3126. @item black_min_duration, d
  3127. Set the minimum detected black duration expressed in seconds. It must
  3128. be a non-negative floating point number.
  3129. Default value is 2.0.
  3130. @item picture_black_ratio_th, pic_th
  3131. Set the threshold for considering a picture "black".
  3132. Express the minimum value for the ratio:
  3133. @example
  3134. @var{nb_black_pixels} / @var{nb_pixels}
  3135. @end example
  3136. for which a picture is considered black.
  3137. Default value is 0.98.
  3138. @item pixel_black_th, pix_th
  3139. Set the threshold for considering a pixel "black".
  3140. The threshold expresses the maximum pixel luminance value for which a
  3141. pixel is considered "black". The provided value is scaled according to
  3142. the following equation:
  3143. @example
  3144. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  3145. @end example
  3146. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  3147. the input video format, the range is [0-255] for YUV full-range
  3148. formats and [16-235] for YUV non full-range formats.
  3149. Default value is 0.10.
  3150. @end table
  3151. The following example sets the maximum pixel threshold to the minimum
  3152. value, and detects only black intervals of 2 or more seconds:
  3153. @example
  3154. blackdetect=d=2:pix_th=0.00
  3155. @end example
  3156. @section blackframe
  3157. Detect frames that are (almost) completely black. Can be useful to
  3158. detect chapter transitions or commercials. Output lines consist of
  3159. the frame number of the detected frame, the percentage of blackness,
  3160. the position in the file if known or -1 and the timestamp in seconds.
  3161. In order to display the output lines, you need to set the loglevel at
  3162. least to the AV_LOG_INFO value.
  3163. It accepts the following parameters:
  3164. @table @option
  3165. @item amount
  3166. The percentage of the pixels that have to be below the threshold; it defaults to
  3167. @code{98}.
  3168. @item threshold, thresh
  3169. The threshold below which a pixel value is considered black; it defaults to
  3170. @code{32}.
  3171. @end table
  3172. @section blend, tblend
  3173. Blend two video frames into each other.
  3174. The @code{blend} filter takes two input streams and outputs one
  3175. stream, the first input is the "top" layer and second input is
  3176. "bottom" layer. Output terminates when shortest input terminates.
  3177. The @code{tblend} (time blend) filter takes two consecutive frames
  3178. from one single stream, and outputs the result obtained by blending
  3179. the new frame on top of the old frame.
  3180. A description of the accepted options follows.
  3181. @table @option
  3182. @item c0_mode
  3183. @item c1_mode
  3184. @item c2_mode
  3185. @item c3_mode
  3186. @item all_mode
  3187. Set blend mode for specific pixel component or all pixel components in case
  3188. of @var{all_mode}. Default value is @code{normal}.
  3189. Available values for component modes are:
  3190. @table @samp
  3191. @item addition
  3192. @item addition128
  3193. @item and
  3194. @item average
  3195. @item burn
  3196. @item darken
  3197. @item difference
  3198. @item difference128
  3199. @item divide
  3200. @item dodge
  3201. @item exclusion
  3202. @item glow
  3203. @item hardlight
  3204. @item hardmix
  3205. @item lighten
  3206. @item linearlight
  3207. @item multiply
  3208. @item multiply128
  3209. @item negation
  3210. @item normal
  3211. @item or
  3212. @item overlay
  3213. @item phoenix
  3214. @item pinlight
  3215. @item reflect
  3216. @item screen
  3217. @item softlight
  3218. @item subtract
  3219. @item vividlight
  3220. @item xor
  3221. @end table
  3222. @item c0_opacity
  3223. @item c1_opacity
  3224. @item c2_opacity
  3225. @item c3_opacity
  3226. @item all_opacity
  3227. Set blend opacity for specific pixel component or all pixel components in case
  3228. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  3229. @item c0_expr
  3230. @item c1_expr
  3231. @item c2_expr
  3232. @item c3_expr
  3233. @item all_expr
  3234. Set blend expression for specific pixel component or all pixel components in case
  3235. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  3236. The expressions can use the following variables:
  3237. @table @option
  3238. @item N
  3239. The sequential number of the filtered frame, starting from @code{0}.
  3240. @item X
  3241. @item Y
  3242. the coordinates of the current sample
  3243. @item W
  3244. @item H
  3245. the width and height of currently filtered plane
  3246. @item SW
  3247. @item SH
  3248. Width and height scale depending on the currently filtered plane. It is the
  3249. ratio between the corresponding luma plane number of pixels and the current
  3250. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  3251. @code{0.5,0.5} for chroma planes.
  3252. @item T
  3253. Time of the current frame, expressed in seconds.
  3254. @item TOP, A
  3255. Value of pixel component at current location for first video frame (top layer).
  3256. @item BOTTOM, B
  3257. Value of pixel component at current location for second video frame (bottom layer).
  3258. @end table
  3259. @item shortest
  3260. Force termination when the shortest input terminates. Default is
  3261. @code{0}. This option is only defined for the @code{blend} filter.
  3262. @item repeatlast
  3263. Continue applying the last bottom frame after the end of the stream. A value of
  3264. @code{0} disable the filter after the last frame of the bottom layer is reached.
  3265. Default is @code{1}. This option is only defined for the @code{blend} filter.
  3266. @end table
  3267. @subsection Examples
  3268. @itemize
  3269. @item
  3270. Apply transition from bottom layer to top layer in first 10 seconds:
  3271. @example
  3272. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  3273. @end example
  3274. @item
  3275. Apply 1x1 checkerboard effect:
  3276. @example
  3277. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  3278. @end example
  3279. @item
  3280. Apply uncover left effect:
  3281. @example
  3282. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  3283. @end example
  3284. @item
  3285. Apply uncover down effect:
  3286. @example
  3287. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  3288. @end example
  3289. @item
  3290. Apply uncover up-left effect:
  3291. @example
  3292. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  3293. @end example
  3294. @item
  3295. Split diagonally video and shows top and bottom layer on each side:
  3296. @example
  3297. blend=all_expr=if(gt(X,Y*(W/H)),A,B)
  3298. @end example
  3299. @item
  3300. Display differences between the current and the previous frame:
  3301. @example
  3302. tblend=all_mode=difference128
  3303. @end example
  3304. @end itemize
  3305. @section boxblur
  3306. Apply a boxblur algorithm to the input video.
  3307. It accepts the following parameters:
  3308. @table @option
  3309. @item luma_radius, lr
  3310. @item luma_power, lp
  3311. @item chroma_radius, cr
  3312. @item chroma_power, cp
  3313. @item alpha_radius, ar
  3314. @item alpha_power, ap
  3315. @end table
  3316. A description of the accepted options follows.
  3317. @table @option
  3318. @item luma_radius, lr
  3319. @item chroma_radius, cr
  3320. @item alpha_radius, ar
  3321. Set an expression for the box radius in pixels used for blurring the
  3322. corresponding input plane.
  3323. The radius value must be a non-negative number, and must not be
  3324. greater than the value of the expression @code{min(w,h)/2} for the
  3325. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  3326. planes.
  3327. Default value for @option{luma_radius} is "2". If not specified,
  3328. @option{chroma_radius} and @option{alpha_radius} default to the
  3329. corresponding value set for @option{luma_radius}.
  3330. The expressions can contain the following constants:
  3331. @table @option
  3332. @item w
  3333. @item h
  3334. The input width and height in pixels.
  3335. @item cw
  3336. @item ch
  3337. The input chroma image width and height in pixels.
  3338. @item hsub
  3339. @item vsub
  3340. The horizontal and vertical chroma subsample values. For example, for the
  3341. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  3342. @end table
  3343. @item luma_power, lp
  3344. @item chroma_power, cp
  3345. @item alpha_power, ap
  3346. Specify how many times the boxblur filter is applied to the
  3347. corresponding plane.
  3348. Default value for @option{luma_power} is 2. If not specified,
  3349. @option{chroma_power} and @option{alpha_power} default to the
  3350. corresponding value set for @option{luma_power}.
  3351. A value of 0 will disable the effect.
  3352. @end table
  3353. @subsection Examples
  3354. @itemize
  3355. @item
  3356. Apply a boxblur filter with the luma, chroma, and alpha radii
  3357. set to 2:
  3358. @example
  3359. boxblur=luma_radius=2:luma_power=1
  3360. boxblur=2:1
  3361. @end example
  3362. @item
  3363. Set the luma radius to 2, and alpha and chroma radius to 0:
  3364. @example
  3365. boxblur=2:1:cr=0:ar=0
  3366. @end example
  3367. @item
  3368. Set the luma and chroma radii to a fraction of the video dimension:
  3369. @example
  3370. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  3371. @end example
  3372. @end itemize
  3373. @section chromakey
  3374. YUV colorspace color/chroma keying.
  3375. The filter accepts the following options:
  3376. @table @option
  3377. @item color
  3378. The color which will be replaced with transparency.
  3379. @item similarity
  3380. Similarity percentage with the key color.
  3381. 0.01 matches only the exact key color, while 1.0 matches everything.
  3382. @item blend
  3383. Blend percentage.
  3384. 0.0 makes pixels either fully transparent, or not transparent at all.
  3385. Higher values result in semi-transparent pixels, with a higher transparency
  3386. the more similar the pixels color is to the key color.
  3387. @item yuv
  3388. Signals that the color passed is already in YUV instead of RGB.
  3389. Litteral colors like "green" or "red" don't make sense with this enabled anymore.
  3390. This can be used to pass exact YUV values as hexadecimal numbers.
  3391. @end table
  3392. @subsection Examples
  3393. @itemize
  3394. @item
  3395. Make every green pixel in the input image transparent:
  3396. @example
  3397. ffmpeg -i input.png -vf chromakey=green out.png
  3398. @end example
  3399. @item
  3400. Overlay a greenscreen-video on top of a static black background.
  3401. @example
  3402. 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
  3403. @end example
  3404. @end itemize
  3405. @section codecview
  3406. Visualize information exported by some codecs.
  3407. Some codecs can export information through frames using side-data or other
  3408. means. For example, some MPEG based codecs export motion vectors through the
  3409. @var{export_mvs} flag in the codec @option{flags2} option.
  3410. The filter accepts the following option:
  3411. @table @option
  3412. @item mv
  3413. Set motion vectors to visualize.
  3414. Available flags for @var{mv} are:
  3415. @table @samp
  3416. @item pf
  3417. forward predicted MVs of P-frames
  3418. @item bf
  3419. forward predicted MVs of B-frames
  3420. @item bb
  3421. backward predicted MVs of B-frames
  3422. @end table
  3423. @item qp
  3424. Display quantization parameters using the chroma planes
  3425. @end table
  3426. @subsection Examples
  3427. @itemize
  3428. @item
  3429. Visualizes multi-directionals MVs from P and B-Frames using @command{ffplay}:
  3430. @example
  3431. ffplay -flags2 +export_mvs input.mpg -vf codecview=mv=pf+bf+bb
  3432. @end example
  3433. @end itemize
  3434. @section colorbalance
  3435. Modify intensity of primary colors (red, green and blue) of input frames.
  3436. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  3437. regions for the red-cyan, green-magenta or blue-yellow balance.
  3438. A positive adjustment value shifts the balance towards the primary color, a negative
  3439. value towards the complementary color.
  3440. The filter accepts the following options:
  3441. @table @option
  3442. @item rs
  3443. @item gs
  3444. @item bs
  3445. Adjust red, green and blue shadows (darkest pixels).
  3446. @item rm
  3447. @item gm
  3448. @item bm
  3449. Adjust red, green and blue midtones (medium pixels).
  3450. @item rh
  3451. @item gh
  3452. @item bh
  3453. Adjust red, green and blue highlights (brightest pixels).
  3454. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3455. @end table
  3456. @subsection Examples
  3457. @itemize
  3458. @item
  3459. Add red color cast to shadows:
  3460. @example
  3461. colorbalance=rs=.3
  3462. @end example
  3463. @end itemize
  3464. @section colorkey
  3465. RGB colorspace color keying.
  3466. The filter accepts the following options:
  3467. @table @option
  3468. @item color
  3469. The color which will be replaced with transparency.
  3470. @item similarity
  3471. Similarity percentage with the key color.
  3472. 0.01 matches only the exact key color, while 1.0 matches everything.
  3473. @item blend
  3474. Blend percentage.
  3475. 0.0 makes pixels either fully transparent, or not transparent at all.
  3476. Higher values result in semi-transparent pixels, with a higher transparency
  3477. the more similar the pixels color is to the key color.
  3478. @end table
  3479. @subsection Examples
  3480. @itemize
  3481. @item
  3482. Make every green pixel in the input image transparent:
  3483. @example
  3484. ffmpeg -i input.png -vf colorkey=green out.png
  3485. @end example
  3486. @item
  3487. Overlay a greenscreen-video on top of a static background image.
  3488. @example
  3489. 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
  3490. @end example
  3491. @end itemize
  3492. @section colorlevels
  3493. Adjust video input frames using levels.
  3494. The filter accepts the following options:
  3495. @table @option
  3496. @item rimin
  3497. @item gimin
  3498. @item bimin
  3499. @item aimin
  3500. Adjust red, green, blue and alpha input black point.
  3501. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3502. @item rimax
  3503. @item gimax
  3504. @item bimax
  3505. @item aimax
  3506. Adjust red, green, blue and alpha input white point.
  3507. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  3508. Input levels are used to lighten highlights (bright tones), darken shadows
  3509. (dark tones), change the balance of bright and dark tones.
  3510. @item romin
  3511. @item gomin
  3512. @item bomin
  3513. @item aomin
  3514. Adjust red, green, blue and alpha output black point.
  3515. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  3516. @item romax
  3517. @item gomax
  3518. @item bomax
  3519. @item aomax
  3520. Adjust red, green, blue and alpha output white point.
  3521. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  3522. Output levels allows manual selection of a constrained output level range.
  3523. @end table
  3524. @subsection Examples
  3525. @itemize
  3526. @item
  3527. Make video output darker:
  3528. @example
  3529. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  3530. @end example
  3531. @item
  3532. Increase contrast:
  3533. @example
  3534. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  3535. @end example
  3536. @item
  3537. Make video output lighter:
  3538. @example
  3539. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  3540. @end example
  3541. @item
  3542. Increase brightness:
  3543. @example
  3544. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  3545. @end example
  3546. @end itemize
  3547. @section colorchannelmixer
  3548. Adjust video input frames by re-mixing color channels.
  3549. This filter modifies a color channel by adding the values associated to
  3550. the other channels of the same pixels. For example if the value to
  3551. modify is red, the output value will be:
  3552. @example
  3553. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  3554. @end example
  3555. The filter accepts the following options:
  3556. @table @option
  3557. @item rr
  3558. @item rg
  3559. @item rb
  3560. @item ra
  3561. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  3562. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  3563. @item gr
  3564. @item gg
  3565. @item gb
  3566. @item ga
  3567. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  3568. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  3569. @item br
  3570. @item bg
  3571. @item bb
  3572. @item ba
  3573. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  3574. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  3575. @item ar
  3576. @item ag
  3577. @item ab
  3578. @item aa
  3579. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  3580. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  3581. Allowed ranges for options are @code{[-2.0, 2.0]}.
  3582. @end table
  3583. @subsection Examples
  3584. @itemize
  3585. @item
  3586. Convert source to grayscale:
  3587. @example
  3588. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  3589. @end example
  3590. @item
  3591. Simulate sepia tones:
  3592. @example
  3593. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  3594. @end example
  3595. @end itemize
  3596. @section colormatrix
  3597. Convert color matrix.
  3598. The filter accepts the following options:
  3599. @table @option
  3600. @item src
  3601. @item dst
  3602. Specify the source and destination color matrix. Both values must be
  3603. specified.
  3604. The accepted values are:
  3605. @table @samp
  3606. @item bt709
  3607. BT.709
  3608. @item bt601
  3609. BT.601
  3610. @item smpte240m
  3611. SMPTE-240M
  3612. @item fcc
  3613. FCC
  3614. @end table
  3615. @end table
  3616. For example to convert from BT.601 to SMPTE-240M, use the command:
  3617. @example
  3618. colormatrix=bt601:smpte240m
  3619. @end example
  3620. @section convolution
  3621. Apply convolution 3x3 or 5x5 filter.
  3622. The filter accepts the following options:
  3623. @table @option
  3624. @item 0m
  3625. @item 1m
  3626. @item 2m
  3627. @item 3m
  3628. Set matrix for each plane.
  3629. Matrix is sequence of 9 or 25 signed integers.
  3630. @item 0rdiv
  3631. @item 1rdiv
  3632. @item 2rdiv
  3633. @item 3rdiv
  3634. Set multiplier for calculated value for each plane.
  3635. @item 0bias
  3636. @item 1bias
  3637. @item 2bias
  3638. @item 3bias
  3639. Set bias for each plane. This value is added to the result of the multiplication.
  3640. Useful for making the overall image brighter or darker. Default is 0.0.
  3641. @end table
  3642. @subsection Examples
  3643. @itemize
  3644. @item
  3645. Apply sharpen:
  3646. @example
  3647. 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"
  3648. @end example
  3649. @item
  3650. Apply blur:
  3651. @example
  3652. 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"
  3653. @end example
  3654. @item
  3655. Apply edge enhance:
  3656. @example
  3657. 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"
  3658. @end example
  3659. @item
  3660. Apply edge detect:
  3661. @example
  3662. 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"
  3663. @end example
  3664. @item
  3665. Apply emboss:
  3666. @example
  3667. 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"
  3668. @end example
  3669. @end itemize
  3670. @section copy
  3671. Copy the input source unchanged to the output. This is mainly useful for
  3672. testing purposes.
  3673. @section crop
  3674. Crop the input video to given dimensions.
  3675. It accepts the following parameters:
  3676. @table @option
  3677. @item w, out_w
  3678. The width of the output video. It defaults to @code{iw}.
  3679. This expression is evaluated only once during the filter
  3680. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  3681. @item h, out_h
  3682. The height of the output video. It defaults to @code{ih}.
  3683. This expression is evaluated only once during the filter
  3684. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  3685. @item x
  3686. The horizontal position, in the input video, of the left edge of the output
  3687. video. It defaults to @code{(in_w-out_w)/2}.
  3688. This expression is evaluated per-frame.
  3689. @item y
  3690. The vertical position, in the input video, of the top edge of the output video.
  3691. It defaults to @code{(in_h-out_h)/2}.
  3692. This expression is evaluated per-frame.
  3693. @item keep_aspect
  3694. If set to 1 will force the output display aspect ratio
  3695. to be the same of the input, by changing the output sample aspect
  3696. ratio. It defaults to 0.
  3697. @end table
  3698. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  3699. expressions containing the following constants:
  3700. @table @option
  3701. @item x
  3702. @item y
  3703. The computed values for @var{x} and @var{y}. They are evaluated for
  3704. each new frame.
  3705. @item in_w
  3706. @item in_h
  3707. The input width and height.
  3708. @item iw
  3709. @item ih
  3710. These are the same as @var{in_w} and @var{in_h}.
  3711. @item out_w
  3712. @item out_h
  3713. The output (cropped) width and height.
  3714. @item ow
  3715. @item oh
  3716. These are the same as @var{out_w} and @var{out_h}.
  3717. @item a
  3718. same as @var{iw} / @var{ih}
  3719. @item sar
  3720. input sample aspect ratio
  3721. @item dar
  3722. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  3723. @item hsub
  3724. @item vsub
  3725. horizontal and vertical chroma subsample values. For example for the
  3726. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  3727. @item n
  3728. The number of the input frame, starting from 0.
  3729. @item pos
  3730. the position in the file of the input frame, NAN if unknown
  3731. @item t
  3732. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  3733. @end table
  3734. The expression for @var{out_w} may depend on the value of @var{out_h},
  3735. and the expression for @var{out_h} may depend on @var{out_w}, but they
  3736. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  3737. evaluated after @var{out_w} and @var{out_h}.
  3738. The @var{x} and @var{y} parameters specify the expressions for the
  3739. position of the top-left corner of the output (non-cropped) area. They
  3740. are evaluated for each frame. If the evaluated value is not valid, it
  3741. is approximated to the nearest valid value.
  3742. The expression for @var{x} may depend on @var{y}, and the expression
  3743. for @var{y} may depend on @var{x}.
  3744. @subsection Examples
  3745. @itemize
  3746. @item
  3747. Crop area with size 100x100 at position (12,34).
  3748. @example
  3749. crop=100:100:12:34
  3750. @end example
  3751. Using named options, the example above becomes:
  3752. @example
  3753. crop=w=100:h=100:x=12:y=34
  3754. @end example
  3755. @item
  3756. Crop the central input area with size 100x100:
  3757. @example
  3758. crop=100:100
  3759. @end example
  3760. @item
  3761. Crop the central input area with size 2/3 of the input video:
  3762. @example
  3763. crop=2/3*in_w:2/3*in_h
  3764. @end example
  3765. @item
  3766. Crop the input video central square:
  3767. @example
  3768. crop=out_w=in_h
  3769. crop=in_h
  3770. @end example
  3771. @item
  3772. Delimit the rectangle with the top-left corner placed at position
  3773. 100:100 and the right-bottom corner corresponding to the right-bottom
  3774. corner of the input image.
  3775. @example
  3776. crop=in_w-100:in_h-100:100:100
  3777. @end example
  3778. @item
  3779. Crop 10 pixels from the left and right borders, and 20 pixels from
  3780. the top and bottom borders
  3781. @example
  3782. crop=in_w-2*10:in_h-2*20
  3783. @end example
  3784. @item
  3785. Keep only the bottom right quarter of the input image:
  3786. @example
  3787. crop=in_w/2:in_h/2:in_w/2:in_h/2
  3788. @end example
  3789. @item
  3790. Crop height for getting Greek harmony:
  3791. @example
  3792. crop=in_w:1/PHI*in_w
  3793. @end example
  3794. @item
  3795. Apply trembling effect:
  3796. @example
  3797. 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)
  3798. @end example
  3799. @item
  3800. Apply erratic camera effect depending on timestamp:
  3801. @example
  3802. 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)"
  3803. @end example
  3804. @item
  3805. Set x depending on the value of y:
  3806. @example
  3807. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  3808. @end example
  3809. @end itemize
  3810. @subsection Commands
  3811. This filter supports the following commands:
  3812. @table @option
  3813. @item w, out_w
  3814. @item h, out_h
  3815. @item x
  3816. @item y
  3817. Set width/height of the output video and the horizontal/vertical position
  3818. in the input video.
  3819. The command accepts the same syntax of the corresponding option.
  3820. If the specified expression is not valid, it is kept at its current
  3821. value.
  3822. @end table
  3823. @section cropdetect
  3824. Auto-detect the crop size.
  3825. It calculates the necessary cropping parameters and prints the
  3826. recommended parameters via the logging system. The detected dimensions
  3827. correspond to the non-black area of the input video.
  3828. It accepts the following parameters:
  3829. @table @option
  3830. @item limit
  3831. Set higher black value threshold, which can be optionally specified
  3832. from nothing (0) to everything (255 for 8bit based formats). An intensity
  3833. value greater to the set value is considered non-black. It defaults to 24.
  3834. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  3835. on the bitdepth of the pixel format.
  3836. @item round
  3837. The value which the width/height should be divisible by. It defaults to
  3838. 16. The offset is automatically adjusted to center the video. Use 2 to
  3839. get only even dimensions (needed for 4:2:2 video). 16 is best when
  3840. encoding to most video codecs.
  3841. @item reset_count, reset
  3842. Set the counter that determines after how many frames cropdetect will
  3843. reset the previously detected largest video area and start over to
  3844. detect the current optimal crop area. Default value is 0.
  3845. This can be useful when channel logos distort the video area. 0
  3846. indicates 'never reset', and returns the largest area encountered during
  3847. playback.
  3848. @end table
  3849. @anchor{curves}
  3850. @section curves
  3851. Apply color adjustments using curves.
  3852. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  3853. component (red, green and blue) has its values defined by @var{N} key points
  3854. tied from each other using a smooth curve. The x-axis represents the pixel
  3855. values from the input frame, and the y-axis the new pixel values to be set for
  3856. the output frame.
  3857. By default, a component curve is defined by the two points @var{(0;0)} and
  3858. @var{(1;1)}. This creates a straight line where each original pixel value is
  3859. "adjusted" to its own value, which means no change to the image.
  3860. The filter allows you to redefine these two points and add some more. A new
  3861. curve (using a natural cubic spline interpolation) will be define to pass
  3862. smoothly through all these new coordinates. The new defined points needs to be
  3863. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  3864. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  3865. the vector spaces, the values will be clipped accordingly.
  3866. If there is no key point defined in @code{x=0}, the filter will automatically
  3867. insert a @var{(0;0)} point. In the same way, if there is no key point defined
  3868. in @code{x=1}, the filter will automatically insert a @var{(1;1)} point.
  3869. The filter accepts the following options:
  3870. @table @option
  3871. @item preset
  3872. Select one of the available color presets. This option can be used in addition
  3873. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  3874. options takes priority on the preset values.
  3875. Available presets are:
  3876. @table @samp
  3877. @item none
  3878. @item color_negative
  3879. @item cross_process
  3880. @item darker
  3881. @item increase_contrast
  3882. @item lighter
  3883. @item linear_contrast
  3884. @item medium_contrast
  3885. @item negative
  3886. @item strong_contrast
  3887. @item vintage
  3888. @end table
  3889. Default is @code{none}.
  3890. @item master, m
  3891. Set the master key points. These points will define a second pass mapping. It
  3892. is sometimes called a "luminance" or "value" mapping. It can be used with
  3893. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  3894. post-processing LUT.
  3895. @item red, r
  3896. Set the key points for the red component.
  3897. @item green, g
  3898. Set the key points for the green component.
  3899. @item blue, b
  3900. Set the key points for the blue component.
  3901. @item all
  3902. Set the key points for all components (not including master).
  3903. Can be used in addition to the other key points component
  3904. options. In this case, the unset component(s) will fallback on this
  3905. @option{all} setting.
  3906. @item psfile
  3907. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  3908. @end table
  3909. To avoid some filtergraph syntax conflicts, each key points list need to be
  3910. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  3911. @subsection Examples
  3912. @itemize
  3913. @item
  3914. Increase slightly the middle level of blue:
  3915. @example
  3916. curves=blue='0.5/0.58'
  3917. @end example
  3918. @item
  3919. Vintage effect:
  3920. @example
  3921. curves=r='0/0.11 .42/.51 1/0.95':g='0.50/0.48':b='0/0.22 .49/.44 1/0.8'
  3922. @end example
  3923. Here we obtain the following coordinates for each components:
  3924. @table @var
  3925. @item red
  3926. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  3927. @item green
  3928. @code{(0;0) (0.50;0.48) (1;1)}
  3929. @item blue
  3930. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  3931. @end table
  3932. @item
  3933. The previous example can also be achieved with the associated built-in preset:
  3934. @example
  3935. curves=preset=vintage
  3936. @end example
  3937. @item
  3938. Or simply:
  3939. @example
  3940. curves=vintage
  3941. @end example
  3942. @item
  3943. Use a Photoshop preset and redefine the points of the green component:
  3944. @example
  3945. curves=psfile='MyCurvesPresets/purple.acv':green='0.45/0.53'
  3946. @end example
  3947. @end itemize
  3948. @section dctdnoiz
  3949. Denoise frames using 2D DCT (frequency domain filtering).
  3950. This filter is not designed for real time.
  3951. The filter accepts the following options:
  3952. @table @option
  3953. @item sigma, s
  3954. Set the noise sigma constant.
  3955. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  3956. coefficient (absolute value) below this threshold with be dropped.
  3957. If you need a more advanced filtering, see @option{expr}.
  3958. Default is @code{0}.
  3959. @item overlap
  3960. Set number overlapping pixels for each block. Since the filter can be slow, you
  3961. may want to reduce this value, at the cost of a less effective filter and the
  3962. risk of various artefacts.
  3963. If the overlapping value doesn't permit processing the whole input width or
  3964. height, a warning will be displayed and according borders won't be denoised.
  3965. Default value is @var{blocksize}-1, which is the best possible setting.
  3966. @item expr, e
  3967. Set the coefficient factor expression.
  3968. For each coefficient of a DCT block, this expression will be evaluated as a
  3969. multiplier value for the coefficient.
  3970. If this is option is set, the @option{sigma} option will be ignored.
  3971. The absolute value of the coefficient can be accessed through the @var{c}
  3972. variable.
  3973. @item n
  3974. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  3975. @var{blocksize}, which is the width and height of the processed blocks.
  3976. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  3977. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  3978. on the speed processing. Also, a larger block size does not necessarily means a
  3979. better de-noising.
  3980. @end table
  3981. @subsection Examples
  3982. Apply a denoise with a @option{sigma} of @code{4.5}:
  3983. @example
  3984. dctdnoiz=4.5
  3985. @end example
  3986. The same operation can be achieved using the expression system:
  3987. @example
  3988. dctdnoiz=e='gte(c, 4.5*3)'
  3989. @end example
  3990. Violent denoise using a block size of @code{16x16}:
  3991. @example
  3992. dctdnoiz=15:n=4
  3993. @end example
  3994. @section deband
  3995. Remove banding artifacts from input video.
  3996. It works by replacing banded pixels with average value of referenced pixels.
  3997. The filter accepts the following options:
  3998. @table @option
  3999. @item 1thr
  4000. @item 2thr
  4001. @item 3thr
  4002. @item 4thr
  4003. Set banding detection threshold for each plane. Default is 0.02.
  4004. Valid range is 0.00003 to 0.5.
  4005. If difference between current pixel and reference pixel is less than threshold,
  4006. it will be considered as banded.
  4007. @item range, r
  4008. Banding detection range in pixels. Default is 16. If positive, random number
  4009. in range 0 to set value will be used. If negative, exact absolute value
  4010. will be used.
  4011. The range defines square of four pixels around current pixel.
  4012. @item direction, d
  4013. Set direction in radians from which four pixel will be compared. If positive,
  4014. random direction from 0 to set direction will be picked. If negative, exact of
  4015. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  4016. will pick only pixels on same row and -PI/2 will pick only pixels on same
  4017. column.
  4018. @item blur
  4019. If enabled, current pixel is compared with average value of all four
  4020. surrounding pixels. The default is enabled. If disabled current pixel is
  4021. compared with all four surrounding pixels. The pixel is considered banded
  4022. if only all four differences with surrounding pixels are less than threshold.
  4023. @end table
  4024. @anchor{decimate}
  4025. @section decimate
  4026. Drop duplicated frames at regular intervals.
  4027. The filter accepts the following options:
  4028. @table @option
  4029. @item cycle
  4030. Set the number of frames from which one will be dropped. Setting this to
  4031. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  4032. Default is @code{5}.
  4033. @item dupthresh
  4034. Set the threshold for duplicate detection. If the difference metric for a frame
  4035. is less than or equal to this value, then it is declared as duplicate. Default
  4036. is @code{1.1}
  4037. @item scthresh
  4038. Set scene change threshold. Default is @code{15}.
  4039. @item blockx
  4040. @item blocky
  4041. Set the size of the x and y-axis blocks used during metric calculations.
  4042. Larger blocks give better noise suppression, but also give worse detection of
  4043. small movements. Must be a power of two. Default is @code{32}.
  4044. @item ppsrc
  4045. Mark main input as a pre-processed input and activate clean source input
  4046. stream. This allows the input to be pre-processed with various filters to help
  4047. the metrics calculation while keeping the frame selection lossless. When set to
  4048. @code{1}, the first stream is for the pre-processed input, and the second
  4049. stream is the clean source from where the kept frames are chosen. Default is
  4050. @code{0}.
  4051. @item chroma
  4052. Set whether or not chroma is considered in the metric calculations. Default is
  4053. @code{1}.
  4054. @end table
  4055. @section deflate
  4056. Apply deflate effect to the video.
  4057. This filter replaces the pixel by the local(3x3) average by taking into account
  4058. only values lower than the pixel.
  4059. It accepts the following options:
  4060. @table @option
  4061. @item threshold0
  4062. @item threshold1
  4063. @item threshold2
  4064. @item threshold3
  4065. Limit the maximum change for each plane, default is 65535.
  4066. If 0, plane will remain unchanged.
  4067. @end table
  4068. @section dejudder
  4069. Remove judder produced by partially interlaced telecined content.
  4070. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  4071. source was partially telecined content then the output of @code{pullup,dejudder}
  4072. will have a variable frame rate. May change the recorded frame rate of the
  4073. container. Aside from that change, this filter will not affect constant frame
  4074. rate video.
  4075. The option available in this filter is:
  4076. @table @option
  4077. @item cycle
  4078. Specify the length of the window over which the judder repeats.
  4079. Accepts any integer greater than 1. Useful values are:
  4080. @table @samp
  4081. @item 4
  4082. If the original was telecined from 24 to 30 fps (Film to NTSC).
  4083. @item 5
  4084. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  4085. @item 20
  4086. If a mixture of the two.
  4087. @end table
  4088. The default is @samp{4}.
  4089. @end table
  4090. @section delogo
  4091. Suppress a TV station logo by a simple interpolation of the surrounding
  4092. pixels. Just set a rectangle covering the logo and watch it disappear
  4093. (and sometimes something even uglier appear - your mileage may vary).
  4094. It accepts the following parameters:
  4095. @table @option
  4096. @item x
  4097. @item y
  4098. Specify the top left corner coordinates of the logo. They must be
  4099. specified.
  4100. @item w
  4101. @item h
  4102. Specify the width and height of the logo to clear. They must be
  4103. specified.
  4104. @item band, t
  4105. Specify the thickness of the fuzzy edge of the rectangle (added to
  4106. @var{w} and @var{h}). The default value is 1. This option is
  4107. deprecated, setting higher values should no longer be necessary and
  4108. is not recommended.
  4109. @item show
  4110. When set to 1, a green rectangle is drawn on the screen to simplify
  4111. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  4112. The default value is 0.
  4113. The rectangle is drawn on the outermost pixels which will be (partly)
  4114. replaced with interpolated values. The values of the next pixels
  4115. immediately outside this rectangle in each direction will be used to
  4116. compute the interpolated pixel values inside the rectangle.
  4117. @end table
  4118. @subsection Examples
  4119. @itemize
  4120. @item
  4121. Set a rectangle covering the area with top left corner coordinates 0,0
  4122. and size 100x77, and a band of size 10:
  4123. @example
  4124. delogo=x=0:y=0:w=100:h=77:band=10
  4125. @end example
  4126. @end itemize
  4127. @section deshake
  4128. Attempt to fix small changes in horizontal and/or vertical shift. This
  4129. filter helps remove camera shake from hand-holding a camera, bumping a
  4130. tripod, moving on a vehicle, etc.
  4131. The filter accepts the following options:
  4132. @table @option
  4133. @item x
  4134. @item y
  4135. @item w
  4136. @item h
  4137. Specify a rectangular area where to limit the search for motion
  4138. vectors.
  4139. If desired the search for motion vectors can be limited to a
  4140. rectangular area of the frame defined by its top left corner, width
  4141. and height. These parameters have the same meaning as the drawbox
  4142. filter which can be used to visualise the position of the bounding
  4143. box.
  4144. This is useful when simultaneous movement of subjects within the frame
  4145. might be confused for camera motion by the motion vector search.
  4146. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  4147. then the full frame is used. This allows later options to be set
  4148. without specifying the bounding box for the motion vector search.
  4149. Default - search the whole frame.
  4150. @item rx
  4151. @item ry
  4152. Specify the maximum extent of movement in x and y directions in the
  4153. range 0-64 pixels. Default 16.
  4154. @item edge
  4155. Specify how to generate pixels to fill blanks at the edge of the
  4156. frame. Available values are:
  4157. @table @samp
  4158. @item blank, 0
  4159. Fill zeroes at blank locations
  4160. @item original, 1
  4161. Original image at blank locations
  4162. @item clamp, 2
  4163. Extruded edge value at blank locations
  4164. @item mirror, 3
  4165. Mirrored edge at blank locations
  4166. @end table
  4167. Default value is @samp{mirror}.
  4168. @item blocksize
  4169. Specify the blocksize to use for motion search. Range 4-128 pixels,
  4170. default 8.
  4171. @item contrast
  4172. Specify the contrast threshold for blocks. Only blocks with more than
  4173. the specified contrast (difference between darkest and lightest
  4174. pixels) will be considered. Range 1-255, default 125.
  4175. @item search
  4176. Specify the search strategy. Available values are:
  4177. @table @samp
  4178. @item exhaustive, 0
  4179. Set exhaustive search
  4180. @item less, 1
  4181. Set less exhaustive search.
  4182. @end table
  4183. Default value is @samp{exhaustive}.
  4184. @item filename
  4185. If set then a detailed log of the motion search is written to the
  4186. specified file.
  4187. @item opencl
  4188. If set to 1, specify using OpenCL capabilities, only available if
  4189. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  4190. @end table
  4191. @section detelecine
  4192. Apply an exact inverse of the telecine operation. It requires a predefined
  4193. pattern specified using the pattern option which must be the same as that passed
  4194. to the telecine filter.
  4195. This filter accepts the following options:
  4196. @table @option
  4197. @item first_field
  4198. @table @samp
  4199. @item top, t
  4200. top field first
  4201. @item bottom, b
  4202. bottom field first
  4203. The default value is @code{top}.
  4204. @end table
  4205. @item pattern
  4206. A string of numbers representing the pulldown pattern you wish to apply.
  4207. The default value is @code{23}.
  4208. @item start_frame
  4209. A number representing position of the first frame with respect to the telecine
  4210. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  4211. @end table
  4212. @section dilation
  4213. Apply dilation effect to the video.
  4214. This filter replaces the pixel by the local(3x3) maximum.
  4215. It accepts the following options:
  4216. @table @option
  4217. @item threshold0
  4218. @item threshold1
  4219. @item threshold2
  4220. @item threshold3
  4221. Limit the maximum change for each plane, default is 65535.
  4222. If 0, plane will remain unchanged.
  4223. @item coordinates
  4224. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  4225. pixels are used.
  4226. Flags to local 3x3 coordinates maps like this:
  4227. 1 2 3
  4228. 4 5
  4229. 6 7 8
  4230. @end table
  4231. @section displace
  4232. Displace pixels as indicated by second and third input stream.
  4233. It takes three input streams and outputs one stream, the first input is the
  4234. source, and second and third input are displacement maps.
  4235. The second input specifies how much to displace pixels along the
  4236. x-axis, while the third input specifies how much to displace pixels
  4237. along the y-axis.
  4238. If one of displacement map streams terminates, last frame from that
  4239. displacement map will be used.
  4240. Note that once generated, displacements maps can be reused over and over again.
  4241. A description of the accepted options follows.
  4242. @table @option
  4243. @item edge
  4244. Set displace behavior for pixels that are out of range.
  4245. Available values are:
  4246. @table @samp
  4247. @item blank
  4248. Missing pixels are replaced by black pixels.
  4249. @item smear
  4250. Adjacent pixels will spread out to replace missing pixels.
  4251. @item wrap
  4252. Out of range pixels are wrapped so they point to pixels of other side.
  4253. @end table
  4254. Default is @samp{smear}.
  4255. @end table
  4256. @subsection Examples
  4257. @itemize
  4258. @item
  4259. Add ripple effect to rgb input of video size hd720:
  4260. @example
  4261. 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
  4262. @end example
  4263. @item
  4264. Add wave effect to rgb input of video size hd720:
  4265. @example
  4266. 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
  4267. @end example
  4268. @end itemize
  4269. @section drawbox
  4270. Draw a colored box on the input image.
  4271. It accepts the following parameters:
  4272. @table @option
  4273. @item x
  4274. @item y
  4275. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  4276. @item width, w
  4277. @item height, h
  4278. The expressions which specify the width and height of the box; if 0 they are interpreted as
  4279. the input width and height. It defaults to 0.
  4280. @item color, c
  4281. Specify the color of the box to write. For the general syntax of this option,
  4282. check the "Color" section in the ffmpeg-utils manual. If the special
  4283. value @code{invert} is used, the box edge color is the same as the
  4284. video with inverted luma.
  4285. @item thickness, t
  4286. The expression which sets the thickness of the box edge. Default value is @code{3}.
  4287. See below for the list of accepted constants.
  4288. @end table
  4289. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  4290. following constants:
  4291. @table @option
  4292. @item dar
  4293. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  4294. @item hsub
  4295. @item vsub
  4296. horizontal and vertical chroma subsample values. For example for the
  4297. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4298. @item in_h, ih
  4299. @item in_w, iw
  4300. The input width and height.
  4301. @item sar
  4302. The input sample aspect ratio.
  4303. @item x
  4304. @item y
  4305. The x and y offset coordinates where the box is drawn.
  4306. @item w
  4307. @item h
  4308. The width and height of the drawn box.
  4309. @item t
  4310. The thickness of the drawn box.
  4311. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  4312. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  4313. @end table
  4314. @subsection Examples
  4315. @itemize
  4316. @item
  4317. Draw a black box around the edge of the input image:
  4318. @example
  4319. drawbox
  4320. @end example
  4321. @item
  4322. Draw a box with color red and an opacity of 50%:
  4323. @example
  4324. drawbox=10:20:200:60:red@@0.5
  4325. @end example
  4326. The previous example can be specified as:
  4327. @example
  4328. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  4329. @end example
  4330. @item
  4331. Fill the box with pink color:
  4332. @example
  4333. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
  4334. @end example
  4335. @item
  4336. Draw a 2-pixel red 2.40:1 mask:
  4337. @example
  4338. 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
  4339. @end example
  4340. @end itemize
  4341. @section drawgraph, adrawgraph
  4342. Draw a graph using input video or audio metadata.
  4343. It accepts the following parameters:
  4344. @table @option
  4345. @item m1
  4346. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  4347. @item fg1
  4348. Set 1st foreground color expression.
  4349. @item m2
  4350. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  4351. @item fg2
  4352. Set 2nd foreground color expression.
  4353. @item m3
  4354. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  4355. @item fg3
  4356. Set 3rd foreground color expression.
  4357. @item m4
  4358. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  4359. @item fg4
  4360. Set 4th foreground color expression.
  4361. @item min
  4362. Set minimal value of metadata value.
  4363. @item max
  4364. Set maximal value of metadata value.
  4365. @item bg
  4366. Set graph background color. Default is white.
  4367. @item mode
  4368. Set graph mode.
  4369. Available values for mode is:
  4370. @table @samp
  4371. @item bar
  4372. @item dot
  4373. @item line
  4374. @end table
  4375. Default is @code{line}.
  4376. @item slide
  4377. Set slide mode.
  4378. Available values for slide is:
  4379. @table @samp
  4380. @item frame
  4381. Draw new frame when right border is reached.
  4382. @item replace
  4383. Replace old columns with new ones.
  4384. @item scroll
  4385. Scroll from right to left.
  4386. @item rscroll
  4387. Scroll from left to right.
  4388. @end table
  4389. Default is @code{frame}.
  4390. @item size
  4391. Set size of graph video. For the syntax of this option, check the
  4392. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  4393. The default value is @code{900x256}.
  4394. The foreground color expressions can use the following variables:
  4395. @table @option
  4396. @item MIN
  4397. Minimal value of metadata value.
  4398. @item MAX
  4399. Maximal value of metadata value.
  4400. @item VAL
  4401. Current metadata key value.
  4402. @end table
  4403. The color is defined as 0xAABBGGRR.
  4404. @end table
  4405. Example using metadata from @ref{signalstats} filter:
  4406. @example
  4407. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  4408. @end example
  4409. Example using metadata from @ref{ebur128} filter:
  4410. @example
  4411. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  4412. @end example
  4413. @section drawgrid
  4414. Draw a grid on the input image.
  4415. It accepts the following parameters:
  4416. @table @option
  4417. @item x
  4418. @item y
  4419. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  4420. @item width, w
  4421. @item height, h
  4422. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  4423. input width and height, respectively, minus @code{thickness}, so image gets
  4424. framed. Default to 0.
  4425. @item color, c
  4426. Specify the color of the grid. For the general syntax of this option,
  4427. check the "Color" section in the ffmpeg-utils manual. If the special
  4428. value @code{invert} is used, the grid color is the same as the
  4429. video with inverted luma.
  4430. @item thickness, t
  4431. The expression which sets the thickness of the grid line. Default value is @code{1}.
  4432. See below for the list of accepted constants.
  4433. @end table
  4434. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  4435. following constants:
  4436. @table @option
  4437. @item dar
  4438. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  4439. @item hsub
  4440. @item vsub
  4441. horizontal and vertical chroma subsample values. For example for the
  4442. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4443. @item in_h, ih
  4444. @item in_w, iw
  4445. The input grid cell width and height.
  4446. @item sar
  4447. The input sample aspect ratio.
  4448. @item x
  4449. @item y
  4450. The x and y coordinates of some point of grid intersection (meant to configure offset).
  4451. @item w
  4452. @item h
  4453. The width and height of the drawn cell.
  4454. @item t
  4455. The thickness of the drawn cell.
  4456. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  4457. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  4458. @end table
  4459. @subsection Examples
  4460. @itemize
  4461. @item
  4462. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  4463. @example
  4464. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  4465. @end example
  4466. @item
  4467. Draw a white 3x3 grid with an opacity of 50%:
  4468. @example
  4469. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  4470. @end example
  4471. @end itemize
  4472. @anchor{drawtext}
  4473. @section drawtext
  4474. Draw a text string or text from a specified file on top of a video, using the
  4475. libfreetype library.
  4476. To enable compilation of this filter, you need to configure FFmpeg with
  4477. @code{--enable-libfreetype}.
  4478. To enable default font fallback and the @var{font} option you need to
  4479. configure FFmpeg with @code{--enable-libfontconfig}.
  4480. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  4481. @code{--enable-libfribidi}.
  4482. @subsection Syntax
  4483. It accepts the following parameters:
  4484. @table @option
  4485. @item box
  4486. Used to draw a box around text using the background color.
  4487. The value must be either 1 (enable) or 0 (disable).
  4488. The default value of @var{box} is 0.
  4489. @item boxborderw
  4490. Set the width of the border to be drawn around the box using @var{boxcolor}.
  4491. The default value of @var{boxborderw} is 0.
  4492. @item boxcolor
  4493. The color to be used for drawing box around text. For the syntax of this
  4494. option, check the "Color" section in the ffmpeg-utils manual.
  4495. The default value of @var{boxcolor} is "white".
  4496. @item borderw
  4497. Set the width of the border to be drawn around the text using @var{bordercolor}.
  4498. The default value of @var{borderw} is 0.
  4499. @item bordercolor
  4500. Set the color to be used for drawing border around text. For the syntax of this
  4501. option, check the "Color" section in the ffmpeg-utils manual.
  4502. The default value of @var{bordercolor} is "black".
  4503. @item expansion
  4504. Select how the @var{text} is expanded. Can be either @code{none},
  4505. @code{strftime} (deprecated) or
  4506. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  4507. below for details.
  4508. @item fix_bounds
  4509. If true, check and fix text coords to avoid clipping.
  4510. @item fontcolor
  4511. The color to be used for drawing fonts. For the syntax of this option, check
  4512. the "Color" section in the ffmpeg-utils manual.
  4513. The default value of @var{fontcolor} is "black".
  4514. @item fontcolor_expr
  4515. String which is expanded the same way as @var{text} to obtain dynamic
  4516. @var{fontcolor} value. By default this option has empty value and is not
  4517. processed. When this option is set, it overrides @var{fontcolor} option.
  4518. @item font
  4519. The font family to be used for drawing text. By default Sans.
  4520. @item fontfile
  4521. The font file to be used for drawing text. The path must be included.
  4522. This parameter is mandatory if the fontconfig support is disabled.
  4523. @item draw
  4524. This option does not exist, please see the timeline system
  4525. @item alpha
  4526. Draw the text applying alpha blending. The value can
  4527. be either a number between 0.0 and 1.0
  4528. The expression accepts the same variables @var{x, y} do.
  4529. The default value is 1.
  4530. Please see fontcolor_expr
  4531. @item fontsize
  4532. The font size to be used for drawing text.
  4533. The default value of @var{fontsize} is 16.
  4534. @item text_shaping
  4535. If set to 1, attempt to shape the text (for example, reverse the order of
  4536. right-to-left text and join Arabic characters) before drawing it.
  4537. Otherwise, just draw the text exactly as given.
  4538. By default 1 (if supported).
  4539. @item ft_load_flags
  4540. The flags to be used for loading the fonts.
  4541. The flags map the corresponding flags supported by libfreetype, and are
  4542. a combination of the following values:
  4543. @table @var
  4544. @item default
  4545. @item no_scale
  4546. @item no_hinting
  4547. @item render
  4548. @item no_bitmap
  4549. @item vertical_layout
  4550. @item force_autohint
  4551. @item crop_bitmap
  4552. @item pedantic
  4553. @item ignore_global_advance_width
  4554. @item no_recurse
  4555. @item ignore_transform
  4556. @item monochrome
  4557. @item linear_design
  4558. @item no_autohint
  4559. @end table
  4560. Default value is "default".
  4561. For more information consult the documentation for the FT_LOAD_*
  4562. libfreetype flags.
  4563. @item shadowcolor
  4564. The color to be used for drawing a shadow behind the drawn text. For the
  4565. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  4566. The default value of @var{shadowcolor} is "black".
  4567. @item shadowx
  4568. @item shadowy
  4569. The x and y offsets for the text shadow position with respect to the
  4570. position of the text. They can be either positive or negative
  4571. values. The default value for both is "0".
  4572. @item start_number
  4573. The starting frame number for the n/frame_num variable. The default value
  4574. is "0".
  4575. @item tabsize
  4576. The size in number of spaces to use for rendering the tab.
  4577. Default value is 4.
  4578. @item timecode
  4579. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  4580. format. It can be used with or without text parameter. @var{timecode_rate}
  4581. option must be specified.
  4582. @item timecode_rate, rate, r
  4583. Set the timecode frame rate (timecode only).
  4584. @item text
  4585. The text string to be drawn. The text must be a sequence of UTF-8
  4586. encoded characters.
  4587. This parameter is mandatory if no file is specified with the parameter
  4588. @var{textfile}.
  4589. @item textfile
  4590. A text file containing text to be drawn. The text must be a sequence
  4591. of UTF-8 encoded characters.
  4592. This parameter is mandatory if no text string is specified with the
  4593. parameter @var{text}.
  4594. If both @var{text} and @var{textfile} are specified, an error is thrown.
  4595. @item reload
  4596. If set to 1, the @var{textfile} will be reloaded before each frame.
  4597. Be sure to update it atomically, or it may be read partially, or even fail.
  4598. @item x
  4599. @item y
  4600. The expressions which specify the offsets where text will be drawn
  4601. within the video frame. They are relative to the top/left border of the
  4602. output image.
  4603. The default value of @var{x} and @var{y} is "0".
  4604. See below for the list of accepted constants and functions.
  4605. @end table
  4606. The parameters for @var{x} and @var{y} are expressions containing the
  4607. following constants and functions:
  4608. @table @option
  4609. @item dar
  4610. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  4611. @item hsub
  4612. @item vsub
  4613. horizontal and vertical chroma subsample values. For example for the
  4614. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4615. @item line_h, lh
  4616. the height of each text line
  4617. @item main_h, h, H
  4618. the input height
  4619. @item main_w, w, W
  4620. the input width
  4621. @item max_glyph_a, ascent
  4622. the maximum distance from the baseline to the highest/upper grid
  4623. coordinate used to place a glyph outline point, for all the rendered
  4624. glyphs.
  4625. It is a positive value, due to the grid's orientation with the Y axis
  4626. upwards.
  4627. @item max_glyph_d, descent
  4628. the maximum distance from the baseline to the lowest grid coordinate
  4629. used to place a glyph outline point, for all the rendered glyphs.
  4630. This is a negative value, due to the grid's orientation, with the Y axis
  4631. upwards.
  4632. @item max_glyph_h
  4633. maximum glyph height, that is the maximum height for all the glyphs
  4634. contained in the rendered text, it is equivalent to @var{ascent} -
  4635. @var{descent}.
  4636. @item max_glyph_w
  4637. maximum glyph width, that is the maximum width for all the glyphs
  4638. contained in the rendered text
  4639. @item n
  4640. the number of input frame, starting from 0
  4641. @item rand(min, max)
  4642. return a random number included between @var{min} and @var{max}
  4643. @item sar
  4644. The input sample aspect ratio.
  4645. @item t
  4646. timestamp expressed in seconds, NAN if the input timestamp is unknown
  4647. @item text_h, th
  4648. the height of the rendered text
  4649. @item text_w, tw
  4650. the width of the rendered text
  4651. @item x
  4652. @item y
  4653. the x and y offset coordinates where the text is drawn.
  4654. These parameters allow the @var{x} and @var{y} expressions to refer
  4655. each other, so you can for example specify @code{y=x/dar}.
  4656. @end table
  4657. @anchor{drawtext_expansion}
  4658. @subsection Text expansion
  4659. If @option{expansion} is set to @code{strftime},
  4660. the filter recognizes strftime() sequences in the provided text and
  4661. expands them accordingly. Check the documentation of strftime(). This
  4662. feature is deprecated.
  4663. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  4664. If @option{expansion} is set to @code{normal} (which is the default),
  4665. the following expansion mechanism is used.
  4666. The backslash character @samp{\}, followed by any character, always expands to
  4667. the second character.
  4668. Sequence of the form @code{%@{...@}} are expanded. The text between the
  4669. braces is a function name, possibly followed by arguments separated by ':'.
  4670. If the arguments contain special characters or delimiters (':' or '@}'),
  4671. they should be escaped.
  4672. Note that they probably must also be escaped as the value for the
  4673. @option{text} option in the filter argument string and as the filter
  4674. argument in the filtergraph description, and possibly also for the shell,
  4675. that makes up to four levels of escaping; using a text file avoids these
  4676. problems.
  4677. The following functions are available:
  4678. @table @command
  4679. @item expr, e
  4680. The expression evaluation result.
  4681. It must take one argument specifying the expression to be evaluated,
  4682. which accepts the same constants and functions as the @var{x} and
  4683. @var{y} values. Note that not all constants should be used, for
  4684. example the text size is not known when evaluating the expression, so
  4685. the constants @var{text_w} and @var{text_h} will have an undefined
  4686. value.
  4687. @item expr_int_format, eif
  4688. Evaluate the expression's value and output as formatted integer.
  4689. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  4690. The second argument specifies the output format. Allowed values are @samp{x},
  4691. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  4692. @code{printf} function.
  4693. The third parameter is optional and sets the number of positions taken by the output.
  4694. It can be used to add padding with zeros from the left.
  4695. @item gmtime
  4696. The time at which the filter is running, expressed in UTC.
  4697. It can accept an argument: a strftime() format string.
  4698. @item localtime
  4699. The time at which the filter is running, expressed in the local time zone.
  4700. It can accept an argument: a strftime() format string.
  4701. @item metadata
  4702. Frame metadata. It must take one argument specifying metadata key.
  4703. @item n, frame_num
  4704. The frame number, starting from 0.
  4705. @item pict_type
  4706. A 1 character description of the current picture type.
  4707. @item pts
  4708. The timestamp of the current frame.
  4709. It can take up to three arguments.
  4710. The first argument is the format of the timestamp; it defaults to @code{flt}
  4711. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  4712. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  4713. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  4714. @code{localtime} stands for the timestamp of the frame formatted as
  4715. local time zone time.
  4716. The second argument is an offset added to the timestamp.
  4717. If the format is set to @code{localtime} or @code{gmtime},
  4718. a third argument may be supplied: a strftime() format string.
  4719. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  4720. @end table
  4721. @subsection Examples
  4722. @itemize
  4723. @item
  4724. Draw "Test Text" with font FreeSerif, using the default values for the
  4725. optional parameters.
  4726. @example
  4727. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  4728. @end example
  4729. @item
  4730. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  4731. and y=50 (counting from the top-left corner of the screen), text is
  4732. yellow with a red box around it. Both the text and the box have an
  4733. opacity of 20%.
  4734. @example
  4735. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  4736. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  4737. @end example
  4738. Note that the double quotes are not necessary if spaces are not used
  4739. within the parameter list.
  4740. @item
  4741. Show the text at the center of the video frame:
  4742. @example
  4743. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  4744. @end example
  4745. @item
  4746. Show a text line sliding from right to left in the last row of the video
  4747. frame. The file @file{LONG_LINE} is assumed to contain a single line
  4748. with no newlines.
  4749. @example
  4750. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  4751. @end example
  4752. @item
  4753. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  4754. @example
  4755. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  4756. @end example
  4757. @item
  4758. Draw a single green letter "g", at the center of the input video.
  4759. The glyph baseline is placed at half screen height.
  4760. @example
  4761. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  4762. @end example
  4763. @item
  4764. Show text for 1 second every 3 seconds:
  4765. @example
  4766. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  4767. @end example
  4768. @item
  4769. Use fontconfig to set the font. Note that the colons need to be escaped.
  4770. @example
  4771. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  4772. @end example
  4773. @item
  4774. Print the date of a real-time encoding (see strftime(3)):
  4775. @example
  4776. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  4777. @end example
  4778. @item
  4779. Show text fading in and out (appearing/disappearing):
  4780. @example
  4781. #!/bin/sh
  4782. DS=1.0 # display start
  4783. DE=10.0 # display end
  4784. FID=1.5 # fade in duration
  4785. FOD=5 # fade out duration
  4786. 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 @}"
  4787. @end example
  4788. @end itemize
  4789. For more information about libfreetype, check:
  4790. @url{http://www.freetype.org/}.
  4791. For more information about fontconfig, check:
  4792. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  4793. For more information about libfribidi, check:
  4794. @url{http://fribidi.org/}.
  4795. @section edgedetect
  4796. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  4797. The filter accepts the following options:
  4798. @table @option
  4799. @item low
  4800. @item high
  4801. Set low and high threshold values used by the Canny thresholding
  4802. algorithm.
  4803. The high threshold selects the "strong" edge pixels, which are then
  4804. connected through 8-connectivity with the "weak" edge pixels selected
  4805. by the low threshold.
  4806. @var{low} and @var{high} threshold values must be chosen in the range
  4807. [0,1], and @var{low} should be lesser or equal to @var{high}.
  4808. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  4809. is @code{50/255}.
  4810. @item mode
  4811. Define the drawing mode.
  4812. @table @samp
  4813. @item wires
  4814. Draw white/gray wires on black background.
  4815. @item colormix
  4816. Mix the colors to create a paint/cartoon effect.
  4817. @end table
  4818. Default value is @var{wires}.
  4819. @end table
  4820. @subsection Examples
  4821. @itemize
  4822. @item
  4823. Standard edge detection with custom values for the hysteresis thresholding:
  4824. @example
  4825. edgedetect=low=0.1:high=0.4
  4826. @end example
  4827. @item
  4828. Painting effect without thresholding:
  4829. @example
  4830. edgedetect=mode=colormix:high=0
  4831. @end example
  4832. @end itemize
  4833. @section eq
  4834. Set brightness, contrast, saturation and approximate gamma adjustment.
  4835. The filter accepts the following options:
  4836. @table @option
  4837. @item contrast
  4838. Set the contrast expression. The value must be a float value in range
  4839. @code{-2.0} to @code{2.0}. The default value is "1".
  4840. @item brightness
  4841. Set the brightness expression. The value must be a float value in
  4842. range @code{-1.0} to @code{1.0}. The default value is "0".
  4843. @item saturation
  4844. Set the saturation expression. The value must be a float in
  4845. range @code{0.0} to @code{3.0}. The default value is "1".
  4846. @item gamma
  4847. Set the gamma expression. The value must be a float in range
  4848. @code{0.1} to @code{10.0}. The default value is "1".
  4849. @item gamma_r
  4850. Set the gamma expression for red. The value must be a float in
  4851. range @code{0.1} to @code{10.0}. The default value is "1".
  4852. @item gamma_g
  4853. Set the gamma expression for green. The value must be a float in range
  4854. @code{0.1} to @code{10.0}. The default value is "1".
  4855. @item gamma_b
  4856. Set the gamma expression for blue. The value must be a float in range
  4857. @code{0.1} to @code{10.0}. The default value is "1".
  4858. @item gamma_weight
  4859. Set the gamma weight expression. It can be used to reduce the effect
  4860. of a high gamma value on bright image areas, e.g. keep them from
  4861. getting overamplified and just plain white. The value must be a float
  4862. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  4863. gamma correction all the way down while @code{1.0} leaves it at its
  4864. full strength. Default is "1".
  4865. @item eval
  4866. Set when the expressions for brightness, contrast, saturation and
  4867. gamma expressions are evaluated.
  4868. It accepts the following values:
  4869. @table @samp
  4870. @item init
  4871. only evaluate expressions once during the filter initialization or
  4872. when a command is processed
  4873. @item frame
  4874. evaluate expressions for each incoming frame
  4875. @end table
  4876. Default value is @samp{init}.
  4877. @end table
  4878. The expressions accept the following parameters:
  4879. @table @option
  4880. @item n
  4881. frame count of the input frame starting from 0
  4882. @item pos
  4883. byte position of the corresponding packet in the input file, NAN if
  4884. unspecified
  4885. @item r
  4886. frame rate of the input video, NAN if the input frame rate is unknown
  4887. @item t
  4888. timestamp expressed in seconds, NAN if the input timestamp is unknown
  4889. @end table
  4890. @subsection Commands
  4891. The filter supports the following commands:
  4892. @table @option
  4893. @item contrast
  4894. Set the contrast expression.
  4895. @item brightness
  4896. Set the brightness expression.
  4897. @item saturation
  4898. Set the saturation expression.
  4899. @item gamma
  4900. Set the gamma expression.
  4901. @item gamma_r
  4902. Set the gamma_r expression.
  4903. @item gamma_g
  4904. Set gamma_g expression.
  4905. @item gamma_b
  4906. Set gamma_b expression.
  4907. @item gamma_weight
  4908. Set gamma_weight expression.
  4909. The command accepts the same syntax of the corresponding option.
  4910. If the specified expression is not valid, it is kept at its current
  4911. value.
  4912. @end table
  4913. @section erosion
  4914. Apply erosion effect to the video.
  4915. This filter replaces the pixel by the local(3x3) minimum.
  4916. It accepts the following options:
  4917. @table @option
  4918. @item threshold0
  4919. @item threshold1
  4920. @item threshold2
  4921. @item threshold3
  4922. Limit the maximum change for each plane, default is 65535.
  4923. If 0, plane will remain unchanged.
  4924. @item coordinates
  4925. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  4926. pixels are used.
  4927. Flags to local 3x3 coordinates maps like this:
  4928. 1 2 3
  4929. 4 5
  4930. 6 7 8
  4931. @end table
  4932. @section extractplanes
  4933. Extract color channel components from input video stream into
  4934. separate grayscale video streams.
  4935. The filter accepts the following option:
  4936. @table @option
  4937. @item planes
  4938. Set plane(s) to extract.
  4939. Available values for planes are:
  4940. @table @samp
  4941. @item y
  4942. @item u
  4943. @item v
  4944. @item a
  4945. @item r
  4946. @item g
  4947. @item b
  4948. @end table
  4949. Choosing planes not available in the input will result in an error.
  4950. That means you cannot select @code{r}, @code{g}, @code{b} planes
  4951. with @code{y}, @code{u}, @code{v} planes at same time.
  4952. @end table
  4953. @subsection Examples
  4954. @itemize
  4955. @item
  4956. Extract luma, u and v color channel component from input video frame
  4957. into 3 grayscale outputs:
  4958. @example
  4959. 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
  4960. @end example
  4961. @end itemize
  4962. @section elbg
  4963. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  4964. For each input image, the filter will compute the optimal mapping from
  4965. the input to the output given the codebook length, that is the number
  4966. of distinct output colors.
  4967. This filter accepts the following options.
  4968. @table @option
  4969. @item codebook_length, l
  4970. Set codebook length. The value must be a positive integer, and
  4971. represents the number of distinct output colors. Default value is 256.
  4972. @item nb_steps, n
  4973. Set the maximum number of iterations to apply for computing the optimal
  4974. mapping. The higher the value the better the result and the higher the
  4975. computation time. Default value is 1.
  4976. @item seed, s
  4977. Set a random seed, must be an integer included between 0 and
  4978. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  4979. will try to use a good random seed on a best effort basis.
  4980. @item pal8
  4981. Set pal8 output pixel format. This option does not work with codebook
  4982. length greater than 256.
  4983. @end table
  4984. @section fade
  4985. Apply a fade-in/out effect to the input video.
  4986. It accepts the following parameters:
  4987. @table @option
  4988. @item type, t
  4989. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  4990. effect.
  4991. Default is @code{in}.
  4992. @item start_frame, s
  4993. Specify the number of the frame to start applying the fade
  4994. effect at. Default is 0.
  4995. @item nb_frames, n
  4996. The number of frames that the fade effect lasts. At the end of the
  4997. fade-in effect, the output video will have the same intensity as the input video.
  4998. At the end of the fade-out transition, the output video will be filled with the
  4999. selected @option{color}.
  5000. Default is 25.
  5001. @item alpha
  5002. If set to 1, fade only alpha channel, if one exists on the input.
  5003. Default value is 0.
  5004. @item start_time, st
  5005. Specify the timestamp (in seconds) of the frame to start to apply the fade
  5006. effect. If both start_frame and start_time are specified, the fade will start at
  5007. whichever comes last. Default is 0.
  5008. @item duration, d
  5009. The number of seconds for which the fade effect has to last. At the end of the
  5010. fade-in effect the output video will have the same intensity as the input video,
  5011. at the end of the fade-out transition the output video will be filled with the
  5012. selected @option{color}.
  5013. If both duration and nb_frames are specified, duration is used. Default is 0
  5014. (nb_frames is used by default).
  5015. @item color, c
  5016. Specify the color of the fade. Default is "black".
  5017. @end table
  5018. @subsection Examples
  5019. @itemize
  5020. @item
  5021. Fade in the first 30 frames of video:
  5022. @example
  5023. fade=in:0:30
  5024. @end example
  5025. The command above is equivalent to:
  5026. @example
  5027. fade=t=in:s=0:n=30
  5028. @end example
  5029. @item
  5030. Fade out the last 45 frames of a 200-frame video:
  5031. @example
  5032. fade=out:155:45
  5033. fade=type=out:start_frame=155:nb_frames=45
  5034. @end example
  5035. @item
  5036. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  5037. @example
  5038. fade=in:0:25, fade=out:975:25
  5039. @end example
  5040. @item
  5041. Make the first 5 frames yellow, then fade in from frame 5-24:
  5042. @example
  5043. fade=in:5:20:color=yellow
  5044. @end example
  5045. @item
  5046. Fade in alpha over first 25 frames of video:
  5047. @example
  5048. fade=in:0:25:alpha=1
  5049. @end example
  5050. @item
  5051. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  5052. @example
  5053. fade=t=in:st=5.5:d=0.5
  5054. @end example
  5055. @end itemize
  5056. @section fftfilt
  5057. Apply arbitrary expressions to samples in frequency domain
  5058. @table @option
  5059. @item dc_Y
  5060. Adjust the dc value (gain) of the luma plane of the image. The filter
  5061. accepts an integer value in range @code{0} to @code{1000}. The default
  5062. value is set to @code{0}.
  5063. @item dc_U
  5064. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  5065. filter accepts an integer value in range @code{0} to @code{1000}. The
  5066. default value is set to @code{0}.
  5067. @item dc_V
  5068. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  5069. filter accepts an integer value in range @code{0} to @code{1000}. The
  5070. default value is set to @code{0}.
  5071. @item weight_Y
  5072. Set the frequency domain weight expression for the luma plane.
  5073. @item weight_U
  5074. Set the frequency domain weight expression for the 1st chroma plane.
  5075. @item weight_V
  5076. Set the frequency domain weight expression for the 2nd chroma plane.
  5077. The filter accepts the following variables:
  5078. @item X
  5079. @item Y
  5080. The coordinates of the current sample.
  5081. @item W
  5082. @item H
  5083. The width and height of the image.
  5084. @end table
  5085. @subsection Examples
  5086. @itemize
  5087. @item
  5088. High-pass:
  5089. @example
  5090. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  5091. @end example
  5092. @item
  5093. Low-pass:
  5094. @example
  5095. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  5096. @end example
  5097. @item
  5098. Sharpen:
  5099. @example
  5100. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  5101. @end example
  5102. @item
  5103. Blur:
  5104. @example
  5105. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  5106. @end example
  5107. @end itemize
  5108. @section field
  5109. Extract a single field from an interlaced image using stride
  5110. arithmetic to avoid wasting CPU time. The output frames are marked as
  5111. non-interlaced.
  5112. The filter accepts the following options:
  5113. @table @option
  5114. @item type
  5115. Specify whether to extract the top (if the value is @code{0} or
  5116. @code{top}) or the bottom field (if the value is @code{1} or
  5117. @code{bottom}).
  5118. @end table
  5119. @section fieldmatch
  5120. Field matching filter for inverse telecine. It is meant to reconstruct the
  5121. progressive frames from a telecined stream. The filter does not drop duplicated
  5122. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  5123. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  5124. The separation of the field matching and the decimation is notably motivated by
  5125. the possibility of inserting a de-interlacing filter fallback between the two.
  5126. If the source has mixed telecined and real interlaced content,
  5127. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  5128. But these remaining combed frames will be marked as interlaced, and thus can be
  5129. de-interlaced by a later filter such as @ref{yadif} before decimation.
  5130. In addition to the various configuration options, @code{fieldmatch} can take an
  5131. optional second stream, activated through the @option{ppsrc} option. If
  5132. enabled, the frames reconstruction will be based on the fields and frames from
  5133. this second stream. This allows the first input to be pre-processed in order to
  5134. help the various algorithms of the filter, while keeping the output lossless
  5135. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  5136. or brightness/contrast adjustments can help.
  5137. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  5138. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  5139. which @code{fieldmatch} is based on. While the semantic and usage are very
  5140. close, some behaviour and options names can differ.
  5141. The @ref{decimate} filter currently only works for constant frame rate input.
  5142. If your input has mixed telecined (30fps) and progressive content with a lower
  5143. framerate like 24fps use the following filterchain to produce the necessary cfr
  5144. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  5145. The filter accepts the following options:
  5146. @table @option
  5147. @item order
  5148. Specify the assumed field order of the input stream. Available values are:
  5149. @table @samp
  5150. @item auto
  5151. Auto detect parity (use FFmpeg's internal parity value).
  5152. @item bff
  5153. Assume bottom field first.
  5154. @item tff
  5155. Assume top field first.
  5156. @end table
  5157. Note that it is sometimes recommended not to trust the parity announced by the
  5158. stream.
  5159. Default value is @var{auto}.
  5160. @item mode
  5161. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  5162. sense that it won't risk creating jerkiness due to duplicate frames when
  5163. possible, but if there are bad edits or blended fields it will end up
  5164. outputting combed frames when a good match might actually exist. On the other
  5165. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  5166. but will almost always find a good frame if there is one. The other values are
  5167. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  5168. jerkiness and creating duplicate frames versus finding good matches in sections
  5169. with bad edits, orphaned fields, blended fields, etc.
  5170. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  5171. Available values are:
  5172. @table @samp
  5173. @item pc
  5174. 2-way matching (p/c)
  5175. @item pc_n
  5176. 2-way matching, and trying 3rd match if still combed (p/c + n)
  5177. @item pc_u
  5178. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  5179. @item pc_n_ub
  5180. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  5181. still combed (p/c + n + u/b)
  5182. @item pcn
  5183. 3-way matching (p/c/n)
  5184. @item pcn_ub
  5185. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  5186. detected as combed (p/c/n + u/b)
  5187. @end table
  5188. The parenthesis at the end indicate the matches that would be used for that
  5189. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  5190. @var{top}).
  5191. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  5192. the slowest.
  5193. Default value is @var{pc_n}.
  5194. @item ppsrc
  5195. Mark the main input stream as a pre-processed input, and enable the secondary
  5196. input stream as the clean source to pick the fields from. See the filter
  5197. introduction for more details. It is similar to the @option{clip2} feature from
  5198. VFM/TFM.
  5199. Default value is @code{0} (disabled).
  5200. @item field
  5201. Set the field to match from. It is recommended to set this to the same value as
  5202. @option{order} unless you experience matching failures with that setting. In
  5203. certain circumstances changing the field that is used to match from can have a
  5204. large impact on matching performance. Available values are:
  5205. @table @samp
  5206. @item auto
  5207. Automatic (same value as @option{order}).
  5208. @item bottom
  5209. Match from the bottom field.
  5210. @item top
  5211. Match from the top field.
  5212. @end table
  5213. Default value is @var{auto}.
  5214. @item mchroma
  5215. Set whether or not chroma is included during the match comparisons. In most
  5216. cases it is recommended to leave this enabled. You should set this to @code{0}
  5217. only if your clip has bad chroma problems such as heavy rainbowing or other
  5218. artifacts. Setting this to @code{0} could also be used to speed things up at
  5219. the cost of some accuracy.
  5220. Default value is @code{1}.
  5221. @item y0
  5222. @item y1
  5223. These define an exclusion band which excludes the lines between @option{y0} and
  5224. @option{y1} from being included in the field matching decision. An exclusion
  5225. band can be used to ignore subtitles, a logo, or other things that may
  5226. interfere with the matching. @option{y0} sets the starting scan line and
  5227. @option{y1} sets the ending line; all lines in between @option{y0} and
  5228. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  5229. @option{y0} and @option{y1} to the same value will disable the feature.
  5230. @option{y0} and @option{y1} defaults to @code{0}.
  5231. @item scthresh
  5232. Set the scene change detection threshold as a percentage of maximum change on
  5233. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  5234. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  5235. @option{scthresh} is @code{[0.0, 100.0]}.
  5236. Default value is @code{12.0}.
  5237. @item combmatch
  5238. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  5239. account the combed scores of matches when deciding what match to use as the
  5240. final match. Available values are:
  5241. @table @samp
  5242. @item none
  5243. No final matching based on combed scores.
  5244. @item sc
  5245. Combed scores are only used when a scene change is detected.
  5246. @item full
  5247. Use combed scores all the time.
  5248. @end table
  5249. Default is @var{sc}.
  5250. @item combdbg
  5251. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  5252. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  5253. Available values are:
  5254. @table @samp
  5255. @item none
  5256. No forced calculation.
  5257. @item pcn
  5258. Force p/c/n calculations.
  5259. @item pcnub
  5260. Force p/c/n/u/b calculations.
  5261. @end table
  5262. Default value is @var{none}.
  5263. @item cthresh
  5264. This is the area combing threshold used for combed frame detection. This
  5265. essentially controls how "strong" or "visible" combing must be to be detected.
  5266. Larger values mean combing must be more visible and smaller values mean combing
  5267. can be less visible or strong and still be detected. Valid settings are from
  5268. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  5269. be detected as combed). This is basically a pixel difference value. A good
  5270. range is @code{[8, 12]}.
  5271. Default value is @code{9}.
  5272. @item chroma
  5273. Sets whether or not chroma is considered in the combed frame decision. Only
  5274. disable this if your source has chroma problems (rainbowing, etc.) that are
  5275. causing problems for the combed frame detection with chroma enabled. Actually,
  5276. using @option{chroma}=@var{0} is usually more reliable, except for the case
  5277. where there is chroma only combing in the source.
  5278. Default value is @code{0}.
  5279. @item blockx
  5280. @item blocky
  5281. Respectively set the x-axis and y-axis size of the window used during combed
  5282. frame detection. This has to do with the size of the area in which
  5283. @option{combpel} pixels are required to be detected as combed for a frame to be
  5284. declared combed. See the @option{combpel} parameter description for more info.
  5285. Possible values are any number that is a power of 2 starting at 4 and going up
  5286. to 512.
  5287. Default value is @code{16}.
  5288. @item combpel
  5289. The number of combed pixels inside any of the @option{blocky} by
  5290. @option{blockx} size blocks on the frame for the frame to be detected as
  5291. combed. While @option{cthresh} controls how "visible" the combing must be, this
  5292. setting controls "how much" combing there must be in any localized area (a
  5293. window defined by the @option{blockx} and @option{blocky} settings) on the
  5294. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  5295. which point no frames will ever be detected as combed). This setting is known
  5296. as @option{MI} in TFM/VFM vocabulary.
  5297. Default value is @code{80}.
  5298. @end table
  5299. @anchor{p/c/n/u/b meaning}
  5300. @subsection p/c/n/u/b meaning
  5301. @subsubsection p/c/n
  5302. We assume the following telecined stream:
  5303. @example
  5304. Top fields: 1 2 2 3 4
  5305. Bottom fields: 1 2 3 4 4
  5306. @end example
  5307. The numbers correspond to the progressive frame the fields relate to. Here, the
  5308. first two frames are progressive, the 3rd and 4th are combed, and so on.
  5309. When @code{fieldmatch} is configured to run a matching from bottom
  5310. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  5311. @example
  5312. Input stream:
  5313. T 1 2 2 3 4
  5314. B 1 2 3 4 4 <-- matching reference
  5315. Matches: c c n n c
  5316. Output stream:
  5317. T 1 2 3 4 4
  5318. B 1 2 3 4 4
  5319. @end example
  5320. As a result of the field matching, we can see that some frames get duplicated.
  5321. To perform a complete inverse telecine, you need to rely on a decimation filter
  5322. after this operation. See for instance the @ref{decimate} filter.
  5323. The same operation now matching from top fields (@option{field}=@var{top})
  5324. looks like this:
  5325. @example
  5326. Input stream:
  5327. T 1 2 2 3 4 <-- matching reference
  5328. B 1 2 3 4 4
  5329. Matches: c c p p c
  5330. Output stream:
  5331. T 1 2 2 3 4
  5332. B 1 2 2 3 4
  5333. @end example
  5334. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  5335. basically, they refer to the frame and field of the opposite parity:
  5336. @itemize
  5337. @item @var{p} matches the field of the opposite parity in the previous frame
  5338. @item @var{c} matches the field of the opposite parity in the current frame
  5339. @item @var{n} matches the field of the opposite parity in the next frame
  5340. @end itemize
  5341. @subsubsection u/b
  5342. The @var{u} and @var{b} matching are a bit special in the sense that they match
  5343. from the opposite parity flag. In the following examples, we assume that we are
  5344. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  5345. 'x' is placed above and below each matched fields.
  5346. With bottom matching (@option{field}=@var{bottom}):
  5347. @example
  5348. Match: c p n b u
  5349. x x x x x
  5350. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  5351. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  5352. x x x x x
  5353. Output frames:
  5354. 2 1 2 2 2
  5355. 2 2 2 1 3
  5356. @end example
  5357. With top matching (@option{field}=@var{top}):
  5358. @example
  5359. Match: c p n b u
  5360. x x x x x
  5361. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  5362. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  5363. x x x x x
  5364. Output frames:
  5365. 2 2 2 1 2
  5366. 2 1 3 2 2
  5367. @end example
  5368. @subsection Examples
  5369. Simple IVTC of a top field first telecined stream:
  5370. @example
  5371. fieldmatch=order=tff:combmatch=none, decimate
  5372. @end example
  5373. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  5374. @example
  5375. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  5376. @end example
  5377. @section fieldorder
  5378. Transform the field order of the input video.
  5379. It accepts the following parameters:
  5380. @table @option
  5381. @item order
  5382. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  5383. for bottom field first.
  5384. @end table
  5385. The default value is @samp{tff}.
  5386. The transformation is done by shifting the picture content up or down
  5387. by one line, and filling the remaining line with appropriate picture content.
  5388. This method is consistent with most broadcast field order converters.
  5389. If the input video is not flagged as being interlaced, or it is already
  5390. flagged as being of the required output field order, then this filter does
  5391. not alter the incoming video.
  5392. It is very useful when converting to or from PAL DV material,
  5393. which is bottom field first.
  5394. For example:
  5395. @example
  5396. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  5397. @end example
  5398. @section fifo, afifo
  5399. Buffer input images and send them when they are requested.
  5400. It is mainly useful when auto-inserted by the libavfilter
  5401. framework.
  5402. It does not take parameters.
  5403. @section find_rect
  5404. Find a rectangular object
  5405. It accepts the following options:
  5406. @table @option
  5407. @item object
  5408. Filepath of the object image, needs to be in gray8.
  5409. @item threshold
  5410. Detection threshold, default is 0.5.
  5411. @item mipmaps
  5412. Number of mipmaps, default is 3.
  5413. @item xmin, ymin, xmax, ymax
  5414. Specifies the rectangle in which to search.
  5415. @end table
  5416. @subsection Examples
  5417. @itemize
  5418. @item
  5419. Generate a representative palette of a given video using @command{ffmpeg}:
  5420. @example
  5421. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  5422. @end example
  5423. @end itemize
  5424. @section cover_rect
  5425. Cover a rectangular object
  5426. It accepts the following options:
  5427. @table @option
  5428. @item cover
  5429. Filepath of the optional cover image, needs to be in yuv420.
  5430. @item mode
  5431. Set covering mode.
  5432. It accepts the following values:
  5433. @table @samp
  5434. @item cover
  5435. cover it by the supplied image
  5436. @item blur
  5437. cover it by interpolating the surrounding pixels
  5438. @end table
  5439. Default value is @var{blur}.
  5440. @end table
  5441. @subsection Examples
  5442. @itemize
  5443. @item
  5444. Generate a representative palette of a given video using @command{ffmpeg}:
  5445. @example
  5446. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  5447. @end example
  5448. @end itemize
  5449. @anchor{format}
  5450. @section format
  5451. Convert the input video to one of the specified pixel formats.
  5452. Libavfilter will try to pick one that is suitable as input to
  5453. the next filter.
  5454. It accepts the following parameters:
  5455. @table @option
  5456. @item pix_fmts
  5457. A '|'-separated list of pixel format names, such as
  5458. "pix_fmts=yuv420p|monow|rgb24".
  5459. @end table
  5460. @subsection Examples
  5461. @itemize
  5462. @item
  5463. Convert the input video to the @var{yuv420p} format
  5464. @example
  5465. format=pix_fmts=yuv420p
  5466. @end example
  5467. Convert the input video to any of the formats in the list
  5468. @example
  5469. format=pix_fmts=yuv420p|yuv444p|yuv410p
  5470. @end example
  5471. @end itemize
  5472. @anchor{fps}
  5473. @section fps
  5474. Convert the video to specified constant frame rate by duplicating or dropping
  5475. frames as necessary.
  5476. It accepts the following parameters:
  5477. @table @option
  5478. @item fps
  5479. The desired output frame rate. The default is @code{25}.
  5480. @item round
  5481. Rounding method.
  5482. Possible values are:
  5483. @table @option
  5484. @item zero
  5485. zero round towards 0
  5486. @item inf
  5487. round away from 0
  5488. @item down
  5489. round towards -infinity
  5490. @item up
  5491. round towards +infinity
  5492. @item near
  5493. round to nearest
  5494. @end table
  5495. The default is @code{near}.
  5496. @item start_time
  5497. Assume the first PTS should be the given value, in seconds. This allows for
  5498. padding/trimming at the start of stream. By default, no assumption is made
  5499. about the first frame's expected PTS, so no padding or trimming is done.
  5500. For example, this could be set to 0 to pad the beginning with duplicates of
  5501. the first frame if a video stream starts after the audio stream or to trim any
  5502. frames with a negative PTS.
  5503. @end table
  5504. Alternatively, the options can be specified as a flat string:
  5505. @var{fps}[:@var{round}].
  5506. See also the @ref{setpts} filter.
  5507. @subsection Examples
  5508. @itemize
  5509. @item
  5510. A typical usage in order to set the fps to 25:
  5511. @example
  5512. fps=fps=25
  5513. @end example
  5514. @item
  5515. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  5516. @example
  5517. fps=fps=film:round=near
  5518. @end example
  5519. @end itemize
  5520. @section framepack
  5521. Pack two different video streams into a stereoscopic video, setting proper
  5522. metadata on supported codecs. The two views should have the same size and
  5523. framerate and processing will stop when the shorter video ends. Please note
  5524. that you may conveniently adjust view properties with the @ref{scale} and
  5525. @ref{fps} filters.
  5526. It accepts the following parameters:
  5527. @table @option
  5528. @item format
  5529. The desired packing format. Supported values are:
  5530. @table @option
  5531. @item sbs
  5532. The views are next to each other (default).
  5533. @item tab
  5534. The views are on top of each other.
  5535. @item lines
  5536. The views are packed by line.
  5537. @item columns
  5538. The views are packed by column.
  5539. @item frameseq
  5540. The views are temporally interleaved.
  5541. @end table
  5542. @end table
  5543. Some examples:
  5544. @example
  5545. # Convert left and right views into a frame-sequential video
  5546. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  5547. # Convert views into a side-by-side video with the same output resolution as the input
  5548. 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
  5549. @end example
  5550. @section framerate
  5551. Change the frame rate by interpolating new video output frames from the source
  5552. frames.
  5553. This filter is not designed to function correctly with interlaced media. If
  5554. you wish to change the frame rate of interlaced media then you are required
  5555. to deinterlace before this filter and re-interlace after this filter.
  5556. A description of the accepted options follows.
  5557. @table @option
  5558. @item fps
  5559. Specify the output frames per second. This option can also be specified
  5560. as a value alone. The default is @code{50}.
  5561. @item interp_start
  5562. Specify the start of a range where the output frame will be created as a
  5563. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  5564. the default is @code{15}.
  5565. @item interp_end
  5566. Specify the end of a range where the output frame will be created as a
  5567. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  5568. the default is @code{240}.
  5569. @item scene
  5570. Specify the level at which a scene change is detected as a value between
  5571. 0 and 100 to indicate a new scene; a low value reflects a low
  5572. probability for the current frame to introduce a new scene, while a higher
  5573. value means the current frame is more likely to be one.
  5574. The default is @code{7}.
  5575. @item flags
  5576. Specify flags influencing the filter process.
  5577. Available value for @var{flags} is:
  5578. @table @option
  5579. @item scene_change_detect, scd
  5580. Enable scene change detection using the value of the option @var{scene}.
  5581. This flag is enabled by default.
  5582. @end table
  5583. @end table
  5584. @section framestep
  5585. Select one frame every N-th frame.
  5586. This filter accepts the following option:
  5587. @table @option
  5588. @item step
  5589. Select frame after every @code{step} frames.
  5590. Allowed values are positive integers higher than 0. Default value is @code{1}.
  5591. @end table
  5592. @anchor{frei0r}
  5593. @section frei0r
  5594. Apply a frei0r effect to the input video.
  5595. To enable the compilation of this filter, you need to install the frei0r
  5596. header and configure FFmpeg with @code{--enable-frei0r}.
  5597. It accepts the following parameters:
  5598. @table @option
  5599. @item filter_name
  5600. The name of the frei0r effect to load. If the environment variable
  5601. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  5602. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  5603. Otherwise, the standard frei0r paths are searched, in this order:
  5604. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  5605. @file{/usr/lib/frei0r-1/}.
  5606. @item filter_params
  5607. A '|'-separated list of parameters to pass to the frei0r effect.
  5608. @end table
  5609. A frei0r effect parameter can be a boolean (its value is either
  5610. "y" or "n"), a double, a color (specified as
  5611. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  5612. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  5613. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  5614. @var{X} and @var{Y} are floating point numbers) and/or a string.
  5615. The number and types of parameters depend on the loaded effect. If an
  5616. effect parameter is not specified, the default value is set.
  5617. @subsection Examples
  5618. @itemize
  5619. @item
  5620. Apply the distort0r effect, setting the first two double parameters:
  5621. @example
  5622. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  5623. @end example
  5624. @item
  5625. Apply the colordistance effect, taking a color as the first parameter:
  5626. @example
  5627. frei0r=colordistance:0.2/0.3/0.4
  5628. frei0r=colordistance:violet
  5629. frei0r=colordistance:0x112233
  5630. @end example
  5631. @item
  5632. Apply the perspective effect, specifying the top left and top right image
  5633. positions:
  5634. @example
  5635. frei0r=perspective:0.2/0.2|0.8/0.2
  5636. @end example
  5637. @end itemize
  5638. For more information, see
  5639. @url{http://frei0r.dyne.org}
  5640. @section fspp
  5641. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  5642. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  5643. processing filter, one of them is performed once per block, not per pixel.
  5644. This allows for much higher speed.
  5645. The filter accepts the following options:
  5646. @table @option
  5647. @item quality
  5648. Set quality. This option defines the number of levels for averaging. It accepts
  5649. an integer in the range 4-5. Default value is @code{4}.
  5650. @item qp
  5651. Force a constant quantization parameter. It accepts an integer in range 0-63.
  5652. If not set, the filter will use the QP from the video stream (if available).
  5653. @item strength
  5654. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  5655. more details but also more artifacts, while higher values make the image smoother
  5656. but also blurrier. Default value is @code{0} − PSNR optimal.
  5657. @item use_bframe_qp
  5658. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  5659. option may cause flicker since the B-Frames have often larger QP. Default is
  5660. @code{0} (not enabled).
  5661. @end table
  5662. @section geq
  5663. The filter accepts the following options:
  5664. @table @option
  5665. @item lum_expr, lum
  5666. Set the luminance expression.
  5667. @item cb_expr, cb
  5668. Set the chrominance blue expression.
  5669. @item cr_expr, cr
  5670. Set the chrominance red expression.
  5671. @item alpha_expr, a
  5672. Set the alpha expression.
  5673. @item red_expr, r
  5674. Set the red expression.
  5675. @item green_expr, g
  5676. Set the green expression.
  5677. @item blue_expr, b
  5678. Set the blue expression.
  5679. @end table
  5680. The colorspace is selected according to the specified options. If one
  5681. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  5682. options is specified, the filter will automatically select a YCbCr
  5683. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  5684. @option{blue_expr} options is specified, it will select an RGB
  5685. colorspace.
  5686. If one of the chrominance expression is not defined, it falls back on the other
  5687. one. If no alpha expression is specified it will evaluate to opaque value.
  5688. If none of chrominance expressions are specified, they will evaluate
  5689. to the luminance expression.
  5690. The expressions can use the following variables and functions:
  5691. @table @option
  5692. @item N
  5693. The sequential number of the filtered frame, starting from @code{0}.
  5694. @item X
  5695. @item Y
  5696. The coordinates of the current sample.
  5697. @item W
  5698. @item H
  5699. The width and height of the image.
  5700. @item SW
  5701. @item SH
  5702. Width and height scale depending on the currently filtered plane. It is the
  5703. ratio between the corresponding luma plane number of pixels and the current
  5704. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  5705. @code{0.5,0.5} for chroma planes.
  5706. @item T
  5707. Time of the current frame, expressed in seconds.
  5708. @item p(x, y)
  5709. Return the value of the pixel at location (@var{x},@var{y}) of the current
  5710. plane.
  5711. @item lum(x, y)
  5712. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  5713. plane.
  5714. @item cb(x, y)
  5715. Return the value of the pixel at location (@var{x},@var{y}) of the
  5716. blue-difference chroma plane. Return 0 if there is no such plane.
  5717. @item cr(x, y)
  5718. Return the value of the pixel at location (@var{x},@var{y}) of the
  5719. red-difference chroma plane. Return 0 if there is no such plane.
  5720. @item r(x, y)
  5721. @item g(x, y)
  5722. @item b(x, y)
  5723. Return the value of the pixel at location (@var{x},@var{y}) of the
  5724. red/green/blue component. Return 0 if there is no such component.
  5725. @item alpha(x, y)
  5726. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  5727. plane. Return 0 if there is no such plane.
  5728. @end table
  5729. For functions, if @var{x} and @var{y} are outside the area, the value will be
  5730. automatically clipped to the closer edge.
  5731. @subsection Examples
  5732. @itemize
  5733. @item
  5734. Flip the image horizontally:
  5735. @example
  5736. geq=p(W-X\,Y)
  5737. @end example
  5738. @item
  5739. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  5740. wavelength of 100 pixels:
  5741. @example
  5742. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  5743. @end example
  5744. @item
  5745. Generate a fancy enigmatic moving light:
  5746. @example
  5747. 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
  5748. @end example
  5749. @item
  5750. Generate a quick emboss effect:
  5751. @example
  5752. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  5753. @end example
  5754. @item
  5755. Modify RGB components depending on pixel position:
  5756. @example
  5757. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  5758. @end example
  5759. @item
  5760. Create a radial gradient that is the same size as the input (also see
  5761. the @ref{vignette} filter):
  5762. @example
  5763. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  5764. @end example
  5765. @item
  5766. Diagonal split screen to compare filter effect:
  5767. @example
  5768. ffmpeg -i input -filter_complex "[0:v]geq=lum=if(gt(X\,Y*(W/H))\,255),format=gray[alpha];[0:v][alpha]alphamerge,curves=preset=color_negative[filtered];[0:v][filtered]overlay" output
  5769. @end example
  5770. @end itemize
  5771. @section gradfun
  5772. Fix the banding artifacts that are sometimes introduced into nearly flat
  5773. regions by truncation to 8bit color depth.
  5774. Interpolate the gradients that should go where the bands are, and
  5775. dither them.
  5776. It is designed for playback only. Do not use it prior to
  5777. lossy compression, because compression tends to lose the dither and
  5778. bring back the bands.
  5779. It accepts the following parameters:
  5780. @table @option
  5781. @item strength
  5782. The maximum amount by which the filter will change any one pixel. This is also
  5783. the threshold for detecting nearly flat regions. Acceptable values range from
  5784. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  5785. valid range.
  5786. @item radius
  5787. The neighborhood to fit the gradient to. A larger radius makes for smoother
  5788. gradients, but also prevents the filter from modifying the pixels near detailed
  5789. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  5790. values will be clipped to the valid range.
  5791. @end table
  5792. Alternatively, the options can be specified as a flat string:
  5793. @var{strength}[:@var{radius}]
  5794. @subsection Examples
  5795. @itemize
  5796. @item
  5797. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  5798. @example
  5799. gradfun=3.5:8
  5800. @end example
  5801. @item
  5802. Specify radius, omitting the strength (which will fall-back to the default
  5803. value):
  5804. @example
  5805. gradfun=radius=8
  5806. @end example
  5807. @end itemize
  5808. @anchor{haldclut}
  5809. @section haldclut
  5810. Apply a Hald CLUT to a video stream.
  5811. First input is the video stream to process, and second one is the Hald CLUT.
  5812. The Hald CLUT input can be a simple picture or a complete video stream.
  5813. The filter accepts the following options:
  5814. @table @option
  5815. @item shortest
  5816. Force termination when the shortest input terminates. Default is @code{0}.
  5817. @item repeatlast
  5818. Continue applying the last CLUT after the end of the stream. A value of
  5819. @code{0} disable the filter after the last frame of the CLUT is reached.
  5820. Default is @code{1}.
  5821. @end table
  5822. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  5823. filters share the same internals).
  5824. More information about the Hald CLUT can be found on Eskil Steenberg's website
  5825. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  5826. @subsection Workflow examples
  5827. @subsubsection Hald CLUT video stream
  5828. Generate an identity Hald CLUT stream altered with various effects:
  5829. @example
  5830. 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
  5831. @end example
  5832. Note: make sure you use a lossless codec.
  5833. Then use it with @code{haldclut} to apply it on some random stream:
  5834. @example
  5835. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  5836. @end example
  5837. The Hald CLUT will be applied to the 10 first seconds (duration of
  5838. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  5839. to the remaining frames of the @code{mandelbrot} stream.
  5840. @subsubsection Hald CLUT with preview
  5841. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  5842. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  5843. biggest possible square starting at the top left of the picture. The remaining
  5844. padding pixels (bottom or right) will be ignored. This area can be used to add
  5845. a preview of the Hald CLUT.
  5846. Typically, the following generated Hald CLUT will be supported by the
  5847. @code{haldclut} filter:
  5848. @example
  5849. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  5850. pad=iw+320 [padded_clut];
  5851. smptebars=s=320x256, split [a][b];
  5852. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  5853. [main][b] overlay=W-320" -frames:v 1 clut.png
  5854. @end example
  5855. It contains the original and a preview of the effect of the CLUT: SMPTE color
  5856. bars are displayed on the right-top, and below the same color bars processed by
  5857. the color changes.
  5858. Then, the effect of this Hald CLUT can be visualized with:
  5859. @example
  5860. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  5861. @end example
  5862. @section hflip
  5863. Flip the input video horizontally.
  5864. For example, to horizontally flip the input video with @command{ffmpeg}:
  5865. @example
  5866. ffmpeg -i in.avi -vf "hflip" out.avi
  5867. @end example
  5868. @section histeq
  5869. This filter applies a global color histogram equalization on a
  5870. per-frame basis.
  5871. It can be used to correct video that has a compressed range of pixel
  5872. intensities. The filter redistributes the pixel intensities to
  5873. equalize their distribution across the intensity range. It may be
  5874. viewed as an "automatically adjusting contrast filter". This filter is
  5875. useful only for correcting degraded or poorly captured source
  5876. video.
  5877. The filter accepts the following options:
  5878. @table @option
  5879. @item strength
  5880. Determine the amount of equalization to be applied. As the strength
  5881. is reduced, the distribution of pixel intensities more-and-more
  5882. approaches that of the input frame. The value must be a float number
  5883. in the range [0,1] and defaults to 0.200.
  5884. @item intensity
  5885. Set the maximum intensity that can generated and scale the output
  5886. values appropriately. The strength should be set as desired and then
  5887. the intensity can be limited if needed to avoid washing-out. The value
  5888. must be a float number in the range [0,1] and defaults to 0.210.
  5889. @item antibanding
  5890. Set the antibanding level. If enabled the filter will randomly vary
  5891. the luminance of output pixels by a small amount to avoid banding of
  5892. the histogram. Possible values are @code{none}, @code{weak} or
  5893. @code{strong}. It defaults to @code{none}.
  5894. @end table
  5895. @section histogram
  5896. Compute and draw a color distribution histogram for the input video.
  5897. The computed histogram is a representation of the color component
  5898. distribution in an image.
  5899. Standard histogram displays the color components distribution in an image.
  5900. Displays color graph for each color component. Shows distribution of
  5901. the Y, U, V, A or R, G, B components, depending on input format, in the
  5902. current frame. Below each graph a color component scale meter is shown.
  5903. The filter accepts the following options:
  5904. @table @option
  5905. @item level_height
  5906. Set height of level. Default value is @code{200}.
  5907. Allowed range is [50, 2048].
  5908. @item scale_height
  5909. Set height of color scale. Default value is @code{12}.
  5910. Allowed range is [0, 40].
  5911. @item display_mode
  5912. Set display mode.
  5913. It accepts the following values:
  5914. @table @samp
  5915. @item parade
  5916. Per color component graphs are placed below each other.
  5917. @item overlay
  5918. Presents information identical to that in the @code{parade}, except
  5919. that the graphs representing color components are superimposed directly
  5920. over one another.
  5921. @end table
  5922. Default is @code{parade}.
  5923. @item levels_mode
  5924. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  5925. Default is @code{linear}.
  5926. @item components
  5927. Set what color components to display.
  5928. Default is @code{7}.
  5929. @end table
  5930. @subsection Examples
  5931. @itemize
  5932. @item
  5933. Calculate and draw histogram:
  5934. @example
  5935. ffplay -i input -vf histogram
  5936. @end example
  5937. @end itemize
  5938. @anchor{hqdn3d}
  5939. @section hqdn3d
  5940. This is a high precision/quality 3d denoise filter. It aims to reduce
  5941. image noise, producing smooth images and making still images really
  5942. still. It should enhance compressibility.
  5943. It accepts the following optional parameters:
  5944. @table @option
  5945. @item luma_spatial
  5946. A non-negative floating point number which specifies spatial luma strength.
  5947. It defaults to 4.0.
  5948. @item chroma_spatial
  5949. A non-negative floating point number which specifies spatial chroma strength.
  5950. It defaults to 3.0*@var{luma_spatial}/4.0.
  5951. @item luma_tmp
  5952. A floating point number which specifies luma temporal strength. It defaults to
  5953. 6.0*@var{luma_spatial}/4.0.
  5954. @item chroma_tmp
  5955. A floating point number which specifies chroma temporal strength. It defaults to
  5956. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  5957. @end table
  5958. @section hqx
  5959. Apply a high-quality magnification filter designed for pixel art. This filter
  5960. was originally created by Maxim Stepin.
  5961. It accepts the following option:
  5962. @table @option
  5963. @item n
  5964. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  5965. @code{hq3x} and @code{4} for @code{hq4x}.
  5966. Default is @code{3}.
  5967. @end table
  5968. @section hstack
  5969. Stack input videos horizontally.
  5970. All streams must be of same pixel format and of same height.
  5971. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  5972. to create same output.
  5973. The filter accept the following option:
  5974. @table @option
  5975. @item inputs
  5976. Set number of input streams. Default is 2.
  5977. @item shortest
  5978. If set to 1, force the output to terminate when the shortest input
  5979. terminates. Default value is 0.
  5980. @end table
  5981. @section hue
  5982. Modify the hue and/or the saturation of the input.
  5983. It accepts the following parameters:
  5984. @table @option
  5985. @item h
  5986. Specify the hue angle as a number of degrees. It accepts an expression,
  5987. and defaults to "0".
  5988. @item s
  5989. Specify the saturation in the [-10,10] range. It accepts an expression and
  5990. defaults to "1".
  5991. @item H
  5992. Specify the hue angle as a number of radians. It accepts an
  5993. expression, and defaults to "0".
  5994. @item b
  5995. Specify the brightness in the [-10,10] range. It accepts an expression and
  5996. defaults to "0".
  5997. @end table
  5998. @option{h} and @option{H} are mutually exclusive, and can't be
  5999. specified at the same time.
  6000. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  6001. expressions containing the following constants:
  6002. @table @option
  6003. @item n
  6004. frame count of the input frame starting from 0
  6005. @item pts
  6006. presentation timestamp of the input frame expressed in time base units
  6007. @item r
  6008. frame rate of the input video, NAN if the input frame rate is unknown
  6009. @item t
  6010. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6011. @item tb
  6012. time base of the input video
  6013. @end table
  6014. @subsection Examples
  6015. @itemize
  6016. @item
  6017. Set the hue to 90 degrees and the saturation to 1.0:
  6018. @example
  6019. hue=h=90:s=1
  6020. @end example
  6021. @item
  6022. Same command but expressing the hue in radians:
  6023. @example
  6024. hue=H=PI/2:s=1
  6025. @end example
  6026. @item
  6027. Rotate hue and make the saturation swing between 0
  6028. and 2 over a period of 1 second:
  6029. @example
  6030. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  6031. @end example
  6032. @item
  6033. Apply a 3 seconds saturation fade-in effect starting at 0:
  6034. @example
  6035. hue="s=min(t/3\,1)"
  6036. @end example
  6037. The general fade-in expression can be written as:
  6038. @example
  6039. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  6040. @end example
  6041. @item
  6042. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  6043. @example
  6044. hue="s=max(0\, min(1\, (8-t)/3))"
  6045. @end example
  6046. The general fade-out expression can be written as:
  6047. @example
  6048. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  6049. @end example
  6050. @end itemize
  6051. @subsection Commands
  6052. This filter supports the following commands:
  6053. @table @option
  6054. @item b
  6055. @item s
  6056. @item h
  6057. @item H
  6058. Modify the hue and/or the saturation and/or brightness of the input video.
  6059. The command accepts the same syntax of the corresponding option.
  6060. If the specified expression is not valid, it is kept at its current
  6061. value.
  6062. @end table
  6063. @section idet
  6064. Detect video interlacing type.
  6065. This filter tries to detect if the input frames as interlaced, progressive,
  6066. top or bottom field first. It will also try and detect fields that are
  6067. repeated between adjacent frames (a sign of telecine).
  6068. Single frame detection considers only immediately adjacent frames when classifying each frame.
  6069. Multiple frame detection incorporates the classification history of previous frames.
  6070. The filter will log these metadata values:
  6071. @table @option
  6072. @item single.current_frame
  6073. Detected type of current frame using single-frame detection. One of:
  6074. ``tff'' (top field first), ``bff'' (bottom field first),
  6075. ``progressive'', or ``undetermined''
  6076. @item single.tff
  6077. Cumulative number of frames detected as top field first using single-frame detection.
  6078. @item multiple.tff
  6079. Cumulative number of frames detected as top field first using multiple-frame detection.
  6080. @item single.bff
  6081. Cumulative number of frames detected as bottom field first using single-frame detection.
  6082. @item multiple.current_frame
  6083. Detected type of current frame using multiple-frame detection. One of:
  6084. ``tff'' (top field first), ``bff'' (bottom field first),
  6085. ``progressive'', or ``undetermined''
  6086. @item multiple.bff
  6087. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  6088. @item single.progressive
  6089. Cumulative number of frames detected as progressive using single-frame detection.
  6090. @item multiple.progressive
  6091. Cumulative number of frames detected as progressive using multiple-frame detection.
  6092. @item single.undetermined
  6093. Cumulative number of frames that could not be classified using single-frame detection.
  6094. @item multiple.undetermined
  6095. Cumulative number of frames that could not be classified using multiple-frame detection.
  6096. @item repeated.current_frame
  6097. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  6098. @item repeated.neither
  6099. Cumulative number of frames with no repeated field.
  6100. @item repeated.top
  6101. Cumulative number of frames with the top field repeated from the previous frame's top field.
  6102. @item repeated.bottom
  6103. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  6104. @end table
  6105. The filter accepts the following options:
  6106. @table @option
  6107. @item intl_thres
  6108. Set interlacing threshold.
  6109. @item prog_thres
  6110. Set progressive threshold.
  6111. @item repeat_thres
  6112. Threshold for repeated field detection.
  6113. @item half_life
  6114. Number of frames after which a given frame's contribution to the
  6115. statistics is halved (i.e., it contributes only 0.5 to it's
  6116. classification). The default of 0 means that all frames seen are given
  6117. full weight of 1.0 forever.
  6118. @item analyze_interlaced_flag
  6119. When this is not 0 then idet will use the specified number of frames to determine
  6120. if the interlaced flag is accurate, it will not count undetermined frames.
  6121. If the flag is found to be accurate it will be used without any further
  6122. computations, if it is found to be inaccurate it will be cleared without any
  6123. further computations. This allows inserting the idet filter as a low computational
  6124. method to clean up the interlaced flag
  6125. @end table
  6126. @section il
  6127. Deinterleave or interleave fields.
  6128. This filter allows one to process interlaced images fields without
  6129. deinterlacing them. Deinterleaving splits the input frame into 2
  6130. fields (so called half pictures). Odd lines are moved to the top
  6131. half of the output image, even lines to the bottom half.
  6132. You can process (filter) them independently and then re-interleave them.
  6133. The filter accepts the following options:
  6134. @table @option
  6135. @item luma_mode, l
  6136. @item chroma_mode, c
  6137. @item alpha_mode, a
  6138. Available values for @var{luma_mode}, @var{chroma_mode} and
  6139. @var{alpha_mode} are:
  6140. @table @samp
  6141. @item none
  6142. Do nothing.
  6143. @item deinterleave, d
  6144. Deinterleave fields, placing one above the other.
  6145. @item interleave, i
  6146. Interleave fields. Reverse the effect of deinterleaving.
  6147. @end table
  6148. Default value is @code{none}.
  6149. @item luma_swap, ls
  6150. @item chroma_swap, cs
  6151. @item alpha_swap, as
  6152. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  6153. @end table
  6154. @section inflate
  6155. Apply inflate effect to the video.
  6156. This filter replaces the pixel by the local(3x3) average by taking into account
  6157. only values higher than the pixel.
  6158. It accepts the following options:
  6159. @table @option
  6160. @item threshold0
  6161. @item threshold1
  6162. @item threshold2
  6163. @item threshold3
  6164. Limit the maximum change for each plane, default is 65535.
  6165. If 0, plane will remain unchanged.
  6166. @end table
  6167. @section interlace
  6168. Simple interlacing filter from progressive contents. This interleaves upper (or
  6169. lower) lines from odd frames with lower (or upper) lines from even frames,
  6170. halving the frame rate and preserving image height.
  6171. @example
  6172. Original Original New Frame
  6173. Frame 'j' Frame 'j+1' (tff)
  6174. ========== =========== ==================
  6175. Line 0 --------------------> Frame 'j' Line 0
  6176. Line 1 Line 1 ----> Frame 'j+1' Line 1
  6177. Line 2 ---------------------> Frame 'j' Line 2
  6178. Line 3 Line 3 ----> Frame 'j+1' Line 3
  6179. ... ... ...
  6180. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  6181. @end example
  6182. It accepts the following optional parameters:
  6183. @table @option
  6184. @item scan
  6185. This determines whether the interlaced frame is taken from the even
  6186. (tff - default) or odd (bff) lines of the progressive frame.
  6187. @item lowpass
  6188. Enable (default) or disable the vertical lowpass filter to avoid twitter
  6189. interlacing and reduce moire patterns.
  6190. @end table
  6191. @section kerndeint
  6192. Deinterlace input video by applying Donald Graft's adaptive kernel
  6193. deinterling. Work on interlaced parts of a video to produce
  6194. progressive frames.
  6195. The description of the accepted parameters follows.
  6196. @table @option
  6197. @item thresh
  6198. Set the threshold which affects the filter's tolerance when
  6199. determining if a pixel line must be processed. It must be an integer
  6200. in the range [0,255] and defaults to 10. A value of 0 will result in
  6201. applying the process on every pixels.
  6202. @item map
  6203. Paint pixels exceeding the threshold value to white if set to 1.
  6204. Default is 0.
  6205. @item order
  6206. Set the fields order. Swap fields if set to 1, leave fields alone if
  6207. 0. Default is 0.
  6208. @item sharp
  6209. Enable additional sharpening if set to 1. Default is 0.
  6210. @item twoway
  6211. Enable twoway sharpening if set to 1. Default is 0.
  6212. @end table
  6213. @subsection Examples
  6214. @itemize
  6215. @item
  6216. Apply default values:
  6217. @example
  6218. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  6219. @end example
  6220. @item
  6221. Enable additional sharpening:
  6222. @example
  6223. kerndeint=sharp=1
  6224. @end example
  6225. @item
  6226. Paint processed pixels in white:
  6227. @example
  6228. kerndeint=map=1
  6229. @end example
  6230. @end itemize
  6231. @section lenscorrection
  6232. Correct radial lens distortion
  6233. This filter can be used to correct for radial distortion as can result from the use
  6234. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  6235. one can use tools available for example as part of opencv or simply trial-and-error.
  6236. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  6237. and extract the k1 and k2 coefficients from the resulting matrix.
  6238. Note that effectively the same filter is available in the open-source tools Krita and
  6239. Digikam from the KDE project.
  6240. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  6241. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  6242. brightness distribution, so you may want to use both filters together in certain
  6243. cases, though you will have to take care of ordering, i.e. whether vignetting should
  6244. be applied before or after lens correction.
  6245. @subsection Options
  6246. The filter accepts the following options:
  6247. @table @option
  6248. @item cx
  6249. Relative x-coordinate of the focal point of the image, and thereby the center of the
  6250. distortion. This value has a range [0,1] and is expressed as fractions of the image
  6251. width.
  6252. @item cy
  6253. Relative y-coordinate of the focal point of the image, and thereby the center of the
  6254. distortion. This value has a range [0,1] and is expressed as fractions of the image
  6255. height.
  6256. @item k1
  6257. Coefficient of the quadratic correction term. 0.5 means no correction.
  6258. @item k2
  6259. Coefficient of the double quadratic correction term. 0.5 means no correction.
  6260. @end table
  6261. The formula that generates the correction is:
  6262. @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)
  6263. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  6264. distances from the focal point in the source and target images, respectively.
  6265. @anchor{lut3d}
  6266. @section lut3d
  6267. Apply a 3D LUT to an input video.
  6268. The filter accepts the following options:
  6269. @table @option
  6270. @item file
  6271. Set the 3D LUT file name.
  6272. Currently supported formats:
  6273. @table @samp
  6274. @item 3dl
  6275. AfterEffects
  6276. @item cube
  6277. Iridas
  6278. @item dat
  6279. DaVinci
  6280. @item m3d
  6281. Pandora
  6282. @end table
  6283. @item interp
  6284. Select interpolation mode.
  6285. Available values are:
  6286. @table @samp
  6287. @item nearest
  6288. Use values from the nearest defined point.
  6289. @item trilinear
  6290. Interpolate values using the 8 points defining a cube.
  6291. @item tetrahedral
  6292. Interpolate values using a tetrahedron.
  6293. @end table
  6294. @end table
  6295. @section lut, lutrgb, lutyuv
  6296. Compute a look-up table for binding each pixel component input value
  6297. to an output value, and apply it to the input video.
  6298. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  6299. to an RGB input video.
  6300. These filters accept the following parameters:
  6301. @table @option
  6302. @item c0
  6303. set first pixel component expression
  6304. @item c1
  6305. set second pixel component expression
  6306. @item c2
  6307. set third pixel component expression
  6308. @item c3
  6309. set fourth pixel component expression, corresponds to the alpha component
  6310. @item r
  6311. set red component expression
  6312. @item g
  6313. set green component expression
  6314. @item b
  6315. set blue component expression
  6316. @item a
  6317. alpha component expression
  6318. @item y
  6319. set Y/luminance component expression
  6320. @item u
  6321. set U/Cb component expression
  6322. @item v
  6323. set V/Cr component expression
  6324. @end table
  6325. Each of them specifies the expression to use for computing the lookup table for
  6326. the corresponding pixel component values.
  6327. The exact component associated to each of the @var{c*} options depends on the
  6328. format in input.
  6329. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  6330. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  6331. The expressions can contain the following constants and functions:
  6332. @table @option
  6333. @item w
  6334. @item h
  6335. The input width and height.
  6336. @item val
  6337. The input value for the pixel component.
  6338. @item clipval
  6339. The input value, clipped to the @var{minval}-@var{maxval} range.
  6340. @item maxval
  6341. The maximum value for the pixel component.
  6342. @item minval
  6343. The minimum value for the pixel component.
  6344. @item negval
  6345. The negated value for the pixel component value, clipped to the
  6346. @var{minval}-@var{maxval} range; it corresponds to the expression
  6347. "maxval-clipval+minval".
  6348. @item clip(val)
  6349. The computed value in @var{val}, clipped to the
  6350. @var{minval}-@var{maxval} range.
  6351. @item gammaval(gamma)
  6352. The computed gamma correction value of the pixel component value,
  6353. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  6354. expression
  6355. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  6356. @end table
  6357. All expressions default to "val".
  6358. @subsection Examples
  6359. @itemize
  6360. @item
  6361. Negate input video:
  6362. @example
  6363. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  6364. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  6365. @end example
  6366. The above is the same as:
  6367. @example
  6368. lutrgb="r=negval:g=negval:b=negval"
  6369. lutyuv="y=negval:u=negval:v=negval"
  6370. @end example
  6371. @item
  6372. Negate luminance:
  6373. @example
  6374. lutyuv=y=negval
  6375. @end example
  6376. @item
  6377. Remove chroma components, turning the video into a graytone image:
  6378. @example
  6379. lutyuv="u=128:v=128"
  6380. @end example
  6381. @item
  6382. Apply a luma burning effect:
  6383. @example
  6384. lutyuv="y=2*val"
  6385. @end example
  6386. @item
  6387. Remove green and blue components:
  6388. @example
  6389. lutrgb="g=0:b=0"
  6390. @end example
  6391. @item
  6392. Set a constant alpha channel value on input:
  6393. @example
  6394. format=rgba,lutrgb=a="maxval-minval/2"
  6395. @end example
  6396. @item
  6397. Correct luminance gamma by a factor of 0.5:
  6398. @example
  6399. lutyuv=y=gammaval(0.5)
  6400. @end example
  6401. @item
  6402. Discard least significant bits of luma:
  6403. @example
  6404. lutyuv=y='bitand(val, 128+64+32)'
  6405. @end example
  6406. @end itemize
  6407. @section maskedmerge
  6408. Merge the first input stream with the second input stream using per pixel
  6409. weights in the third input stream.
  6410. A value of 0 in the third stream pixel component means that pixel component
  6411. from first stream is returned unchanged, while maximum value (eg. 255 for
  6412. 8-bit videos) means that pixel component from second stream is returned
  6413. unchanged. Intermediate values define the amount of merging between both
  6414. input stream's pixel components.
  6415. This filter accepts the following options:
  6416. @table @option
  6417. @item planes
  6418. Set which planes will be processed as bitmap, unprocessed planes will be
  6419. copied from first stream.
  6420. By default value 0xf, all planes will be processed.
  6421. @end table
  6422. @section mcdeint
  6423. Apply motion-compensation deinterlacing.
  6424. It needs one field per frame as input and must thus be used together
  6425. with yadif=1/3 or equivalent.
  6426. This filter accepts the following options:
  6427. @table @option
  6428. @item mode
  6429. Set the deinterlacing mode.
  6430. It accepts one of the following values:
  6431. @table @samp
  6432. @item fast
  6433. @item medium
  6434. @item slow
  6435. use iterative motion estimation
  6436. @item extra_slow
  6437. like @samp{slow}, but use multiple reference frames.
  6438. @end table
  6439. Default value is @samp{fast}.
  6440. @item parity
  6441. Set the picture field parity assumed for the input video. It must be
  6442. one of the following values:
  6443. @table @samp
  6444. @item 0, tff
  6445. assume top field first
  6446. @item 1, bff
  6447. assume bottom field first
  6448. @end table
  6449. Default value is @samp{bff}.
  6450. @item qp
  6451. Set per-block quantization parameter (QP) used by the internal
  6452. encoder.
  6453. Higher values should result in a smoother motion vector field but less
  6454. optimal individual vectors. Default value is 1.
  6455. @end table
  6456. @section mergeplanes
  6457. Merge color channel components from several video streams.
  6458. The filter accepts up to 4 input streams, and merge selected input
  6459. planes to the output video.
  6460. This filter accepts the following options:
  6461. @table @option
  6462. @item mapping
  6463. Set input to output plane mapping. Default is @code{0}.
  6464. The mappings is specified as a bitmap. It should be specified as a
  6465. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  6466. mapping for the first plane of the output stream. 'A' sets the number of
  6467. the input stream to use (from 0 to 3), and 'a' the plane number of the
  6468. corresponding input to use (from 0 to 3). The rest of the mappings is
  6469. similar, 'Bb' describes the mapping for the output stream second
  6470. plane, 'Cc' describes the mapping for the output stream third plane and
  6471. 'Dd' describes the mapping for the output stream fourth plane.
  6472. @item format
  6473. Set output pixel format. Default is @code{yuva444p}.
  6474. @end table
  6475. @subsection Examples
  6476. @itemize
  6477. @item
  6478. Merge three gray video streams of same width and height into single video stream:
  6479. @example
  6480. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  6481. @end example
  6482. @item
  6483. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  6484. @example
  6485. [a0][a1]mergeplanes=0x00010210:yuva444p
  6486. @end example
  6487. @item
  6488. Swap Y and A plane in yuva444p stream:
  6489. @example
  6490. format=yuva444p,mergeplanes=0x03010200:yuva444p
  6491. @end example
  6492. @item
  6493. Swap U and V plane in yuv420p stream:
  6494. @example
  6495. format=yuv420p,mergeplanes=0x000201:yuv420p
  6496. @end example
  6497. @item
  6498. Cast a rgb24 clip to yuv444p:
  6499. @example
  6500. format=rgb24,mergeplanes=0x000102:yuv444p
  6501. @end example
  6502. @end itemize
  6503. @section metadata, ametadata
  6504. Manipulate frame metadata.
  6505. This filter accepts the following options:
  6506. @table @option
  6507. @item mode
  6508. Set mode of operation of the filter.
  6509. Can be one of the following:
  6510. @table @samp
  6511. @item select
  6512. If both @code{value} and @code{key} is set, select frames
  6513. which have such metadata. If only @code{key} is set, select
  6514. every frame that has such key in metadata.
  6515. @item add
  6516. Add new metadata @code{key} and @code{value}. If key is already available
  6517. do nothing.
  6518. @item modify
  6519. Modify value of already present key.
  6520. @item delete
  6521. If @code{value} is set, delete only keys that have such value.
  6522. Otherwise, delete key.
  6523. @item print
  6524. Print key and its value if metadata was found. If @code{key} is not set print all
  6525. metadata values available in frame.
  6526. @end table
  6527. @item key
  6528. Set key used with all modes. Must be set for all modes except @code{print}.
  6529. @item value
  6530. Set metadata value which will be used. This option is mandatory for
  6531. @code{modify} and @code{add} mode.
  6532. @item function
  6533. Which function to use when comparing metadata value and @code{value}.
  6534. Can be one of following:
  6535. @table @samp
  6536. @item same_str
  6537. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  6538. @item starts_with
  6539. Values are interpreted as strings, returns true if metadata value starts with
  6540. the @code{value} option string.
  6541. @item less
  6542. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  6543. @item equal
  6544. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  6545. @item greater
  6546. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  6547. @item expr
  6548. Values are interpreted as floats, returns true if expression from option @code{expr}
  6549. evaluates to true.
  6550. @end table
  6551. @item expr
  6552. Set expression which is used when @code{function} is set to @code{expr}.
  6553. The expression is evaluated through the eval API and can contain the following
  6554. constants:
  6555. @table @option
  6556. @item VALUE1
  6557. Float representation of @code{value} from metadata key.
  6558. @item VALUE2
  6559. Float representation of @code{value} as supplied by user in @code{value} option.
  6560. @end table
  6561. @item file
  6562. If specified in @code{print} mode, output is written to the named file. When
  6563. filename equals "-" data is written to standard output.
  6564. If @code{file} option is not set, output is written to the log with AV_LOG_INFO
  6565. loglevel.
  6566. @end table
  6567. @subsection Examples
  6568. @itemize
  6569. @item
  6570. Print all metadata values for frames with key @code{lavfi.singnalstats.YDIF} with values
  6571. between 0 and 1.
  6572. @example
  6573. @end example
  6574. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  6575. @end itemize
  6576. @section mpdecimate
  6577. Drop frames that do not differ greatly from the previous frame in
  6578. order to reduce frame rate.
  6579. The main use of this filter is for very-low-bitrate encoding
  6580. (e.g. streaming over dialup modem), but it could in theory be used for
  6581. fixing movies that were inverse-telecined incorrectly.
  6582. A description of the accepted options follows.
  6583. @table @option
  6584. @item max
  6585. Set the maximum number of consecutive frames which can be dropped (if
  6586. positive), or the minimum interval between dropped frames (if
  6587. negative). If the value is 0, the frame is dropped unregarding the
  6588. number of previous sequentially dropped frames.
  6589. Default value is 0.
  6590. @item hi
  6591. @item lo
  6592. @item frac
  6593. Set the dropping threshold values.
  6594. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  6595. represent actual pixel value differences, so a threshold of 64
  6596. corresponds to 1 unit of difference for each pixel, or the same spread
  6597. out differently over the block.
  6598. A frame is a candidate for dropping if no 8x8 blocks differ by more
  6599. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  6600. meaning the whole image) differ by more than a threshold of @option{lo}.
  6601. Default value for @option{hi} is 64*12, default value for @option{lo} is
  6602. 64*5, and default value for @option{frac} is 0.33.
  6603. @end table
  6604. @section negate
  6605. Negate input video.
  6606. It accepts an integer in input; if non-zero it negates the
  6607. alpha component (if available). The default value in input is 0.
  6608. @section nnedi
  6609. Deinterlace video using neural network edge directed interpolation.
  6610. This filter accepts the following options:
  6611. @table @option
  6612. @item weights
  6613. Mandatory option, without binary file filter can not work.
  6614. Currently file can be found here:
  6615. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  6616. @item deint
  6617. Set which frames to deinterlace, by default it is @code{all}.
  6618. Can be @code{all} or @code{interlaced}.
  6619. @item field
  6620. Set mode of operation.
  6621. Can be one of the following:
  6622. @table @samp
  6623. @item af
  6624. Use frame flags, both fields.
  6625. @item a
  6626. Use frame flags, single field.
  6627. @item t
  6628. Use top field only.
  6629. @item b
  6630. Use bottom field only.
  6631. @item ft
  6632. Use both fields, top first.
  6633. @item fb
  6634. Use both fields, bottom first.
  6635. @end table
  6636. @item planes
  6637. Set which planes to process, by default filter process all frames.
  6638. @item nsize
  6639. Set size of local neighborhood around each pixel, used by the predictor neural
  6640. network.
  6641. Can be one of the following:
  6642. @table @samp
  6643. @item s8x6
  6644. @item s16x6
  6645. @item s32x6
  6646. @item s48x6
  6647. @item s8x4
  6648. @item s16x4
  6649. @item s32x4
  6650. @end table
  6651. @item nns
  6652. Set the number of neurons in predicctor neural network.
  6653. Can be one of the following:
  6654. @table @samp
  6655. @item n16
  6656. @item n32
  6657. @item n64
  6658. @item n128
  6659. @item n256
  6660. @end table
  6661. @item qual
  6662. Controls the number of different neural network predictions that are blended
  6663. together to compute the final output value. Can be @code{fast}, default or
  6664. @code{slow}.
  6665. @item etype
  6666. Set which set of weights to use in the predictor.
  6667. Can be one of the following:
  6668. @table @samp
  6669. @item a
  6670. weights trained to minimize absolute error
  6671. @item s
  6672. weights trained to minimize squared error
  6673. @end table
  6674. @item pscrn
  6675. Controls whether or not the prescreener neural network is used to decide
  6676. which pixels should be processed by the predictor neural network and which
  6677. can be handled by simple cubic interpolation.
  6678. The prescreener is trained to know whether cubic interpolation will be
  6679. sufficient for a pixel or whether it should be predicted by the predictor nn.
  6680. The computational complexity of the prescreener nn is much less than that of
  6681. the predictor nn. Since most pixels can be handled by cubic interpolation,
  6682. using the prescreener generally results in much faster processing.
  6683. The prescreener is pretty accurate, so the difference between using it and not
  6684. using it is almost always unnoticeable.
  6685. Can be one of the following:
  6686. @table @samp
  6687. @item none
  6688. @item original
  6689. @item new
  6690. @end table
  6691. Default is @code{new}.
  6692. @item fapprox
  6693. Set various debugging flags.
  6694. @end table
  6695. @section noformat
  6696. Force libavfilter not to use any of the specified pixel formats for the
  6697. input to the next filter.
  6698. It accepts the following parameters:
  6699. @table @option
  6700. @item pix_fmts
  6701. A '|'-separated list of pixel format names, such as
  6702. apix_fmts=yuv420p|monow|rgb24".
  6703. @end table
  6704. @subsection Examples
  6705. @itemize
  6706. @item
  6707. Force libavfilter to use a format different from @var{yuv420p} for the
  6708. input to the vflip filter:
  6709. @example
  6710. noformat=pix_fmts=yuv420p,vflip
  6711. @end example
  6712. @item
  6713. Convert the input video to any of the formats not contained in the list:
  6714. @example
  6715. noformat=yuv420p|yuv444p|yuv410p
  6716. @end example
  6717. @end itemize
  6718. @section noise
  6719. Add noise on video input frame.
  6720. The filter accepts the following options:
  6721. @table @option
  6722. @item all_seed
  6723. @item c0_seed
  6724. @item c1_seed
  6725. @item c2_seed
  6726. @item c3_seed
  6727. Set noise seed for specific pixel component or all pixel components in case
  6728. of @var{all_seed}. Default value is @code{123457}.
  6729. @item all_strength, alls
  6730. @item c0_strength, c0s
  6731. @item c1_strength, c1s
  6732. @item c2_strength, c2s
  6733. @item c3_strength, c3s
  6734. Set noise strength for specific pixel component or all pixel components in case
  6735. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  6736. @item all_flags, allf
  6737. @item c0_flags, c0f
  6738. @item c1_flags, c1f
  6739. @item c2_flags, c2f
  6740. @item c3_flags, c3f
  6741. Set pixel component flags or set flags for all components if @var{all_flags}.
  6742. Available values for component flags are:
  6743. @table @samp
  6744. @item a
  6745. averaged temporal noise (smoother)
  6746. @item p
  6747. mix random noise with a (semi)regular pattern
  6748. @item t
  6749. temporal noise (noise pattern changes between frames)
  6750. @item u
  6751. uniform noise (gaussian otherwise)
  6752. @end table
  6753. @end table
  6754. @subsection Examples
  6755. Add temporal and uniform noise to input video:
  6756. @example
  6757. noise=alls=20:allf=t+u
  6758. @end example
  6759. @section null
  6760. Pass the video source unchanged to the output.
  6761. @section ocr
  6762. Optical Character Recognition
  6763. This filter uses Tesseract for optical character recognition.
  6764. It accepts the following options:
  6765. @table @option
  6766. @item datapath
  6767. Set datapath to tesseract data. Default is to use whatever was
  6768. set at installation.
  6769. @item language
  6770. Set language, default is "eng".
  6771. @item whitelist
  6772. Set character whitelist.
  6773. @item blacklist
  6774. Set character blacklist.
  6775. @end table
  6776. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  6777. @section ocv
  6778. Apply a video transform using libopencv.
  6779. To enable this filter, install the libopencv library and headers and
  6780. configure FFmpeg with @code{--enable-libopencv}.
  6781. It accepts the following parameters:
  6782. @table @option
  6783. @item filter_name
  6784. The name of the libopencv filter to apply.
  6785. @item filter_params
  6786. The parameters to pass to the libopencv filter. If not specified, the default
  6787. values are assumed.
  6788. @end table
  6789. Refer to the official libopencv documentation for more precise
  6790. information:
  6791. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  6792. Several libopencv filters are supported; see the following subsections.
  6793. @anchor{dilate}
  6794. @subsection dilate
  6795. Dilate an image by using a specific structuring element.
  6796. It corresponds to the libopencv function @code{cvDilate}.
  6797. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  6798. @var{struct_el} represents a structuring element, and has the syntax:
  6799. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  6800. @var{cols} and @var{rows} represent the number of columns and rows of
  6801. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  6802. point, and @var{shape} the shape for the structuring element. @var{shape}
  6803. must be "rect", "cross", "ellipse", or "custom".
  6804. If the value for @var{shape} is "custom", it must be followed by a
  6805. string of the form "=@var{filename}". The file with name
  6806. @var{filename} is assumed to represent a binary image, with each
  6807. printable character corresponding to a bright pixel. When a custom
  6808. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  6809. or columns and rows of the read file are assumed instead.
  6810. The default value for @var{struct_el} is "3x3+0x0/rect".
  6811. @var{nb_iterations} specifies the number of times the transform is
  6812. applied to the image, and defaults to 1.
  6813. Some examples:
  6814. @example
  6815. # Use the default values
  6816. ocv=dilate
  6817. # Dilate using a structuring element with a 5x5 cross, iterating two times
  6818. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  6819. # Read the shape from the file diamond.shape, iterating two times.
  6820. # The file diamond.shape may contain a pattern of characters like this
  6821. # *
  6822. # ***
  6823. # *****
  6824. # ***
  6825. # *
  6826. # The specified columns and rows are ignored
  6827. # but the anchor point coordinates are not
  6828. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  6829. @end example
  6830. @subsection erode
  6831. Erode an image by using a specific structuring element.
  6832. It corresponds to the libopencv function @code{cvErode}.
  6833. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  6834. with the same syntax and semantics as the @ref{dilate} filter.
  6835. @subsection smooth
  6836. Smooth the input video.
  6837. The filter takes the following parameters:
  6838. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  6839. @var{type} is the type of smooth filter to apply, and must be one of
  6840. the following values: "blur", "blur_no_scale", "median", "gaussian",
  6841. or "bilateral". The default value is "gaussian".
  6842. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  6843. depend on the smooth type. @var{param1} and
  6844. @var{param2} accept integer positive values or 0. @var{param3} and
  6845. @var{param4} accept floating point values.
  6846. The default value for @var{param1} is 3. The default value for the
  6847. other parameters is 0.
  6848. These parameters correspond to the parameters assigned to the
  6849. libopencv function @code{cvSmooth}.
  6850. @anchor{overlay}
  6851. @section overlay
  6852. Overlay one video on top of another.
  6853. It takes two inputs and has one output. The first input is the "main"
  6854. video on which the second input is overlaid.
  6855. It accepts the following parameters:
  6856. A description of the accepted options follows.
  6857. @table @option
  6858. @item x
  6859. @item y
  6860. Set the expression for the x and y coordinates of the overlaid video
  6861. on the main video. Default value is "0" for both expressions. In case
  6862. the expression is invalid, it is set to a huge value (meaning that the
  6863. overlay will not be displayed within the output visible area).
  6864. @item eof_action
  6865. The action to take when EOF is encountered on the secondary input; it accepts
  6866. one of the following values:
  6867. @table @option
  6868. @item repeat
  6869. Repeat the last frame (the default).
  6870. @item endall
  6871. End both streams.
  6872. @item pass
  6873. Pass the main input through.
  6874. @end table
  6875. @item eval
  6876. Set when the expressions for @option{x}, and @option{y} are evaluated.
  6877. It accepts the following values:
  6878. @table @samp
  6879. @item init
  6880. only evaluate expressions once during the filter initialization or
  6881. when a command is processed
  6882. @item frame
  6883. evaluate expressions for each incoming frame
  6884. @end table
  6885. Default value is @samp{frame}.
  6886. @item shortest
  6887. If set to 1, force the output to terminate when the shortest input
  6888. terminates. Default value is 0.
  6889. @item format
  6890. Set the format for the output video.
  6891. It accepts the following values:
  6892. @table @samp
  6893. @item yuv420
  6894. force YUV420 output
  6895. @item yuv422
  6896. force YUV422 output
  6897. @item yuv444
  6898. force YUV444 output
  6899. @item rgb
  6900. force RGB output
  6901. @end table
  6902. Default value is @samp{yuv420}.
  6903. @item rgb @emph{(deprecated)}
  6904. If set to 1, force the filter to accept inputs in the RGB
  6905. color space. Default value is 0. This option is deprecated, use
  6906. @option{format} instead.
  6907. @item repeatlast
  6908. If set to 1, force the filter to draw the last overlay frame over the
  6909. main input until the end of the stream. A value of 0 disables this
  6910. behavior. Default value is 1.
  6911. @end table
  6912. The @option{x}, and @option{y} expressions can contain the following
  6913. parameters.
  6914. @table @option
  6915. @item main_w, W
  6916. @item main_h, H
  6917. The main input width and height.
  6918. @item overlay_w, w
  6919. @item overlay_h, h
  6920. The overlay input width and height.
  6921. @item x
  6922. @item y
  6923. The computed values for @var{x} and @var{y}. They are evaluated for
  6924. each new frame.
  6925. @item hsub
  6926. @item vsub
  6927. horizontal and vertical chroma subsample values of the output
  6928. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  6929. @var{vsub} is 1.
  6930. @item n
  6931. the number of input frame, starting from 0
  6932. @item pos
  6933. the position in the file of the input frame, NAN if unknown
  6934. @item t
  6935. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  6936. @end table
  6937. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  6938. when evaluation is done @emph{per frame}, and will evaluate to NAN
  6939. when @option{eval} is set to @samp{init}.
  6940. Be aware that frames are taken from each input video in timestamp
  6941. order, hence, if their initial timestamps differ, it is a good idea
  6942. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  6943. have them begin in the same zero timestamp, as the example for
  6944. the @var{movie} filter does.
  6945. You can chain together more overlays but you should test the
  6946. efficiency of such approach.
  6947. @subsection Commands
  6948. This filter supports the following commands:
  6949. @table @option
  6950. @item x
  6951. @item y
  6952. Modify the x and y of the overlay input.
  6953. The command accepts the same syntax of the corresponding option.
  6954. If the specified expression is not valid, it is kept at its current
  6955. value.
  6956. @end table
  6957. @subsection Examples
  6958. @itemize
  6959. @item
  6960. Draw the overlay at 10 pixels from the bottom right corner of the main
  6961. video:
  6962. @example
  6963. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  6964. @end example
  6965. Using named options the example above becomes:
  6966. @example
  6967. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  6968. @end example
  6969. @item
  6970. Insert a transparent PNG logo in the bottom left corner of the input,
  6971. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  6972. @example
  6973. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  6974. @end example
  6975. @item
  6976. Insert 2 different transparent PNG logos (second logo on bottom
  6977. right corner) using the @command{ffmpeg} tool:
  6978. @example
  6979. 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
  6980. @end example
  6981. @item
  6982. Add a transparent color layer on top of the main video; @code{WxH}
  6983. must specify the size of the main input to the overlay filter:
  6984. @example
  6985. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  6986. @end example
  6987. @item
  6988. Play an original video and a filtered version (here with the deshake
  6989. filter) side by side using the @command{ffplay} tool:
  6990. @example
  6991. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  6992. @end example
  6993. The above command is the same as:
  6994. @example
  6995. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  6996. @end example
  6997. @item
  6998. Make a sliding overlay appearing from the left to the right top part of the
  6999. screen starting since time 2:
  7000. @example
  7001. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  7002. @end example
  7003. @item
  7004. Compose output by putting two input videos side to side:
  7005. @example
  7006. ffmpeg -i left.avi -i right.avi -filter_complex "
  7007. nullsrc=size=200x100 [background];
  7008. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  7009. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  7010. [background][left] overlay=shortest=1 [background+left];
  7011. [background+left][right] overlay=shortest=1:x=100 [left+right]
  7012. "
  7013. @end example
  7014. @item
  7015. Mask 10-20 seconds of a video by applying the delogo filter to a section
  7016. @example
  7017. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  7018. -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]'
  7019. masked.avi
  7020. @end example
  7021. @item
  7022. Chain several overlays in cascade:
  7023. @example
  7024. nullsrc=s=200x200 [bg];
  7025. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  7026. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  7027. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  7028. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  7029. [in3] null, [mid2] overlay=100:100 [out0]
  7030. @end example
  7031. @end itemize
  7032. @section owdenoise
  7033. Apply Overcomplete Wavelet denoiser.
  7034. The filter accepts the following options:
  7035. @table @option
  7036. @item depth
  7037. Set depth.
  7038. Larger depth values will denoise lower frequency components more, but
  7039. slow down filtering.
  7040. Must be an int in the range 8-16, default is @code{8}.
  7041. @item luma_strength, ls
  7042. Set luma strength.
  7043. Must be a double value in the range 0-1000, default is @code{1.0}.
  7044. @item chroma_strength, cs
  7045. Set chroma strength.
  7046. Must be a double value in the range 0-1000, default is @code{1.0}.
  7047. @end table
  7048. @anchor{pad}
  7049. @section pad
  7050. Add paddings to the input image, and place the original input at the
  7051. provided @var{x}, @var{y} coordinates.
  7052. It accepts the following parameters:
  7053. @table @option
  7054. @item width, w
  7055. @item height, h
  7056. Specify an expression for the size of the output image with the
  7057. paddings added. If the value for @var{width} or @var{height} is 0, the
  7058. corresponding input size is used for the output.
  7059. The @var{width} expression can reference the value set by the
  7060. @var{height} expression, and vice versa.
  7061. The default value of @var{width} and @var{height} is 0.
  7062. @item x
  7063. @item y
  7064. Specify the offsets to place the input image at within the padded area,
  7065. with respect to the top/left border of the output image.
  7066. The @var{x} expression can reference the value set by the @var{y}
  7067. expression, and vice versa.
  7068. The default value of @var{x} and @var{y} is 0.
  7069. @item color
  7070. Specify the color of the padded area. For the syntax of this option,
  7071. check the "Color" section in the ffmpeg-utils manual.
  7072. The default value of @var{color} is "black".
  7073. @end table
  7074. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  7075. options are expressions containing the following constants:
  7076. @table @option
  7077. @item in_w
  7078. @item in_h
  7079. The input video width and height.
  7080. @item iw
  7081. @item ih
  7082. These are the same as @var{in_w} and @var{in_h}.
  7083. @item out_w
  7084. @item out_h
  7085. The output width and height (the size of the padded area), as
  7086. specified by the @var{width} and @var{height} expressions.
  7087. @item ow
  7088. @item oh
  7089. These are the same as @var{out_w} and @var{out_h}.
  7090. @item x
  7091. @item y
  7092. The x and y offsets as specified by the @var{x} and @var{y}
  7093. expressions, or NAN if not yet specified.
  7094. @item a
  7095. same as @var{iw} / @var{ih}
  7096. @item sar
  7097. input sample aspect ratio
  7098. @item dar
  7099. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  7100. @item hsub
  7101. @item vsub
  7102. The horizontal and vertical chroma subsample values. For example for the
  7103. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7104. @end table
  7105. @subsection Examples
  7106. @itemize
  7107. @item
  7108. Add paddings with the color "violet" to the input video. The output video
  7109. size is 640x480, and the top-left corner of the input video is placed at
  7110. column 0, row 40
  7111. @example
  7112. pad=640:480:0:40:violet
  7113. @end example
  7114. The example above is equivalent to the following command:
  7115. @example
  7116. pad=width=640:height=480:x=0:y=40:color=violet
  7117. @end example
  7118. @item
  7119. Pad the input to get an output with dimensions increased by 3/2,
  7120. and put the input video at the center of the padded area:
  7121. @example
  7122. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  7123. @end example
  7124. @item
  7125. Pad the input to get a squared output with size equal to the maximum
  7126. value between the input width and height, and put the input video at
  7127. the center of the padded area:
  7128. @example
  7129. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  7130. @end example
  7131. @item
  7132. Pad the input to get a final w/h ratio of 16:9:
  7133. @example
  7134. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  7135. @end example
  7136. @item
  7137. In case of anamorphic video, in order to set the output display aspect
  7138. correctly, it is necessary to use @var{sar} in the expression,
  7139. according to the relation:
  7140. @example
  7141. (ih * X / ih) * sar = output_dar
  7142. X = output_dar / sar
  7143. @end example
  7144. Thus the previous example needs to be modified to:
  7145. @example
  7146. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  7147. @end example
  7148. @item
  7149. Double the output size and put the input video in the bottom-right
  7150. corner of the output padded area:
  7151. @example
  7152. pad="2*iw:2*ih:ow-iw:oh-ih"
  7153. @end example
  7154. @end itemize
  7155. @anchor{palettegen}
  7156. @section palettegen
  7157. Generate one palette for a whole video stream.
  7158. It accepts the following options:
  7159. @table @option
  7160. @item max_colors
  7161. Set the maximum number of colors to quantize in the palette.
  7162. Note: the palette will still contain 256 colors; the unused palette entries
  7163. will be black.
  7164. @item reserve_transparent
  7165. Create a palette of 255 colors maximum and reserve the last one for
  7166. transparency. Reserving the transparency color is useful for GIF optimization.
  7167. If not set, the maximum of colors in the palette will be 256. You probably want
  7168. to disable this option for a standalone image.
  7169. Set by default.
  7170. @item stats_mode
  7171. Set statistics mode.
  7172. It accepts the following values:
  7173. @table @samp
  7174. @item full
  7175. Compute full frame histograms.
  7176. @item diff
  7177. Compute histograms only for the part that differs from previous frame. This
  7178. might be relevant to give more importance to the moving part of your input if
  7179. the background is static.
  7180. @end table
  7181. Default value is @var{full}.
  7182. @end table
  7183. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  7184. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  7185. color quantization of the palette. This information is also visible at
  7186. @var{info} logging level.
  7187. @subsection Examples
  7188. @itemize
  7189. @item
  7190. Generate a representative palette of a given video using @command{ffmpeg}:
  7191. @example
  7192. ffmpeg -i input.mkv -vf palettegen palette.png
  7193. @end example
  7194. @end itemize
  7195. @section paletteuse
  7196. Use a palette to downsample an input video stream.
  7197. The filter takes two inputs: one video stream and a palette. The palette must
  7198. be a 256 pixels image.
  7199. It accepts the following options:
  7200. @table @option
  7201. @item dither
  7202. Select dithering mode. Available algorithms are:
  7203. @table @samp
  7204. @item bayer
  7205. Ordered 8x8 bayer dithering (deterministic)
  7206. @item heckbert
  7207. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  7208. Note: this dithering is sometimes considered "wrong" and is included as a
  7209. reference.
  7210. @item floyd_steinberg
  7211. Floyd and Steingberg dithering (error diffusion)
  7212. @item sierra2
  7213. Frankie Sierra dithering v2 (error diffusion)
  7214. @item sierra2_4a
  7215. Frankie Sierra dithering v2 "Lite" (error diffusion)
  7216. @end table
  7217. Default is @var{sierra2_4a}.
  7218. @item bayer_scale
  7219. When @var{bayer} dithering is selected, this option defines the scale of the
  7220. pattern (how much the crosshatch pattern is visible). A low value means more
  7221. visible pattern for less banding, and higher value means less visible pattern
  7222. at the cost of more banding.
  7223. The option must be an integer value in the range [0,5]. Default is @var{2}.
  7224. @item diff_mode
  7225. If set, define the zone to process
  7226. @table @samp
  7227. @item rectangle
  7228. Only the changing rectangle will be reprocessed. This is similar to GIF
  7229. cropping/offsetting compression mechanism. This option can be useful for speed
  7230. if only a part of the image is changing, and has use cases such as limiting the
  7231. scope of the error diffusal @option{dither} to the rectangle that bounds the
  7232. moving scene (it leads to more deterministic output if the scene doesn't change
  7233. much, and as a result less moving noise and better GIF compression).
  7234. @end table
  7235. Default is @var{none}.
  7236. @end table
  7237. @subsection Examples
  7238. @itemize
  7239. @item
  7240. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  7241. using @command{ffmpeg}:
  7242. @example
  7243. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  7244. @end example
  7245. @end itemize
  7246. @section perspective
  7247. Correct perspective of video not recorded perpendicular to the screen.
  7248. A description of the accepted parameters follows.
  7249. @table @option
  7250. @item x0
  7251. @item y0
  7252. @item x1
  7253. @item y1
  7254. @item x2
  7255. @item y2
  7256. @item x3
  7257. @item y3
  7258. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  7259. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  7260. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  7261. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  7262. then the corners of the source will be sent to the specified coordinates.
  7263. The expressions can use the following variables:
  7264. @table @option
  7265. @item W
  7266. @item H
  7267. the width and height of video frame.
  7268. @end table
  7269. @item interpolation
  7270. Set interpolation for perspective correction.
  7271. It accepts the following values:
  7272. @table @samp
  7273. @item linear
  7274. @item cubic
  7275. @end table
  7276. Default value is @samp{linear}.
  7277. @item sense
  7278. Set interpretation of coordinate options.
  7279. It accepts the following values:
  7280. @table @samp
  7281. @item 0, source
  7282. Send point in the source specified by the given coordinates to
  7283. the corners of the destination.
  7284. @item 1, destination
  7285. Send the corners of the source to the point in the destination specified
  7286. by the given coordinates.
  7287. Default value is @samp{source}.
  7288. @end table
  7289. @end table
  7290. @section phase
  7291. Delay interlaced video by one field time so that the field order changes.
  7292. The intended use is to fix PAL movies that have been captured with the
  7293. opposite field order to the film-to-video transfer.
  7294. A description of the accepted parameters follows.
  7295. @table @option
  7296. @item mode
  7297. Set phase mode.
  7298. It accepts the following values:
  7299. @table @samp
  7300. @item t
  7301. Capture field order top-first, transfer bottom-first.
  7302. Filter will delay the bottom field.
  7303. @item b
  7304. Capture field order bottom-first, transfer top-first.
  7305. Filter will delay the top field.
  7306. @item p
  7307. Capture and transfer with the same field order. This mode only exists
  7308. for the documentation of the other options to refer to, but if you
  7309. actually select it, the filter will faithfully do nothing.
  7310. @item a
  7311. Capture field order determined automatically by field flags, transfer
  7312. opposite.
  7313. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  7314. basis using field flags. If no field information is available,
  7315. then this works just like @samp{u}.
  7316. @item u
  7317. Capture unknown or varying, transfer opposite.
  7318. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  7319. analyzing the images and selecting the alternative that produces best
  7320. match between the fields.
  7321. @item T
  7322. Capture top-first, transfer unknown or varying.
  7323. Filter selects among @samp{t} and @samp{p} using image analysis.
  7324. @item B
  7325. Capture bottom-first, transfer unknown or varying.
  7326. Filter selects among @samp{b} and @samp{p} using image analysis.
  7327. @item A
  7328. Capture determined by field flags, transfer unknown or varying.
  7329. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  7330. image analysis. If no field information is available, then this works just
  7331. like @samp{U}. This is the default mode.
  7332. @item U
  7333. Both capture and transfer unknown or varying.
  7334. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  7335. @end table
  7336. @end table
  7337. @section pixdesctest
  7338. Pixel format descriptor test filter, mainly useful for internal
  7339. testing. The output video should be equal to the input video.
  7340. For example:
  7341. @example
  7342. format=monow, pixdesctest
  7343. @end example
  7344. can be used to test the monowhite pixel format descriptor definition.
  7345. @section pp
  7346. Enable the specified chain of postprocessing subfilters using libpostproc. This
  7347. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  7348. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  7349. Each subfilter and some options have a short and a long name that can be used
  7350. interchangeably, i.e. dr/dering are the same.
  7351. The filters accept the following options:
  7352. @table @option
  7353. @item subfilters
  7354. Set postprocessing subfilters string.
  7355. @end table
  7356. All subfilters share common options to determine their scope:
  7357. @table @option
  7358. @item a/autoq
  7359. Honor the quality commands for this subfilter.
  7360. @item c/chrom
  7361. Do chrominance filtering, too (default).
  7362. @item y/nochrom
  7363. Do luminance filtering only (no chrominance).
  7364. @item n/noluma
  7365. Do chrominance filtering only (no luminance).
  7366. @end table
  7367. These options can be appended after the subfilter name, separated by a '|'.
  7368. Available subfilters are:
  7369. @table @option
  7370. @item hb/hdeblock[|difference[|flatness]]
  7371. Horizontal deblocking filter
  7372. @table @option
  7373. @item difference
  7374. Difference factor where higher values mean more deblocking (default: @code{32}).
  7375. @item flatness
  7376. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  7377. @end table
  7378. @item vb/vdeblock[|difference[|flatness]]
  7379. Vertical deblocking filter
  7380. @table @option
  7381. @item difference
  7382. Difference factor where higher values mean more deblocking (default: @code{32}).
  7383. @item flatness
  7384. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  7385. @end table
  7386. @item ha/hadeblock[|difference[|flatness]]
  7387. Accurate horizontal deblocking filter
  7388. @table @option
  7389. @item difference
  7390. Difference factor where higher values mean more deblocking (default: @code{32}).
  7391. @item flatness
  7392. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  7393. @end table
  7394. @item va/vadeblock[|difference[|flatness]]
  7395. Accurate vertical deblocking filter
  7396. @table @option
  7397. @item difference
  7398. Difference factor where higher values mean more deblocking (default: @code{32}).
  7399. @item flatness
  7400. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  7401. @end table
  7402. @end table
  7403. The horizontal and vertical deblocking filters share the difference and
  7404. flatness values so you cannot set different horizontal and vertical
  7405. thresholds.
  7406. @table @option
  7407. @item h1/x1hdeblock
  7408. Experimental horizontal deblocking filter
  7409. @item v1/x1vdeblock
  7410. Experimental vertical deblocking filter
  7411. @item dr/dering
  7412. Deringing filter
  7413. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  7414. @table @option
  7415. @item threshold1
  7416. larger -> stronger filtering
  7417. @item threshold2
  7418. larger -> stronger filtering
  7419. @item threshold3
  7420. larger -> stronger filtering
  7421. @end table
  7422. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  7423. @table @option
  7424. @item f/fullyrange
  7425. Stretch luminance to @code{0-255}.
  7426. @end table
  7427. @item lb/linblenddeint
  7428. Linear blend deinterlacing filter that deinterlaces the given block by
  7429. filtering all lines with a @code{(1 2 1)} filter.
  7430. @item li/linipoldeint
  7431. Linear interpolating deinterlacing filter that deinterlaces the given block by
  7432. linearly interpolating every second line.
  7433. @item ci/cubicipoldeint
  7434. Cubic interpolating deinterlacing filter deinterlaces the given block by
  7435. cubically interpolating every second line.
  7436. @item md/mediandeint
  7437. Median deinterlacing filter that deinterlaces the given block by applying a
  7438. median filter to every second line.
  7439. @item fd/ffmpegdeint
  7440. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  7441. second line with a @code{(-1 4 2 4 -1)} filter.
  7442. @item l5/lowpass5
  7443. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  7444. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  7445. @item fq/forceQuant[|quantizer]
  7446. Overrides the quantizer table from the input with the constant quantizer you
  7447. specify.
  7448. @table @option
  7449. @item quantizer
  7450. Quantizer to use
  7451. @end table
  7452. @item de/default
  7453. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  7454. @item fa/fast
  7455. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  7456. @item ac
  7457. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  7458. @end table
  7459. @subsection Examples
  7460. @itemize
  7461. @item
  7462. Apply horizontal and vertical deblocking, deringing and automatic
  7463. brightness/contrast:
  7464. @example
  7465. pp=hb/vb/dr/al
  7466. @end example
  7467. @item
  7468. Apply default filters without brightness/contrast correction:
  7469. @example
  7470. pp=de/-al
  7471. @end example
  7472. @item
  7473. Apply default filters and temporal denoiser:
  7474. @example
  7475. pp=default/tmpnoise|1|2|3
  7476. @end example
  7477. @item
  7478. Apply deblocking on luminance only, and switch vertical deblocking on or off
  7479. automatically depending on available CPU time:
  7480. @example
  7481. pp=hb|y/vb|a
  7482. @end example
  7483. @end itemize
  7484. @section pp7
  7485. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  7486. similar to spp = 6 with 7 point DCT, where only the center sample is
  7487. used after IDCT.
  7488. The filter accepts the following options:
  7489. @table @option
  7490. @item qp
  7491. Force a constant quantization parameter. It accepts an integer in range
  7492. 0 to 63. If not set, the filter will use the QP from the video stream
  7493. (if available).
  7494. @item mode
  7495. Set thresholding mode. Available modes are:
  7496. @table @samp
  7497. @item hard
  7498. Set hard thresholding.
  7499. @item soft
  7500. Set soft thresholding (better de-ringing effect, but likely blurrier).
  7501. @item medium
  7502. Set medium thresholding (good results, default).
  7503. @end table
  7504. @end table
  7505. @section psnr
  7506. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  7507. Ratio) between two input videos.
  7508. This filter takes in input two input videos, the first input is
  7509. considered the "main" source and is passed unchanged to the
  7510. output. The second input is used as a "reference" video for computing
  7511. the PSNR.
  7512. Both video inputs must have the same resolution and pixel format for
  7513. this filter to work correctly. Also it assumes that both inputs
  7514. have the same number of frames, which are compared one by one.
  7515. The obtained average PSNR is printed through the logging system.
  7516. The filter stores the accumulated MSE (mean squared error) of each
  7517. frame, and at the end of the processing it is averaged across all frames
  7518. equally, and the following formula is applied to obtain the PSNR:
  7519. @example
  7520. PSNR = 10*log10(MAX^2/MSE)
  7521. @end example
  7522. Where MAX is the average of the maximum values of each component of the
  7523. image.
  7524. The description of the accepted parameters follows.
  7525. @table @option
  7526. @item stats_file, f
  7527. If specified the filter will use the named file to save the PSNR of
  7528. each individual frame. When filename equals "-" the data is sent to
  7529. standard output.
  7530. @end table
  7531. The file printed if @var{stats_file} is selected, contains a sequence of
  7532. key/value pairs of the form @var{key}:@var{value} for each compared
  7533. couple of frames.
  7534. A description of each shown parameter follows:
  7535. @table @option
  7536. @item n
  7537. sequential number of the input frame, starting from 1
  7538. @item mse_avg
  7539. Mean Square Error pixel-by-pixel average difference of the compared
  7540. frames, averaged over all the image components.
  7541. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  7542. Mean Square Error pixel-by-pixel average difference of the compared
  7543. frames for the component specified by the suffix.
  7544. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  7545. Peak Signal to Noise ratio of the compared frames for the component
  7546. specified by the suffix.
  7547. @end table
  7548. For example:
  7549. @example
  7550. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  7551. [main][ref] psnr="stats_file=stats.log" [out]
  7552. @end example
  7553. On this example the input file being processed is compared with the
  7554. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  7555. is stored in @file{stats.log}.
  7556. @anchor{pullup}
  7557. @section pullup
  7558. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  7559. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  7560. content.
  7561. The pullup filter is designed to take advantage of future context in making
  7562. its decisions. This filter is stateless in the sense that it does not lock
  7563. onto a pattern to follow, but it instead looks forward to the following
  7564. fields in order to identify matches and rebuild progressive frames.
  7565. To produce content with an even framerate, insert the fps filter after
  7566. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  7567. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  7568. The filter accepts the following options:
  7569. @table @option
  7570. @item jl
  7571. @item jr
  7572. @item jt
  7573. @item jb
  7574. These options set the amount of "junk" to ignore at the left, right, top, and
  7575. bottom of the image, respectively. Left and right are in units of 8 pixels,
  7576. while top and bottom are in units of 2 lines.
  7577. The default is 8 pixels on each side.
  7578. @item sb
  7579. Set the strict breaks. Setting this option to 1 will reduce the chances of
  7580. filter generating an occasional mismatched frame, but it may also cause an
  7581. excessive number of frames to be dropped during high motion sequences.
  7582. Conversely, setting it to -1 will make filter match fields more easily.
  7583. This may help processing of video where there is slight blurring between
  7584. the fields, but may also cause there to be interlaced frames in the output.
  7585. Default value is @code{0}.
  7586. @item mp
  7587. Set the metric plane to use. It accepts the following values:
  7588. @table @samp
  7589. @item l
  7590. Use luma plane.
  7591. @item u
  7592. Use chroma blue plane.
  7593. @item v
  7594. Use chroma red plane.
  7595. @end table
  7596. This option may be set to use chroma plane instead of the default luma plane
  7597. for doing filter's computations. This may improve accuracy on very clean
  7598. source material, but more likely will decrease accuracy, especially if there
  7599. is chroma noise (rainbow effect) or any grayscale video.
  7600. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  7601. load and make pullup usable in realtime on slow machines.
  7602. @end table
  7603. For best results (without duplicated frames in the output file) it is
  7604. necessary to change the output frame rate. For example, to inverse
  7605. telecine NTSC input:
  7606. @example
  7607. ffmpeg -i input -vf pullup -r 24000/1001 ...
  7608. @end example
  7609. @section qp
  7610. Change video quantization parameters (QP).
  7611. The filter accepts the following option:
  7612. @table @option
  7613. @item qp
  7614. Set expression for quantization parameter.
  7615. @end table
  7616. The expression is evaluated through the eval API and can contain, among others,
  7617. the following constants:
  7618. @table @var
  7619. @item known
  7620. 1 if index is not 129, 0 otherwise.
  7621. @item qp
  7622. Sequentional index starting from -129 to 128.
  7623. @end table
  7624. @subsection Examples
  7625. @itemize
  7626. @item
  7627. Some equation like:
  7628. @example
  7629. qp=2+2*sin(PI*qp)
  7630. @end example
  7631. @end itemize
  7632. @section random
  7633. Flush video frames from internal cache of frames into a random order.
  7634. No frame is discarded.
  7635. Inspired by @ref{frei0r} nervous filter.
  7636. @table @option
  7637. @item frames
  7638. Set size in number of frames of internal cache, in range from @code{2} to
  7639. @code{512}. Default is @code{30}.
  7640. @item seed
  7641. Set seed for random number generator, must be an integer included between
  7642. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  7643. less than @code{0}, the filter will try to use a good random seed on a
  7644. best effort basis.
  7645. @end table
  7646. @section removegrain
  7647. The removegrain filter is a spatial denoiser for progressive video.
  7648. @table @option
  7649. @item m0
  7650. Set mode for the first plane.
  7651. @item m1
  7652. Set mode for the second plane.
  7653. @item m2
  7654. Set mode for the third plane.
  7655. @item m3
  7656. Set mode for the fourth plane.
  7657. @end table
  7658. Range of mode is from 0 to 24. Description of each mode follows:
  7659. @table @var
  7660. @item 0
  7661. Leave input plane unchanged. Default.
  7662. @item 1
  7663. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  7664. @item 2
  7665. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  7666. @item 3
  7667. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  7668. @item 4
  7669. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  7670. This is equivalent to a median filter.
  7671. @item 5
  7672. Line-sensitive clipping giving the minimal change.
  7673. @item 6
  7674. Line-sensitive clipping, intermediate.
  7675. @item 7
  7676. Line-sensitive clipping, intermediate.
  7677. @item 8
  7678. Line-sensitive clipping, intermediate.
  7679. @item 9
  7680. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  7681. @item 10
  7682. Replaces the target pixel with the closest neighbour.
  7683. @item 11
  7684. [1 2 1] horizontal and vertical kernel blur.
  7685. @item 12
  7686. Same as mode 11.
  7687. @item 13
  7688. Bob mode, interpolates top field from the line where the neighbours
  7689. pixels are the closest.
  7690. @item 14
  7691. Bob mode, interpolates bottom field from the line where the neighbours
  7692. pixels are the closest.
  7693. @item 15
  7694. Bob mode, interpolates top field. Same as 13 but with a more complicated
  7695. interpolation formula.
  7696. @item 16
  7697. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  7698. interpolation formula.
  7699. @item 17
  7700. Clips the pixel with the minimum and maximum of respectively the maximum and
  7701. minimum of each pair of opposite neighbour pixels.
  7702. @item 18
  7703. Line-sensitive clipping using opposite neighbours whose greatest distance from
  7704. the current pixel is minimal.
  7705. @item 19
  7706. Replaces the pixel with the average of its 8 neighbours.
  7707. @item 20
  7708. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  7709. @item 21
  7710. Clips pixels using the averages of opposite neighbour.
  7711. @item 22
  7712. Same as mode 21 but simpler and faster.
  7713. @item 23
  7714. Small edge and halo removal, but reputed useless.
  7715. @item 24
  7716. Similar as 23.
  7717. @end table
  7718. @section removelogo
  7719. Suppress a TV station logo, using an image file to determine which
  7720. pixels comprise the logo. It works by filling in the pixels that
  7721. comprise the logo with neighboring pixels.
  7722. The filter accepts the following options:
  7723. @table @option
  7724. @item filename, f
  7725. Set the filter bitmap file, which can be any image format supported by
  7726. libavformat. The width and height of the image file must match those of the
  7727. video stream being processed.
  7728. @end table
  7729. Pixels in the provided bitmap image with a value of zero are not
  7730. considered part of the logo, non-zero pixels are considered part of
  7731. the logo. If you use white (255) for the logo and black (0) for the
  7732. rest, you will be safe. For making the filter bitmap, it is
  7733. recommended to take a screen capture of a black frame with the logo
  7734. visible, and then using a threshold filter followed by the erode
  7735. filter once or twice.
  7736. If needed, little splotches can be fixed manually. Remember that if
  7737. logo pixels are not covered, the filter quality will be much
  7738. reduced. Marking too many pixels as part of the logo does not hurt as
  7739. much, but it will increase the amount of blurring needed to cover over
  7740. the image and will destroy more information than necessary, and extra
  7741. pixels will slow things down on a large logo.
  7742. @section repeatfields
  7743. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  7744. fields based on its value.
  7745. @section reverse, areverse
  7746. Reverse a clip.
  7747. Warning: This filter requires memory to buffer the entire clip, so trimming
  7748. is suggested.
  7749. @subsection Examples
  7750. @itemize
  7751. @item
  7752. Take the first 5 seconds of a clip, and reverse it.
  7753. @example
  7754. trim=end=5,reverse
  7755. @end example
  7756. @end itemize
  7757. @section rotate
  7758. Rotate video by an arbitrary angle expressed in radians.
  7759. The filter accepts the following options:
  7760. A description of the optional parameters follows.
  7761. @table @option
  7762. @item angle, a
  7763. Set an expression for the angle by which to rotate the input video
  7764. clockwise, expressed as a number of radians. A negative value will
  7765. result in a counter-clockwise rotation. By default it is set to "0".
  7766. This expression is evaluated for each frame.
  7767. @item out_w, ow
  7768. Set the output width expression, default value is "iw".
  7769. This expression is evaluated just once during configuration.
  7770. @item out_h, oh
  7771. Set the output height expression, default value is "ih".
  7772. This expression is evaluated just once during configuration.
  7773. @item bilinear
  7774. Enable bilinear interpolation if set to 1, a value of 0 disables
  7775. it. Default value is 1.
  7776. @item fillcolor, c
  7777. Set the color used to fill the output area not covered by the rotated
  7778. image. For the general syntax of this option, check the "Color" section in the
  7779. ffmpeg-utils manual. If the special value "none" is selected then no
  7780. background is printed (useful for example if the background is never shown).
  7781. Default value is "black".
  7782. @end table
  7783. The expressions for the angle and the output size can contain the
  7784. following constants and functions:
  7785. @table @option
  7786. @item n
  7787. sequential number of the input frame, starting from 0. It is always NAN
  7788. before the first frame is filtered.
  7789. @item t
  7790. time in seconds of the input frame, it is set to 0 when the filter is
  7791. configured. It is always NAN before the first frame is filtered.
  7792. @item hsub
  7793. @item vsub
  7794. horizontal and vertical chroma subsample values. For example for the
  7795. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7796. @item in_w, iw
  7797. @item in_h, ih
  7798. the input video width and height
  7799. @item out_w, ow
  7800. @item out_h, oh
  7801. the output width and height, that is the size of the padded area as
  7802. specified by the @var{width} and @var{height} expressions
  7803. @item rotw(a)
  7804. @item roth(a)
  7805. the minimal width/height required for completely containing the input
  7806. video rotated by @var{a} radians.
  7807. These are only available when computing the @option{out_w} and
  7808. @option{out_h} expressions.
  7809. @end table
  7810. @subsection Examples
  7811. @itemize
  7812. @item
  7813. Rotate the input by PI/6 radians clockwise:
  7814. @example
  7815. rotate=PI/6
  7816. @end example
  7817. @item
  7818. Rotate the input by PI/6 radians counter-clockwise:
  7819. @example
  7820. rotate=-PI/6
  7821. @end example
  7822. @item
  7823. Rotate the input by 45 degrees clockwise:
  7824. @example
  7825. rotate=45*PI/180
  7826. @end example
  7827. @item
  7828. Apply a constant rotation with period T, starting from an angle of PI/3:
  7829. @example
  7830. rotate=PI/3+2*PI*t/T
  7831. @end example
  7832. @item
  7833. Make the input video rotation oscillating with a period of T
  7834. seconds and an amplitude of A radians:
  7835. @example
  7836. rotate=A*sin(2*PI/T*t)
  7837. @end example
  7838. @item
  7839. Rotate the video, output size is chosen so that the whole rotating
  7840. input video is always completely contained in the output:
  7841. @example
  7842. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  7843. @end example
  7844. @item
  7845. Rotate the video, reduce the output size so that no background is ever
  7846. shown:
  7847. @example
  7848. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  7849. @end example
  7850. @end itemize
  7851. @subsection Commands
  7852. The filter supports the following commands:
  7853. @table @option
  7854. @item a, angle
  7855. Set the angle expression.
  7856. The command accepts the same syntax of the corresponding option.
  7857. If the specified expression is not valid, it is kept at its current
  7858. value.
  7859. @end table
  7860. @section sab
  7861. Apply Shape Adaptive Blur.
  7862. The filter accepts the following options:
  7863. @table @option
  7864. @item luma_radius, lr
  7865. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  7866. value is 1.0. A greater value will result in a more blurred image, and
  7867. in slower processing.
  7868. @item luma_pre_filter_radius, lpfr
  7869. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  7870. value is 1.0.
  7871. @item luma_strength, ls
  7872. Set luma maximum difference between pixels to still be considered, must
  7873. be a value in the 0.1-100.0 range, default value is 1.0.
  7874. @item chroma_radius, cr
  7875. Set chroma blur filter strength, must be a value in range 0.1-4.0. A
  7876. greater value will result in a more blurred image, and in slower
  7877. processing.
  7878. @item chroma_pre_filter_radius, cpfr
  7879. Set chroma pre-filter radius, must be a value in the 0.1-2.0 range.
  7880. @item chroma_strength, cs
  7881. Set chroma maximum difference between pixels to still be considered,
  7882. must be a value in the 0.1-100.0 range.
  7883. @end table
  7884. Each chroma option value, if not explicitly specified, is set to the
  7885. corresponding luma option value.
  7886. @anchor{scale}
  7887. @section scale
  7888. Scale (resize) the input video, using the libswscale library.
  7889. The scale filter forces the output display aspect ratio to be the same
  7890. of the input, by changing the output sample aspect ratio.
  7891. If the input image format is different from the format requested by
  7892. the next filter, the scale filter will convert the input to the
  7893. requested format.
  7894. @subsection Options
  7895. The filter accepts the following options, or any of the options
  7896. supported by the libswscale scaler.
  7897. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  7898. the complete list of scaler options.
  7899. @table @option
  7900. @item width, w
  7901. @item height, h
  7902. Set the output video dimension expression. Default value is the input
  7903. dimension.
  7904. If the value is 0, the input width is used for the output.
  7905. If one of the values is -1, the scale filter will use a value that
  7906. maintains the aspect ratio of the input image, calculated from the
  7907. other specified dimension. If both of them are -1, the input size is
  7908. used
  7909. If one of the values is -n with n > 1, the scale filter will also use a value
  7910. that maintains the aspect ratio of the input image, calculated from the other
  7911. specified dimension. After that it will, however, make sure that the calculated
  7912. dimension is divisible by n and adjust the value if necessary.
  7913. See below for the list of accepted constants for use in the dimension
  7914. expression.
  7915. @item eval
  7916. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  7917. @table @samp
  7918. @item init
  7919. Only evaluate expressions once during the filter initialization or when a command is processed.
  7920. @item frame
  7921. Evaluate expressions for each incoming frame.
  7922. @end table
  7923. Default value is @samp{init}.
  7924. @item interl
  7925. Set the interlacing mode. It accepts the following values:
  7926. @table @samp
  7927. @item 1
  7928. Force interlaced aware scaling.
  7929. @item 0
  7930. Do not apply interlaced scaling.
  7931. @item -1
  7932. Select interlaced aware scaling depending on whether the source frames
  7933. are flagged as interlaced or not.
  7934. @end table
  7935. Default value is @samp{0}.
  7936. @item flags
  7937. Set libswscale scaling flags. See
  7938. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  7939. complete list of values. If not explicitly specified the filter applies
  7940. the default flags.
  7941. @item param0, param1
  7942. Set libswscale input parameters for scaling algorithms that need them. See
  7943. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  7944. complete documentation. If not explicitly specified the filter applies
  7945. empty parameters.
  7946. @item size, s
  7947. Set the video size. For the syntax of this option, check the
  7948. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7949. @item in_color_matrix
  7950. @item out_color_matrix
  7951. Set in/output YCbCr color space type.
  7952. This allows the autodetected value to be overridden as well as allows forcing
  7953. a specific value used for the output and encoder.
  7954. If not specified, the color space type depends on the pixel format.
  7955. Possible values:
  7956. @table @samp
  7957. @item auto
  7958. Choose automatically.
  7959. @item bt709
  7960. Format conforming to International Telecommunication Union (ITU)
  7961. Recommendation BT.709.
  7962. @item fcc
  7963. Set color space conforming to the United States Federal Communications
  7964. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  7965. @item bt601
  7966. Set color space conforming to:
  7967. @itemize
  7968. @item
  7969. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  7970. @item
  7971. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  7972. @item
  7973. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  7974. @end itemize
  7975. @item smpte240m
  7976. Set color space conforming to SMPTE ST 240:1999.
  7977. @end table
  7978. @item in_range
  7979. @item out_range
  7980. Set in/output YCbCr sample range.
  7981. This allows the autodetected value to be overridden as well as allows forcing
  7982. a specific value used for the output and encoder. If not specified, the
  7983. range depends on the pixel format. Possible values:
  7984. @table @samp
  7985. @item auto
  7986. Choose automatically.
  7987. @item jpeg/full/pc
  7988. Set full range (0-255 in case of 8-bit luma).
  7989. @item mpeg/tv
  7990. Set "MPEG" range (16-235 in case of 8-bit luma).
  7991. @end table
  7992. @item force_original_aspect_ratio
  7993. Enable decreasing or increasing output video width or height if necessary to
  7994. keep the original aspect ratio. Possible values:
  7995. @table @samp
  7996. @item disable
  7997. Scale the video as specified and disable this feature.
  7998. @item decrease
  7999. The output video dimensions will automatically be decreased if needed.
  8000. @item increase
  8001. The output video dimensions will automatically be increased if needed.
  8002. @end table
  8003. One useful instance of this option is that when you know a specific device's
  8004. maximum allowed resolution, you can use this to limit the output video to
  8005. that, while retaining the aspect ratio. For example, device A allows
  8006. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  8007. decrease) and specifying 1280x720 to the command line makes the output
  8008. 1280x533.
  8009. Please note that this is a different thing than specifying -1 for @option{w}
  8010. or @option{h}, you still need to specify the output resolution for this option
  8011. to work.
  8012. @end table
  8013. The values of the @option{w} and @option{h} options are expressions
  8014. containing the following constants:
  8015. @table @var
  8016. @item in_w
  8017. @item in_h
  8018. The input width and height
  8019. @item iw
  8020. @item ih
  8021. These are the same as @var{in_w} and @var{in_h}.
  8022. @item out_w
  8023. @item out_h
  8024. The output (scaled) width and height
  8025. @item ow
  8026. @item oh
  8027. These are the same as @var{out_w} and @var{out_h}
  8028. @item a
  8029. The same as @var{iw} / @var{ih}
  8030. @item sar
  8031. input sample aspect ratio
  8032. @item dar
  8033. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  8034. @item hsub
  8035. @item vsub
  8036. horizontal and vertical input chroma subsample values. For example for the
  8037. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8038. @item ohsub
  8039. @item ovsub
  8040. horizontal and vertical output chroma subsample values. For example for the
  8041. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8042. @end table
  8043. @subsection Examples
  8044. @itemize
  8045. @item
  8046. Scale the input video to a size of 200x100
  8047. @example
  8048. scale=w=200:h=100
  8049. @end example
  8050. This is equivalent to:
  8051. @example
  8052. scale=200:100
  8053. @end example
  8054. or:
  8055. @example
  8056. scale=200x100
  8057. @end example
  8058. @item
  8059. Specify a size abbreviation for the output size:
  8060. @example
  8061. scale=qcif
  8062. @end example
  8063. which can also be written as:
  8064. @example
  8065. scale=size=qcif
  8066. @end example
  8067. @item
  8068. Scale the input to 2x:
  8069. @example
  8070. scale=w=2*iw:h=2*ih
  8071. @end example
  8072. @item
  8073. The above is the same as:
  8074. @example
  8075. scale=2*in_w:2*in_h
  8076. @end example
  8077. @item
  8078. Scale the input to 2x with forced interlaced scaling:
  8079. @example
  8080. scale=2*iw:2*ih:interl=1
  8081. @end example
  8082. @item
  8083. Scale the input to half size:
  8084. @example
  8085. scale=w=iw/2:h=ih/2
  8086. @end example
  8087. @item
  8088. Increase the width, and set the height to the same size:
  8089. @example
  8090. scale=3/2*iw:ow
  8091. @end example
  8092. @item
  8093. Seek Greek harmony:
  8094. @example
  8095. scale=iw:1/PHI*iw
  8096. scale=ih*PHI:ih
  8097. @end example
  8098. @item
  8099. Increase the height, and set the width to 3/2 of the height:
  8100. @example
  8101. scale=w=3/2*oh:h=3/5*ih
  8102. @end example
  8103. @item
  8104. Increase the size, making the size a multiple of the chroma
  8105. subsample values:
  8106. @example
  8107. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  8108. @end example
  8109. @item
  8110. Increase the width to a maximum of 500 pixels,
  8111. keeping the same aspect ratio as the input:
  8112. @example
  8113. scale=w='min(500\, iw*3/2):h=-1'
  8114. @end example
  8115. @end itemize
  8116. @subsection Commands
  8117. This filter supports the following commands:
  8118. @table @option
  8119. @item width, w
  8120. @item height, h
  8121. Set the output video dimension expression.
  8122. The command accepts the same syntax of the corresponding option.
  8123. If the specified expression is not valid, it is kept at its current
  8124. value.
  8125. @end table
  8126. @section scale2ref
  8127. Scale (resize) the input video, based on a reference video.
  8128. See the scale filter for available options, scale2ref supports the same but
  8129. uses the reference video instead of the main input as basis.
  8130. @subsection Examples
  8131. @itemize
  8132. @item
  8133. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  8134. @example
  8135. 'scale2ref[b][a];[a][b]overlay'
  8136. @end example
  8137. @end itemize
  8138. @section selectivecolor
  8139. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  8140. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  8141. by the "purity" of the color (that is, how saturated it already is).
  8142. This filter is similar to the Adobe Photoshop Selective Color tool.
  8143. The filter accepts the following options:
  8144. @table @option
  8145. @item correction_method
  8146. Select color correction method.
  8147. Available values are:
  8148. @table @samp
  8149. @item absolute
  8150. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  8151. component value).
  8152. @item relative
  8153. Specified adjustments are relative to the original component value.
  8154. @end table
  8155. Default is @code{absolute}.
  8156. @item reds
  8157. Adjustments for red pixels (pixels where the red component is the maximum)
  8158. @item yellows
  8159. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  8160. @item greens
  8161. Adjustments for green pixels (pixels where the green component is the maximum)
  8162. @item cyans
  8163. Adjustments for cyan pixels (pixels where the red component is the minimum)
  8164. @item blues
  8165. Adjustments for blue pixels (pixels where the blue component is the maximum)
  8166. @item magentas
  8167. Adjustments for magenta pixels (pixels where the green component is the minimum)
  8168. @item whites
  8169. Adjustments for white pixels (pixels where all components are greater than 128)
  8170. @item neutrals
  8171. Adjustments for all pixels except pure black and pure white
  8172. @item blacks
  8173. Adjustments for black pixels (pixels where all components are lesser than 128)
  8174. @item psfile
  8175. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  8176. @end table
  8177. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  8178. 4 space separated floating point adjustment values in the [-1,1] range,
  8179. respectively to adjust the amount of cyan, magenta, yellow and black for the
  8180. pixels of its range.
  8181. @subsection Examples
  8182. @itemize
  8183. @item
  8184. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  8185. increase magenta by 27% in blue areas:
  8186. @example
  8187. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  8188. @end example
  8189. @item
  8190. Use a Photoshop selective color preset:
  8191. @example
  8192. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  8193. @end example
  8194. @end itemize
  8195. @section separatefields
  8196. The @code{separatefields} takes a frame-based video input and splits
  8197. each frame into its components fields, producing a new half height clip
  8198. with twice the frame rate and twice the frame count.
  8199. This filter use field-dominance information in frame to decide which
  8200. of each pair of fields to place first in the output.
  8201. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  8202. @section setdar, setsar
  8203. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  8204. output video.
  8205. This is done by changing the specified Sample (aka Pixel) Aspect
  8206. Ratio, according to the following equation:
  8207. @example
  8208. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  8209. @end example
  8210. Keep in mind that the @code{setdar} filter does not modify the pixel
  8211. dimensions of the video frame. Also, the display aspect ratio set by
  8212. this filter may be changed by later filters in the filterchain,
  8213. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  8214. applied.
  8215. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  8216. the filter output video.
  8217. Note that as a consequence of the application of this filter, the
  8218. output display aspect ratio will change according to the equation
  8219. above.
  8220. Keep in mind that the sample aspect ratio set by the @code{setsar}
  8221. filter may be changed by later filters in the filterchain, e.g. if
  8222. another "setsar" or a "setdar" filter is applied.
  8223. It accepts the following parameters:
  8224. @table @option
  8225. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  8226. Set the aspect ratio used by the filter.
  8227. The parameter can be a floating point number string, an expression, or
  8228. a string of the form @var{num}:@var{den}, where @var{num} and
  8229. @var{den} are the numerator and denominator of the aspect ratio. If
  8230. the parameter is not specified, it is assumed the value "0".
  8231. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  8232. should be escaped.
  8233. @item max
  8234. Set the maximum integer value to use for expressing numerator and
  8235. denominator when reducing the expressed aspect ratio to a rational.
  8236. Default value is @code{100}.
  8237. @end table
  8238. The parameter @var{sar} is an expression containing
  8239. the following constants:
  8240. @table @option
  8241. @item E, PI, PHI
  8242. These are approximated values for the mathematical constants e
  8243. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  8244. @item w, h
  8245. The input width and height.
  8246. @item a
  8247. These are the same as @var{w} / @var{h}.
  8248. @item sar
  8249. The input sample aspect ratio.
  8250. @item dar
  8251. The input display aspect ratio. It is the same as
  8252. (@var{w} / @var{h}) * @var{sar}.
  8253. @item hsub, vsub
  8254. Horizontal and vertical chroma subsample values. For example, for the
  8255. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8256. @end table
  8257. @subsection Examples
  8258. @itemize
  8259. @item
  8260. To change the display aspect ratio to 16:9, specify one of the following:
  8261. @example
  8262. setdar=dar=1.77777
  8263. setdar=dar=16/9
  8264. setdar=dar=1.77777
  8265. @end example
  8266. @item
  8267. To change the sample aspect ratio to 10:11, specify:
  8268. @example
  8269. setsar=sar=10/11
  8270. @end example
  8271. @item
  8272. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  8273. 1000 in the aspect ratio reduction, use the command:
  8274. @example
  8275. setdar=ratio=16/9:max=1000
  8276. @end example
  8277. @end itemize
  8278. @anchor{setfield}
  8279. @section setfield
  8280. Force field for the output video frame.
  8281. The @code{setfield} filter marks the interlace type field for the
  8282. output frames. It does not change the input frame, but only sets the
  8283. corresponding property, which affects how the frame is treated by
  8284. following filters (e.g. @code{fieldorder} or @code{yadif}).
  8285. The filter accepts the following options:
  8286. @table @option
  8287. @item mode
  8288. Available values are:
  8289. @table @samp
  8290. @item auto
  8291. Keep the same field property.
  8292. @item bff
  8293. Mark the frame as bottom-field-first.
  8294. @item tff
  8295. Mark the frame as top-field-first.
  8296. @item prog
  8297. Mark the frame as progressive.
  8298. @end table
  8299. @end table
  8300. @section showinfo
  8301. Show a line containing various information for each input video frame.
  8302. The input video is not modified.
  8303. The shown line contains a sequence of key/value pairs of the form
  8304. @var{key}:@var{value}.
  8305. The following values are shown in the output:
  8306. @table @option
  8307. @item n
  8308. The (sequential) number of the input frame, starting from 0.
  8309. @item pts
  8310. The Presentation TimeStamp of the input frame, expressed as a number of
  8311. time base units. The time base unit depends on the filter input pad.
  8312. @item pts_time
  8313. The Presentation TimeStamp of the input frame, expressed as a number of
  8314. seconds.
  8315. @item pos
  8316. The position of the frame in the input stream, or -1 if this information is
  8317. unavailable and/or meaningless (for example in case of synthetic video).
  8318. @item fmt
  8319. The pixel format name.
  8320. @item sar
  8321. The sample aspect ratio of the input frame, expressed in the form
  8322. @var{num}/@var{den}.
  8323. @item s
  8324. The size of the input frame. For the syntax of this option, check the
  8325. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8326. @item i
  8327. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  8328. for bottom field first).
  8329. @item iskey
  8330. This is 1 if the frame is a key frame, 0 otherwise.
  8331. @item type
  8332. The picture type of the input frame ("I" for an I-frame, "P" for a
  8333. P-frame, "B" for a B-frame, or "?" for an unknown type).
  8334. Also refer to the documentation of the @code{AVPictureType} enum and of
  8335. the @code{av_get_picture_type_char} function defined in
  8336. @file{libavutil/avutil.h}.
  8337. @item checksum
  8338. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  8339. @item plane_checksum
  8340. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  8341. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  8342. @end table
  8343. @section showpalette
  8344. Displays the 256 colors palette of each frame. This filter is only relevant for
  8345. @var{pal8} pixel format frames.
  8346. It accepts the following option:
  8347. @table @option
  8348. @item s
  8349. Set the size of the box used to represent one palette color entry. Default is
  8350. @code{30} (for a @code{30x30} pixel box).
  8351. @end table
  8352. @section shuffleframes
  8353. Reorder and/or duplicate video frames.
  8354. It accepts the following parameters:
  8355. @table @option
  8356. @item mapping
  8357. Set the destination indexes of input frames.
  8358. This is space or '|' separated list of indexes that maps input frames to output
  8359. frames. Number of indexes also sets maximal value that each index may have.
  8360. @end table
  8361. The first frame has the index 0. The default is to keep the input unchanged.
  8362. Swap second and third frame of every three frames of the input:
  8363. @example
  8364. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  8365. @end example
  8366. @section shuffleplanes
  8367. Reorder and/or duplicate video planes.
  8368. It accepts the following parameters:
  8369. @table @option
  8370. @item map0
  8371. The index of the input plane to be used as the first output plane.
  8372. @item map1
  8373. The index of the input plane to be used as the second output plane.
  8374. @item map2
  8375. The index of the input plane to be used as the third output plane.
  8376. @item map3
  8377. The index of the input plane to be used as the fourth output plane.
  8378. @end table
  8379. The first plane has the index 0. The default is to keep the input unchanged.
  8380. Swap the second and third planes of the input:
  8381. @example
  8382. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  8383. @end example
  8384. @anchor{signalstats}
  8385. @section signalstats
  8386. Evaluate various visual metrics that assist in determining issues associated
  8387. with the digitization of analog video media.
  8388. By default the filter will log these metadata values:
  8389. @table @option
  8390. @item YMIN
  8391. Display the minimal Y value contained within the input frame. Expressed in
  8392. range of [0-255].
  8393. @item YLOW
  8394. Display the Y value at the 10% percentile within the input frame. Expressed in
  8395. range of [0-255].
  8396. @item YAVG
  8397. Display the average Y value within the input frame. Expressed in range of
  8398. [0-255].
  8399. @item YHIGH
  8400. Display the Y value at the 90% percentile within the input frame. Expressed in
  8401. range of [0-255].
  8402. @item YMAX
  8403. Display the maximum Y value contained within the input frame. Expressed in
  8404. range of [0-255].
  8405. @item UMIN
  8406. Display the minimal U value contained within the input frame. Expressed in
  8407. range of [0-255].
  8408. @item ULOW
  8409. Display the U value at the 10% percentile within the input frame. Expressed in
  8410. range of [0-255].
  8411. @item UAVG
  8412. Display the average U value within the input frame. Expressed in range of
  8413. [0-255].
  8414. @item UHIGH
  8415. Display the U value at the 90% percentile within the input frame. Expressed in
  8416. range of [0-255].
  8417. @item UMAX
  8418. Display the maximum U value contained within the input frame. Expressed in
  8419. range of [0-255].
  8420. @item VMIN
  8421. Display the minimal V value contained within the input frame. Expressed in
  8422. range of [0-255].
  8423. @item VLOW
  8424. Display the V value at the 10% percentile within the input frame. Expressed in
  8425. range of [0-255].
  8426. @item VAVG
  8427. Display the average V value within the input frame. Expressed in range of
  8428. [0-255].
  8429. @item VHIGH
  8430. Display the V value at the 90% percentile within the input frame. Expressed in
  8431. range of [0-255].
  8432. @item VMAX
  8433. Display the maximum V value contained within the input frame. Expressed in
  8434. range of [0-255].
  8435. @item SATMIN
  8436. Display the minimal saturation value contained within the input frame.
  8437. Expressed in range of [0-~181.02].
  8438. @item SATLOW
  8439. Display the saturation value at the 10% percentile within the input frame.
  8440. Expressed in range of [0-~181.02].
  8441. @item SATAVG
  8442. Display the average saturation value within the input frame. Expressed in range
  8443. of [0-~181.02].
  8444. @item SATHIGH
  8445. Display the saturation value at the 90% percentile within the input frame.
  8446. Expressed in range of [0-~181.02].
  8447. @item SATMAX
  8448. Display the maximum saturation value contained within the input frame.
  8449. Expressed in range of [0-~181.02].
  8450. @item HUEMED
  8451. Display the median value for hue within the input frame. Expressed in range of
  8452. [0-360].
  8453. @item HUEAVG
  8454. Display the average value for hue within the input frame. Expressed in range of
  8455. [0-360].
  8456. @item YDIF
  8457. Display the average of sample value difference between all values of the Y
  8458. plane in the current frame and corresponding values of the previous input frame.
  8459. Expressed in range of [0-255].
  8460. @item UDIF
  8461. Display the average of sample value difference between all values of the U
  8462. plane in the current frame and corresponding values of the previous input frame.
  8463. Expressed in range of [0-255].
  8464. @item VDIF
  8465. Display the average of sample value difference between all values of the V
  8466. plane in the current frame and corresponding values of the previous input frame.
  8467. Expressed in range of [0-255].
  8468. @end table
  8469. The filter accepts the following options:
  8470. @table @option
  8471. @item stat
  8472. @item out
  8473. @option{stat} specify an additional form of image analysis.
  8474. @option{out} output video with the specified type of pixel highlighted.
  8475. Both options accept the following values:
  8476. @table @samp
  8477. @item tout
  8478. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  8479. unlike the neighboring pixels of the same field. Examples of temporal outliers
  8480. include the results of video dropouts, head clogs, or tape tracking issues.
  8481. @item vrep
  8482. Identify @var{vertical line repetition}. Vertical line repetition includes
  8483. similar rows of pixels within a frame. In born-digital video vertical line
  8484. repetition is common, but this pattern is uncommon in video digitized from an
  8485. analog source. When it occurs in video that results from the digitization of an
  8486. analog source it can indicate concealment from a dropout compensator.
  8487. @item brng
  8488. Identify pixels that fall outside of legal broadcast range.
  8489. @end table
  8490. @item color, c
  8491. Set the highlight color for the @option{out} option. The default color is
  8492. yellow.
  8493. @end table
  8494. @subsection Examples
  8495. @itemize
  8496. @item
  8497. Output data of various video metrics:
  8498. @example
  8499. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  8500. @end example
  8501. @item
  8502. Output specific data about the minimum and maximum values of the Y plane per frame:
  8503. @example
  8504. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  8505. @end example
  8506. @item
  8507. Playback video while highlighting pixels that are outside of broadcast range in red.
  8508. @example
  8509. ffplay example.mov -vf signalstats="out=brng:color=red"
  8510. @end example
  8511. @item
  8512. Playback video with signalstats metadata drawn over the frame.
  8513. @example
  8514. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  8515. @end example
  8516. The contents of signalstat_drawtext.txt used in the command are:
  8517. @example
  8518. time %@{pts:hms@}
  8519. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  8520. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  8521. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  8522. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  8523. @end example
  8524. @end itemize
  8525. @anchor{smartblur}
  8526. @section smartblur
  8527. Blur the input video without impacting the outlines.
  8528. It accepts the following options:
  8529. @table @option
  8530. @item luma_radius, lr
  8531. Set the luma radius. The option value must be a float number in
  8532. the range [0.1,5.0] that specifies the variance of the gaussian filter
  8533. used to blur the image (slower if larger). Default value is 1.0.
  8534. @item luma_strength, ls
  8535. Set the luma strength. The option value must be a float number
  8536. in the range [-1.0,1.0] that configures the blurring. A value included
  8537. in [0.0,1.0] will blur the image whereas a value included in
  8538. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  8539. @item luma_threshold, lt
  8540. Set the luma threshold used as a coefficient to determine
  8541. whether a pixel should be blurred or not. The option value must be an
  8542. integer in the range [-30,30]. A value of 0 will filter all the image,
  8543. a value included in [0,30] will filter flat areas and a value included
  8544. in [-30,0] will filter edges. Default value is 0.
  8545. @item chroma_radius, cr
  8546. Set the chroma radius. The option value must be a float number in
  8547. the range [0.1,5.0] that specifies the variance of the gaussian filter
  8548. used to blur the image (slower if larger). Default value is 1.0.
  8549. @item chroma_strength, cs
  8550. Set the chroma strength. The option value must be a float number
  8551. in the range [-1.0,1.0] that configures the blurring. A value included
  8552. in [0.0,1.0] will blur the image whereas a value included in
  8553. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  8554. @item chroma_threshold, ct
  8555. Set the chroma threshold used as a coefficient to determine
  8556. whether a pixel should be blurred or not. The option value must be an
  8557. integer in the range [-30,30]. A value of 0 will filter all the image,
  8558. a value included in [0,30] will filter flat areas and a value included
  8559. in [-30,0] will filter edges. Default value is 0.
  8560. @end table
  8561. If a chroma option is not explicitly set, the corresponding luma value
  8562. is set.
  8563. @section ssim
  8564. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  8565. This filter takes in input two input videos, the first input is
  8566. considered the "main" source and is passed unchanged to the
  8567. output. The second input is used as a "reference" video for computing
  8568. the SSIM.
  8569. Both video inputs must have the same resolution and pixel format for
  8570. this filter to work correctly. Also it assumes that both inputs
  8571. have the same number of frames, which are compared one by one.
  8572. The filter stores the calculated SSIM of each frame.
  8573. The description of the accepted parameters follows.
  8574. @table @option
  8575. @item stats_file, f
  8576. If specified the filter will use the named file to save the SSIM of
  8577. each individual frame. When filename equals "-" the data is sent to
  8578. standard output.
  8579. @end table
  8580. The file printed if @var{stats_file} is selected, contains a sequence of
  8581. key/value pairs of the form @var{key}:@var{value} for each compared
  8582. couple of frames.
  8583. A description of each shown parameter follows:
  8584. @table @option
  8585. @item n
  8586. sequential number of the input frame, starting from 1
  8587. @item Y, U, V, R, G, B
  8588. SSIM of the compared frames for the component specified by the suffix.
  8589. @item All
  8590. SSIM of the compared frames for the whole frame.
  8591. @item dB
  8592. Same as above but in dB representation.
  8593. @end table
  8594. For example:
  8595. @example
  8596. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  8597. [main][ref] ssim="stats_file=stats.log" [out]
  8598. @end example
  8599. On this example the input file being processed is compared with the
  8600. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  8601. is stored in @file{stats.log}.
  8602. Another example with both psnr and ssim at same time:
  8603. @example
  8604. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  8605. @end example
  8606. @section stereo3d
  8607. Convert between different stereoscopic image formats.
  8608. The filters accept the following options:
  8609. @table @option
  8610. @item in
  8611. Set stereoscopic image format of input.
  8612. Available values for input image formats are:
  8613. @table @samp
  8614. @item sbsl
  8615. side by side parallel (left eye left, right eye right)
  8616. @item sbsr
  8617. side by side crosseye (right eye left, left eye right)
  8618. @item sbs2l
  8619. side by side parallel with half width resolution
  8620. (left eye left, right eye right)
  8621. @item sbs2r
  8622. side by side crosseye with half width resolution
  8623. (right eye left, left eye right)
  8624. @item abl
  8625. above-below (left eye above, right eye below)
  8626. @item abr
  8627. above-below (right eye above, left eye below)
  8628. @item ab2l
  8629. above-below with half height resolution
  8630. (left eye above, right eye below)
  8631. @item ab2r
  8632. above-below with half height resolution
  8633. (right eye above, left eye below)
  8634. @item al
  8635. alternating frames (left eye first, right eye second)
  8636. @item ar
  8637. alternating frames (right eye first, left eye second)
  8638. @item irl
  8639. interleaved rows (left eye has top row, right eye starts on next row)
  8640. @item irr
  8641. interleaved rows (right eye has top row, left eye starts on next row)
  8642. @item icl
  8643. interleaved columns, left eye first
  8644. @item icr
  8645. interleaved columns, right eye first
  8646. Default value is @samp{sbsl}.
  8647. @end table
  8648. @item out
  8649. Set stereoscopic image format of output.
  8650. @table @samp
  8651. @item sbsl
  8652. side by side parallel (left eye left, right eye right)
  8653. @item sbsr
  8654. side by side crosseye (right eye left, left eye right)
  8655. @item sbs2l
  8656. side by side parallel with half width resolution
  8657. (left eye left, right eye right)
  8658. @item sbs2r
  8659. side by side crosseye with half width resolution
  8660. (right eye left, left eye right)
  8661. @item abl
  8662. above-below (left eye above, right eye below)
  8663. @item abr
  8664. above-below (right eye above, left eye below)
  8665. @item ab2l
  8666. above-below with half height resolution
  8667. (left eye above, right eye below)
  8668. @item ab2r
  8669. above-below with half height resolution
  8670. (right eye above, left eye below)
  8671. @item al
  8672. alternating frames (left eye first, right eye second)
  8673. @item ar
  8674. alternating frames (right eye first, left eye second)
  8675. @item irl
  8676. interleaved rows (left eye has top row, right eye starts on next row)
  8677. @item irr
  8678. interleaved rows (right eye has top row, left eye starts on next row)
  8679. @item arbg
  8680. anaglyph red/blue gray
  8681. (red filter on left eye, blue filter on right eye)
  8682. @item argg
  8683. anaglyph red/green gray
  8684. (red filter on left eye, green filter on right eye)
  8685. @item arcg
  8686. anaglyph red/cyan gray
  8687. (red filter on left eye, cyan filter on right eye)
  8688. @item arch
  8689. anaglyph red/cyan half colored
  8690. (red filter on left eye, cyan filter on right eye)
  8691. @item arcc
  8692. anaglyph red/cyan color
  8693. (red filter on left eye, cyan filter on right eye)
  8694. @item arcd
  8695. anaglyph red/cyan color optimized with the least squares projection of dubois
  8696. (red filter on left eye, cyan filter on right eye)
  8697. @item agmg
  8698. anaglyph green/magenta gray
  8699. (green filter on left eye, magenta filter on right eye)
  8700. @item agmh
  8701. anaglyph green/magenta half colored
  8702. (green filter on left eye, magenta filter on right eye)
  8703. @item agmc
  8704. anaglyph green/magenta colored
  8705. (green filter on left eye, magenta filter on right eye)
  8706. @item agmd
  8707. anaglyph green/magenta color optimized with the least squares projection of dubois
  8708. (green filter on left eye, magenta filter on right eye)
  8709. @item aybg
  8710. anaglyph yellow/blue gray
  8711. (yellow filter on left eye, blue filter on right eye)
  8712. @item aybh
  8713. anaglyph yellow/blue half colored
  8714. (yellow filter on left eye, blue filter on right eye)
  8715. @item aybc
  8716. anaglyph yellow/blue colored
  8717. (yellow filter on left eye, blue filter on right eye)
  8718. @item aybd
  8719. anaglyph yellow/blue color optimized with the least squares projection of dubois
  8720. (yellow filter on left eye, blue filter on right eye)
  8721. @item ml
  8722. mono output (left eye only)
  8723. @item mr
  8724. mono output (right eye only)
  8725. @item chl
  8726. checkerboard, left eye first
  8727. @item chr
  8728. checkerboard, right eye first
  8729. @item icl
  8730. interleaved columns, left eye first
  8731. @item icr
  8732. interleaved columns, right eye first
  8733. @end table
  8734. Default value is @samp{arcd}.
  8735. @end table
  8736. @subsection Examples
  8737. @itemize
  8738. @item
  8739. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  8740. @example
  8741. stereo3d=sbsl:aybd
  8742. @end example
  8743. @item
  8744. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  8745. @example
  8746. stereo3d=abl:sbsr
  8747. @end example
  8748. @end itemize
  8749. @section streamselect, astreamselect
  8750. Select video or audio streams.
  8751. The filter accepts the following options:
  8752. @table @option
  8753. @item inputs
  8754. Set number of inputs. Default is 2.
  8755. @item map
  8756. Set input indexes to remap to outputs.
  8757. @end table
  8758. @subsection Commands
  8759. The @code{streamselect} and @code{astreamselect} filter supports the following
  8760. commands:
  8761. @table @option
  8762. @item map
  8763. Set input indexes to remap to outputs.
  8764. @end table
  8765. @subsection Examples
  8766. @itemize
  8767. @item
  8768. Select first 5 seconds 1st stream and rest of time 2nd stream:
  8769. @example
  8770. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  8771. @end example
  8772. @item
  8773. Same as above, but for audio:
  8774. @example
  8775. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  8776. @end example
  8777. @end itemize
  8778. @anchor{spp}
  8779. @section spp
  8780. Apply a simple postprocessing filter that compresses and decompresses the image
  8781. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  8782. and average the results.
  8783. The filter accepts the following options:
  8784. @table @option
  8785. @item quality
  8786. Set quality. This option defines the number of levels for averaging. It accepts
  8787. an integer in the range 0-6. If set to @code{0}, the filter will have no
  8788. effect. A value of @code{6} means the higher quality. For each increment of
  8789. that value the speed drops by a factor of approximately 2. Default value is
  8790. @code{3}.
  8791. @item qp
  8792. Force a constant quantization parameter. If not set, the filter will use the QP
  8793. from the video stream (if available).
  8794. @item mode
  8795. Set thresholding mode. Available modes are:
  8796. @table @samp
  8797. @item hard
  8798. Set hard thresholding (default).
  8799. @item soft
  8800. Set soft thresholding (better de-ringing effect, but likely blurrier).
  8801. @end table
  8802. @item use_bframe_qp
  8803. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  8804. option may cause flicker since the B-Frames have often larger QP. Default is
  8805. @code{0} (not enabled).
  8806. @end table
  8807. @anchor{subtitles}
  8808. @section subtitles
  8809. Draw subtitles on top of input video using the libass library.
  8810. To enable compilation of this filter you need to configure FFmpeg with
  8811. @code{--enable-libass}. This filter also requires a build with libavcodec and
  8812. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  8813. Alpha) subtitles format.
  8814. The filter accepts the following options:
  8815. @table @option
  8816. @item filename, f
  8817. Set the filename of the subtitle file to read. It must be specified.
  8818. @item original_size
  8819. Specify the size of the original video, the video for which the ASS file
  8820. was composed. For the syntax of this option, check the
  8821. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8822. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  8823. correctly scale the fonts if the aspect ratio has been changed.
  8824. @item fontsdir
  8825. Set a directory path containing fonts that can be used by the filter.
  8826. These fonts will be used in addition to whatever the font provider uses.
  8827. @item charenc
  8828. Set subtitles input character encoding. @code{subtitles} filter only. Only
  8829. useful if not UTF-8.
  8830. @item stream_index, si
  8831. Set subtitles stream index. @code{subtitles} filter only.
  8832. @item force_style
  8833. Override default style or script info parameters of the subtitles. It accepts a
  8834. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  8835. @end table
  8836. If the first key is not specified, it is assumed that the first value
  8837. specifies the @option{filename}.
  8838. For example, to render the file @file{sub.srt} on top of the input
  8839. video, use the command:
  8840. @example
  8841. subtitles=sub.srt
  8842. @end example
  8843. which is equivalent to:
  8844. @example
  8845. subtitles=filename=sub.srt
  8846. @end example
  8847. To render the default subtitles stream from file @file{video.mkv}, use:
  8848. @example
  8849. subtitles=video.mkv
  8850. @end example
  8851. To render the second subtitles stream from that file, use:
  8852. @example
  8853. subtitles=video.mkv:si=1
  8854. @end example
  8855. To make the subtitles stream from @file{sub.srt} appear in transparent green
  8856. @code{DejaVu Serif}, use:
  8857. @example
  8858. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  8859. @end example
  8860. @section super2xsai
  8861. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  8862. Interpolate) pixel art scaling algorithm.
  8863. Useful for enlarging pixel art images without reducing sharpness.
  8864. @section swaprect
  8865. Swap two rectangular objects in video.
  8866. This filter accepts the following options:
  8867. @table @option
  8868. @item w
  8869. Set object width.
  8870. @item h
  8871. Set object height.
  8872. @item x1
  8873. Set 1st rect x coordinate.
  8874. @item y1
  8875. Set 1st rect y coordinate.
  8876. @item x2
  8877. Set 2nd rect x coordinate.
  8878. @item y2
  8879. Set 2nd rect y coordinate.
  8880. All expressions are evaluated once for each frame.
  8881. @end table
  8882. The all options are expressions containing the following constants:
  8883. @table @option
  8884. @item w
  8885. @item h
  8886. The input width and height.
  8887. @item a
  8888. same as @var{w} / @var{h}
  8889. @item sar
  8890. input sample aspect ratio
  8891. @item dar
  8892. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  8893. @item n
  8894. The number of the input frame, starting from 0.
  8895. @item t
  8896. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  8897. @item pos
  8898. the position in the file of the input frame, NAN if unknown
  8899. @end table
  8900. @section swapuv
  8901. Swap U & V plane.
  8902. @section telecine
  8903. Apply telecine process to the video.
  8904. This filter accepts the following options:
  8905. @table @option
  8906. @item first_field
  8907. @table @samp
  8908. @item top, t
  8909. top field first
  8910. @item bottom, b
  8911. bottom field first
  8912. The default value is @code{top}.
  8913. @end table
  8914. @item pattern
  8915. A string of numbers representing the pulldown pattern you wish to apply.
  8916. The default value is @code{23}.
  8917. @end table
  8918. @example
  8919. Some typical patterns:
  8920. NTSC output (30i):
  8921. 27.5p: 32222
  8922. 24p: 23 (classic)
  8923. 24p: 2332 (preferred)
  8924. 20p: 33
  8925. 18p: 334
  8926. 16p: 3444
  8927. PAL output (25i):
  8928. 27.5p: 12222
  8929. 24p: 222222222223 ("Euro pulldown")
  8930. 16.67p: 33
  8931. 16p: 33333334
  8932. @end example
  8933. @section thumbnail
  8934. Select the most representative frame in a given sequence of consecutive frames.
  8935. The filter accepts the following options:
  8936. @table @option
  8937. @item n
  8938. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  8939. will pick one of them, and then handle the next batch of @var{n} frames until
  8940. the end. Default is @code{100}.
  8941. @end table
  8942. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  8943. value will result in a higher memory usage, so a high value is not recommended.
  8944. @subsection Examples
  8945. @itemize
  8946. @item
  8947. Extract one picture each 50 frames:
  8948. @example
  8949. thumbnail=50
  8950. @end example
  8951. @item
  8952. Complete example of a thumbnail creation with @command{ffmpeg}:
  8953. @example
  8954. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  8955. @end example
  8956. @end itemize
  8957. @section tile
  8958. Tile several successive frames together.
  8959. The filter accepts the following options:
  8960. @table @option
  8961. @item layout
  8962. Set the grid size (i.e. the number of lines and columns). For the syntax of
  8963. this option, check the
  8964. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8965. @item nb_frames
  8966. Set the maximum number of frames to render in the given area. It must be less
  8967. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  8968. the area will be used.
  8969. @item margin
  8970. Set the outer border margin in pixels.
  8971. @item padding
  8972. Set the inner border thickness (i.e. the number of pixels between frames). For
  8973. more advanced padding options (such as having different values for the edges),
  8974. refer to the pad video filter.
  8975. @item color
  8976. Specify the color of the unused area. For the syntax of this option, check the
  8977. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  8978. is "black".
  8979. @end table
  8980. @subsection Examples
  8981. @itemize
  8982. @item
  8983. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  8984. @example
  8985. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  8986. @end example
  8987. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  8988. duplicating each output frame to accommodate the originally detected frame
  8989. rate.
  8990. @item
  8991. Display @code{5} pictures in an area of @code{3x2} frames,
  8992. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  8993. mixed flat and named options:
  8994. @example
  8995. tile=3x2:nb_frames=5:padding=7:margin=2
  8996. @end example
  8997. @end itemize
  8998. @section tinterlace
  8999. Perform various types of temporal field interlacing.
  9000. Frames are counted starting from 1, so the first input frame is
  9001. considered odd.
  9002. The filter accepts the following options:
  9003. @table @option
  9004. @item mode
  9005. Specify the mode of the interlacing. This option can also be specified
  9006. as a value alone. See below for a list of values for this option.
  9007. Available values are:
  9008. @table @samp
  9009. @item merge, 0
  9010. Move odd frames into the upper field, even into the lower field,
  9011. generating a double height frame at half frame rate.
  9012. @example
  9013. ------> time
  9014. Input:
  9015. Frame 1 Frame 2 Frame 3 Frame 4
  9016. 11111 22222 33333 44444
  9017. 11111 22222 33333 44444
  9018. 11111 22222 33333 44444
  9019. 11111 22222 33333 44444
  9020. Output:
  9021. 11111 33333
  9022. 22222 44444
  9023. 11111 33333
  9024. 22222 44444
  9025. 11111 33333
  9026. 22222 44444
  9027. 11111 33333
  9028. 22222 44444
  9029. @end example
  9030. @item drop_odd, 1
  9031. Only output even frames, odd frames are dropped, generating a frame with
  9032. unchanged height at half frame rate.
  9033. @example
  9034. ------> time
  9035. Input:
  9036. Frame 1 Frame 2 Frame 3 Frame 4
  9037. 11111 22222 33333 44444
  9038. 11111 22222 33333 44444
  9039. 11111 22222 33333 44444
  9040. 11111 22222 33333 44444
  9041. Output:
  9042. 22222 44444
  9043. 22222 44444
  9044. 22222 44444
  9045. 22222 44444
  9046. @end example
  9047. @item drop_even, 2
  9048. Only output odd frames, even frames are dropped, generating a frame with
  9049. unchanged height at half frame rate.
  9050. @example
  9051. ------> time
  9052. Input:
  9053. Frame 1 Frame 2 Frame 3 Frame 4
  9054. 11111 22222 33333 44444
  9055. 11111 22222 33333 44444
  9056. 11111 22222 33333 44444
  9057. 11111 22222 33333 44444
  9058. Output:
  9059. 11111 33333
  9060. 11111 33333
  9061. 11111 33333
  9062. 11111 33333
  9063. @end example
  9064. @item pad, 3
  9065. Expand each frame to full height, but pad alternate lines with black,
  9066. generating a frame with double height at the same input frame rate.
  9067. @example
  9068. ------> time
  9069. Input:
  9070. Frame 1 Frame 2 Frame 3 Frame 4
  9071. 11111 22222 33333 44444
  9072. 11111 22222 33333 44444
  9073. 11111 22222 33333 44444
  9074. 11111 22222 33333 44444
  9075. Output:
  9076. 11111 ..... 33333 .....
  9077. ..... 22222 ..... 44444
  9078. 11111 ..... 33333 .....
  9079. ..... 22222 ..... 44444
  9080. 11111 ..... 33333 .....
  9081. ..... 22222 ..... 44444
  9082. 11111 ..... 33333 .....
  9083. ..... 22222 ..... 44444
  9084. @end example
  9085. @item interleave_top, 4
  9086. Interleave the upper field from odd frames with the lower field from
  9087. even frames, generating a frame with unchanged height at half frame rate.
  9088. @example
  9089. ------> time
  9090. Input:
  9091. Frame 1 Frame 2 Frame 3 Frame 4
  9092. 11111<- 22222 33333<- 44444
  9093. 11111 22222<- 33333 44444<-
  9094. 11111<- 22222 33333<- 44444
  9095. 11111 22222<- 33333 44444<-
  9096. Output:
  9097. 11111 33333
  9098. 22222 44444
  9099. 11111 33333
  9100. 22222 44444
  9101. @end example
  9102. @item interleave_bottom, 5
  9103. Interleave the lower field from odd frames with the upper field from
  9104. even frames, generating a frame with unchanged height at half frame rate.
  9105. @example
  9106. ------> time
  9107. Input:
  9108. Frame 1 Frame 2 Frame 3 Frame 4
  9109. 11111 22222<- 33333 44444<-
  9110. 11111<- 22222 33333<- 44444
  9111. 11111 22222<- 33333 44444<-
  9112. 11111<- 22222 33333<- 44444
  9113. Output:
  9114. 22222 44444
  9115. 11111 33333
  9116. 22222 44444
  9117. 11111 33333
  9118. @end example
  9119. @item interlacex2, 6
  9120. Double frame rate with unchanged height. Frames are inserted each
  9121. containing the second temporal field from the previous input frame and
  9122. the first temporal field from the next input frame. This mode relies on
  9123. the top_field_first flag. Useful for interlaced video displays with no
  9124. field synchronisation.
  9125. @example
  9126. ------> time
  9127. Input:
  9128. Frame 1 Frame 2 Frame 3 Frame 4
  9129. 11111 22222 33333 44444
  9130. 11111 22222 33333 44444
  9131. 11111 22222 33333 44444
  9132. 11111 22222 33333 44444
  9133. Output:
  9134. 11111 22222 22222 33333 33333 44444 44444
  9135. 11111 11111 22222 22222 33333 33333 44444
  9136. 11111 22222 22222 33333 33333 44444 44444
  9137. 11111 11111 22222 22222 33333 33333 44444
  9138. @end example
  9139. @item mergex2, 7
  9140. Move odd frames into the upper field, even into the lower field,
  9141. generating a double height frame at same frame rate.
  9142. @example
  9143. ------> time
  9144. Input:
  9145. Frame 1 Frame 2 Frame 3 Frame 4
  9146. 11111 22222 33333 44444
  9147. 11111 22222 33333 44444
  9148. 11111 22222 33333 44444
  9149. 11111 22222 33333 44444
  9150. Output:
  9151. 11111 33333 33333 55555
  9152. 22222 22222 44444 44444
  9153. 11111 33333 33333 55555
  9154. 22222 22222 44444 44444
  9155. 11111 33333 33333 55555
  9156. 22222 22222 44444 44444
  9157. 11111 33333 33333 55555
  9158. 22222 22222 44444 44444
  9159. @end example
  9160. @end table
  9161. Numeric values are deprecated but are accepted for backward
  9162. compatibility reasons.
  9163. Default mode is @code{merge}.
  9164. @item flags
  9165. Specify flags influencing the filter process.
  9166. Available value for @var{flags} is:
  9167. @table @option
  9168. @item low_pass_filter, vlfp
  9169. Enable vertical low-pass filtering in the filter.
  9170. Vertical low-pass filtering is required when creating an interlaced
  9171. destination from a progressive source which contains high-frequency
  9172. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  9173. patterning.
  9174. Vertical low-pass filtering can only be enabled for @option{mode}
  9175. @var{interleave_top} and @var{interleave_bottom}.
  9176. @end table
  9177. @end table
  9178. @section transpose
  9179. Transpose rows with columns in the input video and optionally flip it.
  9180. It accepts the following parameters:
  9181. @table @option
  9182. @item dir
  9183. Specify the transposition direction.
  9184. Can assume the following values:
  9185. @table @samp
  9186. @item 0, 4, cclock_flip
  9187. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  9188. @example
  9189. L.R L.l
  9190. . . -> . .
  9191. l.r R.r
  9192. @end example
  9193. @item 1, 5, clock
  9194. Rotate by 90 degrees clockwise, that is:
  9195. @example
  9196. L.R l.L
  9197. . . -> . .
  9198. l.r r.R
  9199. @end example
  9200. @item 2, 6, cclock
  9201. Rotate by 90 degrees counterclockwise, that is:
  9202. @example
  9203. L.R R.r
  9204. . . -> . .
  9205. l.r L.l
  9206. @end example
  9207. @item 3, 7, clock_flip
  9208. Rotate by 90 degrees clockwise and vertically flip, that is:
  9209. @example
  9210. L.R r.R
  9211. . . -> . .
  9212. l.r l.L
  9213. @end example
  9214. @end table
  9215. For values between 4-7, the transposition is only done if the input
  9216. video geometry is portrait and not landscape. These values are
  9217. deprecated, the @code{passthrough} option should be used instead.
  9218. Numerical values are deprecated, and should be dropped in favor of
  9219. symbolic constants.
  9220. @item passthrough
  9221. Do not apply the transposition if the input geometry matches the one
  9222. specified by the specified value. It accepts the following values:
  9223. @table @samp
  9224. @item none
  9225. Always apply transposition.
  9226. @item portrait
  9227. Preserve portrait geometry (when @var{height} >= @var{width}).
  9228. @item landscape
  9229. Preserve landscape geometry (when @var{width} >= @var{height}).
  9230. @end table
  9231. Default value is @code{none}.
  9232. @end table
  9233. For example to rotate by 90 degrees clockwise and preserve portrait
  9234. layout:
  9235. @example
  9236. transpose=dir=1:passthrough=portrait
  9237. @end example
  9238. The command above can also be specified as:
  9239. @example
  9240. transpose=1:portrait
  9241. @end example
  9242. @section trim
  9243. Trim the input so that the output contains one continuous subpart of the input.
  9244. It accepts the following parameters:
  9245. @table @option
  9246. @item start
  9247. Specify the time of the start of the kept section, i.e. the frame with the
  9248. timestamp @var{start} will be the first frame in the output.
  9249. @item end
  9250. Specify the time of the first frame that will be dropped, i.e. the frame
  9251. immediately preceding the one with the timestamp @var{end} will be the last
  9252. frame in the output.
  9253. @item start_pts
  9254. This is the same as @var{start}, except this option sets the start timestamp
  9255. in timebase units instead of seconds.
  9256. @item end_pts
  9257. This is the same as @var{end}, except this option sets the end timestamp
  9258. in timebase units instead of seconds.
  9259. @item duration
  9260. The maximum duration of the output in seconds.
  9261. @item start_frame
  9262. The number of the first frame that should be passed to the output.
  9263. @item end_frame
  9264. The number of the first frame that should be dropped.
  9265. @end table
  9266. @option{start}, @option{end}, and @option{duration} are expressed as time
  9267. duration specifications; see
  9268. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  9269. for the accepted syntax.
  9270. Note that the first two sets of the start/end options and the @option{duration}
  9271. option look at the frame timestamp, while the _frame variants simply count the
  9272. frames that pass through the filter. Also note that this filter does not modify
  9273. the timestamps. If you wish for the output timestamps to start at zero, insert a
  9274. setpts filter after the trim filter.
  9275. If multiple start or end options are set, this filter tries to be greedy and
  9276. keep all the frames that match at least one of the specified constraints. To keep
  9277. only the part that matches all the constraints at once, chain multiple trim
  9278. filters.
  9279. The defaults are such that all the input is kept. So it is possible to set e.g.
  9280. just the end values to keep everything before the specified time.
  9281. Examples:
  9282. @itemize
  9283. @item
  9284. Drop everything except the second minute of input:
  9285. @example
  9286. ffmpeg -i INPUT -vf trim=60:120
  9287. @end example
  9288. @item
  9289. Keep only the first second:
  9290. @example
  9291. ffmpeg -i INPUT -vf trim=duration=1
  9292. @end example
  9293. @end itemize
  9294. @anchor{unsharp}
  9295. @section unsharp
  9296. Sharpen or blur the input video.
  9297. It accepts the following parameters:
  9298. @table @option
  9299. @item luma_msize_x, lx
  9300. Set the luma matrix horizontal size. It must be an odd integer between
  9301. 3 and 63. The default value is 5.
  9302. @item luma_msize_y, ly
  9303. Set the luma matrix vertical size. It must be an odd integer between 3
  9304. and 63. The default value is 5.
  9305. @item luma_amount, la
  9306. Set the luma effect strength. It must be a floating point number, reasonable
  9307. values lay between -1.5 and 1.5.
  9308. Negative values will blur the input video, while positive values will
  9309. sharpen it, a value of zero will disable the effect.
  9310. Default value is 1.0.
  9311. @item chroma_msize_x, cx
  9312. Set the chroma matrix horizontal size. It must be an odd integer
  9313. between 3 and 63. The default value is 5.
  9314. @item chroma_msize_y, cy
  9315. Set the chroma matrix vertical size. It must be an odd integer
  9316. between 3 and 63. The default value is 5.
  9317. @item chroma_amount, ca
  9318. Set the chroma effect strength. It must be a floating point number, reasonable
  9319. values lay between -1.5 and 1.5.
  9320. Negative values will blur the input video, while positive values will
  9321. sharpen it, a value of zero will disable the effect.
  9322. Default value is 0.0.
  9323. @item opencl
  9324. If set to 1, specify using OpenCL capabilities, only available if
  9325. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  9326. @end table
  9327. All parameters are optional and default to the equivalent of the
  9328. string '5:5:1.0:5:5:0.0'.
  9329. @subsection Examples
  9330. @itemize
  9331. @item
  9332. Apply strong luma sharpen effect:
  9333. @example
  9334. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  9335. @end example
  9336. @item
  9337. Apply a strong blur of both luma and chroma parameters:
  9338. @example
  9339. unsharp=7:7:-2:7:7:-2
  9340. @end example
  9341. @end itemize
  9342. @section uspp
  9343. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  9344. the image at several (or - in the case of @option{quality} level @code{8} - all)
  9345. shifts and average the results.
  9346. The way this differs from the behavior of spp is that uspp actually encodes &
  9347. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  9348. DCT similar to MJPEG.
  9349. The filter accepts the following options:
  9350. @table @option
  9351. @item quality
  9352. Set quality. This option defines the number of levels for averaging. It accepts
  9353. an integer in the range 0-8. If set to @code{0}, the filter will have no
  9354. effect. A value of @code{8} means the higher quality. For each increment of
  9355. that value the speed drops by a factor of approximately 2. Default value is
  9356. @code{3}.
  9357. @item qp
  9358. Force a constant quantization parameter. If not set, the filter will use the QP
  9359. from the video stream (if available).
  9360. @end table
  9361. @section vectorscope
  9362. Display 2 color component values in the two dimensional graph (which is called
  9363. a vectorscope).
  9364. This filter accepts the following options:
  9365. @table @option
  9366. @item mode, m
  9367. Set vectorscope mode.
  9368. It accepts the following values:
  9369. @table @samp
  9370. @item gray
  9371. Gray values are displayed on graph, higher brightness means more pixels have
  9372. same component color value on location in graph. This is the default mode.
  9373. @item color
  9374. Gray values are displayed on graph. Surrounding pixels values which are not
  9375. present in video frame are drawn in gradient of 2 color components which are
  9376. set by option @code{x} and @code{y}.
  9377. @item color2
  9378. Actual color components values present in video frame are displayed on graph.
  9379. @item color3
  9380. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  9381. on graph increases value of another color component, which is luminance by
  9382. default values of @code{x} and @code{y}.
  9383. @item color4
  9384. Actual colors present in video frame are displayed on graph. If two different
  9385. colors map to same position on graph then color with higher value of component
  9386. not present in graph is picked.
  9387. @end table
  9388. @item x
  9389. Set which color component will be represented on X-axis. Default is @code{1}.
  9390. @item y
  9391. Set which color component will be represented on Y-axis. Default is @code{2}.
  9392. @item intensity, i
  9393. Set intensity, used by modes: gray, color and color3 for increasing brightness
  9394. of color component which represents frequency of (X, Y) location in graph.
  9395. @item envelope, e
  9396. @table @samp
  9397. @item none
  9398. No envelope, this is default.
  9399. @item instant
  9400. Instant envelope, even darkest single pixel will be clearly highlighted.
  9401. @item peak
  9402. Hold maximum and minimum values presented in graph over time. This way you
  9403. can still spot out of range values without constantly looking at vectorscope.
  9404. @item peak+instant
  9405. Peak and instant envelope combined together.
  9406. @end table
  9407. @end table
  9408. @anchor{vidstabdetect}
  9409. @section vidstabdetect
  9410. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  9411. @ref{vidstabtransform} for pass 2.
  9412. This filter generates a file with relative translation and rotation
  9413. transform information about subsequent frames, which is then used by
  9414. the @ref{vidstabtransform} filter.
  9415. To enable compilation of this filter you need to configure FFmpeg with
  9416. @code{--enable-libvidstab}.
  9417. This filter accepts the following options:
  9418. @table @option
  9419. @item result
  9420. Set the path to the file used to write the transforms information.
  9421. Default value is @file{transforms.trf}.
  9422. @item shakiness
  9423. Set how shaky the video is and how quick the camera is. It accepts an
  9424. integer in the range 1-10, a value of 1 means little shakiness, a
  9425. value of 10 means strong shakiness. Default value is 5.
  9426. @item accuracy
  9427. Set the accuracy of the detection process. It must be a value in the
  9428. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  9429. accuracy. Default value is 15.
  9430. @item stepsize
  9431. Set stepsize of the search process. The region around minimum is
  9432. scanned with 1 pixel resolution. Default value is 6.
  9433. @item mincontrast
  9434. Set minimum contrast. Below this value a local measurement field is
  9435. discarded. Must be a floating point value in the range 0-1. Default
  9436. value is 0.3.
  9437. @item tripod
  9438. Set reference frame number for tripod mode.
  9439. If enabled, the motion of the frames is compared to a reference frame
  9440. in the filtered stream, identified by the specified number. The idea
  9441. is to compensate all movements in a more-or-less static scene and keep
  9442. the camera view absolutely still.
  9443. If set to 0, it is disabled. The frames are counted starting from 1.
  9444. @item show
  9445. Show fields and transforms in the resulting frames. It accepts an
  9446. integer in the range 0-2. Default value is 0, which disables any
  9447. visualization.
  9448. @end table
  9449. @subsection Examples
  9450. @itemize
  9451. @item
  9452. Use default values:
  9453. @example
  9454. vidstabdetect
  9455. @end example
  9456. @item
  9457. Analyze strongly shaky movie and put the results in file
  9458. @file{mytransforms.trf}:
  9459. @example
  9460. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  9461. @end example
  9462. @item
  9463. Visualize the result of internal transformations in the resulting
  9464. video:
  9465. @example
  9466. vidstabdetect=show=1
  9467. @end example
  9468. @item
  9469. Analyze a video with medium shakiness using @command{ffmpeg}:
  9470. @example
  9471. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  9472. @end example
  9473. @end itemize
  9474. @anchor{vidstabtransform}
  9475. @section vidstabtransform
  9476. Video stabilization/deshaking: pass 2 of 2,
  9477. see @ref{vidstabdetect} for pass 1.
  9478. Read a file with transform information for each frame and
  9479. apply/compensate them. Together with the @ref{vidstabdetect}
  9480. filter this can be used to deshake videos. See also
  9481. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  9482. the @ref{unsharp} filter, see below.
  9483. To enable compilation of this filter you need to configure FFmpeg with
  9484. @code{--enable-libvidstab}.
  9485. @subsection Options
  9486. @table @option
  9487. @item input
  9488. Set path to the file used to read the transforms. Default value is
  9489. @file{transforms.trf}.
  9490. @item smoothing
  9491. Set the number of frames (value*2 + 1) used for lowpass filtering the
  9492. camera movements. Default value is 10.
  9493. For example a number of 10 means that 21 frames are used (10 in the
  9494. past and 10 in the future) to smoothen the motion in the video. A
  9495. larger value leads to a smoother video, but limits the acceleration of
  9496. the camera (pan/tilt movements). 0 is a special case where a static
  9497. camera is simulated.
  9498. @item optalgo
  9499. Set the camera path optimization algorithm.
  9500. Accepted values are:
  9501. @table @samp
  9502. @item gauss
  9503. gaussian kernel low-pass filter on camera motion (default)
  9504. @item avg
  9505. averaging on transformations
  9506. @end table
  9507. @item maxshift
  9508. Set maximal number of pixels to translate frames. Default value is -1,
  9509. meaning no limit.
  9510. @item maxangle
  9511. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  9512. value is -1, meaning no limit.
  9513. @item crop
  9514. Specify how to deal with borders that may be visible due to movement
  9515. compensation.
  9516. Available values are:
  9517. @table @samp
  9518. @item keep
  9519. keep image information from previous frame (default)
  9520. @item black
  9521. fill the border black
  9522. @end table
  9523. @item invert
  9524. Invert transforms if set to 1. Default value is 0.
  9525. @item relative
  9526. Consider transforms as relative to previous frame if set to 1,
  9527. absolute if set to 0. Default value is 0.
  9528. @item zoom
  9529. Set percentage to zoom. A positive value will result in a zoom-in
  9530. effect, a negative value in a zoom-out effect. Default value is 0 (no
  9531. zoom).
  9532. @item optzoom
  9533. Set optimal zooming to avoid borders.
  9534. Accepted values are:
  9535. @table @samp
  9536. @item 0
  9537. disabled
  9538. @item 1
  9539. optimal static zoom value is determined (only very strong movements
  9540. will lead to visible borders) (default)
  9541. @item 2
  9542. optimal adaptive zoom value is determined (no borders will be
  9543. visible), see @option{zoomspeed}
  9544. @end table
  9545. Note that the value given at zoom is added to the one calculated here.
  9546. @item zoomspeed
  9547. Set percent to zoom maximally each frame (enabled when
  9548. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  9549. 0.25.
  9550. @item interpol
  9551. Specify type of interpolation.
  9552. Available values are:
  9553. @table @samp
  9554. @item no
  9555. no interpolation
  9556. @item linear
  9557. linear only horizontal
  9558. @item bilinear
  9559. linear in both directions (default)
  9560. @item bicubic
  9561. cubic in both directions (slow)
  9562. @end table
  9563. @item tripod
  9564. Enable virtual tripod mode if set to 1, which is equivalent to
  9565. @code{relative=0:smoothing=0}. Default value is 0.
  9566. Use also @code{tripod} option of @ref{vidstabdetect}.
  9567. @item debug
  9568. Increase log verbosity if set to 1. Also the detected global motions
  9569. are written to the temporary file @file{global_motions.trf}. Default
  9570. value is 0.
  9571. @end table
  9572. @subsection Examples
  9573. @itemize
  9574. @item
  9575. Use @command{ffmpeg} for a typical stabilization with default values:
  9576. @example
  9577. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  9578. @end example
  9579. Note the use of the @ref{unsharp} filter which is always recommended.
  9580. @item
  9581. Zoom in a bit more and load transform data from a given file:
  9582. @example
  9583. vidstabtransform=zoom=5:input="mytransforms.trf"
  9584. @end example
  9585. @item
  9586. Smoothen the video even more:
  9587. @example
  9588. vidstabtransform=smoothing=30
  9589. @end example
  9590. @end itemize
  9591. @section vflip
  9592. Flip the input video vertically.
  9593. For example, to vertically flip a video with @command{ffmpeg}:
  9594. @example
  9595. ffmpeg -i in.avi -vf "vflip" out.avi
  9596. @end example
  9597. @anchor{vignette}
  9598. @section vignette
  9599. Make or reverse a natural vignetting effect.
  9600. The filter accepts the following options:
  9601. @table @option
  9602. @item angle, a
  9603. Set lens angle expression as a number of radians.
  9604. The value is clipped in the @code{[0,PI/2]} range.
  9605. Default value: @code{"PI/5"}
  9606. @item x0
  9607. @item y0
  9608. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  9609. by default.
  9610. @item mode
  9611. Set forward/backward mode.
  9612. Available modes are:
  9613. @table @samp
  9614. @item forward
  9615. The larger the distance from the central point, the darker the image becomes.
  9616. @item backward
  9617. The larger the distance from the central point, the brighter the image becomes.
  9618. This can be used to reverse a vignette effect, though there is no automatic
  9619. detection to extract the lens @option{angle} and other settings (yet). It can
  9620. also be used to create a burning effect.
  9621. @end table
  9622. Default value is @samp{forward}.
  9623. @item eval
  9624. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  9625. It accepts the following values:
  9626. @table @samp
  9627. @item init
  9628. Evaluate expressions only once during the filter initialization.
  9629. @item frame
  9630. Evaluate expressions for each incoming frame. This is way slower than the
  9631. @samp{init} mode since it requires all the scalers to be re-computed, but it
  9632. allows advanced dynamic expressions.
  9633. @end table
  9634. Default value is @samp{init}.
  9635. @item dither
  9636. Set dithering to reduce the circular banding effects. Default is @code{1}
  9637. (enabled).
  9638. @item aspect
  9639. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  9640. Setting this value to the SAR of the input will make a rectangular vignetting
  9641. following the dimensions of the video.
  9642. Default is @code{1/1}.
  9643. @end table
  9644. @subsection Expressions
  9645. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  9646. following parameters.
  9647. @table @option
  9648. @item w
  9649. @item h
  9650. input width and height
  9651. @item n
  9652. the number of input frame, starting from 0
  9653. @item pts
  9654. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  9655. @var{TB} units, NAN if undefined
  9656. @item r
  9657. frame rate of the input video, NAN if the input frame rate is unknown
  9658. @item t
  9659. the PTS (Presentation TimeStamp) of the filtered video frame,
  9660. expressed in seconds, NAN if undefined
  9661. @item tb
  9662. time base of the input video
  9663. @end table
  9664. @subsection Examples
  9665. @itemize
  9666. @item
  9667. Apply simple strong vignetting effect:
  9668. @example
  9669. vignette=PI/4
  9670. @end example
  9671. @item
  9672. Make a flickering vignetting:
  9673. @example
  9674. vignette='PI/4+random(1)*PI/50':eval=frame
  9675. @end example
  9676. @end itemize
  9677. @section vstack
  9678. Stack input videos vertically.
  9679. All streams must be of same pixel format and of same width.
  9680. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  9681. to create same output.
  9682. The filter accept the following option:
  9683. @table @option
  9684. @item inputs
  9685. Set number of input streams. Default is 2.
  9686. @item shortest
  9687. If set to 1, force the output to terminate when the shortest input
  9688. terminates. Default value is 0.
  9689. @end table
  9690. @section w3fdif
  9691. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  9692. Deinterlacing Filter").
  9693. Based on the process described by Martin Weston for BBC R&D, and
  9694. implemented based on the de-interlace algorithm written by Jim
  9695. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  9696. uses filter coefficients calculated by BBC R&D.
  9697. There are two sets of filter coefficients, so called "simple":
  9698. and "complex". Which set of filter coefficients is used can
  9699. be set by passing an optional parameter:
  9700. @table @option
  9701. @item filter
  9702. Set the interlacing filter coefficients. Accepts one of the following values:
  9703. @table @samp
  9704. @item simple
  9705. Simple filter coefficient set.
  9706. @item complex
  9707. More-complex filter coefficient set.
  9708. @end table
  9709. Default value is @samp{complex}.
  9710. @item deint
  9711. Specify which frames to deinterlace. Accept one of the following values:
  9712. @table @samp
  9713. @item all
  9714. Deinterlace all frames,
  9715. @item interlaced
  9716. Only deinterlace frames marked as interlaced.
  9717. @end table
  9718. Default value is @samp{all}.
  9719. @end table
  9720. @section waveform
  9721. Video waveform monitor.
  9722. The waveform monitor plots color component intensity. By default luminance
  9723. only. Each column of the waveform corresponds to a column of pixels in the
  9724. source video.
  9725. It accepts the following options:
  9726. @table @option
  9727. @item mode, m
  9728. Can be either @code{row}, or @code{column}. Default is @code{column}.
  9729. In row mode, the graph on the left side represents color component value 0 and
  9730. the right side represents value = 255. In column mode, the top side represents
  9731. color component value = 0 and bottom side represents value = 255.
  9732. @item intensity, i
  9733. Set intensity. Smaller values are useful to find out how many values of the same
  9734. luminance are distributed across input rows/columns.
  9735. Default value is @code{0.04}. Allowed range is [0, 1].
  9736. @item mirror, r
  9737. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  9738. In mirrored mode, higher values will be represented on the left
  9739. side for @code{row} mode and at the top for @code{column} mode. Default is
  9740. @code{1} (mirrored).
  9741. @item display, d
  9742. Set display mode.
  9743. It accepts the following values:
  9744. @table @samp
  9745. @item overlay
  9746. Presents information identical to that in the @code{parade}, except
  9747. that the graphs representing color components are superimposed directly
  9748. over one another.
  9749. This display mode makes it easier to spot relative differences or similarities
  9750. in overlapping areas of the color components that are supposed to be identical,
  9751. such as neutral whites, grays, or blacks.
  9752. @item parade
  9753. Display separate graph for the color components side by side in
  9754. @code{row} mode or one below the other in @code{column} mode.
  9755. Using this display mode makes it easy to spot color casts in the highlights
  9756. and shadows of an image, by comparing the contours of the top and the bottom
  9757. graphs of each waveform. Since whites, grays, and blacks are characterized
  9758. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  9759. should display three waveforms of roughly equal width/height. If not, the
  9760. correction is easy to perform by making level adjustments the three waveforms.
  9761. @end table
  9762. Default is @code{parade}.
  9763. @item components, c
  9764. Set which color components to display. Default is 1, which means only luminance
  9765. or red color component if input is in RGB colorspace. If is set for example to
  9766. 7 it will display all 3 (if) available color components.
  9767. @item envelope, e
  9768. @table @samp
  9769. @item none
  9770. No envelope, this is default.
  9771. @item instant
  9772. Instant envelope, minimum and maximum values presented in graph will be easily
  9773. visible even with small @code{step} value.
  9774. @item peak
  9775. Hold minimum and maximum values presented in graph across time. This way you
  9776. can still spot out of range values without constantly looking at waveforms.
  9777. @item peak+instant
  9778. Peak and instant envelope combined together.
  9779. @end table
  9780. @item filter, f
  9781. @table @samp
  9782. @item lowpass
  9783. No filtering, this is default.
  9784. @item flat
  9785. Luma and chroma combined together.
  9786. @item aflat
  9787. Similar as above, but shows difference between blue and red chroma.
  9788. @item chroma
  9789. Displays only chroma.
  9790. @item achroma
  9791. Similar as above, but shows difference between blue and red chroma.
  9792. @item color
  9793. Displays actual color value on waveform.
  9794. @end table
  9795. @end table
  9796. @section xbr
  9797. Apply the xBR high-quality magnification filter which is designed for pixel
  9798. art. It follows a set of edge-detection rules, see
  9799. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  9800. It accepts the following option:
  9801. @table @option
  9802. @item n
  9803. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  9804. @code{3xBR} and @code{4} for @code{4xBR}.
  9805. Default is @code{3}.
  9806. @end table
  9807. @anchor{yadif}
  9808. @section yadif
  9809. Deinterlace the input video ("yadif" means "yet another deinterlacing
  9810. filter").
  9811. It accepts the following parameters:
  9812. @table @option
  9813. @item mode
  9814. The interlacing mode to adopt. It accepts one of the following values:
  9815. @table @option
  9816. @item 0, send_frame
  9817. Output one frame for each frame.
  9818. @item 1, send_field
  9819. Output one frame for each field.
  9820. @item 2, send_frame_nospatial
  9821. Like @code{send_frame}, but it skips the spatial interlacing check.
  9822. @item 3, send_field_nospatial
  9823. Like @code{send_field}, but it skips the spatial interlacing check.
  9824. @end table
  9825. The default value is @code{send_frame}.
  9826. @item parity
  9827. The picture field parity assumed for the input interlaced video. It accepts one
  9828. of the following values:
  9829. @table @option
  9830. @item 0, tff
  9831. Assume the top field is first.
  9832. @item 1, bff
  9833. Assume the bottom field is first.
  9834. @item -1, auto
  9835. Enable automatic detection of field parity.
  9836. @end table
  9837. The default value is @code{auto}.
  9838. If the interlacing is unknown or the decoder does not export this information,
  9839. top field first will be assumed.
  9840. @item deint
  9841. Specify which frames to deinterlace. Accept one of the following
  9842. values:
  9843. @table @option
  9844. @item 0, all
  9845. Deinterlace all frames.
  9846. @item 1, interlaced
  9847. Only deinterlace frames marked as interlaced.
  9848. @end table
  9849. The default value is @code{all}.
  9850. @end table
  9851. @section zoompan
  9852. Apply Zoom & Pan effect.
  9853. This filter accepts the following options:
  9854. @table @option
  9855. @item zoom, z
  9856. Set the zoom expression. Default is 1.
  9857. @item x
  9858. @item y
  9859. Set the x and y expression. Default is 0.
  9860. @item d
  9861. Set the duration expression in number of frames.
  9862. This sets for how many number of frames effect will last for
  9863. single input image.
  9864. @item s
  9865. Set the output image size, default is 'hd720'.
  9866. @item fps
  9867. Set the output frame rate, default is '25'.
  9868. @end table
  9869. Each expression can contain the following constants:
  9870. @table @option
  9871. @item in_w, iw
  9872. Input width.
  9873. @item in_h, ih
  9874. Input height.
  9875. @item out_w, ow
  9876. Output width.
  9877. @item out_h, oh
  9878. Output height.
  9879. @item in
  9880. Input frame count.
  9881. @item on
  9882. Output frame count.
  9883. @item x
  9884. @item y
  9885. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  9886. for current input frame.
  9887. @item px
  9888. @item py
  9889. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  9890. not yet such frame (first input frame).
  9891. @item zoom
  9892. Last calculated zoom from 'z' expression for current input frame.
  9893. @item pzoom
  9894. Last calculated zoom of last output frame of previous input frame.
  9895. @item duration
  9896. Number of output frames for current input frame. Calculated from 'd' expression
  9897. for each input frame.
  9898. @item pduration
  9899. number of output frames created for previous input frame
  9900. @item a
  9901. Rational number: input width / input height
  9902. @item sar
  9903. sample aspect ratio
  9904. @item dar
  9905. display aspect ratio
  9906. @end table
  9907. @subsection Examples
  9908. @itemize
  9909. @item
  9910. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  9911. @example
  9912. 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
  9913. @end example
  9914. @item
  9915. Zoom-in up to 1.5 and pan always at center of picture:
  9916. @example
  9917. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  9918. @end example
  9919. @end itemize
  9920. @section zscale
  9921. Scale (resize) the input video, using the z.lib library:
  9922. https://github.com/sekrit-twc/zimg.
  9923. The zscale filter forces the output display aspect ratio to be the same
  9924. as the input, by changing the output sample aspect ratio.
  9925. If the input image format is different from the format requested by
  9926. the next filter, the zscale filter will convert the input to the
  9927. requested format.
  9928. @subsection Options
  9929. The filter accepts the following options.
  9930. @table @option
  9931. @item width, w
  9932. @item height, h
  9933. Set the output video dimension expression. Default value is the input
  9934. dimension.
  9935. If the @var{width} or @var{w} is 0, the input width is used for the output.
  9936. If the @var{height} or @var{h} is 0, the input height is used for the output.
  9937. If one of the values is -1, the zscale filter will use a value that
  9938. maintains the aspect ratio of the input image, calculated from the
  9939. other specified dimension. If both of them are -1, the input size is
  9940. used
  9941. If one of the values is -n with n > 1, the zscale filter will also use a value
  9942. that maintains the aspect ratio of the input image, calculated from the other
  9943. specified dimension. After that it will, however, make sure that the calculated
  9944. dimension is divisible by n and adjust the value if necessary.
  9945. See below for the list of accepted constants for use in the dimension
  9946. expression.
  9947. @item size, s
  9948. Set the video size. For the syntax of this option, check the
  9949. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9950. @item dither, d
  9951. Set the dither type.
  9952. Possible values are:
  9953. @table @var
  9954. @item none
  9955. @item ordered
  9956. @item random
  9957. @item error_diffusion
  9958. @end table
  9959. Default is none.
  9960. @item filter, f
  9961. Set the resize filter type.
  9962. Possible values are:
  9963. @table @var
  9964. @item point
  9965. @item bilinear
  9966. @item bicubic
  9967. @item spline16
  9968. @item spline36
  9969. @item lanczos
  9970. @end table
  9971. Default is bilinear.
  9972. @item range, r
  9973. Set the color range.
  9974. Possible values are:
  9975. @table @var
  9976. @item input
  9977. @item limited
  9978. @item full
  9979. @end table
  9980. Default is same as input.
  9981. @item primaries, p
  9982. Set the color primaries.
  9983. Possible values are:
  9984. @table @var
  9985. @item input
  9986. @item 709
  9987. @item unspecified
  9988. @item 170m
  9989. @item 240m
  9990. @item 2020
  9991. @end table
  9992. Default is same as input.
  9993. @item transfer, t
  9994. Set the transfer characteristics.
  9995. Possible values are:
  9996. @table @var
  9997. @item input
  9998. @item 709
  9999. @item unspecified
  10000. @item 601
  10001. @item linear
  10002. @item 2020_10
  10003. @item 2020_12
  10004. @end table
  10005. Default is same as input.
  10006. @item matrix, m
  10007. Set the colorspace matrix.
  10008. Possible value are:
  10009. @table @var
  10010. @item input
  10011. @item 709
  10012. @item unspecified
  10013. @item 470bg
  10014. @item 170m
  10015. @item 2020_ncl
  10016. @item 2020_cl
  10017. @end table
  10018. Default is same as input.
  10019. @item rangein, rin
  10020. Set the input color range.
  10021. Possible values are:
  10022. @table @var
  10023. @item input
  10024. @item limited
  10025. @item full
  10026. @end table
  10027. Default is same as input.
  10028. @item primariesin, pin
  10029. Set the input color primaries.
  10030. Possible values are:
  10031. @table @var
  10032. @item input
  10033. @item 709
  10034. @item unspecified
  10035. @item 170m
  10036. @item 240m
  10037. @item 2020
  10038. @end table
  10039. Default is same as input.
  10040. @item transferin, tin
  10041. Set the input transfer characteristics.
  10042. Possible values are:
  10043. @table @var
  10044. @item input
  10045. @item 709
  10046. @item unspecified
  10047. @item 601
  10048. @item linear
  10049. @item 2020_10
  10050. @item 2020_12
  10051. @end table
  10052. Default is same as input.
  10053. @item matrixin, min
  10054. Set the input colorspace matrix.
  10055. Possible value are:
  10056. @table @var
  10057. @item input
  10058. @item 709
  10059. @item unspecified
  10060. @item 470bg
  10061. @item 170m
  10062. @item 2020_ncl
  10063. @item 2020_cl
  10064. @end table
  10065. @end table
  10066. The values of the @option{w} and @option{h} options are expressions
  10067. containing the following constants:
  10068. @table @var
  10069. @item in_w
  10070. @item in_h
  10071. The input width and height
  10072. @item iw
  10073. @item ih
  10074. These are the same as @var{in_w} and @var{in_h}.
  10075. @item out_w
  10076. @item out_h
  10077. The output (scaled) width and height
  10078. @item ow
  10079. @item oh
  10080. These are the same as @var{out_w} and @var{out_h}
  10081. @item a
  10082. The same as @var{iw} / @var{ih}
  10083. @item sar
  10084. input sample aspect ratio
  10085. @item dar
  10086. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  10087. @item hsub
  10088. @item vsub
  10089. horizontal and vertical input chroma subsample values. For example for the
  10090. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10091. @item ohsub
  10092. @item ovsub
  10093. horizontal and vertical output chroma subsample values. For example for the
  10094. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10095. @end table
  10096. @table @option
  10097. @end table
  10098. @c man end VIDEO FILTERS
  10099. @chapter Video Sources
  10100. @c man begin VIDEO SOURCES
  10101. Below is a description of the currently available video sources.
  10102. @section buffer
  10103. Buffer video frames, and make them available to the filter chain.
  10104. This source is mainly intended for a programmatic use, in particular
  10105. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  10106. It accepts the following parameters:
  10107. @table @option
  10108. @item video_size
  10109. Specify the size (width and height) of the buffered video frames. For the
  10110. syntax of this option, check the
  10111. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10112. @item width
  10113. The input video width.
  10114. @item height
  10115. The input video height.
  10116. @item pix_fmt
  10117. A string representing the pixel format of the buffered video frames.
  10118. It may be a number corresponding to a pixel format, or a pixel format
  10119. name.
  10120. @item time_base
  10121. Specify the timebase assumed by the timestamps of the buffered frames.
  10122. @item frame_rate
  10123. Specify the frame rate expected for the video stream.
  10124. @item pixel_aspect, sar
  10125. The sample (pixel) aspect ratio of the input video.
  10126. @item sws_param
  10127. Specify the optional parameters to be used for the scale filter which
  10128. is automatically inserted when an input change is detected in the
  10129. input size or format.
  10130. @end table
  10131. For example:
  10132. @example
  10133. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  10134. @end example
  10135. will instruct the source to accept video frames with size 320x240 and
  10136. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  10137. square pixels (1:1 sample aspect ratio).
  10138. Since the pixel format with name "yuv410p" corresponds to the number 6
  10139. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  10140. this example corresponds to:
  10141. @example
  10142. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  10143. @end example
  10144. Alternatively, the options can be specified as a flat string, but this
  10145. syntax is deprecated:
  10146. @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}]
  10147. @section cellauto
  10148. Create a pattern generated by an elementary cellular automaton.
  10149. The initial state of the cellular automaton can be defined through the
  10150. @option{filename}, and @option{pattern} options. If such options are
  10151. not specified an initial state is created randomly.
  10152. At each new frame a new row in the video is filled with the result of
  10153. the cellular automaton next generation. The behavior when the whole
  10154. frame is filled is defined by the @option{scroll} option.
  10155. This source accepts the following options:
  10156. @table @option
  10157. @item filename, f
  10158. Read the initial cellular automaton state, i.e. the starting row, from
  10159. the specified file.
  10160. In the file, each non-whitespace character is considered an alive
  10161. cell, a newline will terminate the row, and further characters in the
  10162. file will be ignored.
  10163. @item pattern, p
  10164. Read the initial cellular automaton state, i.e. the starting row, from
  10165. the specified string.
  10166. Each non-whitespace character in the string is considered an alive
  10167. cell, a newline will terminate the row, and further characters in the
  10168. string will be ignored.
  10169. @item rate, r
  10170. Set the video rate, that is the number of frames generated per second.
  10171. Default is 25.
  10172. @item random_fill_ratio, ratio
  10173. Set the random fill ratio for the initial cellular automaton row. It
  10174. is a floating point number value ranging from 0 to 1, defaults to
  10175. 1/PHI.
  10176. This option is ignored when a file or a pattern is specified.
  10177. @item random_seed, seed
  10178. Set the seed for filling randomly the initial row, must be an integer
  10179. included between 0 and UINT32_MAX. If not specified, or if explicitly
  10180. set to -1, the filter will try to use a good random seed on a best
  10181. effort basis.
  10182. @item rule
  10183. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  10184. Default value is 110.
  10185. @item size, s
  10186. Set the size of the output video. For the syntax of this option, check the
  10187. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10188. If @option{filename} or @option{pattern} is specified, the size is set
  10189. by default to the width of the specified initial state row, and the
  10190. height is set to @var{width} * PHI.
  10191. If @option{size} is set, it must contain the width of the specified
  10192. pattern string, and the specified pattern will be centered in the
  10193. larger row.
  10194. If a filename or a pattern string is not specified, the size value
  10195. defaults to "320x518" (used for a randomly generated initial state).
  10196. @item scroll
  10197. If set to 1, scroll the output upward when all the rows in the output
  10198. have been already filled. If set to 0, the new generated row will be
  10199. written over the top row just after the bottom row is filled.
  10200. Defaults to 1.
  10201. @item start_full, full
  10202. If set to 1, completely fill the output with generated rows before
  10203. outputting the first frame.
  10204. This is the default behavior, for disabling set the value to 0.
  10205. @item stitch
  10206. If set to 1, stitch the left and right row edges together.
  10207. This is the default behavior, for disabling set the value to 0.
  10208. @end table
  10209. @subsection Examples
  10210. @itemize
  10211. @item
  10212. Read the initial state from @file{pattern}, and specify an output of
  10213. size 200x400.
  10214. @example
  10215. cellauto=f=pattern:s=200x400
  10216. @end example
  10217. @item
  10218. Generate a random initial row with a width of 200 cells, with a fill
  10219. ratio of 2/3:
  10220. @example
  10221. cellauto=ratio=2/3:s=200x200
  10222. @end example
  10223. @item
  10224. Create a pattern generated by rule 18 starting by a single alive cell
  10225. centered on an initial row with width 100:
  10226. @example
  10227. cellauto=p=@@:s=100x400:full=0:rule=18
  10228. @end example
  10229. @item
  10230. Specify a more elaborated initial pattern:
  10231. @example
  10232. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  10233. @end example
  10234. @end itemize
  10235. @section mandelbrot
  10236. Generate a Mandelbrot set fractal, and progressively zoom towards the
  10237. point specified with @var{start_x} and @var{start_y}.
  10238. This source accepts the following options:
  10239. @table @option
  10240. @item end_pts
  10241. Set the terminal pts value. Default value is 400.
  10242. @item end_scale
  10243. Set the terminal scale value.
  10244. Must be a floating point value. Default value is 0.3.
  10245. @item inner
  10246. Set the inner coloring mode, that is the algorithm used to draw the
  10247. Mandelbrot fractal internal region.
  10248. It shall assume one of the following values:
  10249. @table @option
  10250. @item black
  10251. Set black mode.
  10252. @item convergence
  10253. Show time until convergence.
  10254. @item mincol
  10255. Set color based on point closest to the origin of the iterations.
  10256. @item period
  10257. Set period mode.
  10258. @end table
  10259. Default value is @var{mincol}.
  10260. @item bailout
  10261. Set the bailout value. Default value is 10.0.
  10262. @item maxiter
  10263. Set the maximum of iterations performed by the rendering
  10264. algorithm. Default value is 7189.
  10265. @item outer
  10266. Set outer coloring mode.
  10267. It shall assume one of following values:
  10268. @table @option
  10269. @item iteration_count
  10270. Set iteration cound mode.
  10271. @item normalized_iteration_count
  10272. set normalized iteration count mode.
  10273. @end table
  10274. Default value is @var{normalized_iteration_count}.
  10275. @item rate, r
  10276. Set frame rate, expressed as number of frames per second. Default
  10277. value is "25".
  10278. @item size, s
  10279. Set frame size. For the syntax of this option, check the "Video
  10280. size" section in the ffmpeg-utils manual. Default value is "640x480".
  10281. @item start_scale
  10282. Set the initial scale value. Default value is 3.0.
  10283. @item start_x
  10284. Set the initial x position. Must be a floating point value between
  10285. -100 and 100. Default value is -0.743643887037158704752191506114774.
  10286. @item start_y
  10287. Set the initial y position. Must be a floating point value between
  10288. -100 and 100. Default value is -0.131825904205311970493132056385139.
  10289. @end table
  10290. @section mptestsrc
  10291. Generate various test patterns, as generated by the MPlayer test filter.
  10292. The size of the generated video is fixed, and is 256x256.
  10293. This source is useful in particular for testing encoding features.
  10294. This source accepts the following options:
  10295. @table @option
  10296. @item rate, r
  10297. Specify the frame rate of the sourced video, as the number of frames
  10298. generated per second. It has to be a string in the format
  10299. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  10300. number or a valid video frame rate abbreviation. The default value is
  10301. "25".
  10302. @item duration, d
  10303. Set the duration of the sourced video. See
  10304. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  10305. for the accepted syntax.
  10306. If not specified, or the expressed duration is negative, the video is
  10307. supposed to be generated forever.
  10308. @item test, t
  10309. Set the number or the name of the test to perform. Supported tests are:
  10310. @table @option
  10311. @item dc_luma
  10312. @item dc_chroma
  10313. @item freq_luma
  10314. @item freq_chroma
  10315. @item amp_luma
  10316. @item amp_chroma
  10317. @item cbp
  10318. @item mv
  10319. @item ring1
  10320. @item ring2
  10321. @item all
  10322. @end table
  10323. Default value is "all", which will cycle through the list of all tests.
  10324. @end table
  10325. Some examples:
  10326. @example
  10327. mptestsrc=t=dc_luma
  10328. @end example
  10329. will generate a "dc_luma" test pattern.
  10330. @section frei0r_src
  10331. Provide a frei0r source.
  10332. To enable compilation of this filter you need to install the frei0r
  10333. header and configure FFmpeg with @code{--enable-frei0r}.
  10334. This source accepts the following parameters:
  10335. @table @option
  10336. @item size
  10337. The size of the video to generate. For the syntax of this option, check the
  10338. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10339. @item framerate
  10340. The framerate of the generated video. It may be a string of the form
  10341. @var{num}/@var{den} or a frame rate abbreviation.
  10342. @item filter_name
  10343. The name to the frei0r source to load. For more information regarding frei0r and
  10344. how to set the parameters, read the @ref{frei0r} section in the video filters
  10345. documentation.
  10346. @item filter_params
  10347. A '|'-separated list of parameters to pass to the frei0r source.
  10348. @end table
  10349. For example, to generate a frei0r partik0l source with size 200x200
  10350. and frame rate 10 which is overlaid on the overlay filter main input:
  10351. @example
  10352. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  10353. @end example
  10354. @section life
  10355. Generate a life pattern.
  10356. This source is based on a generalization of John Conway's life game.
  10357. The sourced input represents a life grid, each pixel represents a cell
  10358. which can be in one of two possible states, alive or dead. Every cell
  10359. interacts with its eight neighbours, which are the cells that are
  10360. horizontally, vertically, or diagonally adjacent.
  10361. At each interaction the grid evolves according to the adopted rule,
  10362. which specifies the number of neighbor alive cells which will make a
  10363. cell stay alive or born. The @option{rule} option allows one to specify
  10364. the rule to adopt.
  10365. This source accepts the following options:
  10366. @table @option
  10367. @item filename, f
  10368. Set the file from which to read the initial grid state. In the file,
  10369. each non-whitespace character is considered an alive cell, and newline
  10370. is used to delimit the end of each row.
  10371. If this option is not specified, the initial grid is generated
  10372. randomly.
  10373. @item rate, r
  10374. Set the video rate, that is the number of frames generated per second.
  10375. Default is 25.
  10376. @item random_fill_ratio, ratio
  10377. Set the random fill ratio for the initial random grid. It is a
  10378. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  10379. It is ignored when a file is specified.
  10380. @item random_seed, seed
  10381. Set the seed for filling the initial random grid, must be an integer
  10382. included between 0 and UINT32_MAX. If not specified, or if explicitly
  10383. set to -1, the filter will try to use a good random seed on a best
  10384. effort basis.
  10385. @item rule
  10386. Set the life rule.
  10387. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  10388. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  10389. @var{NS} specifies the number of alive neighbor cells which make a
  10390. live cell stay alive, and @var{NB} the number of alive neighbor cells
  10391. which make a dead cell to become alive (i.e. to "born").
  10392. "s" and "b" can be used in place of "S" and "B", respectively.
  10393. Alternatively a rule can be specified by an 18-bits integer. The 9
  10394. high order bits are used to encode the next cell state if it is alive
  10395. for each number of neighbor alive cells, the low order bits specify
  10396. the rule for "borning" new cells. Higher order bits encode for an
  10397. higher number of neighbor cells.
  10398. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  10399. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  10400. Default value is "S23/B3", which is the original Conway's game of life
  10401. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  10402. cells, and will born a new cell if there are three alive cells around
  10403. a dead cell.
  10404. @item size, s
  10405. Set the size of the output video. For the syntax of this option, check the
  10406. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10407. If @option{filename} is specified, the size is set by default to the
  10408. same size of the input file. If @option{size} is set, it must contain
  10409. the size specified in the input file, and the initial grid defined in
  10410. that file is centered in the larger resulting area.
  10411. If a filename is not specified, the size value defaults to "320x240"
  10412. (used for a randomly generated initial grid).
  10413. @item stitch
  10414. If set to 1, stitch the left and right grid edges together, and the
  10415. top and bottom edges also. Defaults to 1.
  10416. @item mold
  10417. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  10418. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  10419. value from 0 to 255.
  10420. @item life_color
  10421. Set the color of living (or new born) cells.
  10422. @item death_color
  10423. Set the color of dead cells. If @option{mold} is set, this is the first color
  10424. used to represent a dead cell.
  10425. @item mold_color
  10426. Set mold color, for definitely dead and moldy cells.
  10427. For the syntax of these 3 color options, check the "Color" section in the
  10428. ffmpeg-utils manual.
  10429. @end table
  10430. @subsection Examples
  10431. @itemize
  10432. @item
  10433. Read a grid from @file{pattern}, and center it on a grid of size
  10434. 300x300 pixels:
  10435. @example
  10436. life=f=pattern:s=300x300
  10437. @end example
  10438. @item
  10439. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  10440. @example
  10441. life=ratio=2/3:s=200x200
  10442. @end example
  10443. @item
  10444. Specify a custom rule for evolving a randomly generated grid:
  10445. @example
  10446. life=rule=S14/B34
  10447. @end example
  10448. @item
  10449. Full example with slow death effect (mold) using @command{ffplay}:
  10450. @example
  10451. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  10452. @end example
  10453. @end itemize
  10454. @anchor{allrgb}
  10455. @anchor{allyuv}
  10456. @anchor{color}
  10457. @anchor{haldclutsrc}
  10458. @anchor{nullsrc}
  10459. @anchor{rgbtestsrc}
  10460. @anchor{smptebars}
  10461. @anchor{smptehdbars}
  10462. @anchor{testsrc}
  10463. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc
  10464. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  10465. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  10466. The @code{color} source provides an uniformly colored input.
  10467. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  10468. @ref{haldclut} filter.
  10469. The @code{nullsrc} source returns unprocessed video frames. It is
  10470. mainly useful to be employed in analysis / debugging tools, or as the
  10471. source for filters which ignore the input data.
  10472. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  10473. detecting RGB vs BGR issues. You should see a red, green and blue
  10474. stripe from top to bottom.
  10475. The @code{smptebars} source generates a color bars pattern, based on
  10476. the SMPTE Engineering Guideline EG 1-1990.
  10477. The @code{smptehdbars} source generates a color bars pattern, based on
  10478. the SMPTE RP 219-2002.
  10479. The @code{testsrc} source generates a test video pattern, showing a
  10480. color pattern, a scrolling gradient and a timestamp. This is mainly
  10481. intended for testing purposes.
  10482. The sources accept the following parameters:
  10483. @table @option
  10484. @item color, c
  10485. Specify the color of the source, only available in the @code{color}
  10486. source. For the syntax of this option, check the "Color" section in the
  10487. ffmpeg-utils manual.
  10488. @item level
  10489. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  10490. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  10491. pixels to be used as identity matrix for 3D lookup tables. Each component is
  10492. coded on a @code{1/(N*N)} scale.
  10493. @item size, s
  10494. Specify the size of the sourced video. For the syntax of this option, check the
  10495. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10496. The default value is @code{320x240}.
  10497. This option is not available with the @code{haldclutsrc} filter.
  10498. @item rate, r
  10499. Specify the frame rate of the sourced video, as the number of frames
  10500. generated per second. It has to be a string in the format
  10501. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  10502. number or a valid video frame rate abbreviation. The default value is
  10503. "25".
  10504. @item sar
  10505. Set the sample aspect ratio of the sourced video.
  10506. @item duration, d
  10507. Set the duration of the sourced video. See
  10508. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  10509. for the accepted syntax.
  10510. If not specified, or the expressed duration is negative, the video is
  10511. supposed to be generated forever.
  10512. @item decimals, n
  10513. Set the number of decimals to show in the timestamp, only available in the
  10514. @code{testsrc} source.
  10515. The displayed timestamp value will correspond to the original
  10516. timestamp value multiplied by the power of 10 of the specified
  10517. value. Default value is 0.
  10518. @end table
  10519. For example the following:
  10520. @example
  10521. testsrc=duration=5.3:size=qcif:rate=10
  10522. @end example
  10523. will generate a video with a duration of 5.3 seconds, with size
  10524. 176x144 and a frame rate of 10 frames per second.
  10525. The following graph description will generate a red source
  10526. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  10527. frames per second.
  10528. @example
  10529. color=c=red@@0.2:s=qcif:r=10
  10530. @end example
  10531. If the input content is to be ignored, @code{nullsrc} can be used. The
  10532. following command generates noise in the luminance plane by employing
  10533. the @code{geq} filter:
  10534. @example
  10535. nullsrc=s=256x256, geq=random(1)*255:128:128
  10536. @end example
  10537. @subsection Commands
  10538. The @code{color} source supports the following commands:
  10539. @table @option
  10540. @item c, color
  10541. Set the color of the created image. Accepts the same syntax of the
  10542. corresponding @option{color} option.
  10543. @end table
  10544. @c man end VIDEO SOURCES
  10545. @chapter Video Sinks
  10546. @c man begin VIDEO SINKS
  10547. Below is a description of the currently available video sinks.
  10548. @section buffersink
  10549. Buffer video frames, and make them available to the end of the filter
  10550. graph.
  10551. This sink is mainly intended for programmatic use, in particular
  10552. through the interface defined in @file{libavfilter/buffersink.h}
  10553. or the options system.
  10554. It accepts a pointer to an AVBufferSinkContext structure, which
  10555. defines the incoming buffers' formats, to be passed as the opaque
  10556. parameter to @code{avfilter_init_filter} for initialization.
  10557. @section nullsink
  10558. Null video sink: do absolutely nothing with the input video. It is
  10559. mainly useful as a template and for use in analysis / debugging
  10560. tools.
  10561. @c man end VIDEO SINKS
  10562. @chapter Multimedia Filters
  10563. @c man begin MULTIMEDIA FILTERS
  10564. Below is a description of the currently available multimedia filters.
  10565. @section ahistogram
  10566. Convert input audio to a video output, displaying the volume histogram.
  10567. The filter accepts the following options:
  10568. @table @option
  10569. @item dmode
  10570. Specify how histogram is calculated.
  10571. It accepts the following values:
  10572. @table @samp
  10573. @item single
  10574. Use single histogram for all channels.
  10575. @item separate
  10576. Use separate histogram for each channel.
  10577. @end table
  10578. Default is @code{single}.
  10579. @item rate, r
  10580. Set frame rate, expressed as number of frames per second. Default
  10581. value is "25".
  10582. @item size, s
  10583. Specify the video size for the output. For the syntax of this option, check the
  10584. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10585. Default value is @code{hd720}.
  10586. @item scale
  10587. Set display scale.
  10588. It accepts the following values:
  10589. @table @samp
  10590. @item log
  10591. logarithmic
  10592. @item sqrt
  10593. square root
  10594. @item cbrt
  10595. cubic root
  10596. @item lin
  10597. linear
  10598. @item rlog
  10599. reverse logarithmic
  10600. @end table
  10601. Default is @code{log}.
  10602. @item ascale
  10603. Set amplitude scale.
  10604. It accepts the following values:
  10605. @table @samp
  10606. @item log
  10607. logarithmic
  10608. @item lin
  10609. linear
  10610. @end table
  10611. Default is @code{log}.
  10612. @item acount
  10613. Set how much frames to accumulate in histogram.
  10614. Defauls is 1. Setting this to -1 accumulates all frames.
  10615. @item rheight
  10616. Set histogram ratio of window height.
  10617. @item slide
  10618. Set sonogram sliding.
  10619. It accepts the following values:
  10620. @table @samp
  10621. @item replace
  10622. replace old rows with new ones.
  10623. @item scroll
  10624. scroll from top to bottom.
  10625. @end table
  10626. Default is @code{replace}.
  10627. @end table
  10628. @section aphasemeter
  10629. Convert input audio to a video output, displaying the audio phase.
  10630. The filter accepts the following options:
  10631. @table @option
  10632. @item rate, r
  10633. Set the output frame rate. Default value is @code{25}.
  10634. @item size, s
  10635. Set the video size for the output. For the syntax of this option, check the
  10636. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10637. Default value is @code{800x400}.
  10638. @item rc
  10639. @item gc
  10640. @item bc
  10641. Specify the red, green, blue contrast. Default values are @code{2},
  10642. @code{7} and @code{1}.
  10643. Allowed range is @code{[0, 255]}.
  10644. @item mpc
  10645. Set color which will be used for drawing median phase. If color is
  10646. @code{none} which is default, no median phase value will be drawn.
  10647. @end table
  10648. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  10649. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  10650. The @code{-1} means left and right channels are completely out of phase and
  10651. @code{1} means channels are in phase.
  10652. @section avectorscope
  10653. Convert input audio to a video output, representing the audio vector
  10654. scope.
  10655. The filter is used to measure the difference between channels of stereo
  10656. audio stream. A monoaural signal, consisting of identical left and right
  10657. signal, results in straight vertical line. Any stereo separation is visible
  10658. as a deviation from this line, creating a Lissajous figure.
  10659. If the straight (or deviation from it) but horizontal line appears this
  10660. indicates that the left and right channels are out of phase.
  10661. The filter accepts the following options:
  10662. @table @option
  10663. @item mode, m
  10664. Set the vectorscope mode.
  10665. Available values are:
  10666. @table @samp
  10667. @item lissajous
  10668. Lissajous rotated by 45 degrees.
  10669. @item lissajous_xy
  10670. Same as above but not rotated.
  10671. @item polar
  10672. Shape resembling half of circle.
  10673. @end table
  10674. Default value is @samp{lissajous}.
  10675. @item size, s
  10676. Set the video size for the output. For the syntax of this option, check the
  10677. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10678. Default value is @code{400x400}.
  10679. @item rate, r
  10680. Set the output frame rate. Default value is @code{25}.
  10681. @item rc
  10682. @item gc
  10683. @item bc
  10684. @item ac
  10685. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  10686. @code{160}, @code{80} and @code{255}.
  10687. Allowed range is @code{[0, 255]}.
  10688. @item rf
  10689. @item gf
  10690. @item bf
  10691. @item af
  10692. Specify the red, green, blue and alpha fade. Default values are @code{15},
  10693. @code{10}, @code{5} and @code{5}.
  10694. Allowed range is @code{[0, 255]}.
  10695. @item zoom
  10696. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[1, 10]}.
  10697. @item draw
  10698. Set the vectorscope drawing mode.
  10699. Available values are:
  10700. @table @samp
  10701. @item dot
  10702. Draw dot for each sample.
  10703. @item line
  10704. Draw line between previous and current sample.
  10705. @end table
  10706. Default value is @samp{dot}.
  10707. @end table
  10708. @subsection Examples
  10709. @itemize
  10710. @item
  10711. Complete example using @command{ffplay}:
  10712. @example
  10713. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  10714. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  10715. @end example
  10716. @end itemize
  10717. @section concat
  10718. Concatenate audio and video streams, joining them together one after the
  10719. other.
  10720. The filter works on segments of synchronized video and audio streams. All
  10721. segments must have the same number of streams of each type, and that will
  10722. also be the number of streams at output.
  10723. The filter accepts the following options:
  10724. @table @option
  10725. @item n
  10726. Set the number of segments. Default is 2.
  10727. @item v
  10728. Set the number of output video streams, that is also the number of video
  10729. streams in each segment. Default is 1.
  10730. @item a
  10731. Set the number of output audio streams, that is also the number of audio
  10732. streams in each segment. Default is 0.
  10733. @item unsafe
  10734. Activate unsafe mode: do not fail if segments have a different format.
  10735. @end table
  10736. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  10737. @var{a} audio outputs.
  10738. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  10739. segment, in the same order as the outputs, then the inputs for the second
  10740. segment, etc.
  10741. Related streams do not always have exactly the same duration, for various
  10742. reasons including codec frame size or sloppy authoring. For that reason,
  10743. related synchronized streams (e.g. a video and its audio track) should be
  10744. concatenated at once. The concat filter will use the duration of the longest
  10745. stream in each segment (except the last one), and if necessary pad shorter
  10746. audio streams with silence.
  10747. For this filter to work correctly, all segments must start at timestamp 0.
  10748. All corresponding streams must have the same parameters in all segments; the
  10749. filtering system will automatically select a common pixel format for video
  10750. streams, and a common sample format, sample rate and channel layout for
  10751. audio streams, but other settings, such as resolution, must be converted
  10752. explicitly by the user.
  10753. Different frame rates are acceptable but will result in variable frame rate
  10754. at output; be sure to configure the output file to handle it.
  10755. @subsection Examples
  10756. @itemize
  10757. @item
  10758. Concatenate an opening, an episode and an ending, all in bilingual version
  10759. (video in stream 0, audio in streams 1 and 2):
  10760. @example
  10761. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  10762. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  10763. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  10764. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  10765. @end example
  10766. @item
  10767. Concatenate two parts, handling audio and video separately, using the
  10768. (a)movie sources, and adjusting the resolution:
  10769. @example
  10770. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  10771. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  10772. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  10773. @end example
  10774. Note that a desync will happen at the stitch if the audio and video streams
  10775. do not have exactly the same duration in the first file.
  10776. @end itemize
  10777. @anchor{ebur128}
  10778. @section ebur128
  10779. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  10780. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  10781. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  10782. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  10783. The filter also has a video output (see the @var{video} option) with a real
  10784. time graph to observe the loudness evolution. The graphic contains the logged
  10785. message mentioned above, so it is not printed anymore when this option is set,
  10786. unless the verbose logging is set. The main graphing area contains the
  10787. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  10788. the momentary loudness (400 milliseconds).
  10789. More information about the Loudness Recommendation EBU R128 on
  10790. @url{http://tech.ebu.ch/loudness}.
  10791. The filter accepts the following options:
  10792. @table @option
  10793. @item video
  10794. Activate the video output. The audio stream is passed unchanged whether this
  10795. option is set or no. The video stream will be the first output stream if
  10796. activated. Default is @code{0}.
  10797. @item size
  10798. Set the video size. This option is for video only. For the syntax of this
  10799. option, check the
  10800. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10801. Default and minimum resolution is @code{640x480}.
  10802. @item meter
  10803. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  10804. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  10805. other integer value between this range is allowed.
  10806. @item metadata
  10807. Set metadata injection. If set to @code{1}, the audio input will be segmented
  10808. into 100ms output frames, each of them containing various loudness information
  10809. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  10810. Default is @code{0}.
  10811. @item framelog
  10812. Force the frame logging level.
  10813. Available values are:
  10814. @table @samp
  10815. @item info
  10816. information logging level
  10817. @item verbose
  10818. verbose logging level
  10819. @end table
  10820. By default, the logging level is set to @var{info}. If the @option{video} or
  10821. the @option{metadata} options are set, it switches to @var{verbose}.
  10822. @item peak
  10823. Set peak mode(s).
  10824. Available modes can be cumulated (the option is a @code{flag} type). Possible
  10825. values are:
  10826. @table @samp
  10827. @item none
  10828. Disable any peak mode (default).
  10829. @item sample
  10830. Enable sample-peak mode.
  10831. Simple peak mode looking for the higher sample value. It logs a message
  10832. for sample-peak (identified by @code{SPK}).
  10833. @item true
  10834. Enable true-peak mode.
  10835. If enabled, the peak lookup is done on an over-sampled version of the input
  10836. stream for better peak accuracy. It logs a message for true-peak.
  10837. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  10838. This mode requires a build with @code{libswresample}.
  10839. @end table
  10840. @item dualmono
  10841. Treat mono input files as "dual mono". If a mono file is intended for playback
  10842. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  10843. If set to @code{true}, this option will compensate for this effect.
  10844. Multi-channel input files are not affected by this option.
  10845. @item panlaw
  10846. Set a specific pan law to be used for the measurement of dual mono files.
  10847. This parameter is optional, and has a default value of -3.01dB.
  10848. @end table
  10849. @subsection Examples
  10850. @itemize
  10851. @item
  10852. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  10853. @example
  10854. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  10855. @end example
  10856. @item
  10857. Run an analysis with @command{ffmpeg}:
  10858. @example
  10859. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  10860. @end example
  10861. @end itemize
  10862. @section interleave, ainterleave
  10863. Temporally interleave frames from several inputs.
  10864. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  10865. These filters read frames from several inputs and send the oldest
  10866. queued frame to the output.
  10867. Input streams must have a well defined, monotonically increasing frame
  10868. timestamp values.
  10869. In order to submit one frame to output, these filters need to enqueue
  10870. at least one frame for each input, so they cannot work in case one
  10871. input is not yet terminated and will not receive incoming frames.
  10872. For example consider the case when one input is a @code{select} filter
  10873. which always drop input frames. The @code{interleave} filter will keep
  10874. reading from that input, but it will never be able to send new frames
  10875. to output until the input will send an end-of-stream signal.
  10876. Also, depending on inputs synchronization, the filters will drop
  10877. frames in case one input receives more frames than the other ones, and
  10878. the queue is already filled.
  10879. These filters accept the following options:
  10880. @table @option
  10881. @item nb_inputs, n
  10882. Set the number of different inputs, it is 2 by default.
  10883. @end table
  10884. @subsection Examples
  10885. @itemize
  10886. @item
  10887. Interleave frames belonging to different streams using @command{ffmpeg}:
  10888. @example
  10889. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  10890. @end example
  10891. @item
  10892. Add flickering blur effect:
  10893. @example
  10894. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  10895. @end example
  10896. @end itemize
  10897. @section perms, aperms
  10898. Set read/write permissions for the output frames.
  10899. These filters are mainly aimed at developers to test direct path in the
  10900. following filter in the filtergraph.
  10901. The filters accept the following options:
  10902. @table @option
  10903. @item mode
  10904. Select the permissions mode.
  10905. It accepts the following values:
  10906. @table @samp
  10907. @item none
  10908. Do nothing. This is the default.
  10909. @item ro
  10910. Set all the output frames read-only.
  10911. @item rw
  10912. Set all the output frames directly writable.
  10913. @item toggle
  10914. Make the frame read-only if writable, and writable if read-only.
  10915. @item random
  10916. Set each output frame read-only or writable randomly.
  10917. @end table
  10918. @item seed
  10919. Set the seed for the @var{random} mode, must be an integer included between
  10920. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  10921. @code{-1}, the filter will try to use a good random seed on a best effort
  10922. basis.
  10923. @end table
  10924. Note: in case of auto-inserted filter between the permission filter and the
  10925. following one, the permission might not be received as expected in that
  10926. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  10927. perms/aperms filter can avoid this problem.
  10928. @section realtime, arealtime
  10929. Slow down filtering to match real time approximatively.
  10930. These filters will pause the filtering for a variable amount of time to
  10931. match the output rate with the input timestamps.
  10932. They are similar to the @option{re} option to @code{ffmpeg}.
  10933. They accept the following options:
  10934. @table @option
  10935. @item limit
  10936. Time limit for the pauses. Any pause longer than that will be considered
  10937. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  10938. @end table
  10939. @section select, aselect
  10940. Select frames to pass in output.
  10941. This filter accepts the following options:
  10942. @table @option
  10943. @item expr, e
  10944. Set expression, which is evaluated for each input frame.
  10945. If the expression is evaluated to zero, the frame is discarded.
  10946. If the evaluation result is negative or NaN, the frame is sent to the
  10947. first output; otherwise it is sent to the output with index
  10948. @code{ceil(val)-1}, assuming that the input index starts from 0.
  10949. For example a value of @code{1.2} corresponds to the output with index
  10950. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  10951. @item outputs, n
  10952. Set the number of outputs. The output to which to send the selected
  10953. frame is based on the result of the evaluation. Default value is 1.
  10954. @end table
  10955. The expression can contain the following constants:
  10956. @table @option
  10957. @item n
  10958. The (sequential) number of the filtered frame, starting from 0.
  10959. @item selected_n
  10960. The (sequential) number of the selected frame, starting from 0.
  10961. @item prev_selected_n
  10962. The sequential number of the last selected frame. It's NAN if undefined.
  10963. @item TB
  10964. The timebase of the input timestamps.
  10965. @item pts
  10966. The PTS (Presentation TimeStamp) of the filtered video frame,
  10967. expressed in @var{TB} units. It's NAN if undefined.
  10968. @item t
  10969. The PTS of the filtered video frame,
  10970. expressed in seconds. It's NAN if undefined.
  10971. @item prev_pts
  10972. The PTS of the previously filtered video frame. It's NAN if undefined.
  10973. @item prev_selected_pts
  10974. The PTS of the last previously filtered video frame. It's NAN if undefined.
  10975. @item prev_selected_t
  10976. The PTS of the last previously selected video frame. It's NAN if undefined.
  10977. @item start_pts
  10978. The PTS of the first video frame in the video. It's NAN if undefined.
  10979. @item start_t
  10980. The time of the first video frame in the video. It's NAN if undefined.
  10981. @item pict_type @emph{(video only)}
  10982. The type of the filtered frame. It can assume one of the following
  10983. values:
  10984. @table @option
  10985. @item I
  10986. @item P
  10987. @item B
  10988. @item S
  10989. @item SI
  10990. @item SP
  10991. @item BI
  10992. @end table
  10993. @item interlace_type @emph{(video only)}
  10994. The frame interlace type. It can assume one of the following values:
  10995. @table @option
  10996. @item PROGRESSIVE
  10997. The frame is progressive (not interlaced).
  10998. @item TOPFIRST
  10999. The frame is top-field-first.
  11000. @item BOTTOMFIRST
  11001. The frame is bottom-field-first.
  11002. @end table
  11003. @item consumed_sample_n @emph{(audio only)}
  11004. the number of selected samples before the current frame
  11005. @item samples_n @emph{(audio only)}
  11006. the number of samples in the current frame
  11007. @item sample_rate @emph{(audio only)}
  11008. the input sample rate
  11009. @item key
  11010. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  11011. @item pos
  11012. the position in the file of the filtered frame, -1 if the information
  11013. is not available (e.g. for synthetic video)
  11014. @item scene @emph{(video only)}
  11015. value between 0 and 1 to indicate a new scene; a low value reflects a low
  11016. probability for the current frame to introduce a new scene, while a higher
  11017. value means the current frame is more likely to be one (see the example below)
  11018. @item concatdec_select
  11019. The concat demuxer can select only part of a concat input file by setting an
  11020. inpoint and an outpoint, but the output packets may not be entirely contained
  11021. in the selected interval. By using this variable, it is possible to skip frames
  11022. generated by the concat demuxer which are not exactly contained in the selected
  11023. interval.
  11024. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  11025. and the @var{lavf.concat.duration} packet metadata values which are also
  11026. present in the decoded frames.
  11027. The @var{concatdec_select} variable is -1 if the frame pts is at least
  11028. start_time and either the duration metadata is missing or the frame pts is less
  11029. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  11030. missing.
  11031. That basically means that an input frame is selected if its pts is within the
  11032. interval set by the concat demuxer.
  11033. @end table
  11034. The default value of the select expression is "1".
  11035. @subsection Examples
  11036. @itemize
  11037. @item
  11038. Select all frames in input:
  11039. @example
  11040. select
  11041. @end example
  11042. The example above is the same as:
  11043. @example
  11044. select=1
  11045. @end example
  11046. @item
  11047. Skip all frames:
  11048. @example
  11049. select=0
  11050. @end example
  11051. @item
  11052. Select only I-frames:
  11053. @example
  11054. select='eq(pict_type\,I)'
  11055. @end example
  11056. @item
  11057. Select one frame every 100:
  11058. @example
  11059. select='not(mod(n\,100))'
  11060. @end example
  11061. @item
  11062. Select only frames contained in the 10-20 time interval:
  11063. @example
  11064. select=between(t\,10\,20)
  11065. @end example
  11066. @item
  11067. Select only I frames contained in the 10-20 time interval:
  11068. @example
  11069. select=between(t\,10\,20)*eq(pict_type\,I)
  11070. @end example
  11071. @item
  11072. Select frames with a minimum distance of 10 seconds:
  11073. @example
  11074. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  11075. @end example
  11076. @item
  11077. Use aselect to select only audio frames with samples number > 100:
  11078. @example
  11079. aselect='gt(samples_n\,100)'
  11080. @end example
  11081. @item
  11082. Create a mosaic of the first scenes:
  11083. @example
  11084. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  11085. @end example
  11086. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  11087. choice.
  11088. @item
  11089. Send even and odd frames to separate outputs, and compose them:
  11090. @example
  11091. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  11092. @end example
  11093. @item
  11094. Select useful frames from an ffconcat file which is using inpoints and
  11095. outpoints but where the source files are not intra frame only.
  11096. @example
  11097. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  11098. @end example
  11099. @end itemize
  11100. @section sendcmd, asendcmd
  11101. Send commands to filters in the filtergraph.
  11102. These filters read commands to be sent to other filters in the
  11103. filtergraph.
  11104. @code{sendcmd} must be inserted between two video filters,
  11105. @code{asendcmd} must be inserted between two audio filters, but apart
  11106. from that they act the same way.
  11107. The specification of commands can be provided in the filter arguments
  11108. with the @var{commands} option, or in a file specified by the
  11109. @var{filename} option.
  11110. These filters accept the following options:
  11111. @table @option
  11112. @item commands, c
  11113. Set the commands to be read and sent to the other filters.
  11114. @item filename, f
  11115. Set the filename of the commands to be read and sent to the other
  11116. filters.
  11117. @end table
  11118. @subsection Commands syntax
  11119. A commands description consists of a sequence of interval
  11120. specifications, comprising a list of commands to be executed when a
  11121. particular event related to that interval occurs. The occurring event
  11122. is typically the current frame time entering or leaving a given time
  11123. interval.
  11124. An interval is specified by the following syntax:
  11125. @example
  11126. @var{START}[-@var{END}] @var{COMMANDS};
  11127. @end example
  11128. The time interval is specified by the @var{START} and @var{END} times.
  11129. @var{END} is optional and defaults to the maximum time.
  11130. The current frame time is considered within the specified interval if
  11131. it is included in the interval [@var{START}, @var{END}), that is when
  11132. the time is greater or equal to @var{START} and is lesser than
  11133. @var{END}.
  11134. @var{COMMANDS} consists of a sequence of one or more command
  11135. specifications, separated by ",", relating to that interval. The
  11136. syntax of a command specification is given by:
  11137. @example
  11138. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  11139. @end example
  11140. @var{FLAGS} is optional and specifies the type of events relating to
  11141. the time interval which enable sending the specified command, and must
  11142. be a non-null sequence of identifier flags separated by "+" or "|" and
  11143. enclosed between "[" and "]".
  11144. The following flags are recognized:
  11145. @table @option
  11146. @item enter
  11147. The command is sent when the current frame timestamp enters the
  11148. specified interval. In other words, the command is sent when the
  11149. previous frame timestamp was not in the given interval, and the
  11150. current is.
  11151. @item leave
  11152. The command is sent when the current frame timestamp leaves the
  11153. specified interval. In other words, the command is sent when the
  11154. previous frame timestamp was in the given interval, and the
  11155. current is not.
  11156. @end table
  11157. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  11158. assumed.
  11159. @var{TARGET} specifies the target of the command, usually the name of
  11160. the filter class or a specific filter instance name.
  11161. @var{COMMAND} specifies the name of the command for the target filter.
  11162. @var{ARG} is optional and specifies the optional list of argument for
  11163. the given @var{COMMAND}.
  11164. Between one interval specification and another, whitespaces, or
  11165. sequences of characters starting with @code{#} until the end of line,
  11166. are ignored and can be used to annotate comments.
  11167. A simplified BNF description of the commands specification syntax
  11168. follows:
  11169. @example
  11170. @var{COMMAND_FLAG} ::= "enter" | "leave"
  11171. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  11172. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  11173. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  11174. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  11175. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  11176. @end example
  11177. @subsection Examples
  11178. @itemize
  11179. @item
  11180. Specify audio tempo change at second 4:
  11181. @example
  11182. asendcmd=c='4.0 atempo tempo 1.5',atempo
  11183. @end example
  11184. @item
  11185. Specify a list of drawtext and hue commands in a file.
  11186. @example
  11187. # show text in the interval 5-10
  11188. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  11189. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  11190. # desaturate the image in the interval 15-20
  11191. 15.0-20.0 [enter] hue s 0,
  11192. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  11193. [leave] hue s 1,
  11194. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  11195. # apply an exponential saturation fade-out effect, starting from time 25
  11196. 25 [enter] hue s exp(25-t)
  11197. @end example
  11198. A filtergraph allowing to read and process the above command list
  11199. stored in a file @file{test.cmd}, can be specified with:
  11200. @example
  11201. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  11202. @end example
  11203. @end itemize
  11204. @anchor{setpts}
  11205. @section setpts, asetpts
  11206. Change the PTS (presentation timestamp) of the input frames.
  11207. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  11208. This filter accepts the following options:
  11209. @table @option
  11210. @item expr
  11211. The expression which is evaluated for each frame to construct its timestamp.
  11212. @end table
  11213. The expression is evaluated through the eval API and can contain the following
  11214. constants:
  11215. @table @option
  11216. @item FRAME_RATE
  11217. frame rate, only defined for constant frame-rate video
  11218. @item PTS
  11219. The presentation timestamp in input
  11220. @item N
  11221. The count of the input frame for video or the number of consumed samples,
  11222. not including the current frame for audio, starting from 0.
  11223. @item NB_CONSUMED_SAMPLES
  11224. The number of consumed samples, not including the current frame (only
  11225. audio)
  11226. @item NB_SAMPLES, S
  11227. The number of samples in the current frame (only audio)
  11228. @item SAMPLE_RATE, SR
  11229. The audio sample rate.
  11230. @item STARTPTS
  11231. The PTS of the first frame.
  11232. @item STARTT
  11233. the time in seconds of the first frame
  11234. @item INTERLACED
  11235. State whether the current frame is interlaced.
  11236. @item T
  11237. the time in seconds of the current frame
  11238. @item POS
  11239. original position in the file of the frame, or undefined if undefined
  11240. for the current frame
  11241. @item PREV_INPTS
  11242. The previous input PTS.
  11243. @item PREV_INT
  11244. previous input time in seconds
  11245. @item PREV_OUTPTS
  11246. The previous output PTS.
  11247. @item PREV_OUTT
  11248. previous output time in seconds
  11249. @item RTCTIME
  11250. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  11251. instead.
  11252. @item RTCSTART
  11253. The wallclock (RTC) time at the start of the movie in microseconds.
  11254. @item TB
  11255. The timebase of the input timestamps.
  11256. @end table
  11257. @subsection Examples
  11258. @itemize
  11259. @item
  11260. Start counting PTS from zero
  11261. @example
  11262. setpts=PTS-STARTPTS
  11263. @end example
  11264. @item
  11265. Apply fast motion effect:
  11266. @example
  11267. setpts=0.5*PTS
  11268. @end example
  11269. @item
  11270. Apply slow motion effect:
  11271. @example
  11272. setpts=2.0*PTS
  11273. @end example
  11274. @item
  11275. Set fixed rate of 25 frames per second:
  11276. @example
  11277. setpts=N/(25*TB)
  11278. @end example
  11279. @item
  11280. Set fixed rate 25 fps with some jitter:
  11281. @example
  11282. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  11283. @end example
  11284. @item
  11285. Apply an offset of 10 seconds to the input PTS:
  11286. @example
  11287. setpts=PTS+10/TB
  11288. @end example
  11289. @item
  11290. Generate timestamps from a "live source" and rebase onto the current timebase:
  11291. @example
  11292. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  11293. @end example
  11294. @item
  11295. Generate timestamps by counting samples:
  11296. @example
  11297. asetpts=N/SR/TB
  11298. @end example
  11299. @end itemize
  11300. @section settb, asettb
  11301. Set the timebase to use for the output frames timestamps.
  11302. It is mainly useful for testing timebase configuration.
  11303. It accepts the following parameters:
  11304. @table @option
  11305. @item expr, tb
  11306. The expression which is evaluated into the output timebase.
  11307. @end table
  11308. The value for @option{tb} is an arithmetic expression representing a
  11309. rational. The expression can contain the constants "AVTB" (the default
  11310. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  11311. audio only). Default value is "intb".
  11312. @subsection Examples
  11313. @itemize
  11314. @item
  11315. Set the timebase to 1/25:
  11316. @example
  11317. settb=expr=1/25
  11318. @end example
  11319. @item
  11320. Set the timebase to 1/10:
  11321. @example
  11322. settb=expr=0.1
  11323. @end example
  11324. @item
  11325. Set the timebase to 1001/1000:
  11326. @example
  11327. settb=1+0.001
  11328. @end example
  11329. @item
  11330. Set the timebase to 2*intb:
  11331. @example
  11332. settb=2*intb
  11333. @end example
  11334. @item
  11335. Set the default timebase value:
  11336. @example
  11337. settb=AVTB
  11338. @end example
  11339. @end itemize
  11340. @section showcqt
  11341. Convert input audio to a video output representing frequency spectrum
  11342. logarithmically using Brown-Puckette constant Q transform algorithm with
  11343. direct frequency domain coefficient calculation (but the transform itself
  11344. is not really constant Q, instead the Q factor is actually variable/clamped),
  11345. with musical tone scale, from E0 to D#10.
  11346. The filter accepts the following options:
  11347. @table @option
  11348. @item size, s
  11349. Specify the video size for the output. It must be even. For the syntax of this option,
  11350. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11351. Default value is @code{1920x1080}.
  11352. @item fps, rate, r
  11353. Set the output frame rate. Default value is @code{25}.
  11354. @item bar_h
  11355. Set the bargraph height. It must be even. Default value is @code{-1} which
  11356. computes the bargraph height automatically.
  11357. @item axis_h
  11358. Set the axis height. It must be even. Default value is @code{-1} which computes
  11359. the axis height automatically.
  11360. @item sono_h
  11361. Set the sonogram height. It must be even. Default value is @code{-1} which
  11362. computes the sonogram height automatically.
  11363. @item fullhd
  11364. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  11365. instead. Default value is @code{1}.
  11366. @item sono_v, volume
  11367. Specify the sonogram volume expression. It can contain variables:
  11368. @table @option
  11369. @item bar_v
  11370. the @var{bar_v} evaluated expression
  11371. @item frequency, freq, f
  11372. the frequency where it is evaluated
  11373. @item timeclamp, tc
  11374. the value of @var{timeclamp} option
  11375. @end table
  11376. and functions:
  11377. @table @option
  11378. @item a_weighting(f)
  11379. A-weighting of equal loudness
  11380. @item b_weighting(f)
  11381. B-weighting of equal loudness
  11382. @item c_weighting(f)
  11383. C-weighting of equal loudness.
  11384. @end table
  11385. Default value is @code{16}.
  11386. @item bar_v, volume2
  11387. Specify the bargraph volume expression. It can contain variables:
  11388. @table @option
  11389. @item sono_v
  11390. the @var{sono_v} evaluated expression
  11391. @item frequency, freq, f
  11392. the frequency where it is evaluated
  11393. @item timeclamp, tc
  11394. the value of @var{timeclamp} option
  11395. @end table
  11396. and functions:
  11397. @table @option
  11398. @item a_weighting(f)
  11399. A-weighting of equal loudness
  11400. @item b_weighting(f)
  11401. B-weighting of equal loudness
  11402. @item c_weighting(f)
  11403. C-weighting of equal loudness.
  11404. @end table
  11405. Default value is @code{sono_v}.
  11406. @item sono_g, gamma
  11407. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  11408. higher gamma makes the spectrum having more range. Default value is @code{3}.
  11409. Acceptable range is @code{[1, 7]}.
  11410. @item bar_g, gamma2
  11411. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  11412. @code{[1, 7]}.
  11413. @item timeclamp, tc
  11414. Specify the transform timeclamp. At low frequency, there is trade-off between
  11415. accuracy in time domain and frequency domain. If timeclamp is lower,
  11416. event in time domain is represented more accurately (such as fast bass drum),
  11417. otherwise event in frequency domain is represented more accurately
  11418. (such as bass guitar). Acceptable range is @code{[0.1, 1]}. Default value is @code{0.17}.
  11419. @item basefreq
  11420. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  11421. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  11422. @item endfreq
  11423. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  11424. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  11425. @item coeffclamp
  11426. This option is deprecated and ignored.
  11427. @item tlength
  11428. Specify the transform length in time domain. Use this option to control accuracy
  11429. trade-off between time domain and frequency domain at every frequency sample.
  11430. It can contain variables:
  11431. @table @option
  11432. @item frequency, freq, f
  11433. the frequency where it is evaluated
  11434. @item timeclamp, tc
  11435. the value of @var{timeclamp} option.
  11436. @end table
  11437. Default value is @code{384*tc/(384+tc*f)}.
  11438. @item count
  11439. Specify the transform count for every video frame. Default value is @code{6}.
  11440. Acceptable range is @code{[1, 30]}.
  11441. @item fcount
  11442. Specify the transform count for every single pixel. Default value is @code{0},
  11443. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  11444. @item fontfile
  11445. Specify font file for use with freetype to draw the axis. If not specified,
  11446. use embedded font. Note that drawing with font file or embedded font is not
  11447. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  11448. option instead.
  11449. @item fontcolor
  11450. Specify font color expression. This is arithmetic expression that should return
  11451. integer value 0xRRGGBB. It can contain variables:
  11452. @table @option
  11453. @item frequency, freq, f
  11454. the frequency where it is evaluated
  11455. @item timeclamp, tc
  11456. the value of @var{timeclamp} option
  11457. @end table
  11458. and functions:
  11459. @table @option
  11460. @item midi(f)
  11461. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  11462. @item r(x), g(x), b(x)
  11463. red, green, and blue value of intensity x.
  11464. @end table
  11465. Default value is @code{st(0, (midi(f)-59.5)/12);
  11466. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  11467. r(1-ld(1)) + b(ld(1))}.
  11468. @item axisfile
  11469. Specify image file to draw the axis. This option override @var{fontfile} and
  11470. @var{fontcolor} option.
  11471. @item axis, text
  11472. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  11473. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  11474. Default value is @code{1}.
  11475. @end table
  11476. @subsection Examples
  11477. @itemize
  11478. @item
  11479. Playing audio while showing the spectrum:
  11480. @example
  11481. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  11482. @end example
  11483. @item
  11484. Same as above, but with frame rate 30 fps:
  11485. @example
  11486. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  11487. @end example
  11488. @item
  11489. Playing at 1280x720:
  11490. @example
  11491. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  11492. @end example
  11493. @item
  11494. Disable sonogram display:
  11495. @example
  11496. sono_h=0
  11497. @end example
  11498. @item
  11499. A1 and its harmonics: A1, A2, (near)E3, A3:
  11500. @example
  11501. 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),
  11502. asplit[a][out1]; [a] showcqt [out0]'
  11503. @end example
  11504. @item
  11505. Same as above, but with more accuracy in frequency domain:
  11506. @example
  11507. 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),
  11508. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  11509. @end example
  11510. @item
  11511. Custom volume:
  11512. @example
  11513. bar_v=10:sono_v=bar_v*a_weighting(f)
  11514. @end example
  11515. @item
  11516. Custom gamma, now spectrum is linear to the amplitude.
  11517. @example
  11518. bar_g=2:sono_g=2
  11519. @end example
  11520. @item
  11521. Custom tlength equation:
  11522. @example
  11523. 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)))'
  11524. @end example
  11525. @item
  11526. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  11527. @example
  11528. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  11529. @end example
  11530. @item
  11531. Custom frequency range with custom axis using image file:
  11532. @example
  11533. axisfile=myaxis.png:basefreq=40:endfreq=10000
  11534. @end example
  11535. @end itemize
  11536. @section showfreqs
  11537. Convert input audio to video output representing the audio power spectrum.
  11538. Audio amplitude is on Y-axis while frequency is on X-axis.
  11539. The filter accepts the following options:
  11540. @table @option
  11541. @item size, s
  11542. Specify size of video. For the syntax of this option, check the
  11543. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11544. Default is @code{1024x512}.
  11545. @item mode
  11546. Set display mode.
  11547. This set how each frequency bin will be represented.
  11548. It accepts the following values:
  11549. @table @samp
  11550. @item line
  11551. @item bar
  11552. @item dot
  11553. @end table
  11554. Default is @code{bar}.
  11555. @item ascale
  11556. Set amplitude scale.
  11557. It accepts the following values:
  11558. @table @samp
  11559. @item lin
  11560. Linear scale.
  11561. @item sqrt
  11562. Square root scale.
  11563. @item cbrt
  11564. Cubic root scale.
  11565. @item log
  11566. Logarithmic scale.
  11567. @end table
  11568. Default is @code{log}.
  11569. @item fscale
  11570. Set frequency scale.
  11571. It accepts the following values:
  11572. @table @samp
  11573. @item lin
  11574. Linear scale.
  11575. @item log
  11576. Logarithmic scale.
  11577. @item rlog
  11578. Reverse logarithmic scale.
  11579. @end table
  11580. Default is @code{lin}.
  11581. @item win_size
  11582. Set window size.
  11583. It accepts the following values:
  11584. @table @samp
  11585. @item w16
  11586. @item w32
  11587. @item w64
  11588. @item w128
  11589. @item w256
  11590. @item w512
  11591. @item w1024
  11592. @item w2048
  11593. @item w4096
  11594. @item w8192
  11595. @item w16384
  11596. @item w32768
  11597. @item w65536
  11598. @end table
  11599. Default is @code{w2048}
  11600. @item win_func
  11601. Set windowing function.
  11602. It accepts the following values:
  11603. @table @samp
  11604. @item rect
  11605. @item bartlett
  11606. @item hanning
  11607. @item hamming
  11608. @item blackman
  11609. @item welch
  11610. @item flattop
  11611. @item bharris
  11612. @item bnuttall
  11613. @item bhann
  11614. @item sine
  11615. @item nuttall
  11616. @item lanczos
  11617. @item gauss
  11618. @item tukey
  11619. @end table
  11620. Default is @code{hanning}.
  11621. @item overlap
  11622. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  11623. which means optimal overlap for selected window function will be picked.
  11624. @item averaging
  11625. Set time averaging. Setting this to 0 will display current maximal peaks.
  11626. Default is @code{1}, which means time averaging is disabled.
  11627. @item colors
  11628. Specify list of colors separated by space or by '|' which will be used to
  11629. draw channel frequencies. Unrecognized or missing colors will be replaced
  11630. by white color.
  11631. @item cmode
  11632. Set channel display mode.
  11633. It accepts the following values:
  11634. @table @samp
  11635. @item combined
  11636. @item separate
  11637. @end table
  11638. Default is @code{combined}.
  11639. @end table
  11640. @anchor{showspectrum}
  11641. @section showspectrum
  11642. Convert input audio to a video output, representing the audio frequency
  11643. spectrum.
  11644. The filter accepts the following options:
  11645. @table @option
  11646. @item size, s
  11647. Specify the video size for the output. For the syntax of this option, check the
  11648. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11649. Default value is @code{640x512}.
  11650. @item slide
  11651. Specify how the spectrum should slide along the window.
  11652. It accepts the following values:
  11653. @table @samp
  11654. @item replace
  11655. the samples start again on the left when they reach the right
  11656. @item scroll
  11657. the samples scroll from right to left
  11658. @item rscroll
  11659. the samples scroll from left to right
  11660. @item fullframe
  11661. frames are only produced when the samples reach the right
  11662. @end table
  11663. Default value is @code{replace}.
  11664. @item mode
  11665. Specify display mode.
  11666. It accepts the following values:
  11667. @table @samp
  11668. @item combined
  11669. all channels are displayed in the same row
  11670. @item separate
  11671. all channels are displayed in separate rows
  11672. @end table
  11673. Default value is @samp{combined}.
  11674. @item color
  11675. Specify display color mode.
  11676. It accepts the following values:
  11677. @table @samp
  11678. @item channel
  11679. each channel is displayed in a separate color
  11680. @item intensity
  11681. each channel is displayed using the same color scheme
  11682. @item rainbow
  11683. each channel is displayed using the rainbow color scheme
  11684. @item moreland
  11685. each channel is displayed using the moreland color scheme
  11686. @item nebulae
  11687. each channel is displayed using the nebulae color scheme
  11688. @item fire
  11689. each channel is displayed using the fire color scheme
  11690. @item fiery
  11691. each channel is displayed using the fiery color scheme
  11692. @item fruit
  11693. each channel is displayed using the fruit color scheme
  11694. @item cool
  11695. each channel is displayed using the cool color scheme
  11696. @end table
  11697. Default value is @samp{channel}.
  11698. @item scale
  11699. Specify scale used for calculating intensity color values.
  11700. It accepts the following values:
  11701. @table @samp
  11702. @item lin
  11703. linear
  11704. @item sqrt
  11705. square root, default
  11706. @item cbrt
  11707. cubic root
  11708. @item 4thrt
  11709. 4th root
  11710. @item 5thrt
  11711. 5th root
  11712. @item log
  11713. logarithmic
  11714. @end table
  11715. Default value is @samp{sqrt}.
  11716. @item saturation
  11717. Set saturation modifier for displayed colors. Negative values provide
  11718. alternative color scheme. @code{0} is no saturation at all.
  11719. Saturation must be in [-10.0, 10.0] range.
  11720. Default value is @code{1}.
  11721. @item win_func
  11722. Set window function.
  11723. It accepts the following values:
  11724. @table @samp
  11725. @item rect
  11726. @item bartlett
  11727. @item hann
  11728. @item hanning
  11729. @item hamming
  11730. @item blackman
  11731. @item welch
  11732. @item flattop
  11733. @item bharris
  11734. @item bnuttall
  11735. @item bhann
  11736. @item sine
  11737. @item nuttall
  11738. @item lanczos
  11739. @item gauss
  11740. @item tukey
  11741. @end table
  11742. Default value is @code{hann}.
  11743. @item orientation
  11744. Set orientation of time vs frequency axis. Can be @code{vertical} or
  11745. @code{horizontal}. Default is @code{vertical}.
  11746. @item overlap
  11747. Set ratio of overlap window. Default value is @code{0}.
  11748. When value is @code{1} overlap is set to recommended size for specific
  11749. window function currently used.
  11750. @item gain
  11751. Set scale gain for calculating intensity color values.
  11752. Default value is @code{1}.
  11753. @item data
  11754. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  11755. @end table
  11756. The usage is very similar to the showwaves filter; see the examples in that
  11757. section.
  11758. @subsection Examples
  11759. @itemize
  11760. @item
  11761. Large window with logarithmic color scaling:
  11762. @example
  11763. showspectrum=s=1280x480:scale=log
  11764. @end example
  11765. @item
  11766. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  11767. @example
  11768. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  11769. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  11770. @end example
  11771. @end itemize
  11772. @section showspectrumpic
  11773. Convert input audio to a single video frame, representing the audio frequency
  11774. spectrum.
  11775. The filter accepts the following options:
  11776. @table @option
  11777. @item size, s
  11778. Specify the video size for the output. For the syntax of this option, check the
  11779. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11780. Default value is @code{4096x2048}.
  11781. @item mode
  11782. Specify display mode.
  11783. It accepts the following values:
  11784. @table @samp
  11785. @item combined
  11786. all channels are displayed in the same row
  11787. @item separate
  11788. all channels are displayed in separate rows
  11789. @end table
  11790. Default value is @samp{combined}.
  11791. @item color
  11792. Specify display color mode.
  11793. It accepts the following values:
  11794. @table @samp
  11795. @item channel
  11796. each channel is displayed in a separate color
  11797. @item intensity
  11798. each channel is displayed using the same color scheme
  11799. @item rainbow
  11800. each channel is displayed using the rainbow color scheme
  11801. @item moreland
  11802. each channel is displayed using the moreland color scheme
  11803. @item nebulae
  11804. each channel is displayed using the nebulae color scheme
  11805. @item fire
  11806. each channel is displayed using the fire color scheme
  11807. @item fiery
  11808. each channel is displayed using the fiery color scheme
  11809. @item fruit
  11810. each channel is displayed using the fruit color scheme
  11811. @item cool
  11812. each channel is displayed using the cool color scheme
  11813. @end table
  11814. Default value is @samp{intensity}.
  11815. @item scale
  11816. Specify scale used for calculating intensity color values.
  11817. It accepts the following values:
  11818. @table @samp
  11819. @item lin
  11820. linear
  11821. @item sqrt
  11822. square root, default
  11823. @item cbrt
  11824. cubic root
  11825. @item 4thrt
  11826. 4th root
  11827. @item 5thrt
  11828. 5th root
  11829. @item log
  11830. logarithmic
  11831. @end table
  11832. Default value is @samp{log}.
  11833. @item saturation
  11834. Set saturation modifier for displayed colors. Negative values provide
  11835. alternative color scheme. @code{0} is no saturation at all.
  11836. Saturation must be in [-10.0, 10.0] range.
  11837. Default value is @code{1}.
  11838. @item win_func
  11839. Set window function.
  11840. It accepts the following values:
  11841. @table @samp
  11842. @item rect
  11843. @item bartlett
  11844. @item hann
  11845. @item hanning
  11846. @item hamming
  11847. @item blackman
  11848. @item welch
  11849. @item flattop
  11850. @item bharris
  11851. @item bnuttall
  11852. @item bhann
  11853. @item sine
  11854. @item nuttall
  11855. @item lanczos
  11856. @item gauss
  11857. @item tukey
  11858. @end table
  11859. Default value is @code{hann}.
  11860. @item orientation
  11861. Set orientation of time vs frequency axis. Can be @code{vertical} or
  11862. @code{horizontal}. Default is @code{vertical}.
  11863. @item gain
  11864. Set scale gain for calculating intensity color values.
  11865. Default value is @code{1}.
  11866. @item legend
  11867. Draw time and frequency axes and legends. Default is enabled.
  11868. @end table
  11869. @subsection Examples
  11870. @itemize
  11871. @item
  11872. Extract an audio spectrogram of a whole audio track
  11873. in a 1024x1024 picture using @command{ffmpeg}:
  11874. @example
  11875. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  11876. @end example
  11877. @end itemize
  11878. @section showvolume
  11879. Convert input audio volume to a video output.
  11880. The filter accepts the following options:
  11881. @table @option
  11882. @item rate, r
  11883. Set video rate.
  11884. @item b
  11885. Set border width, allowed range is [0, 5]. Default is 1.
  11886. @item w
  11887. Set channel width, allowed range is [80, 1080]. Default is 400.
  11888. @item h
  11889. Set channel height, allowed range is [1, 100]. Default is 20.
  11890. @item f
  11891. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  11892. @item c
  11893. Set volume color expression.
  11894. The expression can use the following variables:
  11895. @table @option
  11896. @item VOLUME
  11897. Current max volume of channel in dB.
  11898. @item CHANNEL
  11899. Current channel number, starting from 0.
  11900. @end table
  11901. @item t
  11902. If set, displays channel names. Default is enabled.
  11903. @item v
  11904. If set, displays volume values. Default is enabled.
  11905. @end table
  11906. @section showwaves
  11907. Convert input audio to a video output, representing the samples waves.
  11908. The filter accepts the following options:
  11909. @table @option
  11910. @item size, s
  11911. Specify the video size for the output. For the syntax of this option, check the
  11912. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11913. Default value is @code{600x240}.
  11914. @item mode
  11915. Set display mode.
  11916. Available values are:
  11917. @table @samp
  11918. @item point
  11919. Draw a point for each sample.
  11920. @item line
  11921. Draw a vertical line for each sample.
  11922. @item p2p
  11923. Draw a point for each sample and a line between them.
  11924. @item cline
  11925. Draw a centered vertical line for each sample.
  11926. @end table
  11927. Default value is @code{point}.
  11928. @item n
  11929. Set the number of samples which are printed on the same column. A
  11930. larger value will decrease the frame rate. Must be a positive
  11931. integer. This option can be set only if the value for @var{rate}
  11932. is not explicitly specified.
  11933. @item rate, r
  11934. Set the (approximate) output frame rate. This is done by setting the
  11935. option @var{n}. Default value is "25".
  11936. @item split_channels
  11937. Set if channels should be drawn separately or overlap. Default value is 0.
  11938. @item colors
  11939. Set colors separated by '|' which are going to be used for drawing of each channel.
  11940. @item scale
  11941. Set amplitude scale. Can be linear @code{lin} or logarithmic @code{log}.
  11942. Default is linear.
  11943. @end table
  11944. @subsection Examples
  11945. @itemize
  11946. @item
  11947. Output the input file audio and the corresponding video representation
  11948. at the same time:
  11949. @example
  11950. amovie=a.mp3,asplit[out0],showwaves[out1]
  11951. @end example
  11952. @item
  11953. Create a synthetic signal and show it with showwaves, forcing a
  11954. frame rate of 30 frames per second:
  11955. @example
  11956. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  11957. @end example
  11958. @end itemize
  11959. @section showwavespic
  11960. Convert input audio to a single video frame, representing the samples waves.
  11961. The filter accepts the following options:
  11962. @table @option
  11963. @item size, s
  11964. Specify the video size for the output. For the syntax of this option, check the
  11965. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11966. Default value is @code{600x240}.
  11967. @item split_channels
  11968. Set if channels should be drawn separately or overlap. Default value is 0.
  11969. @item colors
  11970. Set colors separated by '|' which are going to be used for drawing of each channel.
  11971. @item scale
  11972. Set amplitude scale. Can be linear @code{lin} or logarithmic @code{log}.
  11973. Default is linear.
  11974. @end table
  11975. @subsection Examples
  11976. @itemize
  11977. @item
  11978. Extract a channel split representation of the wave form of a whole audio track
  11979. in a 1024x800 picture using @command{ffmpeg}:
  11980. @example
  11981. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  11982. @end example
  11983. @item
  11984. Colorize the waveform with colorchannelmixer. This example will make
  11985. the waveform a green color approximately RGB(66,217,150). Additional
  11986. channels will be shades of this color.
  11987. @example
  11988. ffmpeg -i audio.mp3 -filter_complex "showwavespic,colorchannelmixer=rr=66/255:gg=217/255:bb=150/255" waveform.png
  11989. @end example
  11990. @end itemize
  11991. @section spectrumsynth
  11992. Sythesize audio from 2 input video spectrums, first input stream represents
  11993. magnitude across time and second represents phase across time.
  11994. The filter will transform from frequency domain as displayed in videos back
  11995. to time domain as presented in audio output.
  11996. This filter is primarly created for reversing processed @ref{showspectrum}
  11997. filter outputs, but can synthesize sound from other spectrograms too.
  11998. But in such case results are going to be poor if the phase data is not
  11999. available, because in such cases phase data need to be recreated, usually
  12000. its just recreated from random noise.
  12001. For best results use gray only output (@code{channel} color mode in
  12002. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  12003. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  12004. @code{data} option. Inputs videos should generally use @code{fullframe}
  12005. slide mode as that saves resources needed for decoding video.
  12006. The filter accepts the following options:
  12007. @table @option
  12008. @item sample_rate
  12009. Specify sample rate of output audio, the sample rate of audio from which
  12010. spectrum was generated may differ.
  12011. @item channels
  12012. Set number of channels represented in input video spectrums.
  12013. @item scale
  12014. Set scale which was used when generating magnitude input spectrum.
  12015. Can be @code{lin} or @code{log}. Default is @code{log}.
  12016. @item slide
  12017. Set slide which was used when generating inputs spectrums.
  12018. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  12019. Default is @code{fullframe}.
  12020. @item win_func
  12021. Set window function used for resynthesis.
  12022. @item overlap
  12023. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  12024. which means optimal overlap for selected window function will be picked.
  12025. @item orientation
  12026. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  12027. Default is @code{vertical}.
  12028. @end table
  12029. @subsection Examples
  12030. @itemize
  12031. @item
  12032. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  12033. then resynthesize videos back to audio with spectrumsynth:
  12034. @example
  12035. 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
  12036. 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
  12037. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  12038. @end example
  12039. @end itemize
  12040. @section split, asplit
  12041. Split input into several identical outputs.
  12042. @code{asplit} works with audio input, @code{split} with video.
  12043. The filter accepts a single parameter which specifies the number of outputs. If
  12044. unspecified, it defaults to 2.
  12045. @subsection Examples
  12046. @itemize
  12047. @item
  12048. Create two separate outputs from the same input:
  12049. @example
  12050. [in] split [out0][out1]
  12051. @end example
  12052. @item
  12053. To create 3 or more outputs, you need to specify the number of
  12054. outputs, like in:
  12055. @example
  12056. [in] asplit=3 [out0][out1][out2]
  12057. @end example
  12058. @item
  12059. Create two separate outputs from the same input, one cropped and
  12060. one padded:
  12061. @example
  12062. [in] split [splitout1][splitout2];
  12063. [splitout1] crop=100:100:0:0 [cropout];
  12064. [splitout2] pad=200:200:100:100 [padout];
  12065. @end example
  12066. @item
  12067. Create 5 copies of the input audio with @command{ffmpeg}:
  12068. @example
  12069. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  12070. @end example
  12071. @end itemize
  12072. @section zmq, azmq
  12073. Receive commands sent through a libzmq client, and forward them to
  12074. filters in the filtergraph.
  12075. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  12076. must be inserted between two video filters, @code{azmq} between two
  12077. audio filters.
  12078. To enable these filters you need to install the libzmq library and
  12079. headers and configure FFmpeg with @code{--enable-libzmq}.
  12080. For more information about libzmq see:
  12081. @url{http://www.zeromq.org/}
  12082. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  12083. receives messages sent through a network interface defined by the
  12084. @option{bind_address} option.
  12085. The received message must be in the form:
  12086. @example
  12087. @var{TARGET} @var{COMMAND} [@var{ARG}]
  12088. @end example
  12089. @var{TARGET} specifies the target of the command, usually the name of
  12090. the filter class or a specific filter instance name.
  12091. @var{COMMAND} specifies the name of the command for the target filter.
  12092. @var{ARG} is optional and specifies the optional argument list for the
  12093. given @var{COMMAND}.
  12094. Upon reception, the message is processed and the corresponding command
  12095. is injected into the filtergraph. Depending on the result, the filter
  12096. will send a reply to the client, adopting the format:
  12097. @example
  12098. @var{ERROR_CODE} @var{ERROR_REASON}
  12099. @var{MESSAGE}
  12100. @end example
  12101. @var{MESSAGE} is optional.
  12102. @subsection Examples
  12103. Look at @file{tools/zmqsend} for an example of a zmq client which can
  12104. be used to send commands processed by these filters.
  12105. Consider the following filtergraph generated by @command{ffplay}
  12106. @example
  12107. ffplay -dumpgraph 1 -f lavfi "
  12108. color=s=100x100:c=red [l];
  12109. color=s=100x100:c=blue [r];
  12110. nullsrc=s=200x100, zmq [bg];
  12111. [bg][l] overlay [bg+l];
  12112. [bg+l][r] overlay=x=100 "
  12113. @end example
  12114. To change the color of the left side of the video, the following
  12115. command can be used:
  12116. @example
  12117. echo Parsed_color_0 c yellow | tools/zmqsend
  12118. @end example
  12119. To change the right side:
  12120. @example
  12121. echo Parsed_color_1 c pink | tools/zmqsend
  12122. @end example
  12123. @c man end MULTIMEDIA FILTERS
  12124. @chapter Multimedia Sources
  12125. @c man begin MULTIMEDIA SOURCES
  12126. Below is a description of the currently available multimedia sources.
  12127. @section amovie
  12128. This is the same as @ref{movie} source, except it selects an audio
  12129. stream by default.
  12130. @anchor{movie}
  12131. @section movie
  12132. Read audio and/or video stream(s) from a movie container.
  12133. It accepts the following parameters:
  12134. @table @option
  12135. @item filename
  12136. The name of the resource to read (not necessarily a file; it can also be a
  12137. device or a stream accessed through some protocol).
  12138. @item format_name, f
  12139. Specifies the format assumed for the movie to read, and can be either
  12140. the name of a container or an input device. If not specified, the
  12141. format is guessed from @var{movie_name} or by probing.
  12142. @item seek_point, sp
  12143. Specifies the seek point in seconds. The frames will be output
  12144. starting from this seek point. The parameter is evaluated with
  12145. @code{av_strtod}, so the numerical value may be suffixed by an IS
  12146. postfix. The default value is "0".
  12147. @item streams, s
  12148. Specifies the streams to read. Several streams can be specified,
  12149. separated by "+". The source will then have as many outputs, in the
  12150. same order. The syntax is explained in the ``Stream specifiers''
  12151. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  12152. respectively the default (best suited) video and audio stream. Default
  12153. is "dv", or "da" if the filter is called as "amovie".
  12154. @item stream_index, si
  12155. Specifies the index of the video stream to read. If the value is -1,
  12156. the most suitable video stream will be automatically selected. The default
  12157. value is "-1". Deprecated. If the filter is called "amovie", it will select
  12158. audio instead of video.
  12159. @item loop
  12160. Specifies how many times to read the stream in sequence.
  12161. If the value is less than 1, the stream will be read again and again.
  12162. Default value is "1".
  12163. Note that when the movie is looped the source timestamps are not
  12164. changed, so it will generate non monotonically increasing timestamps.
  12165. @end table
  12166. It allows overlaying a second video on top of the main input of
  12167. a filtergraph, as shown in this graph:
  12168. @example
  12169. input -----------> deltapts0 --> overlay --> output
  12170. ^
  12171. |
  12172. movie --> scale--> deltapts1 -------+
  12173. @end example
  12174. @subsection Examples
  12175. @itemize
  12176. @item
  12177. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  12178. on top of the input labelled "in":
  12179. @example
  12180. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  12181. [in] setpts=PTS-STARTPTS [main];
  12182. [main][over] overlay=16:16 [out]
  12183. @end example
  12184. @item
  12185. Read from a video4linux2 device, and overlay it on top of the input
  12186. labelled "in":
  12187. @example
  12188. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  12189. [in] setpts=PTS-STARTPTS [main];
  12190. [main][over] overlay=16:16 [out]
  12191. @end example
  12192. @item
  12193. Read the first video stream and the audio stream with id 0x81 from
  12194. dvd.vob; the video is connected to the pad named "video" and the audio is
  12195. connected to the pad named "audio":
  12196. @example
  12197. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  12198. @end example
  12199. @end itemize
  12200. @c man end MULTIMEDIA SOURCES