filters.texi 479 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962
  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program.
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  173. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  174. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  175. @var{FILTER} ::= [@var{LINKLABELS}] @var{NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  176. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  177. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  178. @end example
  179. @section Notes on filtergraph escaping
  180. Filtergraph description composition entails several levels of
  181. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  182. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  183. information about the employed escaping procedure.
  184. A first level escaping affects the content of each filter option
  185. value, which may contain the special character @code{:} used to
  186. separate values, or one of the escaping characters @code{\'}.
  187. A second level escaping affects the whole filter description, which
  188. may contain the escaping characters @code{\'} or the special
  189. characters @code{[],;} used by the filtergraph description.
  190. Finally, when you specify a filtergraph on a shell commandline, you
  191. need to perform a third level escaping for the shell special
  192. characters contained within it.
  193. For example, consider the following string to be embedded in
  194. the @ref{drawtext} filter description @option{text} value:
  195. @example
  196. this is a 'string': may contain one, or more, special characters
  197. @end example
  198. This string contains the @code{'} special escaping character, and the
  199. @code{:} special character, so it needs to be escaped in this way:
  200. @example
  201. text=this is a \'string\'\: may contain one, or more, special characters
  202. @end example
  203. A second level of escaping is required when embedding the filter
  204. description in a filtergraph description, in order to escape all the
  205. filtergraph special characters. Thus the example above becomes:
  206. @example
  207. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  208. @end example
  209. (note that in addition to the @code{\'} escaping special characters,
  210. also @code{,} needs to be escaped).
  211. Finally an additional level of escaping is needed when writing the
  212. filtergraph description in a shell command, which depends on the
  213. escaping rules of the adopted shell. For example, assuming that
  214. @code{\} is special and needs to be escaped with another @code{\}, the
  215. previous string will finally result in:
  216. @example
  217. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  218. @end example
  219. @chapter Timeline editing
  220. Some filters support a generic @option{enable} option. For the filters
  221. supporting timeline editing, this option can be set to an expression which is
  222. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  223. the filter will be enabled, otherwise the frame will be sent unchanged to the
  224. next filter in the filtergraph.
  225. The expression accepts the following values:
  226. @table @samp
  227. @item t
  228. timestamp expressed in seconds, NAN if the input timestamp is unknown
  229. @item n
  230. sequential number of the input frame, starting from 0
  231. @item pos
  232. the position in the file of the input frame, NAN if unknown
  233. @item w
  234. @item h
  235. width and height of the input frame if video
  236. @end table
  237. Additionally, these filters support an @option{enable} command that can be used
  238. to re-define the expression.
  239. Like any other filtering option, the @option{enable} option follows the same
  240. rules.
  241. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  242. minutes, and a @ref{curves} filter starting at 3 seconds:
  243. @example
  244. smartblur = enable='between(t,10,3*60)',
  245. curves = enable='gte(t,3)' : preset=cross_process
  246. @end example
  247. @c man end FILTERGRAPH DESCRIPTION
  248. @chapter Audio Filters
  249. @c man begin AUDIO FILTERS
  250. When you configure your FFmpeg build, you can disable any of the
  251. existing filters using @code{--disable-filters}.
  252. The configure output will show the audio filters included in your
  253. build.
  254. Below is a description of the currently available audio filters.
  255. @section acompressor
  256. A compressor is mainly used to reduce the dynamic range of a signal.
  257. Especially modern music is mostly compressed at a high ratio to
  258. improve the overall loudness. It's done to get the highest attention
  259. of a listener, "fatten" the sound and bring more "power" to the track.
  260. If a signal is compressed too much it may sound dull or "dead"
  261. afterwards or it may start to "pump" (which could be a powerful effect
  262. but can also destroy a track completely).
  263. The right compression is the key to reach a professional sound and is
  264. the high art of mixing and mastering. Because of its complex settings
  265. it may take a long time to get the right feeling for this kind of effect.
  266. Compression is done by detecting the volume above a chosen level
  267. @code{threshold} and dividing it by the factor set with @code{ratio}.
  268. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  269. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  270. the signal would cause distortion of the waveform the reduction can be
  271. levelled over the time. This is done by setting "Attack" and "Release".
  272. @code{attack} determines how long the signal has to rise above the threshold
  273. before any reduction will occur and @code{release} sets the time the signal
  274. has to fall below the threshold to reduce the reduction again. Shorter signals
  275. than the chosen attack time will be left untouched.
  276. The overall reduction of the signal can be made up afterwards with the
  277. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  278. raising the makeup to this level results in a signal twice as loud than the
  279. source. To gain a softer entry in the compression the @code{knee} flattens the
  280. hard edge at the threshold in the range of the chosen decibels.
  281. The filter accepts the following options:
  282. @table @option
  283. @item level_in
  284. Set input gain. Default is 1. Range is between 0.015625 and 64.
  285. @item threshold
  286. If a signal of second stream rises above this level it will affect the gain
  287. reduction of the first stream.
  288. By default it is 0.125. Range is between 0.00097563 and 1.
  289. @item ratio
  290. Set a ratio by which the signal is reduced. 1:2 means that if the level
  291. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  292. Default is 2. Range is between 1 and 20.
  293. @item attack
  294. Amount of milliseconds the signal has to rise above the threshold before gain
  295. reduction starts. Default is 20. Range is between 0.01 and 2000.
  296. @item release
  297. Amount of milliseconds the signal has to fall below the threshold before
  298. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  299. @item makeup
  300. Set the amount by how much signal will be amplified after processing.
  301. Default is 2. Range is from 1 and 64.
  302. @item knee
  303. Curve the sharp knee around the threshold to enter gain reduction more softly.
  304. Default is 2.82843. Range is between 1 and 8.
  305. @item link
  306. Choose if the @code{average} level between all channels of input stream
  307. or the louder(@code{maximum}) channel of input stream affects the
  308. reduction. Default is @code{average}.
  309. @item detection
  310. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  311. of @code{rms}. Default is @code{rms} which is mostly smoother.
  312. @item mix
  313. How much to use compressed signal in output. Default is 1.
  314. Range is between 0 and 1.
  315. @end table
  316. @section acrossfade
  317. Apply cross fade from one input audio stream to another input audio stream.
  318. The cross fade is applied for specified duration near the end of first stream.
  319. The filter accepts the following options:
  320. @table @option
  321. @item nb_samples, ns
  322. Specify the number of samples for which the cross fade effect has to last.
  323. At the end of the cross fade effect the first input audio will be completely
  324. silent. Default is 44100.
  325. @item duration, d
  326. Specify the duration of the cross fade effect. See
  327. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  328. for the accepted syntax.
  329. By default the duration is determined by @var{nb_samples}.
  330. If set this option is used instead of @var{nb_samples}.
  331. @item overlap, o
  332. Should first stream end overlap with second stream start. Default is enabled.
  333. @item curve1
  334. Set curve for cross fade transition for first stream.
  335. @item curve2
  336. Set curve for cross fade transition for second stream.
  337. For description of available curve types see @ref{afade} filter description.
  338. @end table
  339. @subsection Examples
  340. @itemize
  341. @item
  342. Cross fade from one input to another:
  343. @example
  344. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  345. @end example
  346. @item
  347. Cross fade from one input to another but without overlapping:
  348. @example
  349. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  350. @end example
  351. @end itemize
  352. @section acrusher
  353. Reduce audio bit resolution.
  354. This filter is bit crusher with enhanced functionality. A bit crusher
  355. is used to audibly reduce number of bits an audio signal is sampled
  356. with. This doesn't change the bit depth at all, it just produces the
  357. effect. Material reduced in bit depth sounds more harsh and "digital".
  358. This filter is able to even round to continuous values instead of discrete
  359. bit depths.
  360. Additionally it has a D/C offset which results in different crushing of
  361. the lower and the upper half of the signal.
  362. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  363. Another feature of this filter is the logarithmic mode.
  364. This setting switches from linear distances between bits to logarithmic ones.
  365. The result is a much more "natural" sounding crusher which doesn't gate low
  366. signals for example. The human ear has a logarithmic perception, too
  367. so this kind of crushing is much more pleasant.
  368. Logarithmic crushing is also able to get anti-aliased.
  369. The filter accepts the following options:
  370. @table @option
  371. @item level_in
  372. Set level in.
  373. @item level_out
  374. Set level out.
  375. @item bits
  376. Set bit reduction.
  377. @item mix
  378. Set mixing amount.
  379. @item mode
  380. Can be linear: @code{lin} or logarithmic: @code{log}.
  381. @item dc
  382. Set DC.
  383. @item aa
  384. Set anti-aliasing.
  385. @item samples
  386. Set sample reduction.
  387. @item lfo
  388. Enable LFO. By default disabled.
  389. @item lforange
  390. Set LFO range.
  391. @item lforate
  392. Set LFO rate.
  393. @end table
  394. @section adelay
  395. Delay one or more audio channels.
  396. Samples in delayed channel are filled with silence.
  397. The filter accepts the following option:
  398. @table @option
  399. @item delays
  400. Set list of delays in milliseconds for each channel separated by '|'.
  401. At least one delay greater than 0 should be provided.
  402. Unused delays will be silently ignored. If number of given delays is
  403. smaller than number of channels all remaining channels will not be delayed.
  404. If you want to delay exact number of samples, append 'S' to number.
  405. @end table
  406. @subsection Examples
  407. @itemize
  408. @item
  409. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  410. the second channel (and any other channels that may be present) unchanged.
  411. @example
  412. adelay=1500|0|500
  413. @end example
  414. @item
  415. Delay second channel by 500 samples, the third channel by 700 samples and leave
  416. the first channel (and any other channels that may be present) unchanged.
  417. @example
  418. adelay=0|500S|700S
  419. @end example
  420. @end itemize
  421. @section aecho
  422. Apply echoing to the input audio.
  423. Echoes are reflected sound and can occur naturally amongst mountains
  424. (and sometimes large buildings) when talking or shouting; digital echo
  425. effects emulate this behaviour and are often used to help fill out the
  426. sound of a single instrument or vocal. The time difference between the
  427. original signal and the reflection is the @code{delay}, and the
  428. loudness of the reflected signal is the @code{decay}.
  429. Multiple echoes can have different delays and decays.
  430. A description of the accepted parameters follows.
  431. @table @option
  432. @item in_gain
  433. Set input gain of reflected signal. Default is @code{0.6}.
  434. @item out_gain
  435. Set output gain of reflected signal. Default is @code{0.3}.
  436. @item delays
  437. Set list of time intervals in milliseconds between original signal and reflections
  438. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  439. Default is @code{1000}.
  440. @item decays
  441. Set list of loudnesses of reflected signals separated by '|'.
  442. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  443. Default is @code{0.5}.
  444. @end table
  445. @subsection Examples
  446. @itemize
  447. @item
  448. Make it sound as if there are twice as many instruments as are actually playing:
  449. @example
  450. aecho=0.8:0.88:60:0.4
  451. @end example
  452. @item
  453. If delay is very short, then it sound like a (metallic) robot playing music:
  454. @example
  455. aecho=0.8:0.88:6:0.4
  456. @end example
  457. @item
  458. A longer delay will sound like an open air concert in the mountains:
  459. @example
  460. aecho=0.8:0.9:1000:0.3
  461. @end example
  462. @item
  463. Same as above but with one more mountain:
  464. @example
  465. aecho=0.8:0.9:1000|1800:0.3|0.25
  466. @end example
  467. @end itemize
  468. @section aemphasis
  469. Audio emphasis filter creates or restores material directly taken from LPs or
  470. emphased CDs with different filter curves. E.g. to store music on vinyl the
  471. signal has to be altered by a filter first to even out the disadvantages of
  472. this recording medium.
  473. Once the material is played back the inverse filter has to be applied to
  474. restore the distortion of the frequency response.
  475. The filter accepts the following options:
  476. @table @option
  477. @item level_in
  478. Set input gain.
  479. @item level_out
  480. Set output gain.
  481. @item mode
  482. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  483. use @code{production} mode. Default is @code{reproduction} mode.
  484. @item type
  485. Set filter type. Selects medium. Can be one of the following:
  486. @table @option
  487. @item col
  488. select Columbia.
  489. @item emi
  490. select EMI.
  491. @item bsi
  492. select BSI (78RPM).
  493. @item riaa
  494. select RIAA.
  495. @item cd
  496. select Compact Disc (CD).
  497. @item 50fm
  498. select 50µs (FM).
  499. @item 75fm
  500. select 75µs (FM).
  501. @item 50kf
  502. select 50µs (FM-KF).
  503. @item 75kf
  504. select 75µs (FM-KF).
  505. @end table
  506. @end table
  507. @section aeval
  508. Modify an audio signal according to the specified expressions.
  509. This filter accepts one or more expressions (one for each channel),
  510. which are evaluated and used to modify a corresponding audio signal.
  511. It accepts the following parameters:
  512. @table @option
  513. @item exprs
  514. Set the '|'-separated expressions list for each separate channel. If
  515. the number of input channels is greater than the number of
  516. expressions, the last specified expression is used for the remaining
  517. output channels.
  518. @item channel_layout, c
  519. Set output channel layout. If not specified, the channel layout is
  520. specified by the number of expressions. If set to @samp{same}, it will
  521. use by default the same input channel layout.
  522. @end table
  523. Each expression in @var{exprs} can contain the following constants and functions:
  524. @table @option
  525. @item ch
  526. channel number of the current expression
  527. @item n
  528. number of the evaluated sample, starting from 0
  529. @item s
  530. sample rate
  531. @item t
  532. time of the evaluated sample expressed in seconds
  533. @item nb_in_channels
  534. @item nb_out_channels
  535. input and output number of channels
  536. @item val(CH)
  537. the value of input channel with number @var{CH}
  538. @end table
  539. Note: this filter is slow. For faster processing you should use a
  540. dedicated filter.
  541. @subsection Examples
  542. @itemize
  543. @item
  544. Half volume:
  545. @example
  546. aeval=val(ch)/2:c=same
  547. @end example
  548. @item
  549. Invert phase of the second channel:
  550. @example
  551. aeval=val(0)|-val(1)
  552. @end example
  553. @end itemize
  554. @anchor{afade}
  555. @section afade
  556. Apply fade-in/out effect to input audio.
  557. A description of the accepted parameters follows.
  558. @table @option
  559. @item type, t
  560. Specify the effect type, can be either @code{in} for fade-in, or
  561. @code{out} for a fade-out effect. Default is @code{in}.
  562. @item start_sample, ss
  563. Specify the number of the start sample for starting to apply the fade
  564. effect. Default is 0.
  565. @item nb_samples, ns
  566. Specify the number of samples for which the fade effect has to last. At
  567. the end of the fade-in effect the output audio will have the same
  568. volume as the input audio, at the end of the fade-out transition
  569. the output audio will be silence. Default is 44100.
  570. @item start_time, st
  571. Specify the start time of the fade effect. Default is 0.
  572. The value must be specified as a time duration; see
  573. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  574. for the accepted syntax.
  575. If set this option is used instead of @var{start_sample}.
  576. @item duration, d
  577. Specify the duration of the fade effect. See
  578. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  579. for the accepted syntax.
  580. At the end of the fade-in effect the output audio will have the same
  581. volume as the input audio, at the end of the fade-out transition
  582. the output audio will be silence.
  583. By default the duration is determined by @var{nb_samples}.
  584. If set this option is used instead of @var{nb_samples}.
  585. @item curve
  586. Set curve for fade transition.
  587. It accepts the following values:
  588. @table @option
  589. @item tri
  590. select triangular, linear slope (default)
  591. @item qsin
  592. select quarter of sine wave
  593. @item hsin
  594. select half of sine wave
  595. @item esin
  596. select exponential sine wave
  597. @item log
  598. select logarithmic
  599. @item ipar
  600. select inverted parabola
  601. @item qua
  602. select quadratic
  603. @item cub
  604. select cubic
  605. @item squ
  606. select square root
  607. @item cbr
  608. select cubic root
  609. @item par
  610. select parabola
  611. @item exp
  612. select exponential
  613. @item iqsin
  614. select inverted quarter of sine wave
  615. @item ihsin
  616. select inverted half of sine wave
  617. @item dese
  618. select double-exponential seat
  619. @item desi
  620. select double-exponential sigmoid
  621. @end table
  622. @end table
  623. @subsection Examples
  624. @itemize
  625. @item
  626. Fade in first 15 seconds of audio:
  627. @example
  628. afade=t=in:ss=0:d=15
  629. @end example
  630. @item
  631. Fade out last 25 seconds of a 900 seconds audio:
  632. @example
  633. afade=t=out:st=875:d=25
  634. @end example
  635. @end itemize
  636. @section afftfilt
  637. Apply arbitrary expressions to samples in frequency domain.
  638. @table @option
  639. @item real
  640. Set frequency domain real expression for each separate channel separated
  641. by '|'. Default is "1".
  642. If the number of input channels is greater than the number of
  643. expressions, the last specified expression is used for the remaining
  644. output channels.
  645. @item imag
  646. Set frequency domain imaginary expression for each separate channel
  647. separated by '|'. If not set, @var{real} option is used.
  648. Each expression in @var{real} and @var{imag} can contain the following
  649. constants:
  650. @table @option
  651. @item sr
  652. sample rate
  653. @item b
  654. current frequency bin number
  655. @item nb
  656. number of available bins
  657. @item ch
  658. channel number of the current expression
  659. @item chs
  660. number of channels
  661. @item pts
  662. current frame pts
  663. @end table
  664. @item win_size
  665. Set window size.
  666. It accepts the following values:
  667. @table @samp
  668. @item w16
  669. @item w32
  670. @item w64
  671. @item w128
  672. @item w256
  673. @item w512
  674. @item w1024
  675. @item w2048
  676. @item w4096
  677. @item w8192
  678. @item w16384
  679. @item w32768
  680. @item w65536
  681. @end table
  682. Default is @code{w4096}
  683. @item win_func
  684. Set window function. Default is @code{hann}.
  685. @item overlap
  686. Set window overlap. If set to 1, the recommended overlap for selected
  687. window function will be picked. Default is @code{0.75}.
  688. @end table
  689. @subsection Examples
  690. @itemize
  691. @item
  692. Leave almost only low frequencies in audio:
  693. @example
  694. afftfilt="1-clip((b/nb)*b,0,1)"
  695. @end example
  696. @end itemize
  697. @anchor{aformat}
  698. @section aformat
  699. Set output format constraints for the input audio. The framework will
  700. negotiate the most appropriate format to minimize conversions.
  701. It accepts the following parameters:
  702. @table @option
  703. @item sample_fmts
  704. A '|'-separated list of requested sample formats.
  705. @item sample_rates
  706. A '|'-separated list of requested sample rates.
  707. @item channel_layouts
  708. A '|'-separated list of requested channel layouts.
  709. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  710. for the required syntax.
  711. @end table
  712. If a parameter is omitted, all values are allowed.
  713. Force the output to either unsigned 8-bit or signed 16-bit stereo
  714. @example
  715. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  716. @end example
  717. @section agate
  718. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  719. processing reduces disturbing noise between useful signals.
  720. Gating is done by detecting the volume below a chosen level @var{threshold}
  721. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  722. floor is set via @var{range}. Because an exact manipulation of the signal
  723. would cause distortion of the waveform the reduction can be levelled over
  724. time. This is done by setting @var{attack} and @var{release}.
  725. @var{attack} determines how long the signal has to fall below the threshold
  726. before any reduction will occur and @var{release} sets the time the signal
  727. has to rise above the threshold to reduce the reduction again.
  728. Shorter signals than the chosen attack time will be left untouched.
  729. @table @option
  730. @item level_in
  731. Set input level before filtering.
  732. Default is 1. Allowed range is from 0.015625 to 64.
  733. @item range
  734. Set the level of gain reduction when the signal is below the threshold.
  735. Default is 0.06125. Allowed range is from 0 to 1.
  736. @item threshold
  737. If a signal rises above this level the gain reduction is released.
  738. Default is 0.125. Allowed range is from 0 to 1.
  739. @item ratio
  740. Set a ratio by which the signal is reduced.
  741. Default is 2. Allowed range is from 1 to 9000.
  742. @item attack
  743. Amount of milliseconds the signal has to rise above the threshold before gain
  744. reduction stops.
  745. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  746. @item release
  747. Amount of milliseconds the signal has to fall below the threshold before the
  748. reduction is increased again. Default is 250 milliseconds.
  749. Allowed range is from 0.01 to 9000.
  750. @item makeup
  751. Set amount of amplification of signal after processing.
  752. Default is 1. Allowed range is from 1 to 64.
  753. @item knee
  754. Curve the sharp knee around the threshold to enter gain reduction more softly.
  755. Default is 2.828427125. Allowed range is from 1 to 8.
  756. @item detection
  757. Choose if exact signal should be taken for detection or an RMS like one.
  758. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  759. @item link
  760. Choose if the average level between all channels or the louder channel affects
  761. the reduction.
  762. Default is @code{average}. Can be @code{average} or @code{maximum}.
  763. @end table
  764. @section alimiter
  765. The limiter prevents an input signal from rising over a desired threshold.
  766. This limiter uses lookahead technology to prevent your signal from distorting.
  767. It means that there is a small delay after the signal is processed. Keep in mind
  768. that the delay it produces is the attack time you set.
  769. The filter accepts the following options:
  770. @table @option
  771. @item level_in
  772. Set input gain. Default is 1.
  773. @item level_out
  774. Set output gain. Default is 1.
  775. @item limit
  776. Don't let signals above this level pass the limiter. Default is 1.
  777. @item attack
  778. The limiter will reach its attenuation level in this amount of time in
  779. milliseconds. Default is 5 milliseconds.
  780. @item release
  781. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  782. Default is 50 milliseconds.
  783. @item asc
  784. When gain reduction is always needed ASC takes care of releasing to an
  785. average reduction level rather than reaching a reduction of 0 in the release
  786. time.
  787. @item asc_level
  788. Select how much the release time is affected by ASC, 0 means nearly no changes
  789. in release time while 1 produces higher release times.
  790. @item level
  791. Auto level output signal. Default is enabled.
  792. This normalizes audio back to 0dB if enabled.
  793. @end table
  794. Depending on picked setting it is recommended to upsample input 2x or 4x times
  795. with @ref{aresample} before applying this filter.
  796. @section allpass
  797. Apply a two-pole all-pass filter with central frequency (in Hz)
  798. @var{frequency}, and filter-width @var{width}.
  799. An all-pass filter changes the audio's frequency to phase relationship
  800. without changing its frequency to amplitude relationship.
  801. The filter accepts the following options:
  802. @table @option
  803. @item frequency, f
  804. Set frequency in Hz.
  805. @item width_type
  806. Set method to specify band-width of filter.
  807. @table @option
  808. @item h
  809. Hz
  810. @item q
  811. Q-Factor
  812. @item o
  813. octave
  814. @item s
  815. slope
  816. @end table
  817. @item width, w
  818. Specify the band-width of a filter in width_type units.
  819. @end table
  820. @section aloop
  821. Loop audio samples.
  822. The filter accepts the following options:
  823. @table @option
  824. @item loop
  825. Set the number of loops.
  826. @item size
  827. Set maximal number of samples.
  828. @item start
  829. Set first sample of loop.
  830. @end table
  831. @anchor{amerge}
  832. @section amerge
  833. Merge two or more audio streams into a single multi-channel stream.
  834. The filter accepts the following options:
  835. @table @option
  836. @item inputs
  837. Set the number of inputs. Default is 2.
  838. @end table
  839. If the channel layouts of the inputs are disjoint, and therefore compatible,
  840. the channel layout of the output will be set accordingly and the channels
  841. will be reordered as necessary. If the channel layouts of the inputs are not
  842. disjoint, the output will have all the channels of the first input then all
  843. the channels of the second input, in that order, and the channel layout of
  844. the output will be the default value corresponding to the total number of
  845. channels.
  846. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  847. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  848. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  849. first input, b1 is the first channel of the second input).
  850. On the other hand, if both input are in stereo, the output channels will be
  851. in the default order: a1, a2, b1, b2, and the channel layout will be
  852. arbitrarily set to 4.0, which may or may not be the expected value.
  853. All inputs must have the same sample rate, and format.
  854. If inputs do not have the same duration, the output will stop with the
  855. shortest.
  856. @subsection Examples
  857. @itemize
  858. @item
  859. Merge two mono files into a stereo stream:
  860. @example
  861. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  862. @end example
  863. @item
  864. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  865. @example
  866. ffmpeg -i input.mkv -filter_complex "[0:1][0:2][0:3][0:4][0:5][0:6] amerge=inputs=6" -c:a pcm_s16le output.mkv
  867. @end example
  868. @end itemize
  869. @section amix
  870. Mixes multiple audio inputs into a single output.
  871. Note that this filter only supports float samples (the @var{amerge}
  872. and @var{pan} audio filters support many formats). If the @var{amix}
  873. input has integer samples then @ref{aresample} will be automatically
  874. inserted to perform the conversion to float samples.
  875. For example
  876. @example
  877. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  878. @end example
  879. will mix 3 input audio streams to a single output with the same duration as the
  880. first input and a dropout transition time of 3 seconds.
  881. It accepts the following parameters:
  882. @table @option
  883. @item inputs
  884. The number of inputs. If unspecified, it defaults to 2.
  885. @item duration
  886. How to determine the end-of-stream.
  887. @table @option
  888. @item longest
  889. The duration of the longest input. (default)
  890. @item shortest
  891. The duration of the shortest input.
  892. @item first
  893. The duration of the first input.
  894. @end table
  895. @item dropout_transition
  896. The transition time, in seconds, for volume renormalization when an input
  897. stream ends. The default value is 2 seconds.
  898. @end table
  899. @section anequalizer
  900. High-order parametric multiband equalizer for each channel.
  901. It accepts the following parameters:
  902. @table @option
  903. @item params
  904. This option string is in format:
  905. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  906. Each equalizer band is separated by '|'.
  907. @table @option
  908. @item chn
  909. Set channel number to which equalization will be applied.
  910. If input doesn't have that channel the entry is ignored.
  911. @item f
  912. Set central frequency for band.
  913. If input doesn't have that frequency the entry is ignored.
  914. @item w
  915. Set band width in hertz.
  916. @item g
  917. Set band gain in dB.
  918. @item t
  919. Set filter type for band, optional, can be:
  920. @table @samp
  921. @item 0
  922. Butterworth, this is default.
  923. @item 1
  924. Chebyshev type 1.
  925. @item 2
  926. Chebyshev type 2.
  927. @end table
  928. @end table
  929. @item curves
  930. With this option activated frequency response of anequalizer is displayed
  931. in video stream.
  932. @item size
  933. Set video stream size. Only useful if curves option is activated.
  934. @item mgain
  935. Set max gain that will be displayed. Only useful if curves option is activated.
  936. Setting this to a reasonable value makes it possible to display gain which is derived from
  937. neighbour bands which are too close to each other and thus produce higher gain
  938. when both are activated.
  939. @item fscale
  940. Set frequency scale used to draw frequency response in video output.
  941. Can be linear or logarithmic. Default is logarithmic.
  942. @item colors
  943. Set color for each channel curve which is going to be displayed in video stream.
  944. This is list of color names separated by space or by '|'.
  945. Unrecognised or missing colors will be replaced by white color.
  946. @end table
  947. @subsection Examples
  948. @itemize
  949. @item
  950. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  951. for first 2 channels using Chebyshev type 1 filter:
  952. @example
  953. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  954. @end example
  955. @end itemize
  956. @subsection Commands
  957. This filter supports the following commands:
  958. @table @option
  959. @item change
  960. Alter existing filter parameters.
  961. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  962. @var{fN} is existing filter number, starting from 0, if no such filter is available
  963. error is returned.
  964. @var{freq} set new frequency parameter.
  965. @var{width} set new width parameter in herz.
  966. @var{gain} set new gain parameter in dB.
  967. Full filter invocation with asendcmd may look like this:
  968. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  969. @end table
  970. @section anull
  971. Pass the audio source unchanged to the output.
  972. @section apad
  973. Pad the end of an audio stream with silence.
  974. This can be used together with @command{ffmpeg} @option{-shortest} to
  975. extend audio streams to the same length as the video stream.
  976. A description of the accepted options follows.
  977. @table @option
  978. @item packet_size
  979. Set silence packet size. Default value is 4096.
  980. @item pad_len
  981. Set the number of samples of silence to add to the end. After the
  982. value is reached, the stream is terminated. This option is mutually
  983. exclusive with @option{whole_len}.
  984. @item whole_len
  985. Set the minimum total number of samples in the output audio stream. If
  986. the value is longer than the input audio length, silence is added to
  987. the end, until the value is reached. This option is mutually exclusive
  988. with @option{pad_len}.
  989. @end table
  990. If neither the @option{pad_len} nor the @option{whole_len} option is
  991. set, the filter will add silence to the end of the input stream
  992. indefinitely.
  993. @subsection Examples
  994. @itemize
  995. @item
  996. Add 1024 samples of silence to the end of the input:
  997. @example
  998. apad=pad_len=1024
  999. @end example
  1000. @item
  1001. Make sure the audio output will contain at least 10000 samples, pad
  1002. the input with silence if required:
  1003. @example
  1004. apad=whole_len=10000
  1005. @end example
  1006. @item
  1007. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1008. video stream will always result the shortest and will be converted
  1009. until the end in the output file when using the @option{shortest}
  1010. option:
  1011. @example
  1012. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1013. @end example
  1014. @end itemize
  1015. @section aphaser
  1016. Add a phasing effect to the input audio.
  1017. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1018. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1019. A description of the accepted parameters follows.
  1020. @table @option
  1021. @item in_gain
  1022. Set input gain. Default is 0.4.
  1023. @item out_gain
  1024. Set output gain. Default is 0.74
  1025. @item delay
  1026. Set delay in milliseconds. Default is 3.0.
  1027. @item decay
  1028. Set decay. Default is 0.4.
  1029. @item speed
  1030. Set modulation speed in Hz. Default is 0.5.
  1031. @item type
  1032. Set modulation type. Default is triangular.
  1033. It accepts the following values:
  1034. @table @samp
  1035. @item triangular, t
  1036. @item sinusoidal, s
  1037. @end table
  1038. @end table
  1039. @section apulsator
  1040. Audio pulsator is something between an autopanner and a tremolo.
  1041. But it can produce funny stereo effects as well. Pulsator changes the volume
  1042. of the left and right channel based on a LFO (low frequency oscillator) with
  1043. different waveforms and shifted phases.
  1044. This filter have the ability to define an offset between left and right
  1045. channel. An offset of 0 means that both LFO shapes match each other.
  1046. The left and right channel are altered equally - a conventional tremolo.
  1047. An offset of 50% means that the shape of the right channel is exactly shifted
  1048. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1049. an autopanner. At 1 both curves match again. Every setting in between moves the
  1050. phase shift gapless between all stages and produces some "bypassing" sounds with
  1051. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1052. the 0.5) the faster the signal passes from the left to the right speaker.
  1053. The filter accepts the following options:
  1054. @table @option
  1055. @item level_in
  1056. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1057. @item level_out
  1058. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1059. @item mode
  1060. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1061. sawup or sawdown. Default is sine.
  1062. @item amount
  1063. Set modulation. Define how much of original signal is affected by the LFO.
  1064. @item offset_l
  1065. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1066. @item offset_r
  1067. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1068. @item width
  1069. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1070. @item timing
  1071. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1072. @item bpm
  1073. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1074. is set to bpm.
  1075. @item ms
  1076. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1077. is set to ms.
  1078. @item hz
  1079. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1080. if timing is set to hz.
  1081. @end table
  1082. @anchor{aresample}
  1083. @section aresample
  1084. Resample the input audio to the specified parameters, using the
  1085. libswresample library. If none are specified then the filter will
  1086. automatically convert between its input and output.
  1087. This filter is also able to stretch/squeeze the audio data to make it match
  1088. the timestamps or to inject silence / cut out audio to make it match the
  1089. timestamps, do a combination of both or do neither.
  1090. The filter accepts the syntax
  1091. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1092. expresses a sample rate and @var{resampler_options} is a list of
  1093. @var{key}=@var{value} pairs, separated by ":". See the
  1094. ffmpeg-resampler manual for the complete list of supported options.
  1095. @subsection Examples
  1096. @itemize
  1097. @item
  1098. Resample the input audio to 44100Hz:
  1099. @example
  1100. aresample=44100
  1101. @end example
  1102. @item
  1103. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1104. samples per second compensation:
  1105. @example
  1106. aresample=async=1000
  1107. @end example
  1108. @end itemize
  1109. @section areverse
  1110. Reverse an audio clip.
  1111. Warning: This filter requires memory to buffer the entire clip, so trimming
  1112. is suggested.
  1113. @subsection Examples
  1114. @itemize
  1115. @item
  1116. Take the first 5 seconds of a clip, and reverse it.
  1117. @example
  1118. atrim=end=5,areverse
  1119. @end example
  1120. @end itemize
  1121. @section asetnsamples
  1122. Set the number of samples per each output audio frame.
  1123. The last output packet may contain a different number of samples, as
  1124. the filter will flush all the remaining samples when the input audio
  1125. signals its end.
  1126. The filter accepts the following options:
  1127. @table @option
  1128. @item nb_out_samples, n
  1129. Set the number of frames per each output audio frame. The number is
  1130. intended as the number of samples @emph{per each channel}.
  1131. Default value is 1024.
  1132. @item pad, p
  1133. If set to 1, the filter will pad the last audio frame with zeroes, so
  1134. that the last frame will contain the same number of samples as the
  1135. previous ones. Default value is 1.
  1136. @end table
  1137. For example, to set the number of per-frame samples to 1234 and
  1138. disable padding for the last frame, use:
  1139. @example
  1140. asetnsamples=n=1234:p=0
  1141. @end example
  1142. @section asetrate
  1143. Set the sample rate without altering the PCM data.
  1144. This will result in a change of speed and pitch.
  1145. The filter accepts the following options:
  1146. @table @option
  1147. @item sample_rate, r
  1148. Set the output sample rate. Default is 44100 Hz.
  1149. @end table
  1150. @section ashowinfo
  1151. Show a line containing various information for each input audio frame.
  1152. The input audio is not modified.
  1153. The shown line contains a sequence of key/value pairs of the form
  1154. @var{key}:@var{value}.
  1155. The following values are shown in the output:
  1156. @table @option
  1157. @item n
  1158. The (sequential) number of the input frame, starting from 0.
  1159. @item pts
  1160. The presentation timestamp of the input frame, in time base units; the time base
  1161. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1162. @item pts_time
  1163. The presentation timestamp of the input frame in seconds.
  1164. @item pos
  1165. position of the frame in the input stream, -1 if this information in
  1166. unavailable and/or meaningless (for example in case of synthetic audio)
  1167. @item fmt
  1168. The sample format.
  1169. @item chlayout
  1170. The channel layout.
  1171. @item rate
  1172. The sample rate for the audio frame.
  1173. @item nb_samples
  1174. The number of samples (per channel) in the frame.
  1175. @item checksum
  1176. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1177. audio, the data is treated as if all the planes were concatenated.
  1178. @item plane_checksums
  1179. A list of Adler-32 checksums for each data plane.
  1180. @end table
  1181. @anchor{astats}
  1182. @section astats
  1183. Display time domain statistical information about the audio channels.
  1184. Statistics are calculated and displayed for each audio channel and,
  1185. where applicable, an overall figure is also given.
  1186. It accepts the following option:
  1187. @table @option
  1188. @item length
  1189. Short window length in seconds, used for peak and trough RMS measurement.
  1190. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.1 - 10]}.
  1191. @item metadata
  1192. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1193. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1194. disabled.
  1195. Available keys for each channel are:
  1196. DC_offset
  1197. Min_level
  1198. Max_level
  1199. Min_difference
  1200. Max_difference
  1201. Mean_difference
  1202. Peak_level
  1203. RMS_peak
  1204. RMS_trough
  1205. Crest_factor
  1206. Flat_factor
  1207. Peak_count
  1208. Bit_depth
  1209. and for Overall:
  1210. DC_offset
  1211. Min_level
  1212. Max_level
  1213. Min_difference
  1214. Max_difference
  1215. Mean_difference
  1216. Peak_level
  1217. RMS_level
  1218. RMS_peak
  1219. RMS_trough
  1220. Flat_factor
  1221. Peak_count
  1222. Bit_depth
  1223. Number_of_samples
  1224. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1225. this @code{lavfi.astats.Overall.Peak_count}.
  1226. For description what each key means read below.
  1227. @item reset
  1228. Set number of frame after which stats are going to be recalculated.
  1229. Default is disabled.
  1230. @end table
  1231. A description of each shown parameter follows:
  1232. @table @option
  1233. @item DC offset
  1234. Mean amplitude displacement from zero.
  1235. @item Min level
  1236. Minimal sample level.
  1237. @item Max level
  1238. Maximal sample level.
  1239. @item Min difference
  1240. Minimal difference between two consecutive samples.
  1241. @item Max difference
  1242. Maximal difference between two consecutive samples.
  1243. @item Mean difference
  1244. Mean difference between two consecutive samples.
  1245. The average of each difference between two consecutive samples.
  1246. @item Peak level dB
  1247. @item RMS level dB
  1248. Standard peak and RMS level measured in dBFS.
  1249. @item RMS peak dB
  1250. @item RMS trough dB
  1251. Peak and trough values for RMS level measured over a short window.
  1252. @item Crest factor
  1253. Standard ratio of peak to RMS level (note: not in dB).
  1254. @item Flat factor
  1255. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1256. (i.e. either @var{Min level} or @var{Max level}).
  1257. @item Peak count
  1258. Number of occasions (not the number of samples) that the signal attained either
  1259. @var{Min level} or @var{Max level}.
  1260. @item Bit depth
  1261. Overall bit depth of audio. Number of bits used for each sample.
  1262. @end table
  1263. @section asyncts
  1264. Synchronize audio data with timestamps by squeezing/stretching it and/or
  1265. dropping samples/adding silence when needed.
  1266. This filter is not built by default, please use @ref{aresample} to do squeezing/stretching.
  1267. It accepts the following parameters:
  1268. @table @option
  1269. @item compensate
  1270. Enable stretching/squeezing the data to make it match the timestamps. Disabled
  1271. by default. When disabled, time gaps are covered with silence.
  1272. @item min_delta
  1273. The minimum difference between timestamps and audio data (in seconds) to trigger
  1274. adding/dropping samples. The default value is 0.1. If you get an imperfect
  1275. sync with this filter, try setting this parameter to 0.
  1276. @item max_comp
  1277. The maximum compensation in samples per second. Only relevant with compensate=1.
  1278. The default value is 500.
  1279. @item first_pts
  1280. Assume that the first PTS should be this value. The time base is 1 / sample
  1281. rate. This allows for padding/trimming at the start of the stream. By default,
  1282. no assumption is made about the first frame's expected PTS, so no padding or
  1283. trimming is done. For example, this could be set to 0 to pad the beginning with
  1284. silence if an audio stream starts after the video stream or to trim any samples
  1285. with a negative PTS due to encoder delay.
  1286. @end table
  1287. @section atempo
  1288. Adjust audio tempo.
  1289. The filter accepts exactly one parameter, the audio tempo. If not
  1290. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1291. be in the [0.5, 2.0] range.
  1292. @subsection Examples
  1293. @itemize
  1294. @item
  1295. Slow down audio to 80% tempo:
  1296. @example
  1297. atempo=0.8
  1298. @end example
  1299. @item
  1300. To speed up audio to 125% tempo:
  1301. @example
  1302. atempo=1.25
  1303. @end example
  1304. @end itemize
  1305. @section atrim
  1306. Trim the input so that the output contains one continuous subpart of the input.
  1307. It accepts the following parameters:
  1308. @table @option
  1309. @item start
  1310. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1311. sample with the timestamp @var{start} will be the first sample in the output.
  1312. @item end
  1313. Specify time of the first audio sample that will be dropped, i.e. the
  1314. audio sample immediately preceding the one with the timestamp @var{end} will be
  1315. the last sample in the output.
  1316. @item start_pts
  1317. Same as @var{start}, except this option sets the start timestamp in samples
  1318. instead of seconds.
  1319. @item end_pts
  1320. Same as @var{end}, except this option sets the end timestamp in samples instead
  1321. of seconds.
  1322. @item duration
  1323. The maximum duration of the output in seconds.
  1324. @item start_sample
  1325. The number of the first sample that should be output.
  1326. @item end_sample
  1327. The number of the first sample that should be dropped.
  1328. @end table
  1329. @option{start}, @option{end}, and @option{duration} are expressed as time
  1330. duration specifications; see
  1331. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1332. Note that the first two sets of the start/end options and the @option{duration}
  1333. option look at the frame timestamp, while the _sample options simply count the
  1334. samples that pass through the filter. So start/end_pts and start/end_sample will
  1335. give different results when the timestamps are wrong, inexact or do not start at
  1336. zero. Also note that this filter does not modify the timestamps. If you wish
  1337. to have the output timestamps start at zero, insert the asetpts filter after the
  1338. atrim filter.
  1339. If multiple start or end options are set, this filter tries to be greedy and
  1340. keep all samples that match at least one of the specified constraints. To keep
  1341. only the part that matches all the constraints at once, chain multiple atrim
  1342. filters.
  1343. The defaults are such that all the input is kept. So it is possible to set e.g.
  1344. just the end values to keep everything before the specified time.
  1345. Examples:
  1346. @itemize
  1347. @item
  1348. Drop everything except the second minute of input:
  1349. @example
  1350. ffmpeg -i INPUT -af atrim=60:120
  1351. @end example
  1352. @item
  1353. Keep only the first 1000 samples:
  1354. @example
  1355. ffmpeg -i INPUT -af atrim=end_sample=1000
  1356. @end example
  1357. @end itemize
  1358. @section bandpass
  1359. Apply a two-pole Butterworth band-pass filter with central
  1360. frequency @var{frequency}, and (3dB-point) band-width width.
  1361. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1362. instead of the default: constant 0dB peak gain.
  1363. The filter roll off at 6dB per octave (20dB per decade).
  1364. The filter accepts the following options:
  1365. @table @option
  1366. @item frequency, f
  1367. Set the filter's central frequency. Default is @code{3000}.
  1368. @item csg
  1369. Constant skirt gain if set to 1. Defaults to 0.
  1370. @item width_type
  1371. Set method to specify band-width of filter.
  1372. @table @option
  1373. @item h
  1374. Hz
  1375. @item q
  1376. Q-Factor
  1377. @item o
  1378. octave
  1379. @item s
  1380. slope
  1381. @end table
  1382. @item width, w
  1383. Specify the band-width of a filter in width_type units.
  1384. @end table
  1385. @section bandreject
  1386. Apply a two-pole Butterworth band-reject filter with central
  1387. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1388. The filter roll off at 6dB per octave (20dB per decade).
  1389. The filter accepts the following options:
  1390. @table @option
  1391. @item frequency, f
  1392. Set the filter's central frequency. Default is @code{3000}.
  1393. @item width_type
  1394. Set method to specify band-width of filter.
  1395. @table @option
  1396. @item h
  1397. Hz
  1398. @item q
  1399. Q-Factor
  1400. @item o
  1401. octave
  1402. @item s
  1403. slope
  1404. @end table
  1405. @item width, w
  1406. Specify the band-width of a filter in width_type units.
  1407. @end table
  1408. @section bass
  1409. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1410. shelving filter with a response similar to that of a standard
  1411. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1412. The filter accepts the following options:
  1413. @table @option
  1414. @item gain, g
  1415. Give the gain at 0 Hz. Its useful range is about -20
  1416. (for a large cut) to +20 (for a large boost).
  1417. Beware of clipping when using a positive gain.
  1418. @item frequency, f
  1419. Set the filter's central frequency and so can be used
  1420. to extend or reduce the frequency range to be boosted or cut.
  1421. The default value is @code{100} Hz.
  1422. @item width_type
  1423. Set method to specify band-width of filter.
  1424. @table @option
  1425. @item h
  1426. Hz
  1427. @item q
  1428. Q-Factor
  1429. @item o
  1430. octave
  1431. @item s
  1432. slope
  1433. @end table
  1434. @item width, w
  1435. Determine how steep is the filter's shelf transition.
  1436. @end table
  1437. @section biquad
  1438. Apply a biquad IIR filter with the given coefficients.
  1439. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1440. are the numerator and denominator coefficients respectively.
  1441. @section bs2b
  1442. Bauer stereo to binaural transformation, which improves headphone listening of
  1443. stereo audio records.
  1444. It accepts the following parameters:
  1445. @table @option
  1446. @item profile
  1447. Pre-defined crossfeed level.
  1448. @table @option
  1449. @item default
  1450. Default level (fcut=700, feed=50).
  1451. @item cmoy
  1452. Chu Moy circuit (fcut=700, feed=60).
  1453. @item jmeier
  1454. Jan Meier circuit (fcut=650, feed=95).
  1455. @end table
  1456. @item fcut
  1457. Cut frequency (in Hz).
  1458. @item feed
  1459. Feed level (in Hz).
  1460. @end table
  1461. @section channelmap
  1462. Remap input channels to new locations.
  1463. It accepts the following parameters:
  1464. @table @option
  1465. @item channel_layout
  1466. The channel layout of the output stream.
  1467. @item map
  1468. Map channels from input to output. The argument is a '|'-separated list of
  1469. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1470. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1471. channel (e.g. FL for front left) or its index in the input channel layout.
  1472. @var{out_channel} is the name of the output channel or its index in the output
  1473. channel layout. If @var{out_channel} is not given then it is implicitly an
  1474. index, starting with zero and increasing by one for each mapping.
  1475. @end table
  1476. If no mapping is present, the filter will implicitly map input channels to
  1477. output channels, preserving indices.
  1478. For example, assuming a 5.1+downmix input MOV file,
  1479. @example
  1480. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1481. @end example
  1482. will create an output WAV file tagged as stereo from the downmix channels of
  1483. the input.
  1484. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1485. @example
  1486. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1487. @end example
  1488. @section channelsplit
  1489. Split each channel from an input audio stream into a separate output stream.
  1490. It accepts the following parameters:
  1491. @table @option
  1492. @item channel_layout
  1493. The channel layout of the input stream. The default is "stereo".
  1494. @end table
  1495. For example, assuming a stereo input MP3 file,
  1496. @example
  1497. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1498. @end example
  1499. will create an output Matroska file with two audio streams, one containing only
  1500. the left channel and the other the right channel.
  1501. Split a 5.1 WAV file into per-channel files:
  1502. @example
  1503. ffmpeg -i in.wav -filter_complex
  1504. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1505. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1506. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1507. side_right.wav
  1508. @end example
  1509. @section chorus
  1510. Add a chorus effect to the audio.
  1511. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1512. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1513. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1514. The modulation depth defines the range the modulated delay is played before or after
  1515. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1516. sound tuned around the original one, like in a chorus where some vocals are slightly
  1517. off key.
  1518. It accepts the following parameters:
  1519. @table @option
  1520. @item in_gain
  1521. Set input gain. Default is 0.4.
  1522. @item out_gain
  1523. Set output gain. Default is 0.4.
  1524. @item delays
  1525. Set delays. A typical delay is around 40ms to 60ms.
  1526. @item decays
  1527. Set decays.
  1528. @item speeds
  1529. Set speeds.
  1530. @item depths
  1531. Set depths.
  1532. @end table
  1533. @subsection Examples
  1534. @itemize
  1535. @item
  1536. A single delay:
  1537. @example
  1538. chorus=0.7:0.9:55:0.4:0.25:2
  1539. @end example
  1540. @item
  1541. Two delays:
  1542. @example
  1543. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1544. @end example
  1545. @item
  1546. Fuller sounding chorus with three delays:
  1547. @example
  1548. chorus=0.5:0.9:50|60|40:0.4|0.32|0.3:0.25|0.4|0.3:2|2.3|1.3
  1549. @end example
  1550. @end itemize
  1551. @section compand
  1552. Compress or expand the audio's dynamic range.
  1553. It accepts the following parameters:
  1554. @table @option
  1555. @item attacks
  1556. @item decays
  1557. A list of times in seconds for each channel over which the instantaneous level
  1558. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1559. increase of volume and @var{decays} refers to decrease of volume. For most
  1560. situations, the attack time (response to the audio getting louder) should be
  1561. shorter than the decay time, because the human ear is more sensitive to sudden
  1562. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1563. a typical value for decay is 0.8 seconds.
  1564. If specified number of attacks & decays is lower than number of channels, the last
  1565. set attack/decay will be used for all remaining channels.
  1566. @item points
  1567. A list of points for the transfer function, specified in dB relative to the
  1568. maximum possible signal amplitude. Each key points list must be defined using
  1569. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1570. @code{x0/y0 x1/y1 x2/y2 ....}
  1571. The input values must be in strictly increasing order but the transfer function
  1572. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1573. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1574. function are @code{-70/-70|-60/-20}.
  1575. @item soft-knee
  1576. Set the curve radius in dB for all joints. It defaults to 0.01.
  1577. @item gain
  1578. Set the additional gain in dB to be applied at all points on the transfer
  1579. function. This allows for easy adjustment of the overall gain.
  1580. It defaults to 0.
  1581. @item volume
  1582. Set an initial volume, in dB, to be assumed for each channel when filtering
  1583. starts. This permits the user to supply a nominal level initially, so that, for
  1584. example, a very large gain is not applied to initial signal levels before the
  1585. companding has begun to operate. A typical value for audio which is initially
  1586. quiet is -90 dB. It defaults to 0.
  1587. @item delay
  1588. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1589. delayed before being fed to the volume adjuster. Specifying a delay
  1590. approximately equal to the attack/decay times allows the filter to effectively
  1591. operate in predictive rather than reactive mode. It defaults to 0.
  1592. @end table
  1593. @subsection Examples
  1594. @itemize
  1595. @item
  1596. Make music with both quiet and loud passages suitable for listening to in a
  1597. noisy environment:
  1598. @example
  1599. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1600. @end example
  1601. Another example for audio with whisper and explosion parts:
  1602. @example
  1603. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1604. @end example
  1605. @item
  1606. A noise gate for when the noise is at a lower level than the signal:
  1607. @example
  1608. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1609. @end example
  1610. @item
  1611. Here is another noise gate, this time for when the noise is at a higher level
  1612. than the signal (making it, in some ways, similar to squelch):
  1613. @example
  1614. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1615. @end example
  1616. @item
  1617. 2:1 compression starting at -6dB:
  1618. @example
  1619. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1620. @end example
  1621. @item
  1622. 2:1 compression starting at -9dB:
  1623. @example
  1624. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1625. @end example
  1626. @item
  1627. 2:1 compression starting at -12dB:
  1628. @example
  1629. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1630. @end example
  1631. @item
  1632. 2:1 compression starting at -18dB:
  1633. @example
  1634. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1635. @end example
  1636. @item
  1637. 3:1 compression starting at -15dB:
  1638. @example
  1639. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1640. @end example
  1641. @item
  1642. Compressor/Gate:
  1643. @example
  1644. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1645. @end example
  1646. @item
  1647. Expander:
  1648. @example
  1649. compand=attacks=0:points=-80/-169|-54/-80|-49.5/-64.6|-41.1/-41.1|-25.8/-15|-10.8/-4.5|0/0|20/8.3
  1650. @end example
  1651. @item
  1652. Hard limiter at -6dB:
  1653. @example
  1654. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1655. @end example
  1656. @item
  1657. Hard limiter at -12dB:
  1658. @example
  1659. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1660. @end example
  1661. @item
  1662. Hard noise gate at -35 dB:
  1663. @example
  1664. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1665. @end example
  1666. @item
  1667. Soft limiter:
  1668. @example
  1669. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  1670. @end example
  1671. @end itemize
  1672. @section compensationdelay
  1673. Compensation Delay Line is a metric based delay to compensate differing
  1674. positions of microphones or speakers.
  1675. For example, you have recorded guitar with two microphones placed in
  1676. different location. Because the front of sound wave has fixed speed in
  1677. normal conditions, the phasing of microphones can vary and depends on
  1678. their location and interposition. The best sound mix can be achieved when
  1679. these microphones are in phase (synchronized). Note that distance of
  1680. ~30 cm between microphones makes one microphone to capture signal in
  1681. antiphase to another microphone. That makes the final mix sounding moody.
  1682. This filter helps to solve phasing problems by adding different delays
  1683. to each microphone track and make them synchronized.
  1684. The best result can be reached when you take one track as base and
  1685. synchronize other tracks one by one with it.
  1686. Remember that synchronization/delay tolerance depends on sample rate, too.
  1687. Higher sample rates will give more tolerance.
  1688. It accepts the following parameters:
  1689. @table @option
  1690. @item mm
  1691. Set millimeters distance. This is compensation distance for fine tuning.
  1692. Default is 0.
  1693. @item cm
  1694. Set cm distance. This is compensation distance for tightening distance setup.
  1695. Default is 0.
  1696. @item m
  1697. Set meters distance. This is compensation distance for hard distance setup.
  1698. Default is 0.
  1699. @item dry
  1700. Set dry amount. Amount of unprocessed (dry) signal.
  1701. Default is 0.
  1702. @item wet
  1703. Set wet amount. Amount of processed (wet) signal.
  1704. Default is 1.
  1705. @item temp
  1706. Set temperature degree in Celsius. This is the temperature of the environment.
  1707. Default is 20.
  1708. @end table
  1709. @section crystalizer
  1710. Simple algorithm to expand audio dynamic range.
  1711. The filter accepts the following options:
  1712. @table @option
  1713. @item i
  1714. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  1715. (unchanged sound) to 10.0 (maximum effect).
  1716. @item c
  1717. Enable clipping. By default is enabled.
  1718. @end table
  1719. @section dcshift
  1720. Apply a DC shift to the audio.
  1721. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1722. in the recording chain) from the audio. The effect of a DC offset is reduced
  1723. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1724. a signal has a DC offset.
  1725. @table @option
  1726. @item shift
  1727. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1728. the audio.
  1729. @item limitergain
  1730. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1731. used to prevent clipping.
  1732. @end table
  1733. @section dynaudnorm
  1734. Dynamic Audio Normalizer.
  1735. This filter applies a certain amount of gain to the input audio in order
  1736. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  1737. contrast to more "simple" normalization algorithms, the Dynamic Audio
  1738. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  1739. This allows for applying extra gain to the "quiet" sections of the audio
  1740. while avoiding distortions or clipping the "loud" sections. In other words:
  1741. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  1742. sections, in the sense that the volume of each section is brought to the
  1743. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  1744. this goal *without* applying "dynamic range compressing". It will retain 100%
  1745. of the dynamic range *within* each section of the audio file.
  1746. @table @option
  1747. @item f
  1748. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  1749. Default is 500 milliseconds.
  1750. The Dynamic Audio Normalizer processes the input audio in small chunks,
  1751. referred to as frames. This is required, because a peak magnitude has no
  1752. meaning for just a single sample value. Instead, we need to determine the
  1753. peak magnitude for a contiguous sequence of sample values. While a "standard"
  1754. normalizer would simply use the peak magnitude of the complete file, the
  1755. Dynamic Audio Normalizer determines the peak magnitude individually for each
  1756. frame. The length of a frame is specified in milliseconds. By default, the
  1757. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  1758. been found to give good results with most files.
  1759. Note that the exact frame length, in number of samples, will be determined
  1760. automatically, based on the sampling rate of the individual input audio file.
  1761. @item g
  1762. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  1763. number. Default is 31.
  1764. Probably the most important parameter of the Dynamic Audio Normalizer is the
  1765. @code{window size} of the Gaussian smoothing filter. The filter's window size
  1766. is specified in frames, centered around the current frame. For the sake of
  1767. simplicity, this must be an odd number. Consequently, the default value of 31
  1768. takes into account the current frame, as well as the 15 preceding frames and
  1769. the 15 subsequent frames. Using a larger window results in a stronger
  1770. smoothing effect and thus in less gain variation, i.e. slower gain
  1771. adaptation. Conversely, using a smaller window results in a weaker smoothing
  1772. effect and thus in more gain variation, i.e. faster gain adaptation.
  1773. In other words, the more you increase this value, the more the Dynamic Audio
  1774. Normalizer will behave like a "traditional" normalization filter. On the
  1775. contrary, the more you decrease this value, the more the Dynamic Audio
  1776. Normalizer will behave like a dynamic range compressor.
  1777. @item p
  1778. Set the target peak value. This specifies the highest permissible magnitude
  1779. level for the normalized audio input. This filter will try to approach the
  1780. target peak magnitude as closely as possible, but at the same time it also
  1781. makes sure that the normalized signal will never exceed the peak magnitude.
  1782. A frame's maximum local gain factor is imposed directly by the target peak
  1783. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  1784. It is not recommended to go above this value.
  1785. @item m
  1786. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  1787. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  1788. factor for each input frame, i.e. the maximum gain factor that does not
  1789. result in clipping or distortion. The maximum gain factor is determined by
  1790. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  1791. additionally bounds the frame's maximum gain factor by a predetermined
  1792. (global) maximum gain factor. This is done in order to avoid excessive gain
  1793. factors in "silent" or almost silent frames. By default, the maximum gain
  1794. factor is 10.0, For most inputs the default value should be sufficient and
  1795. it usually is not recommended to increase this value. Though, for input
  1796. with an extremely low overall volume level, it may be necessary to allow even
  1797. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  1798. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  1799. Instead, a "sigmoid" threshold function will be applied. This way, the
  1800. gain factors will smoothly approach the threshold value, but never exceed that
  1801. value.
  1802. @item r
  1803. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  1804. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  1805. This means that the maximum local gain factor for each frame is defined
  1806. (only) by the frame's highest magnitude sample. This way, the samples can
  1807. be amplified as much as possible without exceeding the maximum signal
  1808. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  1809. Normalizer can also take into account the frame's root mean square,
  1810. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  1811. determine the power of a time-varying signal. It is therefore considered
  1812. that the RMS is a better approximation of the "perceived loudness" than
  1813. just looking at the signal's peak magnitude. Consequently, by adjusting all
  1814. frames to a constant RMS value, a uniform "perceived loudness" can be
  1815. established. If a target RMS value has been specified, a frame's local gain
  1816. factor is defined as the factor that would result in exactly that RMS value.
  1817. Note, however, that the maximum local gain factor is still restricted by the
  1818. frame's highest magnitude sample, in order to prevent clipping.
  1819. @item n
  1820. Enable channels coupling. By default is enabled.
  1821. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  1822. amount. This means the same gain factor will be applied to all channels, i.e.
  1823. the maximum possible gain factor is determined by the "loudest" channel.
  1824. However, in some recordings, it may happen that the volume of the different
  1825. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  1826. In this case, this option can be used to disable the channel coupling. This way,
  1827. the gain factor will be determined independently for each channel, depending
  1828. only on the individual channel's highest magnitude sample. This allows for
  1829. harmonizing the volume of the different channels.
  1830. @item c
  1831. Enable DC bias correction. By default is disabled.
  1832. An audio signal (in the time domain) is a sequence of sample values.
  1833. In the Dynamic Audio Normalizer these sample values are represented in the
  1834. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  1835. audio signal, or "waveform", should be centered around the zero point.
  1836. That means if we calculate the mean value of all samples in a file, or in a
  1837. single frame, then the result should be 0.0 or at least very close to that
  1838. value. If, however, there is a significant deviation of the mean value from
  1839. 0.0, in either positive or negative direction, this is referred to as a
  1840. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  1841. Audio Normalizer provides optional DC bias correction.
  1842. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  1843. the mean value, or "DC correction" offset, of each input frame and subtract
  1844. that value from all of the frame's sample values which ensures those samples
  1845. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  1846. boundaries, the DC correction offset values will be interpolated smoothly
  1847. between neighbouring frames.
  1848. @item b
  1849. Enable alternative boundary mode. By default is disabled.
  1850. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  1851. around each frame. This includes the preceding frames as well as the
  1852. subsequent frames. However, for the "boundary" frames, located at the very
  1853. beginning and at the very end of the audio file, not all neighbouring
  1854. frames are available. In particular, for the first few frames in the audio
  1855. file, the preceding frames are not known. And, similarly, for the last few
  1856. frames in the audio file, the subsequent frames are not known. Thus, the
  1857. question arises which gain factors should be assumed for the missing frames
  1858. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  1859. to deal with this situation. The default boundary mode assumes a gain factor
  1860. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  1861. "fade out" at the beginning and at the end of the input, respectively.
  1862. @item s
  1863. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  1864. By default, the Dynamic Audio Normalizer does not apply "traditional"
  1865. compression. This means that signal peaks will not be pruned and thus the
  1866. full dynamic range will be retained within each local neighbourhood. However,
  1867. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  1868. normalization algorithm with a more "traditional" compression.
  1869. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  1870. (thresholding) function. If (and only if) the compression feature is enabled,
  1871. all input frames will be processed by a soft knee thresholding function prior
  1872. to the actual normalization process. Put simply, the thresholding function is
  1873. going to prune all samples whose magnitude exceeds a certain threshold value.
  1874. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  1875. value. Instead, the threshold value will be adjusted for each individual
  1876. frame.
  1877. In general, smaller parameters result in stronger compression, and vice versa.
  1878. Values below 3.0 are not recommended, because audible distortion may appear.
  1879. @end table
  1880. @section earwax
  1881. Make audio easier to listen to on headphones.
  1882. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  1883. so that when listened to on headphones the stereo image is moved from
  1884. inside your head (standard for headphones) to outside and in front of
  1885. the listener (standard for speakers).
  1886. Ported from SoX.
  1887. @section equalizer
  1888. Apply a two-pole peaking equalisation (EQ) filter. With this
  1889. filter, the signal-level at and around a selected frequency can
  1890. be increased or decreased, whilst (unlike bandpass and bandreject
  1891. filters) that at all other frequencies is unchanged.
  1892. In order to produce complex equalisation curves, this filter can
  1893. be given several times, each with a different central frequency.
  1894. The filter accepts the following options:
  1895. @table @option
  1896. @item frequency, f
  1897. Set the filter's central frequency in Hz.
  1898. @item width_type
  1899. Set method to specify band-width of filter.
  1900. @table @option
  1901. @item h
  1902. Hz
  1903. @item q
  1904. Q-Factor
  1905. @item o
  1906. octave
  1907. @item s
  1908. slope
  1909. @end table
  1910. @item width, w
  1911. Specify the band-width of a filter in width_type units.
  1912. @item gain, g
  1913. Set the required gain or attenuation in dB.
  1914. Beware of clipping when using a positive gain.
  1915. @end table
  1916. @subsection Examples
  1917. @itemize
  1918. @item
  1919. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  1920. @example
  1921. equalizer=f=1000:width_type=h:width=200:g=-10
  1922. @end example
  1923. @item
  1924. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  1925. @example
  1926. equalizer=f=1000:width_type=q:width=1:g=2,equalizer=f=100:width_type=q:width=2:g=-5
  1927. @end example
  1928. @end itemize
  1929. @section extrastereo
  1930. Linearly increases the difference between left and right channels which
  1931. adds some sort of "live" effect to playback.
  1932. The filter accepts the following options:
  1933. @table @option
  1934. @item m
  1935. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  1936. (average of both channels), with 1.0 sound will be unchanged, with
  1937. -1.0 left and right channels will be swapped.
  1938. @item c
  1939. Enable clipping. By default is enabled.
  1940. @end table
  1941. @section firequalizer
  1942. Apply FIR Equalization using arbitrary frequency response.
  1943. The filter accepts the following option:
  1944. @table @option
  1945. @item gain
  1946. Set gain curve equation (in dB). The expression can contain variables:
  1947. @table @option
  1948. @item f
  1949. the evaluated frequency
  1950. @item sr
  1951. sample rate
  1952. @item ch
  1953. channel number, set to 0 when multichannels evaluation is disabled
  1954. @item chid
  1955. channel id, see libavutil/channel_layout.h, set to the first channel id when
  1956. multichannels evaluation is disabled
  1957. @item chs
  1958. number of channels
  1959. @item chlayout
  1960. channel_layout, see libavutil/channel_layout.h
  1961. @end table
  1962. and functions:
  1963. @table @option
  1964. @item gain_interpolate(f)
  1965. interpolate gain on frequency f based on gain_entry
  1966. @item cubic_interpolate(f)
  1967. same as gain_interpolate, but smoother
  1968. @end table
  1969. This option is also available as command. Default is @code{gain_interpolate(f)}.
  1970. @item gain_entry
  1971. Set gain entry for gain_interpolate function. The expression can
  1972. contain functions:
  1973. @table @option
  1974. @item entry(f, g)
  1975. store gain entry at frequency f with value g
  1976. @end table
  1977. This option is also available as command.
  1978. @item delay
  1979. Set filter delay in seconds. Higher value means more accurate.
  1980. Default is @code{0.01}.
  1981. @item accuracy
  1982. Set filter accuracy in Hz. Lower value means more accurate.
  1983. Default is @code{5}.
  1984. @item wfunc
  1985. Set window function. Acceptable values are:
  1986. @table @option
  1987. @item rectangular
  1988. rectangular window, useful when gain curve is already smooth
  1989. @item hann
  1990. hann window (default)
  1991. @item hamming
  1992. hamming window
  1993. @item blackman
  1994. blackman window
  1995. @item nuttall3
  1996. 3-terms continuous 1st derivative nuttall window
  1997. @item mnuttall3
  1998. minimum 3-terms discontinuous nuttall window
  1999. @item nuttall
  2000. 4-terms continuous 1st derivative nuttall window
  2001. @item bnuttall
  2002. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2003. @item bharris
  2004. blackman-harris window
  2005. @item tukey
  2006. tukey window
  2007. @end table
  2008. @item fixed
  2009. If enabled, use fixed number of audio samples. This improves speed when
  2010. filtering with large delay. Default is disabled.
  2011. @item multi
  2012. Enable multichannels evaluation on gain. Default is disabled.
  2013. @item zero_phase
  2014. Enable zero phase mode by subtracting timestamp to compensate delay.
  2015. Default is disabled.
  2016. @item scale
  2017. Set scale used by gain. Acceptable values are:
  2018. @table @option
  2019. @item linlin
  2020. linear frequency, linear gain
  2021. @item linlog
  2022. linear frequency, logarithmic (in dB) gain (default)
  2023. @item loglin
  2024. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2025. @item loglog
  2026. logarithmic frequency, logarithmic gain
  2027. @end table
  2028. @item dumpfile
  2029. Set file for dumping, suitable for gnuplot.
  2030. @item dumpscale
  2031. Set scale for dumpfile. Acceptable values are same with scale option.
  2032. Default is linlog.
  2033. @end table
  2034. @subsection Examples
  2035. @itemize
  2036. @item
  2037. lowpass at 1000 Hz:
  2038. @example
  2039. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2040. @end example
  2041. @item
  2042. lowpass at 1000 Hz with gain_entry:
  2043. @example
  2044. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2045. @end example
  2046. @item
  2047. custom equalization:
  2048. @example
  2049. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2050. @end example
  2051. @item
  2052. higher delay with zero phase to compensate delay:
  2053. @example
  2054. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2055. @end example
  2056. @item
  2057. lowpass on left channel, highpass on right channel:
  2058. @example
  2059. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2060. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2061. @end example
  2062. @end itemize
  2063. @section flanger
  2064. Apply a flanging effect to the audio.
  2065. The filter accepts the following options:
  2066. @table @option
  2067. @item delay
  2068. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2069. @item depth
  2070. Set added swep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2071. @item regen
  2072. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2073. Default value is 0.
  2074. @item width
  2075. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2076. Default value is 71.
  2077. @item speed
  2078. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2079. @item shape
  2080. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2081. Default value is @var{sinusoidal}.
  2082. @item phase
  2083. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2084. Default value is 25.
  2085. @item interp
  2086. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2087. Default is @var{linear}.
  2088. @end table
  2089. @section hdcd
  2090. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2091. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2092. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2093. of HDCD, and detects the Transient Filter flag.
  2094. @example
  2095. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2096. @end example
  2097. When using the filter with wav, note the default encoding for wav is 16-bit,
  2098. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2099. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2100. @example
  2101. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2102. ffmpeg -i HDCD16.wav -af hdcd -acodec pcm_s24le OUT24.wav
  2103. @end example
  2104. The filter accepts the following options:
  2105. @table @option
  2106. @item disable_autoconvert
  2107. Disable any automatic format conversion or resampling in the filter graph.
  2108. @item process_stereo
  2109. Process the stereo channels together. If target_gain does not match between
  2110. channels, consider it invalid and use the last valid target_gain.
  2111. @item cdt_ms
  2112. Set the code detect timer period in ms.
  2113. @item force_pe
  2114. Always extend peaks above -3dBFS even if PE isn't signaled.
  2115. @item analyze_mode
  2116. Replace audio with a solid tone and adjust the amplitude to signal some
  2117. specific aspect of the decoding process. The output file can be loaded in
  2118. an audio editor alongside the original to aid analysis.
  2119. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2120. Modes are:
  2121. @table @samp
  2122. @item 0, off
  2123. Disabled
  2124. @item 1, lle
  2125. Gain adjustment level at each sample
  2126. @item 2, pe
  2127. Samples where peak extend occurs
  2128. @item 3, cdt
  2129. Samples where the code detect timer is active
  2130. @item 4, tgm
  2131. Samples where the target gain does not match between channels
  2132. @end table
  2133. @end table
  2134. @section highpass
  2135. Apply a high-pass filter with 3dB point frequency.
  2136. The filter can be either single-pole, or double-pole (the default).
  2137. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2138. The filter accepts the following options:
  2139. @table @option
  2140. @item frequency, f
  2141. Set frequency in Hz. Default is 3000.
  2142. @item poles, p
  2143. Set number of poles. Default is 2.
  2144. @item width_type
  2145. Set method to specify band-width of filter.
  2146. @table @option
  2147. @item h
  2148. Hz
  2149. @item q
  2150. Q-Factor
  2151. @item o
  2152. octave
  2153. @item s
  2154. slope
  2155. @end table
  2156. @item width, w
  2157. Specify the band-width of a filter in width_type units.
  2158. Applies only to double-pole filter.
  2159. The default is 0.707q and gives a Butterworth response.
  2160. @end table
  2161. @section join
  2162. Join multiple input streams into one multi-channel stream.
  2163. It accepts the following parameters:
  2164. @table @option
  2165. @item inputs
  2166. The number of input streams. It defaults to 2.
  2167. @item channel_layout
  2168. The desired output channel layout. It defaults to stereo.
  2169. @item map
  2170. Map channels from inputs to output. The argument is a '|'-separated list of
  2171. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2172. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2173. can be either the name of the input channel (e.g. FL for front left) or its
  2174. index in the specified input stream. @var{out_channel} is the name of the output
  2175. channel.
  2176. @end table
  2177. The filter will attempt to guess the mappings when they are not specified
  2178. explicitly. It does so by first trying to find an unused matching input channel
  2179. and if that fails it picks the first unused input channel.
  2180. Join 3 inputs (with properly set channel layouts):
  2181. @example
  2182. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2183. @end example
  2184. Build a 5.1 output from 6 single-channel streams:
  2185. @example
  2186. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2187. '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'
  2188. out
  2189. @end example
  2190. @section ladspa
  2191. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2192. To enable compilation of this filter you need to configure FFmpeg with
  2193. @code{--enable-ladspa}.
  2194. @table @option
  2195. @item file, f
  2196. Specifies the name of LADSPA plugin library to load. If the environment
  2197. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2198. each one of the directories specified by the colon separated list in
  2199. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2200. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2201. @file{/usr/lib/ladspa/}.
  2202. @item plugin, p
  2203. Specifies the plugin within the library. Some libraries contain only
  2204. one plugin, but others contain many of them. If this is not set filter
  2205. will list all available plugins within the specified library.
  2206. @item controls, c
  2207. Set the '|' separated list of controls which are zero or more floating point
  2208. values that determine the behavior of the loaded plugin (for example delay,
  2209. threshold or gain).
  2210. Controls need to be defined using the following syntax:
  2211. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2212. @var{valuei} is the value set on the @var{i}-th control.
  2213. Alternatively they can be also defined using the following syntax:
  2214. @var{value0}|@var{value1}|@var{value2}|..., where
  2215. @var{valuei} is the value set on the @var{i}-th control.
  2216. If @option{controls} is set to @code{help}, all available controls and
  2217. their valid ranges are printed.
  2218. @item sample_rate, s
  2219. Specify the sample rate, default to 44100. Only used if plugin have
  2220. zero inputs.
  2221. @item nb_samples, n
  2222. Set the number of samples per channel per each output frame, default
  2223. is 1024. Only used if plugin have zero inputs.
  2224. @item duration, d
  2225. Set the minimum duration of the sourced audio. See
  2226. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2227. for the accepted syntax.
  2228. Note that the resulting duration may be greater than the specified duration,
  2229. as the generated audio is always cut at the end of a complete frame.
  2230. If not specified, or the expressed duration is negative, the audio is
  2231. supposed to be generated forever.
  2232. Only used if plugin have zero inputs.
  2233. @end table
  2234. @subsection Examples
  2235. @itemize
  2236. @item
  2237. List all available plugins within amp (LADSPA example plugin) library:
  2238. @example
  2239. ladspa=file=amp
  2240. @end example
  2241. @item
  2242. List all available controls and their valid ranges for @code{vcf_notch}
  2243. plugin from @code{VCF} library:
  2244. @example
  2245. ladspa=f=vcf:p=vcf_notch:c=help
  2246. @end example
  2247. @item
  2248. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2249. plugin library:
  2250. @example
  2251. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2252. @end example
  2253. @item
  2254. Add reverberation to the audio using TAP-plugins
  2255. (Tom's Audio Processing plugins):
  2256. @example
  2257. ladspa=file=tap_reverb:tap_reverb
  2258. @end example
  2259. @item
  2260. Generate white noise, with 0.2 amplitude:
  2261. @example
  2262. ladspa=file=cmt:noise_source_white:c=c0=.2
  2263. @end example
  2264. @item
  2265. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2266. @code{C* Audio Plugin Suite} (CAPS) library:
  2267. @example
  2268. ladspa=file=caps:Click:c=c1=20'
  2269. @end example
  2270. @item
  2271. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2272. @example
  2273. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2274. @end example
  2275. @item
  2276. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2277. @code{SWH Plugins} collection:
  2278. @example
  2279. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2280. @end example
  2281. @item
  2282. Attenuate low frequencies using Multiband EQ from Steve Harris
  2283. @code{SWH Plugins} collection:
  2284. @example
  2285. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2286. @end example
  2287. @end itemize
  2288. @subsection Commands
  2289. This filter supports the following commands:
  2290. @table @option
  2291. @item cN
  2292. Modify the @var{N}-th control value.
  2293. If the specified value is not valid, it is ignored and prior one is kept.
  2294. @end table
  2295. @section loudnorm
  2296. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2297. Support for both single pass (livestreams, files) and double pass (files) modes.
  2298. This algorithm can target IL, LRA, and maximum true peak.
  2299. To enable compilation of this filter you need to configure FFmpeg with
  2300. @code{--enable-libebur128}.
  2301. The filter accepts the following options:
  2302. @table @option
  2303. @item I, i
  2304. Set integrated loudness target.
  2305. Range is -70.0 - -5.0. Default value is -24.0.
  2306. @item LRA, lra
  2307. Set loudness range target.
  2308. Range is 1.0 - 20.0. Default value is 7.0.
  2309. @item TP, tp
  2310. Set maximum true peak.
  2311. Range is -9.0 - +0.0. Default value is -2.0.
  2312. @item measured_I, measured_i
  2313. Measured IL of input file.
  2314. Range is -99.0 - +0.0.
  2315. @item measured_LRA, measured_lra
  2316. Measured LRA of input file.
  2317. Range is 0.0 - 99.0.
  2318. @item measured_TP, measured_tp
  2319. Measured true peak of input file.
  2320. Range is -99.0 - +99.0.
  2321. @item measured_thresh
  2322. Measured threshold of input file.
  2323. Range is -99.0 - +0.0.
  2324. @item offset
  2325. Set offset gain. Gain is applied before the true-peak limiter.
  2326. Range is -99.0 - +99.0. Default is +0.0.
  2327. @item linear
  2328. Normalize linearly if possible.
  2329. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2330. to be specified in order to use this mode.
  2331. Options are true or false. Default is true.
  2332. @item dual_mono
  2333. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2334. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2335. If set to @code{true}, this option will compensate for this effect.
  2336. Multi-channel input files are not affected by this option.
  2337. Options are true or false. Default is false.
  2338. @item print_format
  2339. Set print format for stats. Options are summary, json, or none.
  2340. Default value is none.
  2341. @end table
  2342. @section lowpass
  2343. Apply a low-pass filter with 3dB point frequency.
  2344. The filter can be either single-pole or double-pole (the default).
  2345. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2346. The filter accepts the following options:
  2347. @table @option
  2348. @item frequency, f
  2349. Set frequency in Hz. Default is 500.
  2350. @item poles, p
  2351. Set number of poles. Default is 2.
  2352. @item width_type
  2353. Set method to specify band-width of filter.
  2354. @table @option
  2355. @item h
  2356. Hz
  2357. @item q
  2358. Q-Factor
  2359. @item o
  2360. octave
  2361. @item s
  2362. slope
  2363. @end table
  2364. @item width, w
  2365. Specify the band-width of a filter in width_type units.
  2366. Applies only to double-pole filter.
  2367. The default is 0.707q and gives a Butterworth response.
  2368. @end table
  2369. @anchor{pan}
  2370. @section pan
  2371. Mix channels with specific gain levels. The filter accepts the output
  2372. channel layout followed by a set of channels definitions.
  2373. This filter is also designed to efficiently remap the channels of an audio
  2374. stream.
  2375. The filter accepts parameters of the form:
  2376. "@var{l}|@var{outdef}|@var{outdef}|..."
  2377. @table @option
  2378. @item l
  2379. output channel layout or number of channels
  2380. @item outdef
  2381. output channel specification, of the form:
  2382. "@var{out_name}=[@var{gain}*]@var{in_name}[+[@var{gain}*]@var{in_name}...]"
  2383. @item out_name
  2384. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2385. number (c0, c1, etc.)
  2386. @item gain
  2387. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2388. @item in_name
  2389. input channel to use, see out_name for details; it is not possible to mix
  2390. named and numbered input channels
  2391. @end table
  2392. If the `=' in a channel specification is replaced by `<', then the gains for
  2393. that specification will be renormalized so that the total is 1, thus
  2394. avoiding clipping noise.
  2395. @subsection Mixing examples
  2396. For example, if you want to down-mix from stereo to mono, but with a bigger
  2397. factor for the left channel:
  2398. @example
  2399. pan=1c|c0=0.9*c0+0.1*c1
  2400. @end example
  2401. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2402. 7-channels surround:
  2403. @example
  2404. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2405. @end example
  2406. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2407. that should be preferred (see "-ac" option) unless you have very specific
  2408. needs.
  2409. @subsection Remapping examples
  2410. The channel remapping will be effective if, and only if:
  2411. @itemize
  2412. @item gain coefficients are zeroes or ones,
  2413. @item only one input per channel output,
  2414. @end itemize
  2415. If all these conditions are satisfied, the filter will notify the user ("Pure
  2416. channel mapping detected"), and use an optimized and lossless method to do the
  2417. remapping.
  2418. For example, if you have a 5.1 source and want a stereo audio stream by
  2419. dropping the extra channels:
  2420. @example
  2421. pan="stereo| c0=FL | c1=FR"
  2422. @end example
  2423. Given the same source, you can also switch front left and front right channels
  2424. and keep the input channel layout:
  2425. @example
  2426. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2427. @end example
  2428. If the input is a stereo audio stream, you can mute the front left channel (and
  2429. still keep the stereo channel layout) with:
  2430. @example
  2431. pan="stereo|c1=c1"
  2432. @end example
  2433. Still with a stereo audio stream input, you can copy the right channel in both
  2434. front left and right:
  2435. @example
  2436. pan="stereo| c0=FR | c1=FR"
  2437. @end example
  2438. @section replaygain
  2439. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2440. outputs it unchanged.
  2441. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2442. @section resample
  2443. Convert the audio sample format, sample rate and channel layout. It is
  2444. not meant to be used directly.
  2445. @section rubberband
  2446. Apply time-stretching and pitch-shifting with librubberband.
  2447. The filter accepts the following options:
  2448. @table @option
  2449. @item tempo
  2450. Set tempo scale factor.
  2451. @item pitch
  2452. Set pitch scale factor.
  2453. @item transients
  2454. Set transients detector.
  2455. Possible values are:
  2456. @table @var
  2457. @item crisp
  2458. @item mixed
  2459. @item smooth
  2460. @end table
  2461. @item detector
  2462. Set detector.
  2463. Possible values are:
  2464. @table @var
  2465. @item compound
  2466. @item percussive
  2467. @item soft
  2468. @end table
  2469. @item phase
  2470. Set phase.
  2471. Possible values are:
  2472. @table @var
  2473. @item laminar
  2474. @item independent
  2475. @end table
  2476. @item window
  2477. Set processing window size.
  2478. Possible values are:
  2479. @table @var
  2480. @item standard
  2481. @item short
  2482. @item long
  2483. @end table
  2484. @item smoothing
  2485. Set smoothing.
  2486. Possible values are:
  2487. @table @var
  2488. @item off
  2489. @item on
  2490. @end table
  2491. @item formant
  2492. Enable formant preservation when shift pitching.
  2493. Possible values are:
  2494. @table @var
  2495. @item shifted
  2496. @item preserved
  2497. @end table
  2498. @item pitchq
  2499. Set pitch quality.
  2500. Possible values are:
  2501. @table @var
  2502. @item quality
  2503. @item speed
  2504. @item consistency
  2505. @end table
  2506. @item channels
  2507. Set channels.
  2508. Possible values are:
  2509. @table @var
  2510. @item apart
  2511. @item together
  2512. @end table
  2513. @end table
  2514. @section sidechaincompress
  2515. This filter acts like normal compressor but has the ability to compress
  2516. detected signal using second input signal.
  2517. It needs two input streams and returns one output stream.
  2518. First input stream will be processed depending on second stream signal.
  2519. The filtered signal then can be filtered with other filters in later stages of
  2520. processing. See @ref{pan} and @ref{amerge} filter.
  2521. The filter accepts the following options:
  2522. @table @option
  2523. @item level_in
  2524. Set input gain. Default is 1. Range is between 0.015625 and 64.
  2525. @item threshold
  2526. If a signal of second stream raises above this level it will affect the gain
  2527. reduction of first stream.
  2528. By default is 0.125. Range is between 0.00097563 and 1.
  2529. @item ratio
  2530. Set a ratio about which the signal is reduced. 1:2 means that if the level
  2531. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  2532. Default is 2. Range is between 1 and 20.
  2533. @item attack
  2534. Amount of milliseconds the signal has to rise above the threshold before gain
  2535. reduction starts. Default is 20. Range is between 0.01 and 2000.
  2536. @item release
  2537. Amount of milliseconds the signal has to fall below the threshold before
  2538. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  2539. @item makeup
  2540. Set the amount by how much signal will be amplified after processing.
  2541. Default is 2. Range is from 1 and 64.
  2542. @item knee
  2543. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2544. Default is 2.82843. Range is between 1 and 8.
  2545. @item link
  2546. Choose if the @code{average} level between all channels of side-chain stream
  2547. or the louder(@code{maximum}) channel of side-chain stream affects the
  2548. reduction. Default is @code{average}.
  2549. @item detection
  2550. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  2551. of @code{rms}. Default is @code{rms} which is mainly smoother.
  2552. @item level_sc
  2553. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  2554. @item mix
  2555. How much to use compressed signal in output. Default is 1.
  2556. Range is between 0 and 1.
  2557. @end table
  2558. @subsection Examples
  2559. @itemize
  2560. @item
  2561. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  2562. depending on the signal of 2nd input and later compressed signal to be
  2563. merged with 2nd input:
  2564. @example
  2565. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  2566. @end example
  2567. @end itemize
  2568. @section sidechaingate
  2569. A sidechain gate acts like a normal (wideband) gate but has the ability to
  2570. filter the detected signal before sending it to the gain reduction stage.
  2571. Normally a gate uses the full range signal to detect a level above the
  2572. threshold.
  2573. For example: If you cut all lower frequencies from your sidechain signal
  2574. the gate will decrease the volume of your track only if not enough highs
  2575. appear. With this technique you are able to reduce the resonation of a
  2576. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  2577. guitar.
  2578. It needs two input streams and returns one output stream.
  2579. First input stream will be processed depending on second stream signal.
  2580. The filter accepts the following options:
  2581. @table @option
  2582. @item level_in
  2583. Set input level before filtering.
  2584. Default is 1. Allowed range is from 0.015625 to 64.
  2585. @item range
  2586. Set the level of gain reduction when the signal is below the threshold.
  2587. Default is 0.06125. Allowed range is from 0 to 1.
  2588. @item threshold
  2589. If a signal rises above this level the gain reduction is released.
  2590. Default is 0.125. Allowed range is from 0 to 1.
  2591. @item ratio
  2592. Set a ratio about which the signal is reduced.
  2593. Default is 2. Allowed range is from 1 to 9000.
  2594. @item attack
  2595. Amount of milliseconds the signal has to rise above the threshold before gain
  2596. reduction stops.
  2597. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  2598. @item release
  2599. Amount of milliseconds the signal has to fall below the threshold before the
  2600. reduction is increased again. Default is 250 milliseconds.
  2601. Allowed range is from 0.01 to 9000.
  2602. @item makeup
  2603. Set amount of amplification of signal after processing.
  2604. Default is 1. Allowed range is from 1 to 64.
  2605. @item knee
  2606. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2607. Default is 2.828427125. Allowed range is from 1 to 8.
  2608. @item detection
  2609. Choose if exact signal should be taken for detection or an RMS like one.
  2610. Default is rms. Can be peak or rms.
  2611. @item link
  2612. Choose if the average level between all channels or the louder channel affects
  2613. the reduction.
  2614. Default is average. Can be average or maximum.
  2615. @item level_sc
  2616. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  2617. @end table
  2618. @section silencedetect
  2619. Detect silence in an audio stream.
  2620. This filter logs a message when it detects that the input audio volume is less
  2621. or equal to a noise tolerance value for a duration greater or equal to the
  2622. minimum detected noise duration.
  2623. The printed times and duration are expressed in seconds.
  2624. The filter accepts the following options:
  2625. @table @option
  2626. @item duration, d
  2627. Set silence duration until notification (default is 2 seconds).
  2628. @item noise, n
  2629. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  2630. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  2631. @end table
  2632. @subsection Examples
  2633. @itemize
  2634. @item
  2635. Detect 5 seconds of silence with -50dB noise tolerance:
  2636. @example
  2637. silencedetect=n=-50dB:d=5
  2638. @end example
  2639. @item
  2640. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  2641. tolerance in @file{silence.mp3}:
  2642. @example
  2643. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  2644. @end example
  2645. @end itemize
  2646. @section silenceremove
  2647. Remove silence from the beginning, middle or end of the audio.
  2648. The filter accepts the following options:
  2649. @table @option
  2650. @item start_periods
  2651. This value is used to indicate if audio should be trimmed at beginning of
  2652. the audio. A value of zero indicates no silence should be trimmed from the
  2653. beginning. When specifying a non-zero value, it trims audio up until it
  2654. finds non-silence. Normally, when trimming silence from beginning of audio
  2655. the @var{start_periods} will be @code{1} but it can be increased to higher
  2656. values to trim all audio up to specific count of non-silence periods.
  2657. Default value is @code{0}.
  2658. @item start_duration
  2659. Specify the amount of time that non-silence must be detected before it stops
  2660. trimming audio. By increasing the duration, bursts of noises can be treated
  2661. as silence and trimmed off. Default value is @code{0}.
  2662. @item start_threshold
  2663. This indicates what sample value should be treated as silence. For digital
  2664. audio, a value of @code{0} may be fine but for audio recorded from analog,
  2665. you may wish to increase the value to account for background noise.
  2666. Can be specified in dB (in case "dB" is appended to the specified value)
  2667. or amplitude ratio. Default value is @code{0}.
  2668. @item stop_periods
  2669. Set the count for trimming silence from the end of audio.
  2670. To remove silence from the middle of a file, specify a @var{stop_periods}
  2671. that is negative. This value is then treated as a positive value and is
  2672. used to indicate the effect should restart processing as specified by
  2673. @var{start_periods}, making it suitable for removing periods of silence
  2674. in the middle of the audio.
  2675. Default value is @code{0}.
  2676. @item stop_duration
  2677. Specify a duration of silence that must exist before audio is not copied any
  2678. more. By specifying a higher duration, silence that is wanted can be left in
  2679. the audio.
  2680. Default value is @code{0}.
  2681. @item stop_threshold
  2682. This is the same as @option{start_threshold} but for trimming silence from
  2683. the end of audio.
  2684. Can be specified in dB (in case "dB" is appended to the specified value)
  2685. or amplitude ratio. Default value is @code{0}.
  2686. @item leave_silence
  2687. This indicates that @var{stop_duration} length of audio should be left intact
  2688. at the beginning of each period of silence.
  2689. For example, if you want to remove long pauses between words but do not want
  2690. to remove the pauses completely. Default value is @code{0}.
  2691. @item detection
  2692. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  2693. and works better with digital silence which is exactly 0.
  2694. Default value is @code{rms}.
  2695. @item window
  2696. Set ratio used to calculate size of window for detecting silence.
  2697. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  2698. @end table
  2699. @subsection Examples
  2700. @itemize
  2701. @item
  2702. The following example shows how this filter can be used to start a recording
  2703. that does not contain the delay at the start which usually occurs between
  2704. pressing the record button and the start of the performance:
  2705. @example
  2706. silenceremove=1:5:0.02
  2707. @end example
  2708. @item
  2709. Trim all silence encountered from beginning to end where there is more than 1
  2710. second of silence in audio:
  2711. @example
  2712. silenceremove=0:0:0:-1:1:-90dB
  2713. @end example
  2714. @end itemize
  2715. @section sofalizer
  2716. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  2717. loudspeakers around the user for binaural listening via headphones (audio
  2718. formats up to 9 channels supported).
  2719. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  2720. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  2721. Austrian Academy of Sciences.
  2722. To enable compilation of this filter you need to configure FFmpeg with
  2723. @code{--enable-netcdf}.
  2724. The filter accepts the following options:
  2725. @table @option
  2726. @item sofa
  2727. Set the SOFA file used for rendering.
  2728. @item gain
  2729. Set gain applied to audio. Value is in dB. Default is 0.
  2730. @item rotation
  2731. Set rotation of virtual loudspeakers in deg. Default is 0.
  2732. @item elevation
  2733. Set elevation of virtual speakers in deg. Default is 0.
  2734. @item radius
  2735. Set distance in meters between loudspeakers and the listener with near-field
  2736. HRTFs. Default is 1.
  2737. @item type
  2738. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2739. processing audio in time domain which is slow.
  2740. @var{freq} is processing audio in frequency domain which is fast.
  2741. Default is @var{freq}.
  2742. @item speakers
  2743. Set custom positions of virtual loudspeakers. Syntax for this option is:
  2744. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  2745. Each virtual loudspeaker is described with short channel name following with
  2746. azimuth and elevation in degreees.
  2747. Each virtual loudspeaker description is separated by '|'.
  2748. For example to override front left and front right channel positions use:
  2749. 'speakers=FL 45 15|FR 345 15'.
  2750. Descriptions with unrecognised channel names are ignored.
  2751. @end table
  2752. @subsection Examples
  2753. @itemize
  2754. @item
  2755. Using ClubFritz6 sofa file:
  2756. @example
  2757. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  2758. @end example
  2759. @item
  2760. Using ClubFritz12 sofa file and bigger radius with small rotation:
  2761. @example
  2762. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  2763. @end example
  2764. @item
  2765. Similar as above but with custom speaker positions for front left, front right, rear left and rear right
  2766. and also with custom gain:
  2767. @example
  2768. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|RL 135|RR 225:gain=28"
  2769. @end example
  2770. @end itemize
  2771. @section stereotools
  2772. This filter has some handy utilities to manage stereo signals, for converting
  2773. M/S stereo recordings to L/R signal while having control over the parameters
  2774. or spreading the stereo image of master track.
  2775. The filter accepts the following options:
  2776. @table @option
  2777. @item level_in
  2778. Set input level before filtering for both channels. Defaults is 1.
  2779. Allowed range is from 0.015625 to 64.
  2780. @item level_out
  2781. Set output level after filtering for both channels. Defaults is 1.
  2782. Allowed range is from 0.015625 to 64.
  2783. @item balance_in
  2784. Set input balance between both channels. Default is 0.
  2785. Allowed range is from -1 to 1.
  2786. @item balance_out
  2787. Set output balance between both channels. Default is 0.
  2788. Allowed range is from -1 to 1.
  2789. @item softclip
  2790. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  2791. clipping. Disabled by default.
  2792. @item mutel
  2793. Mute the left channel. Disabled by default.
  2794. @item muter
  2795. Mute the right channel. Disabled by default.
  2796. @item phasel
  2797. Change the phase of the left channel. Disabled by default.
  2798. @item phaser
  2799. Change the phase of the right channel. Disabled by default.
  2800. @item mode
  2801. Set stereo mode. Available values are:
  2802. @table @samp
  2803. @item lr>lr
  2804. Left/Right to Left/Right, this is default.
  2805. @item lr>ms
  2806. Left/Right to Mid/Side.
  2807. @item ms>lr
  2808. Mid/Side to Left/Right.
  2809. @item lr>ll
  2810. Left/Right to Left/Left.
  2811. @item lr>rr
  2812. Left/Right to Right/Right.
  2813. @item lr>l+r
  2814. Left/Right to Left + Right.
  2815. @item lr>rl
  2816. Left/Right to Right/Left.
  2817. @end table
  2818. @item slev
  2819. Set level of side signal. Default is 1.
  2820. Allowed range is from 0.015625 to 64.
  2821. @item sbal
  2822. Set balance of side signal. Default is 0.
  2823. Allowed range is from -1 to 1.
  2824. @item mlev
  2825. Set level of the middle signal. Default is 1.
  2826. Allowed range is from 0.015625 to 64.
  2827. @item mpan
  2828. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  2829. @item base
  2830. Set stereo base between mono and inversed channels. Default is 0.
  2831. Allowed range is from -1 to 1.
  2832. @item delay
  2833. Set delay in milliseconds how much to delay left from right channel and
  2834. vice versa. Default is 0. Allowed range is from -20 to 20.
  2835. @item sclevel
  2836. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  2837. @item phase
  2838. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  2839. @end table
  2840. @subsection Examples
  2841. @itemize
  2842. @item
  2843. Apply karaoke like effect:
  2844. @example
  2845. stereotools=mlev=0.015625
  2846. @end example
  2847. @item
  2848. Convert M/S signal to L/R:
  2849. @example
  2850. "stereotools=mode=ms>lr"
  2851. @end example
  2852. @end itemize
  2853. @section stereowiden
  2854. This filter enhance the stereo effect by suppressing signal common to both
  2855. channels and by delaying the signal of left into right and vice versa,
  2856. thereby widening the stereo effect.
  2857. The filter accepts the following options:
  2858. @table @option
  2859. @item delay
  2860. Time in milliseconds of the delay of left signal into right and vice versa.
  2861. Default is 20 milliseconds.
  2862. @item feedback
  2863. Amount of gain in delayed signal into right and vice versa. Gives a delay
  2864. effect of left signal in right output and vice versa which gives widening
  2865. effect. Default is 0.3.
  2866. @item crossfeed
  2867. Cross feed of left into right with inverted phase. This helps in suppressing
  2868. the mono. If the value is 1 it will cancel all the signal common to both
  2869. channels. Default is 0.3.
  2870. @item drymix
  2871. Set level of input signal of original channel. Default is 0.8.
  2872. @end table
  2873. @section treble
  2874. Boost or cut treble (upper) frequencies of the audio using a two-pole
  2875. shelving filter with a response similar to that of a standard
  2876. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2877. The filter accepts the following options:
  2878. @table @option
  2879. @item gain, g
  2880. Give the gain at whichever is the lower of ~22 kHz and the
  2881. Nyquist frequency. Its useful range is about -20 (for a large cut)
  2882. to +20 (for a large boost). Beware of clipping when using a positive gain.
  2883. @item frequency, f
  2884. Set the filter's central frequency and so can be used
  2885. to extend or reduce the frequency range to be boosted or cut.
  2886. The default value is @code{3000} Hz.
  2887. @item width_type
  2888. Set method to specify band-width of filter.
  2889. @table @option
  2890. @item h
  2891. Hz
  2892. @item q
  2893. Q-Factor
  2894. @item o
  2895. octave
  2896. @item s
  2897. slope
  2898. @end table
  2899. @item width, w
  2900. Determine how steep is the filter's shelf transition.
  2901. @end table
  2902. @section tremolo
  2903. Sinusoidal amplitude modulation.
  2904. The filter accepts the following options:
  2905. @table @option
  2906. @item f
  2907. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  2908. (20 Hz or lower) will result in a tremolo effect.
  2909. This filter may also be used as a ring modulator by specifying
  2910. a modulation frequency higher than 20 Hz.
  2911. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2912. @item d
  2913. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2914. Default value is 0.5.
  2915. @end table
  2916. @section vibrato
  2917. Sinusoidal phase modulation.
  2918. The filter accepts the following options:
  2919. @table @option
  2920. @item f
  2921. Modulation frequency in Hertz.
  2922. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2923. @item d
  2924. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2925. Default value is 0.5.
  2926. @end table
  2927. @section volume
  2928. Adjust the input audio volume.
  2929. It accepts the following parameters:
  2930. @table @option
  2931. @item volume
  2932. Set audio volume expression.
  2933. Output values are clipped to the maximum value.
  2934. The output audio volume is given by the relation:
  2935. @example
  2936. @var{output_volume} = @var{volume} * @var{input_volume}
  2937. @end example
  2938. The default value for @var{volume} is "1.0".
  2939. @item precision
  2940. This parameter represents the mathematical precision.
  2941. It determines which input sample formats will be allowed, which affects the
  2942. precision of the volume scaling.
  2943. @table @option
  2944. @item fixed
  2945. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  2946. @item float
  2947. 32-bit floating-point; this limits input sample format to FLT. (default)
  2948. @item double
  2949. 64-bit floating-point; this limits input sample format to DBL.
  2950. @end table
  2951. @item replaygain
  2952. Choose the behaviour on encountering ReplayGain side data in input frames.
  2953. @table @option
  2954. @item drop
  2955. Remove ReplayGain side data, ignoring its contents (the default).
  2956. @item ignore
  2957. Ignore ReplayGain side data, but leave it in the frame.
  2958. @item track
  2959. Prefer the track gain, if present.
  2960. @item album
  2961. Prefer the album gain, if present.
  2962. @end table
  2963. @item replaygain_preamp
  2964. Pre-amplification gain in dB to apply to the selected replaygain gain.
  2965. Default value for @var{replaygain_preamp} is 0.0.
  2966. @item eval
  2967. Set when the volume expression is evaluated.
  2968. It accepts the following values:
  2969. @table @samp
  2970. @item once
  2971. only evaluate expression once during the filter initialization, or
  2972. when the @samp{volume} command is sent
  2973. @item frame
  2974. evaluate expression for each incoming frame
  2975. @end table
  2976. Default value is @samp{once}.
  2977. @end table
  2978. The volume expression can contain the following parameters.
  2979. @table @option
  2980. @item n
  2981. frame number (starting at zero)
  2982. @item nb_channels
  2983. number of channels
  2984. @item nb_consumed_samples
  2985. number of samples consumed by the filter
  2986. @item nb_samples
  2987. number of samples in the current frame
  2988. @item pos
  2989. original frame position in the file
  2990. @item pts
  2991. frame PTS
  2992. @item sample_rate
  2993. sample rate
  2994. @item startpts
  2995. PTS at start of stream
  2996. @item startt
  2997. time at start of stream
  2998. @item t
  2999. frame time
  3000. @item tb
  3001. timestamp timebase
  3002. @item volume
  3003. last set volume value
  3004. @end table
  3005. Note that when @option{eval} is set to @samp{once} only the
  3006. @var{sample_rate} and @var{tb} variables are available, all other
  3007. variables will evaluate to NAN.
  3008. @subsection Commands
  3009. This filter supports the following commands:
  3010. @table @option
  3011. @item volume
  3012. Modify the volume expression.
  3013. The command accepts the same syntax of the corresponding option.
  3014. If the specified expression is not valid, it is kept at its current
  3015. value.
  3016. @item replaygain_noclip
  3017. Prevent clipping by limiting the gain applied.
  3018. Default value for @var{replaygain_noclip} is 1.
  3019. @end table
  3020. @subsection Examples
  3021. @itemize
  3022. @item
  3023. Halve the input audio volume:
  3024. @example
  3025. volume=volume=0.5
  3026. volume=volume=1/2
  3027. volume=volume=-6.0206dB
  3028. @end example
  3029. In all the above example the named key for @option{volume} can be
  3030. omitted, for example like in:
  3031. @example
  3032. volume=0.5
  3033. @end example
  3034. @item
  3035. Increase input audio power by 6 decibels using fixed-point precision:
  3036. @example
  3037. volume=volume=6dB:precision=fixed
  3038. @end example
  3039. @item
  3040. Fade volume after time 10 with an annihilation period of 5 seconds:
  3041. @example
  3042. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3043. @end example
  3044. @end itemize
  3045. @section volumedetect
  3046. Detect the volume of the input video.
  3047. The filter has no parameters. The input is not modified. Statistics about
  3048. the volume will be printed in the log when the input stream end is reached.
  3049. In particular it will show the mean volume (root mean square), maximum
  3050. volume (on a per-sample basis), and the beginning of a histogram of the
  3051. registered volume values (from the maximum value to a cumulated 1/1000 of
  3052. the samples).
  3053. All volumes are in decibels relative to the maximum PCM value.
  3054. @subsection Examples
  3055. Here is an excerpt of the output:
  3056. @example
  3057. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3058. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3059. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3060. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3061. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3062. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3063. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3064. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3065. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3066. @end example
  3067. It means that:
  3068. @itemize
  3069. @item
  3070. The mean square energy is approximately -27 dB, or 10^-2.7.
  3071. @item
  3072. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3073. @item
  3074. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3075. @end itemize
  3076. In other words, raising the volume by +4 dB does not cause any clipping,
  3077. raising it by +5 dB causes clipping for 6 samples, etc.
  3078. @c man end AUDIO FILTERS
  3079. @chapter Audio Sources
  3080. @c man begin AUDIO SOURCES
  3081. Below is a description of the currently available audio sources.
  3082. @section abuffer
  3083. Buffer audio frames, and make them available to the filter chain.
  3084. This source is mainly intended for a programmatic use, in particular
  3085. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3086. It accepts the following parameters:
  3087. @table @option
  3088. @item time_base
  3089. The timebase which will be used for timestamps of submitted frames. It must be
  3090. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3091. @item sample_rate
  3092. The sample rate of the incoming audio buffers.
  3093. @item sample_fmt
  3094. The sample format of the incoming audio buffers.
  3095. Either a sample format name or its corresponding integer representation from
  3096. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3097. @item channel_layout
  3098. The channel layout of the incoming audio buffers.
  3099. Either a channel layout name from channel_layout_map in
  3100. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3101. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3102. @item channels
  3103. The number of channels of the incoming audio buffers.
  3104. If both @var{channels} and @var{channel_layout} are specified, then they
  3105. must be consistent.
  3106. @end table
  3107. @subsection Examples
  3108. @example
  3109. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3110. @end example
  3111. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3112. Since the sample format with name "s16p" corresponds to the number
  3113. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3114. equivalent to:
  3115. @example
  3116. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3117. @end example
  3118. @section aevalsrc
  3119. Generate an audio signal specified by an expression.
  3120. This source accepts in input one or more expressions (one for each
  3121. channel), which are evaluated and used to generate a corresponding
  3122. audio signal.
  3123. This source accepts the following options:
  3124. @table @option
  3125. @item exprs
  3126. Set the '|'-separated expressions list for each separate channel. In case the
  3127. @option{channel_layout} option is not specified, the selected channel layout
  3128. depends on the number of provided expressions. Otherwise the last
  3129. specified expression is applied to the remaining output channels.
  3130. @item channel_layout, c
  3131. Set the channel layout. The number of channels in the specified layout
  3132. must be equal to the number of specified expressions.
  3133. @item duration, d
  3134. Set the minimum duration of the sourced audio. See
  3135. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3136. for the accepted syntax.
  3137. Note that the resulting duration may be greater than the specified
  3138. duration, as the generated audio is always cut at the end of a
  3139. complete frame.
  3140. If not specified, or the expressed duration is negative, the audio is
  3141. supposed to be generated forever.
  3142. @item nb_samples, n
  3143. Set the number of samples per channel per each output frame,
  3144. default to 1024.
  3145. @item sample_rate, s
  3146. Specify the sample rate, default to 44100.
  3147. @end table
  3148. Each expression in @var{exprs} can contain the following constants:
  3149. @table @option
  3150. @item n
  3151. number of the evaluated sample, starting from 0
  3152. @item t
  3153. time of the evaluated sample expressed in seconds, starting from 0
  3154. @item s
  3155. sample rate
  3156. @end table
  3157. @subsection Examples
  3158. @itemize
  3159. @item
  3160. Generate silence:
  3161. @example
  3162. aevalsrc=0
  3163. @end example
  3164. @item
  3165. Generate a sin signal with frequency of 440 Hz, set sample rate to
  3166. 8000 Hz:
  3167. @example
  3168. aevalsrc="sin(440*2*PI*t):s=8000"
  3169. @end example
  3170. @item
  3171. Generate a two channels signal, specify the channel layout (Front
  3172. Center + Back Center) explicitly:
  3173. @example
  3174. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  3175. @end example
  3176. @item
  3177. Generate white noise:
  3178. @example
  3179. aevalsrc="-2+random(0)"
  3180. @end example
  3181. @item
  3182. Generate an amplitude modulated signal:
  3183. @example
  3184. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  3185. @end example
  3186. @item
  3187. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  3188. @example
  3189. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  3190. @end example
  3191. @end itemize
  3192. @section anullsrc
  3193. The null audio source, return unprocessed audio frames. It is mainly useful
  3194. as a template and to be employed in analysis / debugging tools, or as
  3195. the source for filters which ignore the input data (for example the sox
  3196. synth filter).
  3197. This source accepts the following options:
  3198. @table @option
  3199. @item channel_layout, cl
  3200. Specifies the channel layout, and can be either an integer or a string
  3201. representing a channel layout. The default value of @var{channel_layout}
  3202. is "stereo".
  3203. Check the channel_layout_map definition in
  3204. @file{libavutil/channel_layout.c} for the mapping between strings and
  3205. channel layout values.
  3206. @item sample_rate, r
  3207. Specifies the sample rate, and defaults to 44100.
  3208. @item nb_samples, n
  3209. Set the number of samples per requested frames.
  3210. @end table
  3211. @subsection Examples
  3212. @itemize
  3213. @item
  3214. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3215. @example
  3216. anullsrc=r=48000:cl=4
  3217. @end example
  3218. @item
  3219. Do the same operation with a more obvious syntax:
  3220. @example
  3221. anullsrc=r=48000:cl=mono
  3222. @end example
  3223. @end itemize
  3224. All the parameters need to be explicitly defined.
  3225. @section flite
  3226. Synthesize a voice utterance using the libflite library.
  3227. To enable compilation of this filter you need to configure FFmpeg with
  3228. @code{--enable-libflite}.
  3229. Note that the flite library is not thread-safe.
  3230. The filter accepts the following options:
  3231. @table @option
  3232. @item list_voices
  3233. If set to 1, list the names of the available voices and exit
  3234. immediately. Default value is 0.
  3235. @item nb_samples, n
  3236. Set the maximum number of samples per frame. Default value is 512.
  3237. @item textfile
  3238. Set the filename containing the text to speak.
  3239. @item text
  3240. Set the text to speak.
  3241. @item voice, v
  3242. Set the voice to use for the speech synthesis. Default value is
  3243. @code{kal}. See also the @var{list_voices} option.
  3244. @end table
  3245. @subsection Examples
  3246. @itemize
  3247. @item
  3248. Read from file @file{speech.txt}, and synthesize the text using the
  3249. standard flite voice:
  3250. @example
  3251. flite=textfile=speech.txt
  3252. @end example
  3253. @item
  3254. Read the specified text selecting the @code{slt} voice:
  3255. @example
  3256. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3257. @end example
  3258. @item
  3259. Input text to ffmpeg:
  3260. @example
  3261. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3262. @end example
  3263. @item
  3264. Make @file{ffplay} speak the specified text, using @code{flite} and
  3265. the @code{lavfi} device:
  3266. @example
  3267. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3268. @end example
  3269. @end itemize
  3270. For more information about libflite, check:
  3271. @url{http://www.speech.cs.cmu.edu/flite/}
  3272. @section anoisesrc
  3273. Generate a noise audio signal.
  3274. The filter accepts the following options:
  3275. @table @option
  3276. @item sample_rate, r
  3277. Specify the sample rate. Default value is 48000 Hz.
  3278. @item amplitude, a
  3279. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  3280. is 1.0.
  3281. @item duration, d
  3282. Specify the duration of the generated audio stream. Not specifying this option
  3283. results in noise with an infinite length.
  3284. @item color, colour, c
  3285. Specify the color of noise. Available noise colors are white, pink, and brown.
  3286. Default color is white.
  3287. @item seed, s
  3288. Specify a value used to seed the PRNG.
  3289. @item nb_samples, n
  3290. Set the number of samples per each output frame, default is 1024.
  3291. @end table
  3292. @subsection Examples
  3293. @itemize
  3294. @item
  3295. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  3296. @example
  3297. anoisesrc=d=60:c=pink:r=44100:a=0.5
  3298. @end example
  3299. @end itemize
  3300. @section sine
  3301. Generate an audio signal made of a sine wave with amplitude 1/8.
  3302. The audio signal is bit-exact.
  3303. The filter accepts the following options:
  3304. @table @option
  3305. @item frequency, f
  3306. Set the carrier frequency. Default is 440 Hz.
  3307. @item beep_factor, b
  3308. Enable a periodic beep every second with frequency @var{beep_factor} times
  3309. the carrier frequency. Default is 0, meaning the beep is disabled.
  3310. @item sample_rate, r
  3311. Specify the sample rate, default is 44100.
  3312. @item duration, d
  3313. Specify the duration of the generated audio stream.
  3314. @item samples_per_frame
  3315. Set the number of samples per output frame.
  3316. The expression can contain the following constants:
  3317. @table @option
  3318. @item n
  3319. The (sequential) number of the output audio frame, starting from 0.
  3320. @item pts
  3321. The PTS (Presentation TimeStamp) of the output audio frame,
  3322. expressed in @var{TB} units.
  3323. @item t
  3324. The PTS of the output audio frame, expressed in seconds.
  3325. @item TB
  3326. The timebase of the output audio frames.
  3327. @end table
  3328. Default is @code{1024}.
  3329. @end table
  3330. @subsection Examples
  3331. @itemize
  3332. @item
  3333. Generate a simple 440 Hz sine wave:
  3334. @example
  3335. sine
  3336. @end example
  3337. @item
  3338. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  3339. @example
  3340. sine=220:4:d=5
  3341. sine=f=220:b=4:d=5
  3342. sine=frequency=220:beep_factor=4:duration=5
  3343. @end example
  3344. @item
  3345. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  3346. pattern:
  3347. @example
  3348. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  3349. @end example
  3350. @end itemize
  3351. @c man end AUDIO SOURCES
  3352. @chapter Audio Sinks
  3353. @c man begin AUDIO SINKS
  3354. Below is a description of the currently available audio sinks.
  3355. @section abuffersink
  3356. Buffer audio frames, and make them available to the end of filter chain.
  3357. This sink is mainly intended for programmatic use, in particular
  3358. through the interface defined in @file{libavfilter/buffersink.h}
  3359. or the options system.
  3360. It accepts a pointer to an AVABufferSinkContext structure, which
  3361. defines the incoming buffers' formats, to be passed as the opaque
  3362. parameter to @code{avfilter_init_filter} for initialization.
  3363. @section anullsink
  3364. Null audio sink; do absolutely nothing with the input audio. It is
  3365. mainly useful as a template and for use in analysis / debugging
  3366. tools.
  3367. @c man end AUDIO SINKS
  3368. @chapter Video Filters
  3369. @c man begin VIDEO FILTERS
  3370. When you configure your FFmpeg build, you can disable any of the
  3371. existing filters using @code{--disable-filters}.
  3372. The configure output will show the video filters included in your
  3373. build.
  3374. Below is a description of the currently available video filters.
  3375. @section alphaextract
  3376. Extract the alpha component from the input as a grayscale video. This
  3377. is especially useful with the @var{alphamerge} filter.
  3378. @section alphamerge
  3379. Add or replace the alpha component of the primary input with the
  3380. grayscale value of a second input. This is intended for use with
  3381. @var{alphaextract} to allow the transmission or storage of frame
  3382. sequences that have alpha in a format that doesn't support an alpha
  3383. channel.
  3384. For example, to reconstruct full frames from a normal YUV-encoded video
  3385. and a separate video created with @var{alphaextract}, you might use:
  3386. @example
  3387. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  3388. @end example
  3389. Since this filter is designed for reconstruction, it operates on frame
  3390. sequences without considering timestamps, and terminates when either
  3391. input reaches end of stream. This will cause problems if your encoding
  3392. pipeline drops frames. If you're trying to apply an image as an
  3393. overlay to a video stream, consider the @var{overlay} filter instead.
  3394. @section ass
  3395. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  3396. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  3397. Substation Alpha) subtitles files.
  3398. This filter accepts the following option in addition to the common options from
  3399. the @ref{subtitles} filter:
  3400. @table @option
  3401. @item shaping
  3402. Set the shaping engine
  3403. Available values are:
  3404. @table @samp
  3405. @item auto
  3406. The default libass shaping engine, which is the best available.
  3407. @item simple
  3408. Fast, font-agnostic shaper that can do only substitutions
  3409. @item complex
  3410. Slower shaper using OpenType for substitutions and positioning
  3411. @end table
  3412. The default is @code{auto}.
  3413. @end table
  3414. @section atadenoise
  3415. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  3416. The filter accepts the following options:
  3417. @table @option
  3418. @item 0a
  3419. Set threshold A for 1st plane. Default is 0.02.
  3420. Valid range is 0 to 0.3.
  3421. @item 0b
  3422. Set threshold B for 1st plane. Default is 0.04.
  3423. Valid range is 0 to 5.
  3424. @item 1a
  3425. Set threshold A for 2nd plane. Default is 0.02.
  3426. Valid range is 0 to 0.3.
  3427. @item 1b
  3428. Set threshold B for 2nd plane. Default is 0.04.
  3429. Valid range is 0 to 5.
  3430. @item 2a
  3431. Set threshold A for 3rd plane. Default is 0.02.
  3432. Valid range is 0 to 0.3.
  3433. @item 2b
  3434. Set threshold B for 3rd plane. Default is 0.04.
  3435. Valid range is 0 to 5.
  3436. Threshold A is designed to react on abrupt changes in the input signal and
  3437. threshold B is designed to react on continuous changes in the input signal.
  3438. @item s
  3439. Set number of frames filter will use for averaging. Default is 33. Must be odd
  3440. number in range [5, 129].
  3441. @item p
  3442. Set what planes of frame filter will use for averaging. Default is all.
  3443. @end table
  3444. @section avgblur
  3445. Apply average blur filter.
  3446. The filter accepts the following options:
  3447. @table @option
  3448. @item sizeX
  3449. Set horizontal kernel size.
  3450. @item planes
  3451. Set which planes to filter. By default all planes are filtered.
  3452. @item sizeY
  3453. Set vertical kernel size, if zero it will be same as @code{sizeX}.
  3454. Default is @code{0}.
  3455. @end table
  3456. @section bbox
  3457. Compute the bounding box for the non-black pixels in the input frame
  3458. luminance plane.
  3459. This filter computes the bounding box containing all the pixels with a
  3460. luminance value greater than the minimum allowed value.
  3461. The parameters describing the bounding box are printed on the filter
  3462. log.
  3463. The filter accepts the following option:
  3464. @table @option
  3465. @item min_val
  3466. Set the minimal luminance value. Default is @code{16}.
  3467. @end table
  3468. @section bitplanenoise
  3469. Show and measure bit plane noise.
  3470. The filter accepts the following options:
  3471. @table @option
  3472. @item bitplane
  3473. Set which plane to analyze. Default is @code{1}.
  3474. @item filter
  3475. Filter out noisy pixels from @code{bitplane} set above.
  3476. Default is disabled.
  3477. @end table
  3478. @section blackdetect
  3479. Detect video intervals that are (almost) completely black. Can be
  3480. useful to detect chapter transitions, commercials, or invalid
  3481. recordings. Output lines contains the time for the start, end and
  3482. duration of the detected black interval expressed in seconds.
  3483. In order to display the output lines, you need to set the loglevel at
  3484. least to the AV_LOG_INFO value.
  3485. The filter accepts the following options:
  3486. @table @option
  3487. @item black_min_duration, d
  3488. Set the minimum detected black duration expressed in seconds. It must
  3489. be a non-negative floating point number.
  3490. Default value is 2.0.
  3491. @item picture_black_ratio_th, pic_th
  3492. Set the threshold for considering a picture "black".
  3493. Express the minimum value for the ratio:
  3494. @example
  3495. @var{nb_black_pixels} / @var{nb_pixels}
  3496. @end example
  3497. for which a picture is considered black.
  3498. Default value is 0.98.
  3499. @item pixel_black_th, pix_th
  3500. Set the threshold for considering a pixel "black".
  3501. The threshold expresses the maximum pixel luminance value for which a
  3502. pixel is considered "black". The provided value is scaled according to
  3503. the following equation:
  3504. @example
  3505. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  3506. @end example
  3507. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  3508. the input video format, the range is [0-255] for YUV full-range
  3509. formats and [16-235] for YUV non full-range formats.
  3510. Default value is 0.10.
  3511. @end table
  3512. The following example sets the maximum pixel threshold to the minimum
  3513. value, and detects only black intervals of 2 or more seconds:
  3514. @example
  3515. blackdetect=d=2:pix_th=0.00
  3516. @end example
  3517. @section blackframe
  3518. Detect frames that are (almost) completely black. Can be useful to
  3519. detect chapter transitions or commercials. Output lines consist of
  3520. the frame number of the detected frame, the percentage of blackness,
  3521. the position in the file if known or -1 and the timestamp in seconds.
  3522. In order to display the output lines, you need to set the loglevel at
  3523. least to the AV_LOG_INFO value.
  3524. It accepts the following parameters:
  3525. @table @option
  3526. @item amount
  3527. The percentage of the pixels that have to be below the threshold; it defaults to
  3528. @code{98}.
  3529. @item threshold, thresh
  3530. The threshold below which a pixel value is considered black; it defaults to
  3531. @code{32}.
  3532. @end table
  3533. @section blend, tblend
  3534. Blend two video frames into each other.
  3535. The @code{blend} filter takes two input streams and outputs one
  3536. stream, the first input is the "top" layer and second input is
  3537. "bottom" layer. By default, the output terminates when the longest input terminates.
  3538. The @code{tblend} (time blend) filter takes two consecutive frames
  3539. from one single stream, and outputs the result obtained by blending
  3540. the new frame on top of the old frame.
  3541. A description of the accepted options follows.
  3542. @table @option
  3543. @item c0_mode
  3544. @item c1_mode
  3545. @item c2_mode
  3546. @item c3_mode
  3547. @item all_mode
  3548. Set blend mode for specific pixel component or all pixel components in case
  3549. of @var{all_mode}. Default value is @code{normal}.
  3550. Available values for component modes are:
  3551. @table @samp
  3552. @item addition
  3553. @item addition128
  3554. @item and
  3555. @item average
  3556. @item burn
  3557. @item darken
  3558. @item difference
  3559. @item difference128
  3560. @item divide
  3561. @item dodge
  3562. @item freeze
  3563. @item exclusion
  3564. @item glow
  3565. @item hardlight
  3566. @item hardmix
  3567. @item heat
  3568. @item lighten
  3569. @item linearlight
  3570. @item multiply
  3571. @item multiply128
  3572. @item negation
  3573. @item normal
  3574. @item or
  3575. @item overlay
  3576. @item phoenix
  3577. @item pinlight
  3578. @item reflect
  3579. @item screen
  3580. @item softlight
  3581. @item subtract
  3582. @item vividlight
  3583. @item xor
  3584. @end table
  3585. @item c0_opacity
  3586. @item c1_opacity
  3587. @item c2_opacity
  3588. @item c3_opacity
  3589. @item all_opacity
  3590. Set blend opacity for specific pixel component or all pixel components in case
  3591. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  3592. @item c0_expr
  3593. @item c1_expr
  3594. @item c2_expr
  3595. @item c3_expr
  3596. @item all_expr
  3597. Set blend expression for specific pixel component or all pixel components in case
  3598. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  3599. The expressions can use the following variables:
  3600. @table @option
  3601. @item N
  3602. The sequential number of the filtered frame, starting from @code{0}.
  3603. @item X
  3604. @item Y
  3605. the coordinates of the current sample
  3606. @item W
  3607. @item H
  3608. the width and height of currently filtered plane
  3609. @item SW
  3610. @item SH
  3611. Width and height scale depending on the currently filtered plane. It is the
  3612. ratio between the corresponding luma plane number of pixels and the current
  3613. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  3614. @code{0.5,0.5} for chroma planes.
  3615. @item T
  3616. Time of the current frame, expressed in seconds.
  3617. @item TOP, A
  3618. Value of pixel component at current location for first video frame (top layer).
  3619. @item BOTTOM, B
  3620. Value of pixel component at current location for second video frame (bottom layer).
  3621. @end table
  3622. @item shortest
  3623. Force termination when the shortest input terminates. Default is
  3624. @code{0}. This option is only defined for the @code{blend} filter.
  3625. @item repeatlast
  3626. Continue applying the last bottom frame after the end of the stream. A value of
  3627. @code{0} disable the filter after the last frame of the bottom layer is reached.
  3628. Default is @code{1}. This option is only defined for the @code{blend} filter.
  3629. @end table
  3630. @subsection Examples
  3631. @itemize
  3632. @item
  3633. Apply transition from bottom layer to top layer in first 10 seconds:
  3634. @example
  3635. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  3636. @end example
  3637. @item
  3638. Apply 1x1 checkerboard effect:
  3639. @example
  3640. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  3641. @end example
  3642. @item
  3643. Apply uncover left effect:
  3644. @example
  3645. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  3646. @end example
  3647. @item
  3648. Apply uncover down effect:
  3649. @example
  3650. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  3651. @end example
  3652. @item
  3653. Apply uncover up-left effect:
  3654. @example
  3655. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  3656. @end example
  3657. @item
  3658. Split diagonally video and shows top and bottom layer on each side:
  3659. @example
  3660. blend=all_expr=if(gt(X,Y*(W/H)),A,B)
  3661. @end example
  3662. @item
  3663. Display differences between the current and the previous frame:
  3664. @example
  3665. tblend=all_mode=difference128
  3666. @end example
  3667. @end itemize
  3668. @section boxblur
  3669. Apply a boxblur algorithm to the input video.
  3670. It accepts the following parameters:
  3671. @table @option
  3672. @item luma_radius, lr
  3673. @item luma_power, lp
  3674. @item chroma_radius, cr
  3675. @item chroma_power, cp
  3676. @item alpha_radius, ar
  3677. @item alpha_power, ap
  3678. @end table
  3679. A description of the accepted options follows.
  3680. @table @option
  3681. @item luma_radius, lr
  3682. @item chroma_radius, cr
  3683. @item alpha_radius, ar
  3684. Set an expression for the box radius in pixels used for blurring the
  3685. corresponding input plane.
  3686. The radius value must be a non-negative number, and must not be
  3687. greater than the value of the expression @code{min(w,h)/2} for the
  3688. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  3689. planes.
  3690. Default value for @option{luma_radius} is "2". If not specified,
  3691. @option{chroma_radius} and @option{alpha_radius} default to the
  3692. corresponding value set for @option{luma_radius}.
  3693. The expressions can contain the following constants:
  3694. @table @option
  3695. @item w
  3696. @item h
  3697. The input width and height in pixels.
  3698. @item cw
  3699. @item ch
  3700. The input chroma image width and height in pixels.
  3701. @item hsub
  3702. @item vsub
  3703. The horizontal and vertical chroma subsample values. For example, for the
  3704. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  3705. @end table
  3706. @item luma_power, lp
  3707. @item chroma_power, cp
  3708. @item alpha_power, ap
  3709. Specify how many times the boxblur filter is applied to the
  3710. corresponding plane.
  3711. Default value for @option{luma_power} is 2. If not specified,
  3712. @option{chroma_power} and @option{alpha_power} default to the
  3713. corresponding value set for @option{luma_power}.
  3714. A value of 0 will disable the effect.
  3715. @end table
  3716. @subsection Examples
  3717. @itemize
  3718. @item
  3719. Apply a boxblur filter with the luma, chroma, and alpha radii
  3720. set to 2:
  3721. @example
  3722. boxblur=luma_radius=2:luma_power=1
  3723. boxblur=2:1
  3724. @end example
  3725. @item
  3726. Set the luma radius to 2, and alpha and chroma radius to 0:
  3727. @example
  3728. boxblur=2:1:cr=0:ar=0
  3729. @end example
  3730. @item
  3731. Set the luma and chroma radii to a fraction of the video dimension:
  3732. @example
  3733. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  3734. @end example
  3735. @end itemize
  3736. @section bwdif
  3737. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  3738. Deinterlacing Filter").
  3739. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  3740. interpolation algorithms.
  3741. It accepts the following parameters:
  3742. @table @option
  3743. @item mode
  3744. The interlacing mode to adopt. It accepts one of the following values:
  3745. @table @option
  3746. @item 0, send_frame
  3747. Output one frame for each frame.
  3748. @item 1, send_field
  3749. Output one frame for each field.
  3750. @end table
  3751. The default value is @code{send_field}.
  3752. @item parity
  3753. The picture field parity assumed for the input interlaced video. It accepts one
  3754. of the following values:
  3755. @table @option
  3756. @item 0, tff
  3757. Assume the top field is first.
  3758. @item 1, bff
  3759. Assume the bottom field is first.
  3760. @item -1, auto
  3761. Enable automatic detection of field parity.
  3762. @end table
  3763. The default value is @code{auto}.
  3764. If the interlacing is unknown or the decoder does not export this information,
  3765. top field first will be assumed.
  3766. @item deint
  3767. Specify which frames to deinterlace. Accept one of the following
  3768. values:
  3769. @table @option
  3770. @item 0, all
  3771. Deinterlace all frames.
  3772. @item 1, interlaced
  3773. Only deinterlace frames marked as interlaced.
  3774. @end table
  3775. The default value is @code{all}.
  3776. @end table
  3777. @section chromakey
  3778. YUV colorspace color/chroma keying.
  3779. The filter accepts the following options:
  3780. @table @option
  3781. @item color
  3782. The color which will be replaced with transparency.
  3783. @item similarity
  3784. Similarity percentage with the key color.
  3785. 0.01 matches only the exact key color, while 1.0 matches everything.
  3786. @item blend
  3787. Blend percentage.
  3788. 0.0 makes pixels either fully transparent, or not transparent at all.
  3789. Higher values result in semi-transparent pixels, with a higher transparency
  3790. the more similar the pixels color is to the key color.
  3791. @item yuv
  3792. Signals that the color passed is already in YUV instead of RGB.
  3793. Litteral colors like "green" or "red" don't make sense with this enabled anymore.
  3794. This can be used to pass exact YUV values as hexadecimal numbers.
  3795. @end table
  3796. @subsection Examples
  3797. @itemize
  3798. @item
  3799. Make every green pixel in the input image transparent:
  3800. @example
  3801. ffmpeg -i input.png -vf chromakey=green out.png
  3802. @end example
  3803. @item
  3804. Overlay a greenscreen-video on top of a static black background.
  3805. @example
  3806. 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
  3807. @end example
  3808. @end itemize
  3809. @section ciescope
  3810. Display CIE color diagram with pixels overlaid onto it.
  3811. The filter accepts the following options:
  3812. @table @option
  3813. @item system
  3814. Set color system.
  3815. @table @samp
  3816. @item ntsc, 470m
  3817. @item ebu, 470bg
  3818. @item smpte
  3819. @item 240m
  3820. @item apple
  3821. @item widergb
  3822. @item cie1931
  3823. @item rec709, hdtv
  3824. @item uhdtv, rec2020
  3825. @end table
  3826. @item cie
  3827. Set CIE system.
  3828. @table @samp
  3829. @item xyy
  3830. @item ucs
  3831. @item luv
  3832. @end table
  3833. @item gamuts
  3834. Set what gamuts to draw.
  3835. See @code{system} option for available values.
  3836. @item size, s
  3837. Set ciescope size, by default set to 512.
  3838. @item intensity, i
  3839. Set intensity used to map input pixel values to CIE diagram.
  3840. @item contrast
  3841. Set contrast used to draw tongue colors that are out of active color system gamut.
  3842. @item corrgamma
  3843. Correct gamma displayed on scope, by default enabled.
  3844. @item showwhite
  3845. Show white point on CIE diagram, by default disabled.
  3846. @item gamma
  3847. Set input gamma. Used only with XYZ input color space.
  3848. @end table
  3849. @section codecview
  3850. Visualize information exported by some codecs.
  3851. Some codecs can export information through frames using side-data or other
  3852. means. For example, some MPEG based codecs export motion vectors through the
  3853. @var{export_mvs} flag in the codec @option{flags2} option.
  3854. The filter accepts the following option:
  3855. @table @option
  3856. @item mv
  3857. Set motion vectors to visualize.
  3858. Available flags for @var{mv} are:
  3859. @table @samp
  3860. @item pf
  3861. forward predicted MVs of P-frames
  3862. @item bf
  3863. forward predicted MVs of B-frames
  3864. @item bb
  3865. backward predicted MVs of B-frames
  3866. @end table
  3867. @item qp
  3868. Display quantization parameters using the chroma planes.
  3869. @item mv_type, mvt
  3870. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  3871. Available flags for @var{mv_type} are:
  3872. @table @samp
  3873. @item fp
  3874. forward predicted MVs
  3875. @item bp
  3876. backward predicted MVs
  3877. @end table
  3878. @item frame_type, ft
  3879. Set frame type to visualize motion vectors of.
  3880. Available flags for @var{frame_type} are:
  3881. @table @samp
  3882. @item if
  3883. intra-coded frames (I-frames)
  3884. @item pf
  3885. predicted frames (P-frames)
  3886. @item bf
  3887. bi-directionally predicted frames (B-frames)
  3888. @end table
  3889. @end table
  3890. @subsection Examples
  3891. @itemize
  3892. @item
  3893. Visualize forward predicted MVs of all frames using @command{ffplay}:
  3894. @example
  3895. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  3896. @end example
  3897. @item
  3898. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  3899. @example
  3900. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  3901. @end example
  3902. @end itemize
  3903. @section colorbalance
  3904. Modify intensity of primary colors (red, green and blue) of input frames.
  3905. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  3906. regions for the red-cyan, green-magenta or blue-yellow balance.
  3907. A positive adjustment value shifts the balance towards the primary color, a negative
  3908. value towards the complementary color.
  3909. The filter accepts the following options:
  3910. @table @option
  3911. @item rs
  3912. @item gs
  3913. @item bs
  3914. Adjust red, green and blue shadows (darkest pixels).
  3915. @item rm
  3916. @item gm
  3917. @item bm
  3918. Adjust red, green and blue midtones (medium pixels).
  3919. @item rh
  3920. @item gh
  3921. @item bh
  3922. Adjust red, green and blue highlights (brightest pixels).
  3923. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3924. @end table
  3925. @subsection Examples
  3926. @itemize
  3927. @item
  3928. Add red color cast to shadows:
  3929. @example
  3930. colorbalance=rs=.3
  3931. @end example
  3932. @end itemize
  3933. @section colorkey
  3934. RGB colorspace color keying.
  3935. The filter accepts the following options:
  3936. @table @option
  3937. @item color
  3938. The color which will be replaced with transparency.
  3939. @item similarity
  3940. Similarity percentage with the key color.
  3941. 0.01 matches only the exact key color, while 1.0 matches everything.
  3942. @item blend
  3943. Blend percentage.
  3944. 0.0 makes pixels either fully transparent, or not transparent at all.
  3945. Higher values result in semi-transparent pixels, with a higher transparency
  3946. the more similar the pixels color is to the key color.
  3947. @end table
  3948. @subsection Examples
  3949. @itemize
  3950. @item
  3951. Make every green pixel in the input image transparent:
  3952. @example
  3953. ffmpeg -i input.png -vf colorkey=green out.png
  3954. @end example
  3955. @item
  3956. Overlay a greenscreen-video on top of a static background image.
  3957. @example
  3958. 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
  3959. @end example
  3960. @end itemize
  3961. @section colorlevels
  3962. Adjust video input frames using levels.
  3963. The filter accepts the following options:
  3964. @table @option
  3965. @item rimin
  3966. @item gimin
  3967. @item bimin
  3968. @item aimin
  3969. Adjust red, green, blue and alpha input black point.
  3970. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3971. @item rimax
  3972. @item gimax
  3973. @item bimax
  3974. @item aimax
  3975. Adjust red, green, blue and alpha input white point.
  3976. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  3977. Input levels are used to lighten highlights (bright tones), darken shadows
  3978. (dark tones), change the balance of bright and dark tones.
  3979. @item romin
  3980. @item gomin
  3981. @item bomin
  3982. @item aomin
  3983. Adjust red, green, blue and alpha output black point.
  3984. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  3985. @item romax
  3986. @item gomax
  3987. @item bomax
  3988. @item aomax
  3989. Adjust red, green, blue and alpha output white point.
  3990. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  3991. Output levels allows manual selection of a constrained output level range.
  3992. @end table
  3993. @subsection Examples
  3994. @itemize
  3995. @item
  3996. Make video output darker:
  3997. @example
  3998. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  3999. @end example
  4000. @item
  4001. Increase contrast:
  4002. @example
  4003. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  4004. @end example
  4005. @item
  4006. Make video output lighter:
  4007. @example
  4008. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  4009. @end example
  4010. @item
  4011. Increase brightness:
  4012. @example
  4013. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  4014. @end example
  4015. @end itemize
  4016. @section colorchannelmixer
  4017. Adjust video input frames by re-mixing color channels.
  4018. This filter modifies a color channel by adding the values associated to
  4019. the other channels of the same pixels. For example if the value to
  4020. modify is red, the output value will be:
  4021. @example
  4022. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  4023. @end example
  4024. The filter accepts the following options:
  4025. @table @option
  4026. @item rr
  4027. @item rg
  4028. @item rb
  4029. @item ra
  4030. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  4031. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  4032. @item gr
  4033. @item gg
  4034. @item gb
  4035. @item ga
  4036. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  4037. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  4038. @item br
  4039. @item bg
  4040. @item bb
  4041. @item ba
  4042. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  4043. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  4044. @item ar
  4045. @item ag
  4046. @item ab
  4047. @item aa
  4048. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  4049. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  4050. Allowed ranges for options are @code{[-2.0, 2.0]}.
  4051. @end table
  4052. @subsection Examples
  4053. @itemize
  4054. @item
  4055. Convert source to grayscale:
  4056. @example
  4057. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  4058. @end example
  4059. @item
  4060. Simulate sepia tones:
  4061. @example
  4062. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  4063. @end example
  4064. @end itemize
  4065. @section colormatrix
  4066. Convert color matrix.
  4067. The filter accepts the following options:
  4068. @table @option
  4069. @item src
  4070. @item dst
  4071. Specify the source and destination color matrix. Both values must be
  4072. specified.
  4073. The accepted values are:
  4074. @table @samp
  4075. @item bt709
  4076. BT.709
  4077. @item bt601
  4078. BT.601
  4079. @item smpte240m
  4080. SMPTE-240M
  4081. @item fcc
  4082. FCC
  4083. @item bt2020
  4084. BT.2020
  4085. @end table
  4086. @end table
  4087. For example to convert from BT.601 to SMPTE-240M, use the command:
  4088. @example
  4089. colormatrix=bt601:smpte240m
  4090. @end example
  4091. @section colorspace
  4092. Convert colorspace, transfer characteristics or color primaries.
  4093. The filter accepts the following options:
  4094. @table @option
  4095. @anchor{all}
  4096. @item all
  4097. Specify all color properties at once.
  4098. The accepted values are:
  4099. @table @samp
  4100. @item bt470m
  4101. BT.470M
  4102. @item bt470bg
  4103. BT.470BG
  4104. @item bt601-6-525
  4105. BT.601-6 525
  4106. @item bt601-6-625
  4107. BT.601-6 625
  4108. @item bt709
  4109. BT.709
  4110. @item smpte170m
  4111. SMPTE-170M
  4112. @item smpte240m
  4113. SMPTE-240M
  4114. @item bt2020
  4115. BT.2020
  4116. @end table
  4117. @anchor{space}
  4118. @item space
  4119. Specify output colorspace.
  4120. The accepted values are:
  4121. @table @samp
  4122. @item bt709
  4123. BT.709
  4124. @item fcc
  4125. FCC
  4126. @item bt470bg
  4127. BT.470BG or BT.601-6 625
  4128. @item smpte170m
  4129. SMPTE-170M or BT.601-6 525
  4130. @item smpte240m
  4131. SMPTE-240M
  4132. @item bt2020ncl
  4133. BT.2020 with non-constant luminance
  4134. @end table
  4135. @anchor{trc}
  4136. @item trc
  4137. Specify output transfer characteristics.
  4138. The accepted values are:
  4139. @table @samp
  4140. @item bt709
  4141. BT.709
  4142. @item gamma22
  4143. Constant gamma of 2.2
  4144. @item gamma28
  4145. Constant gamma of 2.8
  4146. @item smpte170m
  4147. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  4148. @item smpte240m
  4149. SMPTE-240M
  4150. @item bt2020-10
  4151. BT.2020 for 10-bits content
  4152. @item bt2020-12
  4153. BT.2020 for 12-bits content
  4154. @end table
  4155. @anchor{primaries}
  4156. @item primaries
  4157. Specify output color primaries.
  4158. The accepted values are:
  4159. @table @samp
  4160. @item bt709
  4161. BT.709
  4162. @item bt470m
  4163. BT.470M
  4164. @item bt470bg
  4165. BT.470BG or BT.601-6 625
  4166. @item smpte170m
  4167. SMPTE-170M or BT.601-6 525
  4168. @item smpte240m
  4169. SMPTE-240M
  4170. @item bt2020
  4171. BT.2020
  4172. @end table
  4173. @anchor{range}
  4174. @item range
  4175. Specify output color range.
  4176. The accepted values are:
  4177. @table @samp
  4178. @item mpeg
  4179. MPEG (restricted) range
  4180. @item jpeg
  4181. JPEG (full) range
  4182. @end table
  4183. @item format
  4184. Specify output color format.
  4185. The accepted values are:
  4186. @table @samp
  4187. @item yuv420p
  4188. YUV 4:2:0 planar 8-bits
  4189. @item yuv420p10
  4190. YUV 4:2:0 planar 10-bits
  4191. @item yuv420p12
  4192. YUV 4:2:0 planar 12-bits
  4193. @item yuv422p
  4194. YUV 4:2:2 planar 8-bits
  4195. @item yuv422p10
  4196. YUV 4:2:2 planar 10-bits
  4197. @item yuv422p12
  4198. YUV 4:2:2 planar 12-bits
  4199. @item yuv444p
  4200. YUV 4:4:4 planar 8-bits
  4201. @item yuv444p10
  4202. YUV 4:4:4 planar 10-bits
  4203. @item yuv444p12
  4204. YUV 4:4:4 planar 12-bits
  4205. @end table
  4206. @item fast
  4207. Do a fast conversion, which skips gamma/primary correction. This will take
  4208. significantly less CPU, but will be mathematically incorrect. To get output
  4209. compatible with that produced by the colormatrix filter, use fast=1.
  4210. @item dither
  4211. Specify dithering mode.
  4212. The accepted values are:
  4213. @table @samp
  4214. @item none
  4215. No dithering
  4216. @item fsb
  4217. Floyd-Steinberg dithering
  4218. @end table
  4219. @item wpadapt
  4220. Whitepoint adaptation mode.
  4221. The accepted values are:
  4222. @table @samp
  4223. @item bradford
  4224. Bradford whitepoint adaptation
  4225. @item vonkries
  4226. von Kries whitepoint adaptation
  4227. @item identity
  4228. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  4229. @end table
  4230. @item iall
  4231. Override all input properties at once. Same accepted values as @ref{all}.
  4232. @item ispace
  4233. Override input colorspace. Same accepted values as @ref{space}.
  4234. @item iprimaries
  4235. Override input color primaries. Same accepted values as @ref{primaries}.
  4236. @item itrc
  4237. Override input transfer characteristics. Same accepted values as @ref{trc}.
  4238. @item irange
  4239. Override input color range. Same accepted values as @ref{range}.
  4240. @end table
  4241. The filter converts the transfer characteristics, color space and color
  4242. primaries to the specified user values. The output value, if not specified,
  4243. is set to a default value based on the "all" property. If that property is
  4244. also not specified, the filter will log an error. The output color range and
  4245. format default to the same value as the input color range and format. The
  4246. input transfer characteristics, color space, color primaries and color range
  4247. should be set on the input data. If any of these are missing, the filter will
  4248. log an error and no conversion will take place.
  4249. For example to convert the input to SMPTE-240M, use the command:
  4250. @example
  4251. colorspace=smpte240m
  4252. @end example
  4253. @section convolution
  4254. Apply convolution 3x3 or 5x5 filter.
  4255. The filter accepts the following options:
  4256. @table @option
  4257. @item 0m
  4258. @item 1m
  4259. @item 2m
  4260. @item 3m
  4261. Set matrix for each plane.
  4262. Matrix is sequence of 9 or 25 signed integers.
  4263. @item 0rdiv
  4264. @item 1rdiv
  4265. @item 2rdiv
  4266. @item 3rdiv
  4267. Set multiplier for calculated value for each plane.
  4268. @item 0bias
  4269. @item 1bias
  4270. @item 2bias
  4271. @item 3bias
  4272. Set bias for each plane. This value is added to the result of the multiplication.
  4273. Useful for making the overall image brighter or darker. Default is 0.0.
  4274. @end table
  4275. @subsection Examples
  4276. @itemize
  4277. @item
  4278. Apply sharpen:
  4279. @example
  4280. 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"
  4281. @end example
  4282. @item
  4283. Apply blur:
  4284. @example
  4285. 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"
  4286. @end example
  4287. @item
  4288. Apply edge enhance:
  4289. @example
  4290. 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"
  4291. @end example
  4292. @item
  4293. Apply edge detect:
  4294. @example
  4295. 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"
  4296. @end example
  4297. @item
  4298. Apply emboss:
  4299. @example
  4300. 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"
  4301. @end example
  4302. @end itemize
  4303. @section copy
  4304. Copy the input source unchanged to the output. This is mainly useful for
  4305. testing purposes.
  4306. @anchor{coreimage}
  4307. @section coreimage
  4308. Video filtering on GPU using Apple's CoreImage API on OSX.
  4309. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  4310. processed by video hardware. However, software-based OpenGL implementations
  4311. exist which means there is no guarantee for hardware processing. It depends on
  4312. the respective OSX.
  4313. There are many filters and image generators provided by Apple that come with a
  4314. large variety of options. The filter has to be referenced by its name along
  4315. with its options.
  4316. The coreimage filter accepts the following options:
  4317. @table @option
  4318. @item list_filters
  4319. List all available filters and generators along with all their respective
  4320. options as well as possible minimum and maximum values along with the default
  4321. values.
  4322. @example
  4323. list_filters=true
  4324. @end example
  4325. @item filter
  4326. Specify all filters by their respective name and options.
  4327. Use @var{list_filters} to determine all valid filter names and options.
  4328. Numerical options are specified by a float value and are automatically clamped
  4329. to their respective value range. Vector and color options have to be specified
  4330. by a list of space separated float values. Character escaping has to be done.
  4331. A special option name @code{default} is available to use default options for a
  4332. filter.
  4333. It is required to specify either @code{default} or at least one of the filter options.
  4334. All omitted options are used with their default values.
  4335. The syntax of the filter string is as follows:
  4336. @example
  4337. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  4338. @end example
  4339. @item output_rect
  4340. Specify a rectangle where the output of the filter chain is copied into the
  4341. input image. It is given by a list of space separated float values:
  4342. @example
  4343. output_rect=x\ y\ width\ height
  4344. @end example
  4345. If not given, the output rectangle equals the dimensions of the input image.
  4346. The output rectangle is automatically cropped at the borders of the input
  4347. image. Negative values are valid for each component.
  4348. @example
  4349. output_rect=25\ 25\ 100\ 100
  4350. @end example
  4351. @end table
  4352. Several filters can be chained for successive processing without GPU-HOST
  4353. transfers allowing for fast processing of complex filter chains.
  4354. Currently, only filters with zero (generators) or exactly one (filters) input
  4355. image and one output image are supported. Also, transition filters are not yet
  4356. usable as intended.
  4357. Some filters generate output images with additional padding depending on the
  4358. respective filter kernel. The padding is automatically removed to ensure the
  4359. filter output has the same size as the input image.
  4360. For image generators, the size of the output image is determined by the
  4361. previous output image of the filter chain or the input image of the whole
  4362. filterchain, respectively. The generators do not use the pixel information of
  4363. this image to generate their output. However, the generated output is
  4364. blended onto this image, resulting in partial or complete coverage of the
  4365. output image.
  4366. The @ref{coreimagesrc} video source can be used for generating input images
  4367. which are directly fed into the filter chain. By using it, providing input
  4368. images by another video source or an input video is not required.
  4369. @subsection Examples
  4370. @itemize
  4371. @item
  4372. List all filters available:
  4373. @example
  4374. coreimage=list_filters=true
  4375. @end example
  4376. @item
  4377. Use the CIBoxBlur filter with default options to blur an image:
  4378. @example
  4379. coreimage=filter=CIBoxBlur@@default
  4380. @end example
  4381. @item
  4382. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  4383. its center at 100x100 and a radius of 50 pixels:
  4384. @example
  4385. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  4386. @end example
  4387. @item
  4388. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  4389. given as complete and escaped command-line for Apple's standard bash shell:
  4390. @example
  4391. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  4392. @end example
  4393. @end itemize
  4394. @section crop
  4395. Crop the input video to given dimensions.
  4396. It accepts the following parameters:
  4397. @table @option
  4398. @item w, out_w
  4399. The width of the output video. It defaults to @code{iw}.
  4400. This expression is evaluated only once during the filter
  4401. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  4402. @item h, out_h
  4403. The height of the output video. It defaults to @code{ih}.
  4404. This expression is evaluated only once during the filter
  4405. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  4406. @item x
  4407. The horizontal position, in the input video, of the left edge of the output
  4408. video. It defaults to @code{(in_w-out_w)/2}.
  4409. This expression is evaluated per-frame.
  4410. @item y
  4411. The vertical position, in the input video, of the top edge of the output video.
  4412. It defaults to @code{(in_h-out_h)/2}.
  4413. This expression is evaluated per-frame.
  4414. @item keep_aspect
  4415. If set to 1 will force the output display aspect ratio
  4416. to be the same of the input, by changing the output sample aspect
  4417. ratio. It defaults to 0.
  4418. @item exact
  4419. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  4420. width/height/x/y as specified and will not be rounded to nearest smaller value.
  4421. It defaults to 0.
  4422. @end table
  4423. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  4424. expressions containing the following constants:
  4425. @table @option
  4426. @item x
  4427. @item y
  4428. The computed values for @var{x} and @var{y}. They are evaluated for
  4429. each new frame.
  4430. @item in_w
  4431. @item in_h
  4432. The input width and height.
  4433. @item iw
  4434. @item ih
  4435. These are the same as @var{in_w} and @var{in_h}.
  4436. @item out_w
  4437. @item out_h
  4438. The output (cropped) width and height.
  4439. @item ow
  4440. @item oh
  4441. These are the same as @var{out_w} and @var{out_h}.
  4442. @item a
  4443. same as @var{iw} / @var{ih}
  4444. @item sar
  4445. input sample aspect ratio
  4446. @item dar
  4447. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  4448. @item hsub
  4449. @item vsub
  4450. horizontal and vertical chroma subsample values. For example for the
  4451. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4452. @item n
  4453. The number of the input frame, starting from 0.
  4454. @item pos
  4455. the position in the file of the input frame, NAN if unknown
  4456. @item t
  4457. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  4458. @end table
  4459. The expression for @var{out_w} may depend on the value of @var{out_h},
  4460. and the expression for @var{out_h} may depend on @var{out_w}, but they
  4461. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  4462. evaluated after @var{out_w} and @var{out_h}.
  4463. The @var{x} and @var{y} parameters specify the expressions for the
  4464. position of the top-left corner of the output (non-cropped) area. They
  4465. are evaluated for each frame. If the evaluated value is not valid, it
  4466. is approximated to the nearest valid value.
  4467. The expression for @var{x} may depend on @var{y}, and the expression
  4468. for @var{y} may depend on @var{x}.
  4469. @subsection Examples
  4470. @itemize
  4471. @item
  4472. Crop area with size 100x100 at position (12,34).
  4473. @example
  4474. crop=100:100:12:34
  4475. @end example
  4476. Using named options, the example above becomes:
  4477. @example
  4478. crop=w=100:h=100:x=12:y=34
  4479. @end example
  4480. @item
  4481. Crop the central input area with size 100x100:
  4482. @example
  4483. crop=100:100
  4484. @end example
  4485. @item
  4486. Crop the central input area with size 2/3 of the input video:
  4487. @example
  4488. crop=2/3*in_w:2/3*in_h
  4489. @end example
  4490. @item
  4491. Crop the input video central square:
  4492. @example
  4493. crop=out_w=in_h
  4494. crop=in_h
  4495. @end example
  4496. @item
  4497. Delimit the rectangle with the top-left corner placed at position
  4498. 100:100 and the right-bottom corner corresponding to the right-bottom
  4499. corner of the input image.
  4500. @example
  4501. crop=in_w-100:in_h-100:100:100
  4502. @end example
  4503. @item
  4504. Crop 10 pixels from the left and right borders, and 20 pixels from
  4505. the top and bottom borders
  4506. @example
  4507. crop=in_w-2*10:in_h-2*20
  4508. @end example
  4509. @item
  4510. Keep only the bottom right quarter of the input image:
  4511. @example
  4512. crop=in_w/2:in_h/2:in_w/2:in_h/2
  4513. @end example
  4514. @item
  4515. Crop height for getting Greek harmony:
  4516. @example
  4517. crop=in_w:1/PHI*in_w
  4518. @end example
  4519. @item
  4520. Apply trembling effect:
  4521. @example
  4522. 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)
  4523. @end example
  4524. @item
  4525. Apply erratic camera effect depending on timestamp:
  4526. @example
  4527. 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)"
  4528. @end example
  4529. @item
  4530. Set x depending on the value of y:
  4531. @example
  4532. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  4533. @end example
  4534. @end itemize
  4535. @subsection Commands
  4536. This filter supports the following commands:
  4537. @table @option
  4538. @item w, out_w
  4539. @item h, out_h
  4540. @item x
  4541. @item y
  4542. Set width/height of the output video and the horizontal/vertical position
  4543. in the input video.
  4544. The command accepts the same syntax of the corresponding option.
  4545. If the specified expression is not valid, it is kept at its current
  4546. value.
  4547. @end table
  4548. @section cropdetect
  4549. Auto-detect the crop size.
  4550. It calculates the necessary cropping parameters and prints the
  4551. recommended parameters via the logging system. The detected dimensions
  4552. correspond to the non-black area of the input video.
  4553. It accepts the following parameters:
  4554. @table @option
  4555. @item limit
  4556. Set higher black value threshold, which can be optionally specified
  4557. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  4558. value greater to the set value is considered non-black. It defaults to 24.
  4559. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  4560. on the bitdepth of the pixel format.
  4561. @item round
  4562. The value which the width/height should be divisible by. It defaults to
  4563. 16. The offset is automatically adjusted to center the video. Use 2 to
  4564. get only even dimensions (needed for 4:2:2 video). 16 is best when
  4565. encoding to most video codecs.
  4566. @item reset_count, reset
  4567. Set the counter that determines after how many frames cropdetect will
  4568. reset the previously detected largest video area and start over to
  4569. detect the current optimal crop area. Default value is 0.
  4570. This can be useful when channel logos distort the video area. 0
  4571. indicates 'never reset', and returns the largest area encountered during
  4572. playback.
  4573. @end table
  4574. @anchor{curves}
  4575. @section curves
  4576. Apply color adjustments using curves.
  4577. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  4578. component (red, green and blue) has its values defined by @var{N} key points
  4579. tied from each other using a smooth curve. The x-axis represents the pixel
  4580. values from the input frame, and the y-axis the new pixel values to be set for
  4581. the output frame.
  4582. By default, a component curve is defined by the two points @var{(0;0)} and
  4583. @var{(1;1)}. This creates a straight line where each original pixel value is
  4584. "adjusted" to its own value, which means no change to the image.
  4585. The filter allows you to redefine these two points and add some more. A new
  4586. curve (using a natural cubic spline interpolation) will be define to pass
  4587. smoothly through all these new coordinates. The new defined points needs to be
  4588. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  4589. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  4590. the vector spaces, the values will be clipped accordingly.
  4591. The filter accepts the following options:
  4592. @table @option
  4593. @item preset
  4594. Select one of the available color presets. This option can be used in addition
  4595. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  4596. options takes priority on the preset values.
  4597. Available presets are:
  4598. @table @samp
  4599. @item none
  4600. @item color_negative
  4601. @item cross_process
  4602. @item darker
  4603. @item increase_contrast
  4604. @item lighter
  4605. @item linear_contrast
  4606. @item medium_contrast
  4607. @item negative
  4608. @item strong_contrast
  4609. @item vintage
  4610. @end table
  4611. Default is @code{none}.
  4612. @item master, m
  4613. Set the master key points. These points will define a second pass mapping. It
  4614. is sometimes called a "luminance" or "value" mapping. It can be used with
  4615. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  4616. post-processing LUT.
  4617. @item red, r
  4618. Set the key points for the red component.
  4619. @item green, g
  4620. Set the key points for the green component.
  4621. @item blue, b
  4622. Set the key points for the blue component.
  4623. @item all
  4624. Set the key points for all components (not including master).
  4625. Can be used in addition to the other key points component
  4626. options. In this case, the unset component(s) will fallback on this
  4627. @option{all} setting.
  4628. @item psfile
  4629. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  4630. @item plot
  4631. Save Gnuplot script of the curves in specified file.
  4632. @end table
  4633. To avoid some filtergraph syntax conflicts, each key points list need to be
  4634. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  4635. @subsection Examples
  4636. @itemize
  4637. @item
  4638. Increase slightly the middle level of blue:
  4639. @example
  4640. curves=blue='0/0 0.5/0.58 1/1'
  4641. @end example
  4642. @item
  4643. Vintage effect:
  4644. @example
  4645. curves=r='0/0.11 .42/.51 1/0.95':g='0/0 0.50/0.48 1/1':b='0/0.22 .49/.44 1/0.8'
  4646. @end example
  4647. Here we obtain the following coordinates for each components:
  4648. @table @var
  4649. @item red
  4650. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  4651. @item green
  4652. @code{(0;0) (0.50;0.48) (1;1)}
  4653. @item blue
  4654. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  4655. @end table
  4656. @item
  4657. The previous example can also be achieved with the associated built-in preset:
  4658. @example
  4659. curves=preset=vintage
  4660. @end example
  4661. @item
  4662. Or simply:
  4663. @example
  4664. curves=vintage
  4665. @end example
  4666. @item
  4667. Use a Photoshop preset and redefine the points of the green component:
  4668. @example
  4669. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  4670. @end example
  4671. @item
  4672. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  4673. and @command{gnuplot}:
  4674. @example
  4675. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  4676. gnuplot -p /tmp/curves.plt
  4677. @end example
  4678. @end itemize
  4679. @section datascope
  4680. Video data analysis filter.
  4681. This filter shows hexadecimal pixel values of part of video.
  4682. The filter accepts the following options:
  4683. @table @option
  4684. @item size, s
  4685. Set output video size.
  4686. @item x
  4687. Set x offset from where to pick pixels.
  4688. @item y
  4689. Set y offset from where to pick pixels.
  4690. @item mode
  4691. Set scope mode, can be one of the following:
  4692. @table @samp
  4693. @item mono
  4694. Draw hexadecimal pixel values with white color on black background.
  4695. @item color
  4696. Draw hexadecimal pixel values with input video pixel color on black
  4697. background.
  4698. @item color2
  4699. Draw hexadecimal pixel values on color background picked from input video,
  4700. the text color is picked in such way so its always visible.
  4701. @end table
  4702. @item axis
  4703. Draw rows and columns numbers on left and top of video.
  4704. @item opacity
  4705. Set background opacity.
  4706. @end table
  4707. @section dctdnoiz
  4708. Denoise frames using 2D DCT (frequency domain filtering).
  4709. This filter is not designed for real time.
  4710. The filter accepts the following options:
  4711. @table @option
  4712. @item sigma, s
  4713. Set the noise sigma constant.
  4714. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  4715. coefficient (absolute value) below this threshold with be dropped.
  4716. If you need a more advanced filtering, see @option{expr}.
  4717. Default is @code{0}.
  4718. @item overlap
  4719. Set number overlapping pixels for each block. Since the filter can be slow, you
  4720. may want to reduce this value, at the cost of a less effective filter and the
  4721. risk of various artefacts.
  4722. If the overlapping value doesn't permit processing the whole input width or
  4723. height, a warning will be displayed and according borders won't be denoised.
  4724. Default value is @var{blocksize}-1, which is the best possible setting.
  4725. @item expr, e
  4726. Set the coefficient factor expression.
  4727. For each coefficient of a DCT block, this expression will be evaluated as a
  4728. multiplier value for the coefficient.
  4729. If this is option is set, the @option{sigma} option will be ignored.
  4730. The absolute value of the coefficient can be accessed through the @var{c}
  4731. variable.
  4732. @item n
  4733. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  4734. @var{blocksize}, which is the width and height of the processed blocks.
  4735. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  4736. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  4737. on the speed processing. Also, a larger block size does not necessarily means a
  4738. better de-noising.
  4739. @end table
  4740. @subsection Examples
  4741. Apply a denoise with a @option{sigma} of @code{4.5}:
  4742. @example
  4743. dctdnoiz=4.5
  4744. @end example
  4745. The same operation can be achieved using the expression system:
  4746. @example
  4747. dctdnoiz=e='gte(c, 4.5*3)'
  4748. @end example
  4749. Violent denoise using a block size of @code{16x16}:
  4750. @example
  4751. dctdnoiz=15:n=4
  4752. @end example
  4753. @section deband
  4754. Remove banding artifacts from input video.
  4755. It works by replacing banded pixels with average value of referenced pixels.
  4756. The filter accepts the following options:
  4757. @table @option
  4758. @item 1thr
  4759. @item 2thr
  4760. @item 3thr
  4761. @item 4thr
  4762. Set banding detection threshold for each plane. Default is 0.02.
  4763. Valid range is 0.00003 to 0.5.
  4764. If difference between current pixel and reference pixel is less than threshold,
  4765. it will be considered as banded.
  4766. @item range, r
  4767. Banding detection range in pixels. Default is 16. If positive, random number
  4768. in range 0 to set value will be used. If negative, exact absolute value
  4769. will be used.
  4770. The range defines square of four pixels around current pixel.
  4771. @item direction, d
  4772. Set direction in radians from which four pixel will be compared. If positive,
  4773. random direction from 0 to set direction will be picked. If negative, exact of
  4774. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  4775. will pick only pixels on same row and -PI/2 will pick only pixels on same
  4776. column.
  4777. @item blur
  4778. If enabled, current pixel is compared with average value of all four
  4779. surrounding pixels. The default is enabled. If disabled current pixel is
  4780. compared with all four surrounding pixels. The pixel is considered banded
  4781. if only all four differences with surrounding pixels are less than threshold.
  4782. @end table
  4783. @anchor{decimate}
  4784. @section decimate
  4785. Drop duplicated frames at regular intervals.
  4786. The filter accepts the following options:
  4787. @table @option
  4788. @item cycle
  4789. Set the number of frames from which one will be dropped. Setting this to
  4790. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  4791. Default is @code{5}.
  4792. @item dupthresh
  4793. Set the threshold for duplicate detection. If the difference metric for a frame
  4794. is less than or equal to this value, then it is declared as duplicate. Default
  4795. is @code{1.1}
  4796. @item scthresh
  4797. Set scene change threshold. Default is @code{15}.
  4798. @item blockx
  4799. @item blocky
  4800. Set the size of the x and y-axis blocks used during metric calculations.
  4801. Larger blocks give better noise suppression, but also give worse detection of
  4802. small movements. Must be a power of two. Default is @code{32}.
  4803. @item ppsrc
  4804. Mark main input as a pre-processed input and activate clean source input
  4805. stream. This allows the input to be pre-processed with various filters to help
  4806. the metrics calculation while keeping the frame selection lossless. When set to
  4807. @code{1}, the first stream is for the pre-processed input, and the second
  4808. stream is the clean source from where the kept frames are chosen. Default is
  4809. @code{0}.
  4810. @item chroma
  4811. Set whether or not chroma is considered in the metric calculations. Default is
  4812. @code{1}.
  4813. @end table
  4814. @section deflate
  4815. Apply deflate effect to the video.
  4816. This filter replaces the pixel by the local(3x3) average by taking into account
  4817. only values lower than the pixel.
  4818. It accepts the following options:
  4819. @table @option
  4820. @item threshold0
  4821. @item threshold1
  4822. @item threshold2
  4823. @item threshold3
  4824. Limit the maximum change for each plane, default is 65535.
  4825. If 0, plane will remain unchanged.
  4826. @end table
  4827. @section dejudder
  4828. Remove judder produced by partially interlaced telecined content.
  4829. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  4830. source was partially telecined content then the output of @code{pullup,dejudder}
  4831. will have a variable frame rate. May change the recorded frame rate of the
  4832. container. Aside from that change, this filter will not affect constant frame
  4833. rate video.
  4834. The option available in this filter is:
  4835. @table @option
  4836. @item cycle
  4837. Specify the length of the window over which the judder repeats.
  4838. Accepts any integer greater than 1. Useful values are:
  4839. @table @samp
  4840. @item 4
  4841. If the original was telecined from 24 to 30 fps (Film to NTSC).
  4842. @item 5
  4843. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  4844. @item 20
  4845. If a mixture of the two.
  4846. @end table
  4847. The default is @samp{4}.
  4848. @end table
  4849. @section delogo
  4850. Suppress a TV station logo by a simple interpolation of the surrounding
  4851. pixels. Just set a rectangle covering the logo and watch it disappear
  4852. (and sometimes something even uglier appear - your mileage may vary).
  4853. It accepts the following parameters:
  4854. @table @option
  4855. @item x
  4856. @item y
  4857. Specify the top left corner coordinates of the logo. They must be
  4858. specified.
  4859. @item w
  4860. @item h
  4861. Specify the width and height of the logo to clear. They must be
  4862. specified.
  4863. @item band, t
  4864. Specify the thickness of the fuzzy edge of the rectangle (added to
  4865. @var{w} and @var{h}). The default value is 1. This option is
  4866. deprecated, setting higher values should no longer be necessary and
  4867. is not recommended.
  4868. @item show
  4869. When set to 1, a green rectangle is drawn on the screen to simplify
  4870. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  4871. The default value is 0.
  4872. The rectangle is drawn on the outermost pixels which will be (partly)
  4873. replaced with interpolated values. The values of the next pixels
  4874. immediately outside this rectangle in each direction will be used to
  4875. compute the interpolated pixel values inside the rectangle.
  4876. @end table
  4877. @subsection Examples
  4878. @itemize
  4879. @item
  4880. Set a rectangle covering the area with top left corner coordinates 0,0
  4881. and size 100x77, and a band of size 10:
  4882. @example
  4883. delogo=x=0:y=0:w=100:h=77:band=10
  4884. @end example
  4885. @end itemize
  4886. @section deshake
  4887. Attempt to fix small changes in horizontal and/or vertical shift. This
  4888. filter helps remove camera shake from hand-holding a camera, bumping a
  4889. tripod, moving on a vehicle, etc.
  4890. The filter accepts the following options:
  4891. @table @option
  4892. @item x
  4893. @item y
  4894. @item w
  4895. @item h
  4896. Specify a rectangular area where to limit the search for motion
  4897. vectors.
  4898. If desired the search for motion vectors can be limited to a
  4899. rectangular area of the frame defined by its top left corner, width
  4900. and height. These parameters have the same meaning as the drawbox
  4901. filter which can be used to visualise the position of the bounding
  4902. box.
  4903. This is useful when simultaneous movement of subjects within the frame
  4904. might be confused for camera motion by the motion vector search.
  4905. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  4906. then the full frame is used. This allows later options to be set
  4907. without specifying the bounding box for the motion vector search.
  4908. Default - search the whole frame.
  4909. @item rx
  4910. @item ry
  4911. Specify the maximum extent of movement in x and y directions in the
  4912. range 0-64 pixels. Default 16.
  4913. @item edge
  4914. Specify how to generate pixels to fill blanks at the edge of the
  4915. frame. Available values are:
  4916. @table @samp
  4917. @item blank, 0
  4918. Fill zeroes at blank locations
  4919. @item original, 1
  4920. Original image at blank locations
  4921. @item clamp, 2
  4922. Extruded edge value at blank locations
  4923. @item mirror, 3
  4924. Mirrored edge at blank locations
  4925. @end table
  4926. Default value is @samp{mirror}.
  4927. @item blocksize
  4928. Specify the blocksize to use for motion search. Range 4-128 pixels,
  4929. default 8.
  4930. @item contrast
  4931. Specify the contrast threshold for blocks. Only blocks with more than
  4932. the specified contrast (difference between darkest and lightest
  4933. pixels) will be considered. Range 1-255, default 125.
  4934. @item search
  4935. Specify the search strategy. Available values are:
  4936. @table @samp
  4937. @item exhaustive, 0
  4938. Set exhaustive search
  4939. @item less, 1
  4940. Set less exhaustive search.
  4941. @end table
  4942. Default value is @samp{exhaustive}.
  4943. @item filename
  4944. If set then a detailed log of the motion search is written to the
  4945. specified file.
  4946. @item opencl
  4947. If set to 1, specify using OpenCL capabilities, only available if
  4948. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  4949. @end table
  4950. @section detelecine
  4951. Apply an exact inverse of the telecine operation. It requires a predefined
  4952. pattern specified using the pattern option which must be the same as that passed
  4953. to the telecine filter.
  4954. This filter accepts the following options:
  4955. @table @option
  4956. @item first_field
  4957. @table @samp
  4958. @item top, t
  4959. top field first
  4960. @item bottom, b
  4961. bottom field first
  4962. The default value is @code{top}.
  4963. @end table
  4964. @item pattern
  4965. A string of numbers representing the pulldown pattern you wish to apply.
  4966. The default value is @code{23}.
  4967. @item start_frame
  4968. A number representing position of the first frame with respect to the telecine
  4969. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  4970. @end table
  4971. @section dilation
  4972. Apply dilation effect to the video.
  4973. This filter replaces the pixel by the local(3x3) maximum.
  4974. It accepts the following options:
  4975. @table @option
  4976. @item threshold0
  4977. @item threshold1
  4978. @item threshold2
  4979. @item threshold3
  4980. Limit the maximum change for each plane, default is 65535.
  4981. If 0, plane will remain unchanged.
  4982. @item coordinates
  4983. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  4984. pixels are used.
  4985. Flags to local 3x3 coordinates maps like this:
  4986. 1 2 3
  4987. 4 5
  4988. 6 7 8
  4989. @end table
  4990. @section displace
  4991. Displace pixels as indicated by second and third input stream.
  4992. It takes three input streams and outputs one stream, the first input is the
  4993. source, and second and third input are displacement maps.
  4994. The second input specifies how much to displace pixels along the
  4995. x-axis, while the third input specifies how much to displace pixels
  4996. along the y-axis.
  4997. If one of displacement map streams terminates, last frame from that
  4998. displacement map will be used.
  4999. Note that once generated, displacements maps can be reused over and over again.
  5000. A description of the accepted options follows.
  5001. @table @option
  5002. @item edge
  5003. Set displace behavior for pixels that are out of range.
  5004. Available values are:
  5005. @table @samp
  5006. @item blank
  5007. Missing pixels are replaced by black pixels.
  5008. @item smear
  5009. Adjacent pixels will spread out to replace missing pixels.
  5010. @item wrap
  5011. Out of range pixels are wrapped so they point to pixels of other side.
  5012. @end table
  5013. Default is @samp{smear}.
  5014. @end table
  5015. @subsection Examples
  5016. @itemize
  5017. @item
  5018. Add ripple effect to rgb input of video size hd720:
  5019. @example
  5020. 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
  5021. @end example
  5022. @item
  5023. Add wave effect to rgb input of video size hd720:
  5024. @example
  5025. 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
  5026. @end example
  5027. @end itemize
  5028. @section drawbox
  5029. Draw a colored box on the input image.
  5030. It accepts the following parameters:
  5031. @table @option
  5032. @item x
  5033. @item y
  5034. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  5035. @item width, w
  5036. @item height, h
  5037. The expressions which specify the width and height of the box; if 0 they are interpreted as
  5038. the input width and height. It defaults to 0.
  5039. @item color, c
  5040. Specify the color of the box to write. For the general syntax of this option,
  5041. check the "Color" section in the ffmpeg-utils manual. If the special
  5042. value @code{invert} is used, the box edge color is the same as the
  5043. video with inverted luma.
  5044. @item thickness, t
  5045. The expression which sets the thickness of the box edge. Default value is @code{3}.
  5046. See below for the list of accepted constants.
  5047. @end table
  5048. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5049. following constants:
  5050. @table @option
  5051. @item dar
  5052. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5053. @item hsub
  5054. @item vsub
  5055. horizontal and vertical chroma subsample values. For example for the
  5056. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5057. @item in_h, ih
  5058. @item in_w, iw
  5059. The input width and height.
  5060. @item sar
  5061. The input sample aspect ratio.
  5062. @item x
  5063. @item y
  5064. The x and y offset coordinates where the box is drawn.
  5065. @item w
  5066. @item h
  5067. The width and height of the drawn box.
  5068. @item t
  5069. The thickness of the drawn box.
  5070. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5071. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5072. @end table
  5073. @subsection Examples
  5074. @itemize
  5075. @item
  5076. Draw a black box around the edge of the input image:
  5077. @example
  5078. drawbox
  5079. @end example
  5080. @item
  5081. Draw a box with color red and an opacity of 50%:
  5082. @example
  5083. drawbox=10:20:200:60:red@@0.5
  5084. @end example
  5085. The previous example can be specified as:
  5086. @example
  5087. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  5088. @end example
  5089. @item
  5090. Fill the box with pink color:
  5091. @example
  5092. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
  5093. @end example
  5094. @item
  5095. Draw a 2-pixel red 2.40:1 mask:
  5096. @example
  5097. 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
  5098. @end example
  5099. @end itemize
  5100. @section drawgrid
  5101. Draw a grid on the input image.
  5102. It accepts the following parameters:
  5103. @table @option
  5104. @item x
  5105. @item y
  5106. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  5107. @item width, w
  5108. @item height, h
  5109. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  5110. input width and height, respectively, minus @code{thickness}, so image gets
  5111. framed. Default to 0.
  5112. @item color, c
  5113. Specify the color of the grid. For the general syntax of this option,
  5114. check the "Color" section in the ffmpeg-utils manual. If the special
  5115. value @code{invert} is used, the grid color is the same as the
  5116. video with inverted luma.
  5117. @item thickness, t
  5118. The expression which sets the thickness of the grid line. Default value is @code{1}.
  5119. See below for the list of accepted constants.
  5120. @end table
  5121. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5122. following constants:
  5123. @table @option
  5124. @item dar
  5125. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5126. @item hsub
  5127. @item vsub
  5128. horizontal and vertical chroma subsample values. For example for the
  5129. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5130. @item in_h, ih
  5131. @item in_w, iw
  5132. The input grid cell width and height.
  5133. @item sar
  5134. The input sample aspect ratio.
  5135. @item x
  5136. @item y
  5137. The x and y coordinates of some point of grid intersection (meant to configure offset).
  5138. @item w
  5139. @item h
  5140. The width and height of the drawn cell.
  5141. @item t
  5142. The thickness of the drawn cell.
  5143. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5144. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5145. @end table
  5146. @subsection Examples
  5147. @itemize
  5148. @item
  5149. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  5150. @example
  5151. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  5152. @end example
  5153. @item
  5154. Draw a white 3x3 grid with an opacity of 50%:
  5155. @example
  5156. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  5157. @end example
  5158. @end itemize
  5159. @anchor{drawtext}
  5160. @section drawtext
  5161. Draw a text string or text from a specified file on top of a video, using the
  5162. libfreetype library.
  5163. To enable compilation of this filter, you need to configure FFmpeg with
  5164. @code{--enable-libfreetype}.
  5165. To enable default font fallback and the @var{font} option you need to
  5166. configure FFmpeg with @code{--enable-libfontconfig}.
  5167. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  5168. @code{--enable-libfribidi}.
  5169. @subsection Syntax
  5170. It accepts the following parameters:
  5171. @table @option
  5172. @item box
  5173. Used to draw a box around text using the background color.
  5174. The value must be either 1 (enable) or 0 (disable).
  5175. The default value of @var{box} is 0.
  5176. @item boxborderw
  5177. Set the width of the border to be drawn around the box using @var{boxcolor}.
  5178. The default value of @var{boxborderw} is 0.
  5179. @item boxcolor
  5180. The color to be used for drawing box around text. For the syntax of this
  5181. option, check the "Color" section in the ffmpeg-utils manual.
  5182. The default value of @var{boxcolor} is "white".
  5183. @item borderw
  5184. Set the width of the border to be drawn around the text using @var{bordercolor}.
  5185. The default value of @var{borderw} is 0.
  5186. @item bordercolor
  5187. Set the color to be used for drawing border around text. For the syntax of this
  5188. option, check the "Color" section in the ffmpeg-utils manual.
  5189. The default value of @var{bordercolor} is "black".
  5190. @item expansion
  5191. Select how the @var{text} is expanded. Can be either @code{none},
  5192. @code{strftime} (deprecated) or
  5193. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  5194. below for details.
  5195. @item fix_bounds
  5196. If true, check and fix text coords to avoid clipping.
  5197. @item fontcolor
  5198. The color to be used for drawing fonts. For the syntax of this option, check
  5199. the "Color" section in the ffmpeg-utils manual.
  5200. The default value of @var{fontcolor} is "black".
  5201. @item fontcolor_expr
  5202. String which is expanded the same way as @var{text} to obtain dynamic
  5203. @var{fontcolor} value. By default this option has empty value and is not
  5204. processed. When this option is set, it overrides @var{fontcolor} option.
  5205. @item font
  5206. The font family to be used for drawing text. By default Sans.
  5207. @item fontfile
  5208. The font file to be used for drawing text. The path must be included.
  5209. This parameter is mandatory if the fontconfig support is disabled.
  5210. @item draw
  5211. This option does not exist, please see the timeline system
  5212. @item alpha
  5213. Draw the text applying alpha blending. The value can
  5214. be a number between 0.0 and 1.0.
  5215. The expression accepts the same variables @var{x, y} as well.
  5216. The default value is 1.
  5217. Please see @var{fontcolor_expr}.
  5218. @item fontsize
  5219. The font size to be used for drawing text.
  5220. The default value of @var{fontsize} is 16.
  5221. @item text_shaping
  5222. If set to 1, attempt to shape the text (for example, reverse the order of
  5223. right-to-left text and join Arabic characters) before drawing it.
  5224. Otherwise, just draw the text exactly as given.
  5225. By default 1 (if supported).
  5226. @item ft_load_flags
  5227. The flags to be used for loading the fonts.
  5228. The flags map the corresponding flags supported by libfreetype, and are
  5229. a combination of the following values:
  5230. @table @var
  5231. @item default
  5232. @item no_scale
  5233. @item no_hinting
  5234. @item render
  5235. @item no_bitmap
  5236. @item vertical_layout
  5237. @item force_autohint
  5238. @item crop_bitmap
  5239. @item pedantic
  5240. @item ignore_global_advance_width
  5241. @item no_recurse
  5242. @item ignore_transform
  5243. @item monochrome
  5244. @item linear_design
  5245. @item no_autohint
  5246. @end table
  5247. Default value is "default".
  5248. For more information consult the documentation for the FT_LOAD_*
  5249. libfreetype flags.
  5250. @item shadowcolor
  5251. The color to be used for drawing a shadow behind the drawn text. For the
  5252. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  5253. The default value of @var{shadowcolor} is "black".
  5254. @item shadowx
  5255. @item shadowy
  5256. The x and y offsets for the text shadow position with respect to the
  5257. position of the text. They can be either positive or negative
  5258. values. The default value for both is "0".
  5259. @item start_number
  5260. The starting frame number for the n/frame_num variable. The default value
  5261. is "0".
  5262. @item tabsize
  5263. The size in number of spaces to use for rendering the tab.
  5264. Default value is 4.
  5265. @item timecode
  5266. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  5267. format. It can be used with or without text parameter. @var{timecode_rate}
  5268. option must be specified.
  5269. @item timecode_rate, rate, r
  5270. Set the timecode frame rate (timecode only).
  5271. @item text
  5272. The text string to be drawn. The text must be a sequence of UTF-8
  5273. encoded characters.
  5274. This parameter is mandatory if no file is specified with the parameter
  5275. @var{textfile}.
  5276. @item textfile
  5277. A text file containing text to be drawn. The text must be a sequence
  5278. of UTF-8 encoded characters.
  5279. This parameter is mandatory if no text string is specified with the
  5280. parameter @var{text}.
  5281. If both @var{text} and @var{textfile} are specified, an error is thrown.
  5282. @item reload
  5283. If set to 1, the @var{textfile} will be reloaded before each frame.
  5284. Be sure to update it atomically, or it may be read partially, or even fail.
  5285. @item x
  5286. @item y
  5287. The expressions which specify the offsets where text will be drawn
  5288. within the video frame. They are relative to the top/left border of the
  5289. output image.
  5290. The default value of @var{x} and @var{y} is "0".
  5291. See below for the list of accepted constants and functions.
  5292. @end table
  5293. The parameters for @var{x} and @var{y} are expressions containing the
  5294. following constants and functions:
  5295. @table @option
  5296. @item dar
  5297. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  5298. @item hsub
  5299. @item vsub
  5300. horizontal and vertical chroma subsample values. For example for the
  5301. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5302. @item line_h, lh
  5303. the height of each text line
  5304. @item main_h, h, H
  5305. the input height
  5306. @item main_w, w, W
  5307. the input width
  5308. @item max_glyph_a, ascent
  5309. the maximum distance from the baseline to the highest/upper grid
  5310. coordinate used to place a glyph outline point, for all the rendered
  5311. glyphs.
  5312. It is a positive value, due to the grid's orientation with the Y axis
  5313. upwards.
  5314. @item max_glyph_d, descent
  5315. the maximum distance from the baseline to the lowest grid coordinate
  5316. used to place a glyph outline point, for all the rendered glyphs.
  5317. This is a negative value, due to the grid's orientation, with the Y axis
  5318. upwards.
  5319. @item max_glyph_h
  5320. maximum glyph height, that is the maximum height for all the glyphs
  5321. contained in the rendered text, it is equivalent to @var{ascent} -
  5322. @var{descent}.
  5323. @item max_glyph_w
  5324. maximum glyph width, that is the maximum width for all the glyphs
  5325. contained in the rendered text
  5326. @item n
  5327. the number of input frame, starting from 0
  5328. @item rand(min, max)
  5329. return a random number included between @var{min} and @var{max}
  5330. @item sar
  5331. The input sample aspect ratio.
  5332. @item t
  5333. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5334. @item text_h, th
  5335. the height of the rendered text
  5336. @item text_w, tw
  5337. the width of the rendered text
  5338. @item x
  5339. @item y
  5340. the x and y offset coordinates where the text is drawn.
  5341. These parameters allow the @var{x} and @var{y} expressions to refer
  5342. each other, so you can for example specify @code{y=x/dar}.
  5343. @end table
  5344. @anchor{drawtext_expansion}
  5345. @subsection Text expansion
  5346. If @option{expansion} is set to @code{strftime},
  5347. the filter recognizes strftime() sequences in the provided text and
  5348. expands them accordingly. Check the documentation of strftime(). This
  5349. feature is deprecated.
  5350. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  5351. If @option{expansion} is set to @code{normal} (which is the default),
  5352. the following expansion mechanism is used.
  5353. The backslash character @samp{\}, followed by any character, always expands to
  5354. the second character.
  5355. Sequences of the form @code{%@{...@}} are expanded. The text between the
  5356. braces is a function name, possibly followed by arguments separated by ':'.
  5357. If the arguments contain special characters or delimiters (':' or '@}'),
  5358. they should be escaped.
  5359. Note that they probably must also be escaped as the value for the
  5360. @option{text} option in the filter argument string and as the filter
  5361. argument in the filtergraph description, and possibly also for the shell,
  5362. that makes up to four levels of escaping; using a text file avoids these
  5363. problems.
  5364. The following functions are available:
  5365. @table @command
  5366. @item expr, e
  5367. The expression evaluation result.
  5368. It must take one argument specifying the expression to be evaluated,
  5369. which accepts the same constants and functions as the @var{x} and
  5370. @var{y} values. Note that not all constants should be used, for
  5371. example the text size is not known when evaluating the expression, so
  5372. the constants @var{text_w} and @var{text_h} will have an undefined
  5373. value.
  5374. @item expr_int_format, eif
  5375. Evaluate the expression's value and output as formatted integer.
  5376. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  5377. The second argument specifies the output format. Allowed values are @samp{x},
  5378. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  5379. @code{printf} function.
  5380. The third parameter is optional and sets the number of positions taken by the output.
  5381. It can be used to add padding with zeros from the left.
  5382. @item gmtime
  5383. The time at which the filter is running, expressed in UTC.
  5384. It can accept an argument: a strftime() format string.
  5385. @item localtime
  5386. The time at which the filter is running, expressed in the local time zone.
  5387. It can accept an argument: a strftime() format string.
  5388. @item metadata
  5389. Frame metadata. Takes one or two arguments.
  5390. The first argument is mandatory and specifies the metadata key.
  5391. The second argument is optional and specifies a default value, used when the
  5392. metadata key is not found or empty.
  5393. @item n, frame_num
  5394. The frame number, starting from 0.
  5395. @item pict_type
  5396. A 1 character description of the current picture type.
  5397. @item pts
  5398. The timestamp of the current frame.
  5399. It can take up to three arguments.
  5400. The first argument is the format of the timestamp; it defaults to @code{flt}
  5401. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  5402. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  5403. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  5404. @code{localtime} stands for the timestamp of the frame formatted as
  5405. local time zone time.
  5406. The second argument is an offset added to the timestamp.
  5407. If the format is set to @code{localtime} or @code{gmtime},
  5408. a third argument may be supplied: a strftime() format string.
  5409. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  5410. @end table
  5411. @subsection Examples
  5412. @itemize
  5413. @item
  5414. Draw "Test Text" with font FreeSerif, using the default values for the
  5415. optional parameters.
  5416. @example
  5417. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  5418. @end example
  5419. @item
  5420. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  5421. and y=50 (counting from the top-left corner of the screen), text is
  5422. yellow with a red box around it. Both the text and the box have an
  5423. opacity of 20%.
  5424. @example
  5425. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  5426. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  5427. @end example
  5428. Note that the double quotes are not necessary if spaces are not used
  5429. within the parameter list.
  5430. @item
  5431. Show the text at the center of the video frame:
  5432. @example
  5433. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  5434. @end example
  5435. @item
  5436. Show the text at a random position, switching to a new position every 30 seconds:
  5437. @example
  5438. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=if(eq(mod(t\,30)\,0)\,rand(0\,(w-text_w))\,x):y=if(eq(mod(t\,30)\,0)\,rand(0\,(h-text_h))\,y)"
  5439. @end example
  5440. @item
  5441. Show a text line sliding from right to left in the last row of the video
  5442. frame. The file @file{LONG_LINE} is assumed to contain a single line
  5443. with no newlines.
  5444. @example
  5445. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  5446. @end example
  5447. @item
  5448. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  5449. @example
  5450. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  5451. @end example
  5452. @item
  5453. Draw a single green letter "g", at the center of the input video.
  5454. The glyph baseline is placed at half screen height.
  5455. @example
  5456. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  5457. @end example
  5458. @item
  5459. Show text for 1 second every 3 seconds:
  5460. @example
  5461. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  5462. @end example
  5463. @item
  5464. Use fontconfig to set the font. Note that the colons need to be escaped.
  5465. @example
  5466. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  5467. @end example
  5468. @item
  5469. Print the date of a real-time encoding (see strftime(3)):
  5470. @example
  5471. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  5472. @end example
  5473. @item
  5474. Show text fading in and out (appearing/disappearing):
  5475. @example
  5476. #!/bin/sh
  5477. DS=1.0 # display start
  5478. DE=10.0 # display end
  5479. FID=1.5 # fade in duration
  5480. FOD=5 # fade out duration
  5481. 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 @}"
  5482. @end example
  5483. @end itemize
  5484. For more information about libfreetype, check:
  5485. @url{http://www.freetype.org/}.
  5486. For more information about fontconfig, check:
  5487. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  5488. For more information about libfribidi, check:
  5489. @url{http://fribidi.org/}.
  5490. @section edgedetect
  5491. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  5492. The filter accepts the following options:
  5493. @table @option
  5494. @item low
  5495. @item high
  5496. Set low and high threshold values used by the Canny thresholding
  5497. algorithm.
  5498. The high threshold selects the "strong" edge pixels, which are then
  5499. connected through 8-connectivity with the "weak" edge pixels selected
  5500. by the low threshold.
  5501. @var{low} and @var{high} threshold values must be chosen in the range
  5502. [0,1], and @var{low} should be lesser or equal to @var{high}.
  5503. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  5504. is @code{50/255}.
  5505. @item mode
  5506. Define the drawing mode.
  5507. @table @samp
  5508. @item wires
  5509. Draw white/gray wires on black background.
  5510. @item colormix
  5511. Mix the colors to create a paint/cartoon effect.
  5512. @end table
  5513. Default value is @var{wires}.
  5514. @end table
  5515. @subsection Examples
  5516. @itemize
  5517. @item
  5518. Standard edge detection with custom values for the hysteresis thresholding:
  5519. @example
  5520. edgedetect=low=0.1:high=0.4
  5521. @end example
  5522. @item
  5523. Painting effect without thresholding:
  5524. @example
  5525. edgedetect=mode=colormix:high=0
  5526. @end example
  5527. @end itemize
  5528. @section eq
  5529. Set brightness, contrast, saturation and approximate gamma adjustment.
  5530. The filter accepts the following options:
  5531. @table @option
  5532. @item contrast
  5533. Set the contrast expression. The value must be a float value in range
  5534. @code{-2.0} to @code{2.0}. The default value is "1".
  5535. @item brightness
  5536. Set the brightness expression. The value must be a float value in
  5537. range @code{-1.0} to @code{1.0}. The default value is "0".
  5538. @item saturation
  5539. Set the saturation expression. The value must be a float in
  5540. range @code{0.0} to @code{3.0}. The default value is "1".
  5541. @item gamma
  5542. Set the gamma expression. The value must be a float in range
  5543. @code{0.1} to @code{10.0}. The default value is "1".
  5544. @item gamma_r
  5545. Set the gamma expression for red. The value must be a float in
  5546. range @code{0.1} to @code{10.0}. The default value is "1".
  5547. @item gamma_g
  5548. Set the gamma expression for green. The value must be a float in range
  5549. @code{0.1} to @code{10.0}. The default value is "1".
  5550. @item gamma_b
  5551. Set the gamma expression for blue. The value must be a float in range
  5552. @code{0.1} to @code{10.0}. The default value is "1".
  5553. @item gamma_weight
  5554. Set the gamma weight expression. It can be used to reduce the effect
  5555. of a high gamma value on bright image areas, e.g. keep them from
  5556. getting overamplified and just plain white. The value must be a float
  5557. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  5558. gamma correction all the way down while @code{1.0} leaves it at its
  5559. full strength. Default is "1".
  5560. @item eval
  5561. Set when the expressions for brightness, contrast, saturation and
  5562. gamma expressions are evaluated.
  5563. It accepts the following values:
  5564. @table @samp
  5565. @item init
  5566. only evaluate expressions once during the filter initialization or
  5567. when a command is processed
  5568. @item frame
  5569. evaluate expressions for each incoming frame
  5570. @end table
  5571. Default value is @samp{init}.
  5572. @end table
  5573. The expressions accept the following parameters:
  5574. @table @option
  5575. @item n
  5576. frame count of the input frame starting from 0
  5577. @item pos
  5578. byte position of the corresponding packet in the input file, NAN if
  5579. unspecified
  5580. @item r
  5581. frame rate of the input video, NAN if the input frame rate is unknown
  5582. @item t
  5583. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5584. @end table
  5585. @subsection Commands
  5586. The filter supports the following commands:
  5587. @table @option
  5588. @item contrast
  5589. Set the contrast expression.
  5590. @item brightness
  5591. Set the brightness expression.
  5592. @item saturation
  5593. Set the saturation expression.
  5594. @item gamma
  5595. Set the gamma expression.
  5596. @item gamma_r
  5597. Set the gamma_r expression.
  5598. @item gamma_g
  5599. Set gamma_g expression.
  5600. @item gamma_b
  5601. Set gamma_b expression.
  5602. @item gamma_weight
  5603. Set gamma_weight expression.
  5604. The command accepts the same syntax of the corresponding option.
  5605. If the specified expression is not valid, it is kept at its current
  5606. value.
  5607. @end table
  5608. @section erosion
  5609. Apply erosion effect to the video.
  5610. This filter replaces the pixel by the local(3x3) minimum.
  5611. It accepts the following options:
  5612. @table @option
  5613. @item threshold0
  5614. @item threshold1
  5615. @item threshold2
  5616. @item threshold3
  5617. Limit the maximum change for each plane, default is 65535.
  5618. If 0, plane will remain unchanged.
  5619. @item coordinates
  5620. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5621. pixels are used.
  5622. Flags to local 3x3 coordinates maps like this:
  5623. 1 2 3
  5624. 4 5
  5625. 6 7 8
  5626. @end table
  5627. @section extractplanes
  5628. Extract color channel components from input video stream into
  5629. separate grayscale video streams.
  5630. The filter accepts the following option:
  5631. @table @option
  5632. @item planes
  5633. Set plane(s) to extract.
  5634. Available values for planes are:
  5635. @table @samp
  5636. @item y
  5637. @item u
  5638. @item v
  5639. @item a
  5640. @item r
  5641. @item g
  5642. @item b
  5643. @end table
  5644. Choosing planes not available in the input will result in an error.
  5645. That means you cannot select @code{r}, @code{g}, @code{b} planes
  5646. with @code{y}, @code{u}, @code{v} planes at same time.
  5647. @end table
  5648. @subsection Examples
  5649. @itemize
  5650. @item
  5651. Extract luma, u and v color channel component from input video frame
  5652. into 3 grayscale outputs:
  5653. @example
  5654. 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
  5655. @end example
  5656. @end itemize
  5657. @section elbg
  5658. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  5659. For each input image, the filter will compute the optimal mapping from
  5660. the input to the output given the codebook length, that is the number
  5661. of distinct output colors.
  5662. This filter accepts the following options.
  5663. @table @option
  5664. @item codebook_length, l
  5665. Set codebook length. The value must be a positive integer, and
  5666. represents the number of distinct output colors. Default value is 256.
  5667. @item nb_steps, n
  5668. Set the maximum number of iterations to apply for computing the optimal
  5669. mapping. The higher the value the better the result and the higher the
  5670. computation time. Default value is 1.
  5671. @item seed, s
  5672. Set a random seed, must be an integer included between 0 and
  5673. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  5674. will try to use a good random seed on a best effort basis.
  5675. @item pal8
  5676. Set pal8 output pixel format. This option does not work with codebook
  5677. length greater than 256.
  5678. @end table
  5679. @section fade
  5680. Apply a fade-in/out effect to the input video.
  5681. It accepts the following parameters:
  5682. @table @option
  5683. @item type, t
  5684. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  5685. effect.
  5686. Default is @code{in}.
  5687. @item start_frame, s
  5688. Specify the number of the frame to start applying the fade
  5689. effect at. Default is 0.
  5690. @item nb_frames, n
  5691. The number of frames that the fade effect lasts. At the end of the
  5692. fade-in effect, the output video will have the same intensity as the input video.
  5693. At the end of the fade-out transition, the output video will be filled with the
  5694. selected @option{color}.
  5695. Default is 25.
  5696. @item alpha
  5697. If set to 1, fade only alpha channel, if one exists on the input.
  5698. Default value is 0.
  5699. @item start_time, st
  5700. Specify the timestamp (in seconds) of the frame to start to apply the fade
  5701. effect. If both start_frame and start_time are specified, the fade will start at
  5702. whichever comes last. Default is 0.
  5703. @item duration, d
  5704. The number of seconds for which the fade effect has to last. At the end of the
  5705. fade-in effect the output video will have the same intensity as the input video,
  5706. at the end of the fade-out transition the output video will be filled with the
  5707. selected @option{color}.
  5708. If both duration and nb_frames are specified, duration is used. Default is 0
  5709. (nb_frames is used by default).
  5710. @item color, c
  5711. Specify the color of the fade. Default is "black".
  5712. @end table
  5713. @subsection Examples
  5714. @itemize
  5715. @item
  5716. Fade in the first 30 frames of video:
  5717. @example
  5718. fade=in:0:30
  5719. @end example
  5720. The command above is equivalent to:
  5721. @example
  5722. fade=t=in:s=0:n=30
  5723. @end example
  5724. @item
  5725. Fade out the last 45 frames of a 200-frame video:
  5726. @example
  5727. fade=out:155:45
  5728. fade=type=out:start_frame=155:nb_frames=45
  5729. @end example
  5730. @item
  5731. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  5732. @example
  5733. fade=in:0:25, fade=out:975:25
  5734. @end example
  5735. @item
  5736. Make the first 5 frames yellow, then fade in from frame 5-24:
  5737. @example
  5738. fade=in:5:20:color=yellow
  5739. @end example
  5740. @item
  5741. Fade in alpha over first 25 frames of video:
  5742. @example
  5743. fade=in:0:25:alpha=1
  5744. @end example
  5745. @item
  5746. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  5747. @example
  5748. fade=t=in:st=5.5:d=0.5
  5749. @end example
  5750. @end itemize
  5751. @section fftfilt
  5752. Apply arbitrary expressions to samples in frequency domain
  5753. @table @option
  5754. @item dc_Y
  5755. Adjust the dc value (gain) of the luma plane of the image. The filter
  5756. accepts an integer value in range @code{0} to @code{1000}. The default
  5757. value is set to @code{0}.
  5758. @item dc_U
  5759. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  5760. filter accepts an integer value in range @code{0} to @code{1000}. The
  5761. default value is set to @code{0}.
  5762. @item dc_V
  5763. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  5764. filter accepts an integer value in range @code{0} to @code{1000}. The
  5765. default value is set to @code{0}.
  5766. @item weight_Y
  5767. Set the frequency domain weight expression for the luma plane.
  5768. @item weight_U
  5769. Set the frequency domain weight expression for the 1st chroma plane.
  5770. @item weight_V
  5771. Set the frequency domain weight expression for the 2nd chroma plane.
  5772. The filter accepts the following variables:
  5773. @item X
  5774. @item Y
  5775. The coordinates of the current sample.
  5776. @item W
  5777. @item H
  5778. The width and height of the image.
  5779. @end table
  5780. @subsection Examples
  5781. @itemize
  5782. @item
  5783. High-pass:
  5784. @example
  5785. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  5786. @end example
  5787. @item
  5788. Low-pass:
  5789. @example
  5790. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  5791. @end example
  5792. @item
  5793. Sharpen:
  5794. @example
  5795. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  5796. @end example
  5797. @item
  5798. Blur:
  5799. @example
  5800. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  5801. @end example
  5802. @end itemize
  5803. @section field
  5804. Extract a single field from an interlaced image using stride
  5805. arithmetic to avoid wasting CPU time. The output frames are marked as
  5806. non-interlaced.
  5807. The filter accepts the following options:
  5808. @table @option
  5809. @item type
  5810. Specify whether to extract the top (if the value is @code{0} or
  5811. @code{top}) or the bottom field (if the value is @code{1} or
  5812. @code{bottom}).
  5813. @end table
  5814. @section fieldhint
  5815. Create new frames by copying the top and bottom fields from surrounding frames
  5816. supplied as numbers by the hint file.
  5817. @table @option
  5818. @item hint
  5819. Set file containing hints: absolute/relative frame numbers.
  5820. There must be one line for each frame in a clip. Each line must contain two
  5821. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  5822. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  5823. is current frame number for @code{absolute} mode or out of [-1, 1] range
  5824. for @code{relative} mode. First number tells from which frame to pick up top
  5825. field and second number tells from which frame to pick up bottom field.
  5826. If optionally followed by @code{+} output frame will be marked as interlaced,
  5827. else if followed by @code{-} output frame will be marked as progressive, else
  5828. it will be marked same as input frame.
  5829. If line starts with @code{#} or @code{;} that line is skipped.
  5830. @item mode
  5831. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  5832. @end table
  5833. Example of first several lines of @code{hint} file for @code{relative} mode:
  5834. @example
  5835. 0,0 - # first frame
  5836. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  5837. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  5838. 1,0 -
  5839. 0,0 -
  5840. 0,0 -
  5841. 1,0 -
  5842. 1,0 -
  5843. 1,0 -
  5844. 0,0 -
  5845. 0,0 -
  5846. 1,0 -
  5847. 1,0 -
  5848. 1,0 -
  5849. 0,0 -
  5850. @end example
  5851. @section fieldmatch
  5852. Field matching filter for inverse telecine. It is meant to reconstruct the
  5853. progressive frames from a telecined stream. The filter does not drop duplicated
  5854. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  5855. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  5856. The separation of the field matching and the decimation is notably motivated by
  5857. the possibility of inserting a de-interlacing filter fallback between the two.
  5858. If the source has mixed telecined and real interlaced content,
  5859. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  5860. But these remaining combed frames will be marked as interlaced, and thus can be
  5861. de-interlaced by a later filter such as @ref{yadif} before decimation.
  5862. In addition to the various configuration options, @code{fieldmatch} can take an
  5863. optional second stream, activated through the @option{ppsrc} option. If
  5864. enabled, the frames reconstruction will be based on the fields and frames from
  5865. this second stream. This allows the first input to be pre-processed in order to
  5866. help the various algorithms of the filter, while keeping the output lossless
  5867. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  5868. or brightness/contrast adjustments can help.
  5869. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  5870. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  5871. which @code{fieldmatch} is based on. While the semantic and usage are very
  5872. close, some behaviour and options names can differ.
  5873. The @ref{decimate} filter currently only works for constant frame rate input.
  5874. If your input has mixed telecined (30fps) and progressive content with a lower
  5875. framerate like 24fps use the following filterchain to produce the necessary cfr
  5876. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  5877. The filter accepts the following options:
  5878. @table @option
  5879. @item order
  5880. Specify the assumed field order of the input stream. Available values are:
  5881. @table @samp
  5882. @item auto
  5883. Auto detect parity (use FFmpeg's internal parity value).
  5884. @item bff
  5885. Assume bottom field first.
  5886. @item tff
  5887. Assume top field first.
  5888. @end table
  5889. Note that it is sometimes recommended not to trust the parity announced by the
  5890. stream.
  5891. Default value is @var{auto}.
  5892. @item mode
  5893. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  5894. sense that it won't risk creating jerkiness due to duplicate frames when
  5895. possible, but if there are bad edits or blended fields it will end up
  5896. outputting combed frames when a good match might actually exist. On the other
  5897. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  5898. but will almost always find a good frame if there is one. The other values are
  5899. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  5900. jerkiness and creating duplicate frames versus finding good matches in sections
  5901. with bad edits, orphaned fields, blended fields, etc.
  5902. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  5903. Available values are:
  5904. @table @samp
  5905. @item pc
  5906. 2-way matching (p/c)
  5907. @item pc_n
  5908. 2-way matching, and trying 3rd match if still combed (p/c + n)
  5909. @item pc_u
  5910. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  5911. @item pc_n_ub
  5912. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  5913. still combed (p/c + n + u/b)
  5914. @item pcn
  5915. 3-way matching (p/c/n)
  5916. @item pcn_ub
  5917. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  5918. detected as combed (p/c/n + u/b)
  5919. @end table
  5920. The parenthesis at the end indicate the matches that would be used for that
  5921. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  5922. @var{top}).
  5923. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  5924. the slowest.
  5925. Default value is @var{pc_n}.
  5926. @item ppsrc
  5927. Mark the main input stream as a pre-processed input, and enable the secondary
  5928. input stream as the clean source to pick the fields from. See the filter
  5929. introduction for more details. It is similar to the @option{clip2} feature from
  5930. VFM/TFM.
  5931. Default value is @code{0} (disabled).
  5932. @item field
  5933. Set the field to match from. It is recommended to set this to the same value as
  5934. @option{order} unless you experience matching failures with that setting. In
  5935. certain circumstances changing the field that is used to match from can have a
  5936. large impact on matching performance. Available values are:
  5937. @table @samp
  5938. @item auto
  5939. Automatic (same value as @option{order}).
  5940. @item bottom
  5941. Match from the bottom field.
  5942. @item top
  5943. Match from the top field.
  5944. @end table
  5945. Default value is @var{auto}.
  5946. @item mchroma
  5947. Set whether or not chroma is included during the match comparisons. In most
  5948. cases it is recommended to leave this enabled. You should set this to @code{0}
  5949. only if your clip has bad chroma problems such as heavy rainbowing or other
  5950. artifacts. Setting this to @code{0} could also be used to speed things up at
  5951. the cost of some accuracy.
  5952. Default value is @code{1}.
  5953. @item y0
  5954. @item y1
  5955. These define an exclusion band which excludes the lines between @option{y0} and
  5956. @option{y1} from being included in the field matching decision. An exclusion
  5957. band can be used to ignore subtitles, a logo, or other things that may
  5958. interfere with the matching. @option{y0} sets the starting scan line and
  5959. @option{y1} sets the ending line; all lines in between @option{y0} and
  5960. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  5961. @option{y0} and @option{y1} to the same value will disable the feature.
  5962. @option{y0} and @option{y1} defaults to @code{0}.
  5963. @item scthresh
  5964. Set the scene change detection threshold as a percentage of maximum change on
  5965. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  5966. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  5967. @option{scthresh} is @code{[0.0, 100.0]}.
  5968. Default value is @code{12.0}.
  5969. @item combmatch
  5970. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  5971. account the combed scores of matches when deciding what match to use as the
  5972. final match. Available values are:
  5973. @table @samp
  5974. @item none
  5975. No final matching based on combed scores.
  5976. @item sc
  5977. Combed scores are only used when a scene change is detected.
  5978. @item full
  5979. Use combed scores all the time.
  5980. @end table
  5981. Default is @var{sc}.
  5982. @item combdbg
  5983. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  5984. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  5985. Available values are:
  5986. @table @samp
  5987. @item none
  5988. No forced calculation.
  5989. @item pcn
  5990. Force p/c/n calculations.
  5991. @item pcnub
  5992. Force p/c/n/u/b calculations.
  5993. @end table
  5994. Default value is @var{none}.
  5995. @item cthresh
  5996. This is the area combing threshold used for combed frame detection. This
  5997. essentially controls how "strong" or "visible" combing must be to be detected.
  5998. Larger values mean combing must be more visible and smaller values mean combing
  5999. can be less visible or strong and still be detected. Valid settings are from
  6000. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  6001. be detected as combed). This is basically a pixel difference value. A good
  6002. range is @code{[8, 12]}.
  6003. Default value is @code{9}.
  6004. @item chroma
  6005. Sets whether or not chroma is considered in the combed frame decision. Only
  6006. disable this if your source has chroma problems (rainbowing, etc.) that are
  6007. causing problems for the combed frame detection with chroma enabled. Actually,
  6008. using @option{chroma}=@var{0} is usually more reliable, except for the case
  6009. where there is chroma only combing in the source.
  6010. Default value is @code{0}.
  6011. @item blockx
  6012. @item blocky
  6013. Respectively set the x-axis and y-axis size of the window used during combed
  6014. frame detection. This has to do with the size of the area in which
  6015. @option{combpel} pixels are required to be detected as combed for a frame to be
  6016. declared combed. See the @option{combpel} parameter description for more info.
  6017. Possible values are any number that is a power of 2 starting at 4 and going up
  6018. to 512.
  6019. Default value is @code{16}.
  6020. @item combpel
  6021. The number of combed pixels inside any of the @option{blocky} by
  6022. @option{blockx} size blocks on the frame for the frame to be detected as
  6023. combed. While @option{cthresh} controls how "visible" the combing must be, this
  6024. setting controls "how much" combing there must be in any localized area (a
  6025. window defined by the @option{blockx} and @option{blocky} settings) on the
  6026. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  6027. which point no frames will ever be detected as combed). This setting is known
  6028. as @option{MI} in TFM/VFM vocabulary.
  6029. Default value is @code{80}.
  6030. @end table
  6031. @anchor{p/c/n/u/b meaning}
  6032. @subsection p/c/n/u/b meaning
  6033. @subsubsection p/c/n
  6034. We assume the following telecined stream:
  6035. @example
  6036. Top fields: 1 2 2 3 4
  6037. Bottom fields: 1 2 3 4 4
  6038. @end example
  6039. The numbers correspond to the progressive frame the fields relate to. Here, the
  6040. first two frames are progressive, the 3rd and 4th are combed, and so on.
  6041. When @code{fieldmatch} is configured to run a matching from bottom
  6042. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  6043. @example
  6044. Input stream:
  6045. T 1 2 2 3 4
  6046. B 1 2 3 4 4 <-- matching reference
  6047. Matches: c c n n c
  6048. Output stream:
  6049. T 1 2 3 4 4
  6050. B 1 2 3 4 4
  6051. @end example
  6052. As a result of the field matching, we can see that some frames get duplicated.
  6053. To perform a complete inverse telecine, you need to rely on a decimation filter
  6054. after this operation. See for instance the @ref{decimate} filter.
  6055. The same operation now matching from top fields (@option{field}=@var{top})
  6056. looks like this:
  6057. @example
  6058. Input stream:
  6059. T 1 2 2 3 4 <-- matching reference
  6060. B 1 2 3 4 4
  6061. Matches: c c p p c
  6062. Output stream:
  6063. T 1 2 2 3 4
  6064. B 1 2 2 3 4
  6065. @end example
  6066. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  6067. basically, they refer to the frame and field of the opposite parity:
  6068. @itemize
  6069. @item @var{p} matches the field of the opposite parity in the previous frame
  6070. @item @var{c} matches the field of the opposite parity in the current frame
  6071. @item @var{n} matches the field of the opposite parity in the next frame
  6072. @end itemize
  6073. @subsubsection u/b
  6074. The @var{u} and @var{b} matching are a bit special in the sense that they match
  6075. from the opposite parity flag. In the following examples, we assume that we are
  6076. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  6077. 'x' is placed above and below each matched fields.
  6078. With bottom matching (@option{field}=@var{bottom}):
  6079. @example
  6080. Match: c p n b u
  6081. x x x x x
  6082. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6083. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6084. x x x x x
  6085. Output frames:
  6086. 2 1 2 2 2
  6087. 2 2 2 1 3
  6088. @end example
  6089. With top matching (@option{field}=@var{top}):
  6090. @example
  6091. Match: c p n b u
  6092. x x x x x
  6093. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6094. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6095. x x x x x
  6096. Output frames:
  6097. 2 2 2 1 2
  6098. 2 1 3 2 2
  6099. @end example
  6100. @subsection Examples
  6101. Simple IVTC of a top field first telecined stream:
  6102. @example
  6103. fieldmatch=order=tff:combmatch=none, decimate
  6104. @end example
  6105. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  6106. @example
  6107. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  6108. @end example
  6109. @section fieldorder
  6110. Transform the field order of the input video.
  6111. It accepts the following parameters:
  6112. @table @option
  6113. @item order
  6114. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  6115. for bottom field first.
  6116. @end table
  6117. The default value is @samp{tff}.
  6118. The transformation is done by shifting the picture content up or down
  6119. by one line, and filling the remaining line with appropriate picture content.
  6120. This method is consistent with most broadcast field order converters.
  6121. If the input video is not flagged as being interlaced, or it is already
  6122. flagged as being of the required output field order, then this filter does
  6123. not alter the incoming video.
  6124. It is very useful when converting to or from PAL DV material,
  6125. which is bottom field first.
  6126. For example:
  6127. @example
  6128. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  6129. @end example
  6130. @section fifo, afifo
  6131. Buffer input images and send them when they are requested.
  6132. It is mainly useful when auto-inserted by the libavfilter
  6133. framework.
  6134. It does not take parameters.
  6135. @section find_rect
  6136. Find a rectangular object
  6137. It accepts the following options:
  6138. @table @option
  6139. @item object
  6140. Filepath of the object image, needs to be in gray8.
  6141. @item threshold
  6142. Detection threshold, default is 0.5.
  6143. @item mipmaps
  6144. Number of mipmaps, default is 3.
  6145. @item xmin, ymin, xmax, ymax
  6146. Specifies the rectangle in which to search.
  6147. @end table
  6148. @subsection Examples
  6149. @itemize
  6150. @item
  6151. Generate a representative palette of a given video using @command{ffmpeg}:
  6152. @example
  6153. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6154. @end example
  6155. @end itemize
  6156. @section cover_rect
  6157. Cover a rectangular object
  6158. It accepts the following options:
  6159. @table @option
  6160. @item cover
  6161. Filepath of the optional cover image, needs to be in yuv420.
  6162. @item mode
  6163. Set covering mode.
  6164. It accepts the following values:
  6165. @table @samp
  6166. @item cover
  6167. cover it by the supplied image
  6168. @item blur
  6169. cover it by interpolating the surrounding pixels
  6170. @end table
  6171. Default value is @var{blur}.
  6172. @end table
  6173. @subsection Examples
  6174. @itemize
  6175. @item
  6176. Generate a representative palette of a given video using @command{ffmpeg}:
  6177. @example
  6178. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6179. @end example
  6180. @end itemize
  6181. @anchor{format}
  6182. @section format
  6183. Convert the input video to one of the specified pixel formats.
  6184. Libavfilter will try to pick one that is suitable as input to
  6185. the next filter.
  6186. It accepts the following parameters:
  6187. @table @option
  6188. @item pix_fmts
  6189. A '|'-separated list of pixel format names, such as
  6190. "pix_fmts=yuv420p|monow|rgb24".
  6191. @end table
  6192. @subsection Examples
  6193. @itemize
  6194. @item
  6195. Convert the input video to the @var{yuv420p} format
  6196. @example
  6197. format=pix_fmts=yuv420p
  6198. @end example
  6199. Convert the input video to any of the formats in the list
  6200. @example
  6201. format=pix_fmts=yuv420p|yuv444p|yuv410p
  6202. @end example
  6203. @end itemize
  6204. @anchor{fps}
  6205. @section fps
  6206. Convert the video to specified constant frame rate by duplicating or dropping
  6207. frames as necessary.
  6208. It accepts the following parameters:
  6209. @table @option
  6210. @item fps
  6211. The desired output frame rate. The default is @code{25}.
  6212. @item round
  6213. Rounding method.
  6214. Possible values are:
  6215. @table @option
  6216. @item zero
  6217. zero round towards 0
  6218. @item inf
  6219. round away from 0
  6220. @item down
  6221. round towards -infinity
  6222. @item up
  6223. round towards +infinity
  6224. @item near
  6225. round to nearest
  6226. @end table
  6227. The default is @code{near}.
  6228. @item start_time
  6229. Assume the first PTS should be the given value, in seconds. This allows for
  6230. padding/trimming at the start of stream. By default, no assumption is made
  6231. about the first frame's expected PTS, so no padding or trimming is done.
  6232. For example, this could be set to 0 to pad the beginning with duplicates of
  6233. the first frame if a video stream starts after the audio stream or to trim any
  6234. frames with a negative PTS.
  6235. @end table
  6236. Alternatively, the options can be specified as a flat string:
  6237. @var{fps}[:@var{round}].
  6238. See also the @ref{setpts} filter.
  6239. @subsection Examples
  6240. @itemize
  6241. @item
  6242. A typical usage in order to set the fps to 25:
  6243. @example
  6244. fps=fps=25
  6245. @end example
  6246. @item
  6247. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  6248. @example
  6249. fps=fps=film:round=near
  6250. @end example
  6251. @end itemize
  6252. @section framepack
  6253. Pack two different video streams into a stereoscopic video, setting proper
  6254. metadata on supported codecs. The two views should have the same size and
  6255. framerate and processing will stop when the shorter video ends. Please note
  6256. that you may conveniently adjust view properties with the @ref{scale} and
  6257. @ref{fps} filters.
  6258. It accepts the following parameters:
  6259. @table @option
  6260. @item format
  6261. The desired packing format. Supported values are:
  6262. @table @option
  6263. @item sbs
  6264. The views are next to each other (default).
  6265. @item tab
  6266. The views are on top of each other.
  6267. @item lines
  6268. The views are packed by line.
  6269. @item columns
  6270. The views are packed by column.
  6271. @item frameseq
  6272. The views are temporally interleaved.
  6273. @end table
  6274. @end table
  6275. Some examples:
  6276. @example
  6277. # Convert left and right views into a frame-sequential video
  6278. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  6279. # Convert views into a side-by-side video with the same output resolution as the input
  6280. 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
  6281. @end example
  6282. @section framerate
  6283. Change the frame rate by interpolating new video output frames from the source
  6284. frames.
  6285. This filter is not designed to function correctly with interlaced media. If
  6286. you wish to change the frame rate of interlaced media then you are required
  6287. to deinterlace before this filter and re-interlace after this filter.
  6288. A description of the accepted options follows.
  6289. @table @option
  6290. @item fps
  6291. Specify the output frames per second. This option can also be specified
  6292. as a value alone. The default is @code{50}.
  6293. @item interp_start
  6294. Specify the start of a range where the output frame will be created as a
  6295. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6296. the default is @code{15}.
  6297. @item interp_end
  6298. Specify the end of a range where the output frame will be created as a
  6299. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6300. the default is @code{240}.
  6301. @item scene
  6302. Specify the level at which a scene change is detected as a value between
  6303. 0 and 100 to indicate a new scene; a low value reflects a low
  6304. probability for the current frame to introduce a new scene, while a higher
  6305. value means the current frame is more likely to be one.
  6306. The default is @code{7}.
  6307. @item flags
  6308. Specify flags influencing the filter process.
  6309. Available value for @var{flags} is:
  6310. @table @option
  6311. @item scene_change_detect, scd
  6312. Enable scene change detection using the value of the option @var{scene}.
  6313. This flag is enabled by default.
  6314. @end table
  6315. @end table
  6316. @section framestep
  6317. Select one frame every N-th frame.
  6318. This filter accepts the following option:
  6319. @table @option
  6320. @item step
  6321. Select frame after every @code{step} frames.
  6322. Allowed values are positive integers higher than 0. Default value is @code{1}.
  6323. @end table
  6324. @anchor{frei0r}
  6325. @section frei0r
  6326. Apply a frei0r effect to the input video.
  6327. To enable the compilation of this filter, you need to install the frei0r
  6328. header and configure FFmpeg with @code{--enable-frei0r}.
  6329. It accepts the following parameters:
  6330. @table @option
  6331. @item filter_name
  6332. The name of the frei0r effect to load. If the environment variable
  6333. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  6334. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  6335. Otherwise, the standard frei0r paths are searched, in this order:
  6336. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  6337. @file{/usr/lib/frei0r-1/}.
  6338. @item filter_params
  6339. A '|'-separated list of parameters to pass to the frei0r effect.
  6340. @end table
  6341. A frei0r effect parameter can be a boolean (its value is either
  6342. "y" or "n"), a double, a color (specified as
  6343. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  6344. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  6345. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  6346. @var{X} and @var{Y} are floating point numbers) and/or a string.
  6347. The number and types of parameters depend on the loaded effect. If an
  6348. effect parameter is not specified, the default value is set.
  6349. @subsection Examples
  6350. @itemize
  6351. @item
  6352. Apply the distort0r effect, setting the first two double parameters:
  6353. @example
  6354. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  6355. @end example
  6356. @item
  6357. Apply the colordistance effect, taking a color as the first parameter:
  6358. @example
  6359. frei0r=colordistance:0.2/0.3/0.4
  6360. frei0r=colordistance:violet
  6361. frei0r=colordistance:0x112233
  6362. @end example
  6363. @item
  6364. Apply the perspective effect, specifying the top left and top right image
  6365. positions:
  6366. @example
  6367. frei0r=perspective:0.2/0.2|0.8/0.2
  6368. @end example
  6369. @end itemize
  6370. For more information, see
  6371. @url{http://frei0r.dyne.org}
  6372. @section fspp
  6373. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  6374. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  6375. processing filter, one of them is performed once per block, not per pixel.
  6376. This allows for much higher speed.
  6377. The filter accepts the following options:
  6378. @table @option
  6379. @item quality
  6380. Set quality. This option defines the number of levels for averaging. It accepts
  6381. an integer in the range 4-5. Default value is @code{4}.
  6382. @item qp
  6383. Force a constant quantization parameter. It accepts an integer in range 0-63.
  6384. If not set, the filter will use the QP from the video stream (if available).
  6385. @item strength
  6386. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  6387. more details but also more artifacts, while higher values make the image smoother
  6388. but also blurrier. Default value is @code{0} − PSNR optimal.
  6389. @item use_bframe_qp
  6390. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  6391. option may cause flicker since the B-Frames have often larger QP. Default is
  6392. @code{0} (not enabled).
  6393. @end table
  6394. @section gblur
  6395. Apply Gaussian blur filter.
  6396. The filter accepts the following options:
  6397. @table @option
  6398. @item sigma
  6399. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  6400. @item steps
  6401. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  6402. @item planes
  6403. Set which planes to filter. By default all planes are filtered.
  6404. @item sigmaV
  6405. Set vertical sigma, if negative it will be same as @code{sigma}.
  6406. Default is @code{-1}.
  6407. @end table
  6408. @section geq
  6409. The filter accepts the following options:
  6410. @table @option
  6411. @item lum_expr, lum
  6412. Set the luminance expression.
  6413. @item cb_expr, cb
  6414. Set the chrominance blue expression.
  6415. @item cr_expr, cr
  6416. Set the chrominance red expression.
  6417. @item alpha_expr, a
  6418. Set the alpha expression.
  6419. @item red_expr, r
  6420. Set the red expression.
  6421. @item green_expr, g
  6422. Set the green expression.
  6423. @item blue_expr, b
  6424. Set the blue expression.
  6425. @end table
  6426. The colorspace is selected according to the specified options. If one
  6427. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  6428. options is specified, the filter will automatically select a YCbCr
  6429. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  6430. @option{blue_expr} options is specified, it will select an RGB
  6431. colorspace.
  6432. If one of the chrominance expression is not defined, it falls back on the other
  6433. one. If no alpha expression is specified it will evaluate to opaque value.
  6434. If none of chrominance expressions are specified, they will evaluate
  6435. to the luminance expression.
  6436. The expressions can use the following variables and functions:
  6437. @table @option
  6438. @item N
  6439. The sequential number of the filtered frame, starting from @code{0}.
  6440. @item X
  6441. @item Y
  6442. The coordinates of the current sample.
  6443. @item W
  6444. @item H
  6445. The width and height of the image.
  6446. @item SW
  6447. @item SH
  6448. Width and height scale depending on the currently filtered plane. It is the
  6449. ratio between the corresponding luma plane number of pixels and the current
  6450. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  6451. @code{0.5,0.5} for chroma planes.
  6452. @item T
  6453. Time of the current frame, expressed in seconds.
  6454. @item p(x, y)
  6455. Return the value of the pixel at location (@var{x},@var{y}) of the current
  6456. plane.
  6457. @item lum(x, y)
  6458. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  6459. plane.
  6460. @item cb(x, y)
  6461. Return the value of the pixel at location (@var{x},@var{y}) of the
  6462. blue-difference chroma plane. Return 0 if there is no such plane.
  6463. @item cr(x, y)
  6464. Return the value of the pixel at location (@var{x},@var{y}) of the
  6465. red-difference chroma plane. Return 0 if there is no such plane.
  6466. @item r(x, y)
  6467. @item g(x, y)
  6468. @item b(x, y)
  6469. Return the value of the pixel at location (@var{x},@var{y}) of the
  6470. red/green/blue component. Return 0 if there is no such component.
  6471. @item alpha(x, y)
  6472. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  6473. plane. Return 0 if there is no such plane.
  6474. @end table
  6475. For functions, if @var{x} and @var{y} are outside the area, the value will be
  6476. automatically clipped to the closer edge.
  6477. @subsection Examples
  6478. @itemize
  6479. @item
  6480. Flip the image horizontally:
  6481. @example
  6482. geq=p(W-X\,Y)
  6483. @end example
  6484. @item
  6485. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  6486. wavelength of 100 pixels:
  6487. @example
  6488. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  6489. @end example
  6490. @item
  6491. Generate a fancy enigmatic moving light:
  6492. @example
  6493. 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
  6494. @end example
  6495. @item
  6496. Generate a quick emboss effect:
  6497. @example
  6498. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  6499. @end example
  6500. @item
  6501. Modify RGB components depending on pixel position:
  6502. @example
  6503. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  6504. @end example
  6505. @item
  6506. Create a radial gradient that is the same size as the input (also see
  6507. the @ref{vignette} filter):
  6508. @example
  6509. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  6510. @end example
  6511. @end itemize
  6512. @section gradfun
  6513. Fix the banding artifacts that are sometimes introduced into nearly flat
  6514. regions by truncation to 8-bit color depth.
  6515. Interpolate the gradients that should go where the bands are, and
  6516. dither them.
  6517. It is designed for playback only. Do not use it prior to
  6518. lossy compression, because compression tends to lose the dither and
  6519. bring back the bands.
  6520. It accepts the following parameters:
  6521. @table @option
  6522. @item strength
  6523. The maximum amount by which the filter will change any one pixel. This is also
  6524. the threshold for detecting nearly flat regions. Acceptable values range from
  6525. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  6526. valid range.
  6527. @item radius
  6528. The neighborhood to fit the gradient to. A larger radius makes for smoother
  6529. gradients, but also prevents the filter from modifying the pixels near detailed
  6530. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  6531. values will be clipped to the valid range.
  6532. @end table
  6533. Alternatively, the options can be specified as a flat string:
  6534. @var{strength}[:@var{radius}]
  6535. @subsection Examples
  6536. @itemize
  6537. @item
  6538. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  6539. @example
  6540. gradfun=3.5:8
  6541. @end example
  6542. @item
  6543. Specify radius, omitting the strength (which will fall-back to the default
  6544. value):
  6545. @example
  6546. gradfun=radius=8
  6547. @end example
  6548. @end itemize
  6549. @anchor{haldclut}
  6550. @section haldclut
  6551. Apply a Hald CLUT to a video stream.
  6552. First input is the video stream to process, and second one is the Hald CLUT.
  6553. The Hald CLUT input can be a simple picture or a complete video stream.
  6554. The filter accepts the following options:
  6555. @table @option
  6556. @item shortest
  6557. Force termination when the shortest input terminates. Default is @code{0}.
  6558. @item repeatlast
  6559. Continue applying the last CLUT after the end of the stream. A value of
  6560. @code{0} disable the filter after the last frame of the CLUT is reached.
  6561. Default is @code{1}.
  6562. @end table
  6563. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  6564. filters share the same internals).
  6565. More information about the Hald CLUT can be found on Eskil Steenberg's website
  6566. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  6567. @subsection Workflow examples
  6568. @subsubsection Hald CLUT video stream
  6569. Generate an identity Hald CLUT stream altered with various effects:
  6570. @example
  6571. 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
  6572. @end example
  6573. Note: make sure you use a lossless codec.
  6574. Then use it with @code{haldclut} to apply it on some random stream:
  6575. @example
  6576. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  6577. @end example
  6578. The Hald CLUT will be applied to the 10 first seconds (duration of
  6579. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  6580. to the remaining frames of the @code{mandelbrot} stream.
  6581. @subsubsection Hald CLUT with preview
  6582. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  6583. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  6584. biggest possible square starting at the top left of the picture. The remaining
  6585. padding pixels (bottom or right) will be ignored. This area can be used to add
  6586. a preview of the Hald CLUT.
  6587. Typically, the following generated Hald CLUT will be supported by the
  6588. @code{haldclut} filter:
  6589. @example
  6590. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  6591. pad=iw+320 [padded_clut];
  6592. smptebars=s=320x256, split [a][b];
  6593. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  6594. [main][b] overlay=W-320" -frames:v 1 clut.png
  6595. @end example
  6596. It contains the original and a preview of the effect of the CLUT: SMPTE color
  6597. bars are displayed on the right-top, and below the same color bars processed by
  6598. the color changes.
  6599. Then, the effect of this Hald CLUT can be visualized with:
  6600. @example
  6601. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  6602. @end example
  6603. @section hflip
  6604. Flip the input video horizontally.
  6605. For example, to horizontally flip the input video with @command{ffmpeg}:
  6606. @example
  6607. ffmpeg -i in.avi -vf "hflip" out.avi
  6608. @end example
  6609. @section histeq
  6610. This filter applies a global color histogram equalization on a
  6611. per-frame basis.
  6612. It can be used to correct video that has a compressed range of pixel
  6613. intensities. The filter redistributes the pixel intensities to
  6614. equalize their distribution across the intensity range. It may be
  6615. viewed as an "automatically adjusting contrast filter". This filter is
  6616. useful only for correcting degraded or poorly captured source
  6617. video.
  6618. The filter accepts the following options:
  6619. @table @option
  6620. @item strength
  6621. Determine the amount of equalization to be applied. As the strength
  6622. is reduced, the distribution of pixel intensities more-and-more
  6623. approaches that of the input frame. The value must be a float number
  6624. in the range [0,1] and defaults to 0.200.
  6625. @item intensity
  6626. Set the maximum intensity that can generated and scale the output
  6627. values appropriately. The strength should be set as desired and then
  6628. the intensity can be limited if needed to avoid washing-out. The value
  6629. must be a float number in the range [0,1] and defaults to 0.210.
  6630. @item antibanding
  6631. Set the antibanding level. If enabled the filter will randomly vary
  6632. the luminance of output pixels by a small amount to avoid banding of
  6633. the histogram. Possible values are @code{none}, @code{weak} or
  6634. @code{strong}. It defaults to @code{none}.
  6635. @end table
  6636. @section histogram
  6637. Compute and draw a color distribution histogram for the input video.
  6638. The computed histogram is a representation of the color component
  6639. distribution in an image.
  6640. Standard histogram displays the color components distribution in an image.
  6641. Displays color graph for each color component. Shows distribution of
  6642. the Y, U, V, A or R, G, B components, depending on input format, in the
  6643. current frame. Below each graph a color component scale meter is shown.
  6644. The filter accepts the following options:
  6645. @table @option
  6646. @item level_height
  6647. Set height of level. Default value is @code{200}.
  6648. Allowed range is [50, 2048].
  6649. @item scale_height
  6650. Set height of color scale. Default value is @code{12}.
  6651. Allowed range is [0, 40].
  6652. @item display_mode
  6653. Set display mode.
  6654. It accepts the following values:
  6655. @table @samp
  6656. @item parade
  6657. Per color component graphs are placed below each other.
  6658. @item overlay
  6659. Presents information identical to that in the @code{parade}, except
  6660. that the graphs representing color components are superimposed directly
  6661. over one another.
  6662. @end table
  6663. Default is @code{parade}.
  6664. @item levels_mode
  6665. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  6666. Default is @code{linear}.
  6667. @item components
  6668. Set what color components to display.
  6669. Default is @code{7}.
  6670. @item fgopacity
  6671. Set foreground opacity. Default is @code{0.7}.
  6672. @item bgopacity
  6673. Set background opacity. Default is @code{0.5}.
  6674. @end table
  6675. @subsection Examples
  6676. @itemize
  6677. @item
  6678. Calculate and draw histogram:
  6679. @example
  6680. ffplay -i input -vf histogram
  6681. @end example
  6682. @end itemize
  6683. @anchor{hqdn3d}
  6684. @section hqdn3d
  6685. This is a high precision/quality 3d denoise filter. It aims to reduce
  6686. image noise, producing smooth images and making still images really
  6687. still. It should enhance compressibility.
  6688. It accepts the following optional parameters:
  6689. @table @option
  6690. @item luma_spatial
  6691. A non-negative floating point number which specifies spatial luma strength.
  6692. It defaults to 4.0.
  6693. @item chroma_spatial
  6694. A non-negative floating point number which specifies spatial chroma strength.
  6695. It defaults to 3.0*@var{luma_spatial}/4.0.
  6696. @item luma_tmp
  6697. A floating point number which specifies luma temporal strength. It defaults to
  6698. 6.0*@var{luma_spatial}/4.0.
  6699. @item chroma_tmp
  6700. A floating point number which specifies chroma temporal strength. It defaults to
  6701. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  6702. @end table
  6703. @anchor{hwupload_cuda}
  6704. @section hwupload_cuda
  6705. Upload system memory frames to a CUDA device.
  6706. It accepts the following optional parameters:
  6707. @table @option
  6708. @item device
  6709. The number of the CUDA device to use
  6710. @end table
  6711. @section hqx
  6712. Apply a high-quality magnification filter designed for pixel art. This filter
  6713. was originally created by Maxim Stepin.
  6714. It accepts the following option:
  6715. @table @option
  6716. @item n
  6717. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  6718. @code{hq3x} and @code{4} for @code{hq4x}.
  6719. Default is @code{3}.
  6720. @end table
  6721. @section hstack
  6722. Stack input videos horizontally.
  6723. All streams must be of same pixel format and of same height.
  6724. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  6725. to create same output.
  6726. The filter accept the following option:
  6727. @table @option
  6728. @item inputs
  6729. Set number of input streams. Default is 2.
  6730. @item shortest
  6731. If set to 1, force the output to terminate when the shortest input
  6732. terminates. Default value is 0.
  6733. @end table
  6734. @section hue
  6735. Modify the hue and/or the saturation of the input.
  6736. It accepts the following parameters:
  6737. @table @option
  6738. @item h
  6739. Specify the hue angle as a number of degrees. It accepts an expression,
  6740. and defaults to "0".
  6741. @item s
  6742. Specify the saturation in the [-10,10] range. It accepts an expression and
  6743. defaults to "1".
  6744. @item H
  6745. Specify the hue angle as a number of radians. It accepts an
  6746. expression, and defaults to "0".
  6747. @item b
  6748. Specify the brightness in the [-10,10] range. It accepts an expression and
  6749. defaults to "0".
  6750. @end table
  6751. @option{h} and @option{H} are mutually exclusive, and can't be
  6752. specified at the same time.
  6753. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  6754. expressions containing the following constants:
  6755. @table @option
  6756. @item n
  6757. frame count of the input frame starting from 0
  6758. @item pts
  6759. presentation timestamp of the input frame expressed in time base units
  6760. @item r
  6761. frame rate of the input video, NAN if the input frame rate is unknown
  6762. @item t
  6763. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6764. @item tb
  6765. time base of the input video
  6766. @end table
  6767. @subsection Examples
  6768. @itemize
  6769. @item
  6770. Set the hue to 90 degrees and the saturation to 1.0:
  6771. @example
  6772. hue=h=90:s=1
  6773. @end example
  6774. @item
  6775. Same command but expressing the hue in radians:
  6776. @example
  6777. hue=H=PI/2:s=1
  6778. @end example
  6779. @item
  6780. Rotate hue and make the saturation swing between 0
  6781. and 2 over a period of 1 second:
  6782. @example
  6783. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  6784. @end example
  6785. @item
  6786. Apply a 3 seconds saturation fade-in effect starting at 0:
  6787. @example
  6788. hue="s=min(t/3\,1)"
  6789. @end example
  6790. The general fade-in expression can be written as:
  6791. @example
  6792. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  6793. @end example
  6794. @item
  6795. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  6796. @example
  6797. hue="s=max(0\, min(1\, (8-t)/3))"
  6798. @end example
  6799. The general fade-out expression can be written as:
  6800. @example
  6801. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  6802. @end example
  6803. @end itemize
  6804. @subsection Commands
  6805. This filter supports the following commands:
  6806. @table @option
  6807. @item b
  6808. @item s
  6809. @item h
  6810. @item H
  6811. Modify the hue and/or the saturation and/or brightness of the input video.
  6812. The command accepts the same syntax of the corresponding option.
  6813. If the specified expression is not valid, it is kept at its current
  6814. value.
  6815. @end table
  6816. @section hysteresis
  6817. Grow first stream into second stream by connecting components.
  6818. This makes it possible to build more robust edge masks.
  6819. This filter accepts the following options:
  6820. @table @option
  6821. @item planes
  6822. Set which planes will be processed as bitmap, unprocessed planes will be
  6823. copied from first stream.
  6824. By default value 0xf, all planes will be processed.
  6825. @item threshold
  6826. Set threshold which is used in filtering. If pixel component value is higher than
  6827. this value filter algorithm for connecting components is activated.
  6828. By default value is 0.
  6829. @end table
  6830. @section idet
  6831. Detect video interlacing type.
  6832. This filter tries to detect if the input frames are interlaced, progressive,
  6833. top or bottom field first. It will also try to detect fields that are
  6834. repeated between adjacent frames (a sign of telecine).
  6835. Single frame detection considers only immediately adjacent frames when classifying each frame.
  6836. Multiple frame detection incorporates the classification history of previous frames.
  6837. The filter will log these metadata values:
  6838. @table @option
  6839. @item single.current_frame
  6840. Detected type of current frame using single-frame detection. One of:
  6841. ``tff'' (top field first), ``bff'' (bottom field first),
  6842. ``progressive'', or ``undetermined''
  6843. @item single.tff
  6844. Cumulative number of frames detected as top field first using single-frame detection.
  6845. @item multiple.tff
  6846. Cumulative number of frames detected as top field first using multiple-frame detection.
  6847. @item single.bff
  6848. Cumulative number of frames detected as bottom field first using single-frame detection.
  6849. @item multiple.current_frame
  6850. Detected type of current frame using multiple-frame detection. One of:
  6851. ``tff'' (top field first), ``bff'' (bottom field first),
  6852. ``progressive'', or ``undetermined''
  6853. @item multiple.bff
  6854. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  6855. @item single.progressive
  6856. Cumulative number of frames detected as progressive using single-frame detection.
  6857. @item multiple.progressive
  6858. Cumulative number of frames detected as progressive using multiple-frame detection.
  6859. @item single.undetermined
  6860. Cumulative number of frames that could not be classified using single-frame detection.
  6861. @item multiple.undetermined
  6862. Cumulative number of frames that could not be classified using multiple-frame detection.
  6863. @item repeated.current_frame
  6864. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  6865. @item repeated.neither
  6866. Cumulative number of frames with no repeated field.
  6867. @item repeated.top
  6868. Cumulative number of frames with the top field repeated from the previous frame's top field.
  6869. @item repeated.bottom
  6870. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  6871. @end table
  6872. The filter accepts the following options:
  6873. @table @option
  6874. @item intl_thres
  6875. Set interlacing threshold.
  6876. @item prog_thres
  6877. Set progressive threshold.
  6878. @item rep_thres
  6879. Threshold for repeated field detection.
  6880. @item half_life
  6881. Number of frames after which a given frame's contribution to the
  6882. statistics is halved (i.e., it contributes only 0.5 to its
  6883. classification). The default of 0 means that all frames seen are given
  6884. full weight of 1.0 forever.
  6885. @item analyze_interlaced_flag
  6886. When this is not 0 then idet will use the specified number of frames to determine
  6887. if the interlaced flag is accurate, it will not count undetermined frames.
  6888. If the flag is found to be accurate it will be used without any further
  6889. computations, if it is found to be inaccurate it will be cleared without any
  6890. further computations. This allows inserting the idet filter as a low computational
  6891. method to clean up the interlaced flag
  6892. @end table
  6893. @section il
  6894. Deinterleave or interleave fields.
  6895. This filter allows one to process interlaced images fields without
  6896. deinterlacing them. Deinterleaving splits the input frame into 2
  6897. fields (so called half pictures). Odd lines are moved to the top
  6898. half of the output image, even lines to the bottom half.
  6899. You can process (filter) them independently and then re-interleave them.
  6900. The filter accepts the following options:
  6901. @table @option
  6902. @item luma_mode, l
  6903. @item chroma_mode, c
  6904. @item alpha_mode, a
  6905. Available values for @var{luma_mode}, @var{chroma_mode} and
  6906. @var{alpha_mode} are:
  6907. @table @samp
  6908. @item none
  6909. Do nothing.
  6910. @item deinterleave, d
  6911. Deinterleave fields, placing one above the other.
  6912. @item interleave, i
  6913. Interleave fields. Reverse the effect of deinterleaving.
  6914. @end table
  6915. Default value is @code{none}.
  6916. @item luma_swap, ls
  6917. @item chroma_swap, cs
  6918. @item alpha_swap, as
  6919. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  6920. @end table
  6921. @section inflate
  6922. Apply inflate effect to the video.
  6923. This filter replaces the pixel by the local(3x3) average by taking into account
  6924. only values higher than the pixel.
  6925. It accepts the following options:
  6926. @table @option
  6927. @item threshold0
  6928. @item threshold1
  6929. @item threshold2
  6930. @item threshold3
  6931. Limit the maximum change for each plane, default is 65535.
  6932. If 0, plane will remain unchanged.
  6933. @end table
  6934. @section interlace
  6935. Simple interlacing filter from progressive contents. This interleaves upper (or
  6936. lower) lines from odd frames with lower (or upper) lines from even frames,
  6937. halving the frame rate and preserving image height.
  6938. @example
  6939. Original Original New Frame
  6940. Frame 'j' Frame 'j+1' (tff)
  6941. ========== =========== ==================
  6942. Line 0 --------------------> Frame 'j' Line 0
  6943. Line 1 Line 1 ----> Frame 'j+1' Line 1
  6944. Line 2 ---------------------> Frame 'j' Line 2
  6945. Line 3 Line 3 ----> Frame 'j+1' Line 3
  6946. ... ... ...
  6947. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  6948. @end example
  6949. It accepts the following optional parameters:
  6950. @table @option
  6951. @item scan
  6952. This determines whether the interlaced frame is taken from the even
  6953. (tff - default) or odd (bff) lines of the progressive frame.
  6954. @item lowpass
  6955. Enable (default) or disable the vertical lowpass filter to avoid twitter
  6956. interlacing and reduce moire patterns.
  6957. @end table
  6958. @section kerndeint
  6959. Deinterlace input video by applying Donald Graft's adaptive kernel
  6960. deinterling. Work on interlaced parts of a video to produce
  6961. progressive frames.
  6962. The description of the accepted parameters follows.
  6963. @table @option
  6964. @item thresh
  6965. Set the threshold which affects the filter's tolerance when
  6966. determining if a pixel line must be processed. It must be an integer
  6967. in the range [0,255] and defaults to 10. A value of 0 will result in
  6968. applying the process on every pixels.
  6969. @item map
  6970. Paint pixels exceeding the threshold value to white if set to 1.
  6971. Default is 0.
  6972. @item order
  6973. Set the fields order. Swap fields if set to 1, leave fields alone if
  6974. 0. Default is 0.
  6975. @item sharp
  6976. Enable additional sharpening if set to 1. Default is 0.
  6977. @item twoway
  6978. Enable twoway sharpening if set to 1. Default is 0.
  6979. @end table
  6980. @subsection Examples
  6981. @itemize
  6982. @item
  6983. Apply default values:
  6984. @example
  6985. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  6986. @end example
  6987. @item
  6988. Enable additional sharpening:
  6989. @example
  6990. kerndeint=sharp=1
  6991. @end example
  6992. @item
  6993. Paint processed pixels in white:
  6994. @example
  6995. kerndeint=map=1
  6996. @end example
  6997. @end itemize
  6998. @section lenscorrection
  6999. Correct radial lens distortion
  7000. This filter can be used to correct for radial distortion as can result from the use
  7001. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  7002. one can use tools available for example as part of opencv or simply trial-and-error.
  7003. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  7004. and extract the k1 and k2 coefficients from the resulting matrix.
  7005. Note that effectively the same filter is available in the open-source tools Krita and
  7006. Digikam from the KDE project.
  7007. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  7008. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  7009. brightness distribution, so you may want to use both filters together in certain
  7010. cases, though you will have to take care of ordering, i.e. whether vignetting should
  7011. be applied before or after lens correction.
  7012. @subsection Options
  7013. The filter accepts the following options:
  7014. @table @option
  7015. @item cx
  7016. Relative x-coordinate of the focal point of the image, and thereby the center of the
  7017. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7018. width.
  7019. @item cy
  7020. Relative y-coordinate of the focal point of the image, and thereby the center of the
  7021. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7022. height.
  7023. @item k1
  7024. Coefficient of the quadratic correction term. 0.5 means no correction.
  7025. @item k2
  7026. Coefficient of the double quadratic correction term. 0.5 means no correction.
  7027. @end table
  7028. The formula that generates the correction is:
  7029. @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)
  7030. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  7031. distances from the focal point in the source and target images, respectively.
  7032. @section loop
  7033. Loop video frames.
  7034. The filter accepts the following options:
  7035. @table @option
  7036. @item loop
  7037. Set the number of loops.
  7038. @item size
  7039. Set maximal size in number of frames.
  7040. @item start
  7041. Set first frame of loop.
  7042. @end table
  7043. @anchor{lut3d}
  7044. @section lut3d
  7045. Apply a 3D LUT to an input video.
  7046. The filter accepts the following options:
  7047. @table @option
  7048. @item file
  7049. Set the 3D LUT file name.
  7050. Currently supported formats:
  7051. @table @samp
  7052. @item 3dl
  7053. AfterEffects
  7054. @item cube
  7055. Iridas
  7056. @item dat
  7057. DaVinci
  7058. @item m3d
  7059. Pandora
  7060. @end table
  7061. @item interp
  7062. Select interpolation mode.
  7063. Available values are:
  7064. @table @samp
  7065. @item nearest
  7066. Use values from the nearest defined point.
  7067. @item trilinear
  7068. Interpolate values using the 8 points defining a cube.
  7069. @item tetrahedral
  7070. Interpolate values using a tetrahedron.
  7071. @end table
  7072. @end table
  7073. @section lut, lutrgb, lutyuv
  7074. Compute a look-up table for binding each pixel component input value
  7075. to an output value, and apply it to the input video.
  7076. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  7077. to an RGB input video.
  7078. These filters accept the following parameters:
  7079. @table @option
  7080. @item c0
  7081. set first pixel component expression
  7082. @item c1
  7083. set second pixel component expression
  7084. @item c2
  7085. set third pixel component expression
  7086. @item c3
  7087. set fourth pixel component expression, corresponds to the alpha component
  7088. @item r
  7089. set red component expression
  7090. @item g
  7091. set green component expression
  7092. @item b
  7093. set blue component expression
  7094. @item a
  7095. alpha component expression
  7096. @item y
  7097. set Y/luminance component expression
  7098. @item u
  7099. set U/Cb component expression
  7100. @item v
  7101. set V/Cr component expression
  7102. @end table
  7103. Each of them specifies the expression to use for computing the lookup table for
  7104. the corresponding pixel component values.
  7105. The exact component associated to each of the @var{c*} options depends on the
  7106. format in input.
  7107. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  7108. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  7109. The expressions can contain the following constants and functions:
  7110. @table @option
  7111. @item w
  7112. @item h
  7113. The input width and height.
  7114. @item val
  7115. The input value for the pixel component.
  7116. @item clipval
  7117. The input value, clipped to the @var{minval}-@var{maxval} range.
  7118. @item maxval
  7119. The maximum value for the pixel component.
  7120. @item minval
  7121. The minimum value for the pixel component.
  7122. @item negval
  7123. The negated value for the pixel component value, clipped to the
  7124. @var{minval}-@var{maxval} range; it corresponds to the expression
  7125. "maxval-clipval+minval".
  7126. @item clip(val)
  7127. The computed value in @var{val}, clipped to the
  7128. @var{minval}-@var{maxval} range.
  7129. @item gammaval(gamma)
  7130. The computed gamma correction value of the pixel component value,
  7131. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  7132. expression
  7133. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  7134. @end table
  7135. All expressions default to "val".
  7136. @subsection Examples
  7137. @itemize
  7138. @item
  7139. Negate input video:
  7140. @example
  7141. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  7142. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  7143. @end example
  7144. The above is the same as:
  7145. @example
  7146. lutrgb="r=negval:g=negval:b=negval"
  7147. lutyuv="y=negval:u=negval:v=negval"
  7148. @end example
  7149. @item
  7150. Negate luminance:
  7151. @example
  7152. lutyuv=y=negval
  7153. @end example
  7154. @item
  7155. Remove chroma components, turning the video into a graytone image:
  7156. @example
  7157. lutyuv="u=128:v=128"
  7158. @end example
  7159. @item
  7160. Apply a luma burning effect:
  7161. @example
  7162. lutyuv="y=2*val"
  7163. @end example
  7164. @item
  7165. Remove green and blue components:
  7166. @example
  7167. lutrgb="g=0:b=0"
  7168. @end example
  7169. @item
  7170. Set a constant alpha channel value on input:
  7171. @example
  7172. format=rgba,lutrgb=a="maxval-minval/2"
  7173. @end example
  7174. @item
  7175. Correct luminance gamma by a factor of 0.5:
  7176. @example
  7177. lutyuv=y=gammaval(0.5)
  7178. @end example
  7179. @item
  7180. Discard least significant bits of luma:
  7181. @example
  7182. lutyuv=y='bitand(val, 128+64+32)'
  7183. @end example
  7184. @item
  7185. Technicolor like effect:
  7186. @example
  7187. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  7188. @end example
  7189. @end itemize
  7190. @section lut2
  7191. Compute and apply a lookup table from two video inputs.
  7192. This filter accepts the following parameters:
  7193. @table @option
  7194. @item c0
  7195. set first pixel component expression
  7196. @item c1
  7197. set second pixel component expression
  7198. @item c2
  7199. set third pixel component expression
  7200. @item c3
  7201. set fourth pixel component expression, corresponds to the alpha component
  7202. @end table
  7203. Each of them specifies the expression to use for computing the lookup table for
  7204. the corresponding pixel component values.
  7205. The exact component associated to each of the @var{c*} options depends on the
  7206. format in inputs.
  7207. The expressions can contain the following constants:
  7208. @table @option
  7209. @item w
  7210. @item h
  7211. The input width and height.
  7212. @item x
  7213. The first input value for the pixel component.
  7214. @item y
  7215. The second input value for the pixel component.
  7216. @item bdx
  7217. The first input video bit depth.
  7218. @item bdy
  7219. The second input video bit depth.
  7220. @end table
  7221. All expressions default to "x".
  7222. @subsection Examples
  7223. @itemize
  7224. @item
  7225. Highlight differences between two RGB video streams:
  7226. @example
  7227. lut2='ifnot(x-y,0,pow(2,bdx)-1):ifnot(x-y,0,pow(2,bdx)-1):ifnot(x-y,0,pow(2,bdx)-1)'
  7228. @end example
  7229. @item
  7230. Highlight differences between two YUV video streams:
  7231. @example
  7232. lut2='ifnot(x-y,0,pow(2,bdx)-1):ifnot(x-y,pow(2,bdx-1),pow(2,bdx)-1):ifnot(x-y,pow(2,bdx-1),pow(2,bdx)-1)'
  7233. @end example
  7234. @end itemize
  7235. @section maskedclamp
  7236. Clamp the first input stream with the second input and third input stream.
  7237. Returns the value of first stream to be between second input
  7238. stream - @code{undershoot} and third input stream + @code{overshoot}.
  7239. This filter accepts the following options:
  7240. @table @option
  7241. @item undershoot
  7242. Default value is @code{0}.
  7243. @item overshoot
  7244. Default value is @code{0}.
  7245. @item planes
  7246. Set which planes will be processed as bitmap, unprocessed planes will be
  7247. copied from first stream.
  7248. By default value 0xf, all planes will be processed.
  7249. @end table
  7250. @section maskedmerge
  7251. Merge the first input stream with the second input stream using per pixel
  7252. weights in the third input stream.
  7253. A value of 0 in the third stream pixel component means that pixel component
  7254. from first stream is returned unchanged, while maximum value (eg. 255 for
  7255. 8-bit videos) means that pixel component from second stream is returned
  7256. unchanged. Intermediate values define the amount of merging between both
  7257. input stream's pixel components.
  7258. This filter accepts the following options:
  7259. @table @option
  7260. @item planes
  7261. Set which planes will be processed as bitmap, unprocessed planes will be
  7262. copied from first stream.
  7263. By default value 0xf, all planes will be processed.
  7264. @end table
  7265. @section mcdeint
  7266. Apply motion-compensation deinterlacing.
  7267. It needs one field per frame as input and must thus be used together
  7268. with yadif=1/3 or equivalent.
  7269. This filter accepts the following options:
  7270. @table @option
  7271. @item mode
  7272. Set the deinterlacing mode.
  7273. It accepts one of the following values:
  7274. @table @samp
  7275. @item fast
  7276. @item medium
  7277. @item slow
  7278. use iterative motion estimation
  7279. @item extra_slow
  7280. like @samp{slow}, but use multiple reference frames.
  7281. @end table
  7282. Default value is @samp{fast}.
  7283. @item parity
  7284. Set the picture field parity assumed for the input video. It must be
  7285. one of the following values:
  7286. @table @samp
  7287. @item 0, tff
  7288. assume top field first
  7289. @item 1, bff
  7290. assume bottom field first
  7291. @end table
  7292. Default value is @samp{bff}.
  7293. @item qp
  7294. Set per-block quantization parameter (QP) used by the internal
  7295. encoder.
  7296. Higher values should result in a smoother motion vector field but less
  7297. optimal individual vectors. Default value is 1.
  7298. @end table
  7299. @section mergeplanes
  7300. Merge color channel components from several video streams.
  7301. The filter accepts up to 4 input streams, and merge selected input
  7302. planes to the output video.
  7303. This filter accepts the following options:
  7304. @table @option
  7305. @item mapping
  7306. Set input to output plane mapping. Default is @code{0}.
  7307. The mappings is specified as a bitmap. It should be specified as a
  7308. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  7309. mapping for the first plane of the output stream. 'A' sets the number of
  7310. the input stream to use (from 0 to 3), and 'a' the plane number of the
  7311. corresponding input to use (from 0 to 3). The rest of the mappings is
  7312. similar, 'Bb' describes the mapping for the output stream second
  7313. plane, 'Cc' describes the mapping for the output stream third plane and
  7314. 'Dd' describes the mapping for the output stream fourth plane.
  7315. @item format
  7316. Set output pixel format. Default is @code{yuva444p}.
  7317. @end table
  7318. @subsection Examples
  7319. @itemize
  7320. @item
  7321. Merge three gray video streams of same width and height into single video stream:
  7322. @example
  7323. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  7324. @end example
  7325. @item
  7326. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  7327. @example
  7328. [a0][a1]mergeplanes=0x00010210:yuva444p
  7329. @end example
  7330. @item
  7331. Swap Y and A plane in yuva444p stream:
  7332. @example
  7333. format=yuva444p,mergeplanes=0x03010200:yuva444p
  7334. @end example
  7335. @item
  7336. Swap U and V plane in yuv420p stream:
  7337. @example
  7338. format=yuv420p,mergeplanes=0x000201:yuv420p
  7339. @end example
  7340. @item
  7341. Cast a rgb24 clip to yuv444p:
  7342. @example
  7343. format=rgb24,mergeplanes=0x000102:yuv444p
  7344. @end example
  7345. @end itemize
  7346. @section mestimate
  7347. Estimate and export motion vectors using block matching algorithms.
  7348. Motion vectors are stored in frame side data to be used by other filters.
  7349. This filter accepts the following options:
  7350. @table @option
  7351. @item method
  7352. Specify the motion estimation method. Accepts one of the following values:
  7353. @table @samp
  7354. @item esa
  7355. Exhaustive search algorithm.
  7356. @item tss
  7357. Three step search algorithm.
  7358. @item tdls
  7359. Two dimensional logarithmic search algorithm.
  7360. @item ntss
  7361. New three step search algorithm.
  7362. @item fss
  7363. Four step search algorithm.
  7364. @item ds
  7365. Diamond search algorithm.
  7366. @item hexbs
  7367. Hexagon-based search algorithm.
  7368. @item epzs
  7369. Enhanced predictive zonal search algorithm.
  7370. @item umh
  7371. Uneven multi-hexagon search algorithm.
  7372. @end table
  7373. Default value is @samp{esa}.
  7374. @item mb_size
  7375. Macroblock size. Default @code{16}.
  7376. @item search_param
  7377. Search parameter. Default @code{7}.
  7378. @end table
  7379. @section minterpolate
  7380. Convert the video to specified frame rate using motion interpolation.
  7381. This filter accepts the following options:
  7382. @table @option
  7383. @item fps
  7384. Specify the output frame rate. This can be rational e.g. @code{60000/1001}. Frames are dropped if @var{fps} is lower than source fps. Default @code{60}.
  7385. @item mi_mode
  7386. Motion interpolation mode. Following values are accepted:
  7387. @table @samp
  7388. @item dup
  7389. Duplicate previous or next frame for interpolating new ones.
  7390. @item blend
  7391. Blend source frames. Interpolated frame is mean of previous and next frames.
  7392. @item mci
  7393. Motion compensated interpolation. Following options are effective when this mode is selected:
  7394. @table @samp
  7395. @item mc_mode
  7396. Motion compensation mode. Following values are accepted:
  7397. @table @samp
  7398. @item obmc
  7399. Overlapped block motion compensation.
  7400. @item aobmc
  7401. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  7402. @end table
  7403. Default mode is @samp{obmc}.
  7404. @item me_mode
  7405. Motion estimation mode. Following values are accepted:
  7406. @table @samp
  7407. @item bidir
  7408. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  7409. @item bilat
  7410. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  7411. @end table
  7412. Default mode is @samp{bilat}.
  7413. @item me
  7414. The algorithm to be used for motion estimation. Following values are accepted:
  7415. @table @samp
  7416. @item esa
  7417. Exhaustive search algorithm.
  7418. @item tss
  7419. Three step search algorithm.
  7420. @item tdls
  7421. Two dimensional logarithmic search algorithm.
  7422. @item ntss
  7423. New three step search algorithm.
  7424. @item fss
  7425. Four step search algorithm.
  7426. @item ds
  7427. Diamond search algorithm.
  7428. @item hexbs
  7429. Hexagon-based search algorithm.
  7430. @item epzs
  7431. Enhanced predictive zonal search algorithm.
  7432. @item umh
  7433. Uneven multi-hexagon search algorithm.
  7434. @end table
  7435. Default algorithm is @samp{epzs}.
  7436. @item mb_size
  7437. Macroblock size. Default @code{16}.
  7438. @item search_param
  7439. Motion estimation search parameter. Default @code{32}.
  7440. @item vsmbc
  7441. Enable variable-size block motion compensation. Motion estimation is applied with smaller block sizes at object boundaries in order to make the them less blur. Default is @code{0} (disabled).
  7442. @end table
  7443. @end table
  7444. @item scd
  7445. Scene change detection method. Scene change leads motion vectors to be in random direction. Scene change detection replace interpolated frames by duplicate ones. May not be needed for other modes. Following values are accepted:
  7446. @table @samp
  7447. @item none
  7448. Disable scene change detection.
  7449. @item fdiff
  7450. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  7451. @end table
  7452. Default method is @samp{fdiff}.
  7453. @item scd_threshold
  7454. Scene change detection threshold. Default is @code{5.0}.
  7455. @end table
  7456. @section mpdecimate
  7457. Drop frames that do not differ greatly from the previous frame in
  7458. order to reduce frame rate.
  7459. The main use of this filter is for very-low-bitrate encoding
  7460. (e.g. streaming over dialup modem), but it could in theory be used for
  7461. fixing movies that were inverse-telecined incorrectly.
  7462. A description of the accepted options follows.
  7463. @table @option
  7464. @item max
  7465. Set the maximum number of consecutive frames which can be dropped (if
  7466. positive), or the minimum interval between dropped frames (if
  7467. negative). If the value is 0, the frame is dropped unregarding the
  7468. number of previous sequentially dropped frames.
  7469. Default value is 0.
  7470. @item hi
  7471. @item lo
  7472. @item frac
  7473. Set the dropping threshold values.
  7474. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  7475. represent actual pixel value differences, so a threshold of 64
  7476. corresponds to 1 unit of difference for each pixel, or the same spread
  7477. out differently over the block.
  7478. A frame is a candidate for dropping if no 8x8 blocks differ by more
  7479. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  7480. meaning the whole image) differ by more than a threshold of @option{lo}.
  7481. Default value for @option{hi} is 64*12, default value for @option{lo} is
  7482. 64*5, and default value for @option{frac} is 0.33.
  7483. @end table
  7484. @section negate
  7485. Negate input video.
  7486. It accepts an integer in input; if non-zero it negates the
  7487. alpha component (if available). The default value in input is 0.
  7488. @section nlmeans
  7489. Denoise frames using Non-Local Means algorithm.
  7490. Each pixel is adjusted by looking for other pixels with similar contexts. This
  7491. context similarity is defined by comparing their surrounding patches of size
  7492. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  7493. around the pixel.
  7494. Note that the research area defines centers for patches, which means some
  7495. patches will be made of pixels outside that research area.
  7496. The filter accepts the following options.
  7497. @table @option
  7498. @item s
  7499. Set denoising strength.
  7500. @item p
  7501. Set patch size.
  7502. @item pc
  7503. Same as @option{p} but for chroma planes.
  7504. The default value is @var{0} and means automatic.
  7505. @item r
  7506. Set research size.
  7507. @item rc
  7508. Same as @option{r} but for chroma planes.
  7509. The default value is @var{0} and means automatic.
  7510. @end table
  7511. @section nnedi
  7512. Deinterlace video using neural network edge directed interpolation.
  7513. This filter accepts the following options:
  7514. @table @option
  7515. @item weights
  7516. Mandatory option, without binary file filter can not work.
  7517. Currently file can be found here:
  7518. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  7519. @item deint
  7520. Set which frames to deinterlace, by default it is @code{all}.
  7521. Can be @code{all} or @code{interlaced}.
  7522. @item field
  7523. Set mode of operation.
  7524. Can be one of the following:
  7525. @table @samp
  7526. @item af
  7527. Use frame flags, both fields.
  7528. @item a
  7529. Use frame flags, single field.
  7530. @item t
  7531. Use top field only.
  7532. @item b
  7533. Use bottom field only.
  7534. @item tf
  7535. Use both fields, top first.
  7536. @item bf
  7537. Use both fields, bottom first.
  7538. @end table
  7539. @item planes
  7540. Set which planes to process, by default filter process all frames.
  7541. @item nsize
  7542. Set size of local neighborhood around each pixel, used by the predictor neural
  7543. network.
  7544. Can be one of the following:
  7545. @table @samp
  7546. @item s8x6
  7547. @item s16x6
  7548. @item s32x6
  7549. @item s48x6
  7550. @item s8x4
  7551. @item s16x4
  7552. @item s32x4
  7553. @end table
  7554. @item nns
  7555. Set the number of neurons in predicctor neural network.
  7556. Can be one of the following:
  7557. @table @samp
  7558. @item n16
  7559. @item n32
  7560. @item n64
  7561. @item n128
  7562. @item n256
  7563. @end table
  7564. @item qual
  7565. Controls the number of different neural network predictions that are blended
  7566. together to compute the final output value. Can be @code{fast}, default or
  7567. @code{slow}.
  7568. @item etype
  7569. Set which set of weights to use in the predictor.
  7570. Can be one of the following:
  7571. @table @samp
  7572. @item a
  7573. weights trained to minimize absolute error
  7574. @item s
  7575. weights trained to minimize squared error
  7576. @end table
  7577. @item pscrn
  7578. Controls whether or not the prescreener neural network is used to decide
  7579. which pixels should be processed by the predictor neural network and which
  7580. can be handled by simple cubic interpolation.
  7581. The prescreener is trained to know whether cubic interpolation will be
  7582. sufficient for a pixel or whether it should be predicted by the predictor nn.
  7583. The computational complexity of the prescreener nn is much less than that of
  7584. the predictor nn. Since most pixels can be handled by cubic interpolation,
  7585. using the prescreener generally results in much faster processing.
  7586. The prescreener is pretty accurate, so the difference between using it and not
  7587. using it is almost always unnoticeable.
  7588. Can be one of the following:
  7589. @table @samp
  7590. @item none
  7591. @item original
  7592. @item new
  7593. @end table
  7594. Default is @code{new}.
  7595. @item fapprox
  7596. Set various debugging flags.
  7597. @end table
  7598. @section noformat
  7599. Force libavfilter not to use any of the specified pixel formats for the
  7600. input to the next filter.
  7601. It accepts the following parameters:
  7602. @table @option
  7603. @item pix_fmts
  7604. A '|'-separated list of pixel format names, such as
  7605. apix_fmts=yuv420p|monow|rgb24".
  7606. @end table
  7607. @subsection Examples
  7608. @itemize
  7609. @item
  7610. Force libavfilter to use a format different from @var{yuv420p} for the
  7611. input to the vflip filter:
  7612. @example
  7613. noformat=pix_fmts=yuv420p,vflip
  7614. @end example
  7615. @item
  7616. Convert the input video to any of the formats not contained in the list:
  7617. @example
  7618. noformat=yuv420p|yuv444p|yuv410p
  7619. @end example
  7620. @end itemize
  7621. @section noise
  7622. Add noise on video input frame.
  7623. The filter accepts the following options:
  7624. @table @option
  7625. @item all_seed
  7626. @item c0_seed
  7627. @item c1_seed
  7628. @item c2_seed
  7629. @item c3_seed
  7630. Set noise seed for specific pixel component or all pixel components in case
  7631. of @var{all_seed}. Default value is @code{123457}.
  7632. @item all_strength, alls
  7633. @item c0_strength, c0s
  7634. @item c1_strength, c1s
  7635. @item c2_strength, c2s
  7636. @item c3_strength, c3s
  7637. Set noise strength for specific pixel component or all pixel components in case
  7638. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  7639. @item all_flags, allf
  7640. @item c0_flags, c0f
  7641. @item c1_flags, c1f
  7642. @item c2_flags, c2f
  7643. @item c3_flags, c3f
  7644. Set pixel component flags or set flags for all components if @var{all_flags}.
  7645. Available values for component flags are:
  7646. @table @samp
  7647. @item a
  7648. averaged temporal noise (smoother)
  7649. @item p
  7650. mix random noise with a (semi)regular pattern
  7651. @item t
  7652. temporal noise (noise pattern changes between frames)
  7653. @item u
  7654. uniform noise (gaussian otherwise)
  7655. @end table
  7656. @end table
  7657. @subsection Examples
  7658. Add temporal and uniform noise to input video:
  7659. @example
  7660. noise=alls=20:allf=t+u
  7661. @end example
  7662. @section null
  7663. Pass the video source unchanged to the output.
  7664. @section ocr
  7665. Optical Character Recognition
  7666. This filter uses Tesseract for optical character recognition.
  7667. It accepts the following options:
  7668. @table @option
  7669. @item datapath
  7670. Set datapath to tesseract data. Default is to use whatever was
  7671. set at installation.
  7672. @item language
  7673. Set language, default is "eng".
  7674. @item whitelist
  7675. Set character whitelist.
  7676. @item blacklist
  7677. Set character blacklist.
  7678. @end table
  7679. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  7680. @section ocv
  7681. Apply a video transform using libopencv.
  7682. To enable this filter, install the libopencv library and headers and
  7683. configure FFmpeg with @code{--enable-libopencv}.
  7684. It accepts the following parameters:
  7685. @table @option
  7686. @item filter_name
  7687. The name of the libopencv filter to apply.
  7688. @item filter_params
  7689. The parameters to pass to the libopencv filter. If not specified, the default
  7690. values are assumed.
  7691. @end table
  7692. Refer to the official libopencv documentation for more precise
  7693. information:
  7694. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  7695. Several libopencv filters are supported; see the following subsections.
  7696. @anchor{dilate}
  7697. @subsection dilate
  7698. Dilate an image by using a specific structuring element.
  7699. It corresponds to the libopencv function @code{cvDilate}.
  7700. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  7701. @var{struct_el} represents a structuring element, and has the syntax:
  7702. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  7703. @var{cols} and @var{rows} represent the number of columns and rows of
  7704. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  7705. point, and @var{shape} the shape for the structuring element. @var{shape}
  7706. must be "rect", "cross", "ellipse", or "custom".
  7707. If the value for @var{shape} is "custom", it must be followed by a
  7708. string of the form "=@var{filename}". The file with name
  7709. @var{filename} is assumed to represent a binary image, with each
  7710. printable character corresponding to a bright pixel. When a custom
  7711. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  7712. or columns and rows of the read file are assumed instead.
  7713. The default value for @var{struct_el} is "3x3+0x0/rect".
  7714. @var{nb_iterations} specifies the number of times the transform is
  7715. applied to the image, and defaults to 1.
  7716. Some examples:
  7717. @example
  7718. # Use the default values
  7719. ocv=dilate
  7720. # Dilate using a structuring element with a 5x5 cross, iterating two times
  7721. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  7722. # Read the shape from the file diamond.shape, iterating two times.
  7723. # The file diamond.shape may contain a pattern of characters like this
  7724. # *
  7725. # ***
  7726. # *****
  7727. # ***
  7728. # *
  7729. # The specified columns and rows are ignored
  7730. # but the anchor point coordinates are not
  7731. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  7732. @end example
  7733. @subsection erode
  7734. Erode an image by using a specific structuring element.
  7735. It corresponds to the libopencv function @code{cvErode}.
  7736. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  7737. with the same syntax and semantics as the @ref{dilate} filter.
  7738. @subsection smooth
  7739. Smooth the input video.
  7740. The filter takes the following parameters:
  7741. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  7742. @var{type} is the type of smooth filter to apply, and must be one of
  7743. the following values: "blur", "blur_no_scale", "median", "gaussian",
  7744. or "bilateral". The default value is "gaussian".
  7745. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  7746. depend on the smooth type. @var{param1} and
  7747. @var{param2} accept integer positive values or 0. @var{param3} and
  7748. @var{param4} accept floating point values.
  7749. The default value for @var{param1} is 3. The default value for the
  7750. other parameters is 0.
  7751. These parameters correspond to the parameters assigned to the
  7752. libopencv function @code{cvSmooth}.
  7753. @anchor{overlay}
  7754. @section overlay
  7755. Overlay one video on top of another.
  7756. It takes two inputs and has one output. The first input is the "main"
  7757. video on which the second input is overlaid.
  7758. It accepts the following parameters:
  7759. A description of the accepted options follows.
  7760. @table @option
  7761. @item x
  7762. @item y
  7763. Set the expression for the x and y coordinates of the overlaid video
  7764. on the main video. Default value is "0" for both expressions. In case
  7765. the expression is invalid, it is set to a huge value (meaning that the
  7766. overlay will not be displayed within the output visible area).
  7767. @item eof_action
  7768. The action to take when EOF is encountered on the secondary input; it accepts
  7769. one of the following values:
  7770. @table @option
  7771. @item repeat
  7772. Repeat the last frame (the default).
  7773. @item endall
  7774. End both streams.
  7775. @item pass
  7776. Pass the main input through.
  7777. @end table
  7778. @item eval
  7779. Set when the expressions for @option{x}, and @option{y} are evaluated.
  7780. It accepts the following values:
  7781. @table @samp
  7782. @item init
  7783. only evaluate expressions once during the filter initialization or
  7784. when a command is processed
  7785. @item frame
  7786. evaluate expressions for each incoming frame
  7787. @end table
  7788. Default value is @samp{frame}.
  7789. @item shortest
  7790. If set to 1, force the output to terminate when the shortest input
  7791. terminates. Default value is 0.
  7792. @item format
  7793. Set the format for the output video.
  7794. It accepts the following values:
  7795. @table @samp
  7796. @item yuv420
  7797. force YUV420 output
  7798. @item yuv422
  7799. force YUV422 output
  7800. @item yuv444
  7801. force YUV444 output
  7802. @item rgb
  7803. force RGB output
  7804. @end table
  7805. Default value is @samp{yuv420}.
  7806. @item rgb @emph{(deprecated)}
  7807. If set to 1, force the filter to accept inputs in the RGB
  7808. color space. Default value is 0. This option is deprecated, use
  7809. @option{format} instead.
  7810. @item repeatlast
  7811. If set to 1, force the filter to draw the last overlay frame over the
  7812. main input until the end of the stream. A value of 0 disables this
  7813. behavior. Default value is 1.
  7814. @end table
  7815. The @option{x}, and @option{y} expressions can contain the following
  7816. parameters.
  7817. @table @option
  7818. @item main_w, W
  7819. @item main_h, H
  7820. The main input width and height.
  7821. @item overlay_w, w
  7822. @item overlay_h, h
  7823. The overlay input width and height.
  7824. @item x
  7825. @item y
  7826. The computed values for @var{x} and @var{y}. They are evaluated for
  7827. each new frame.
  7828. @item hsub
  7829. @item vsub
  7830. horizontal and vertical chroma subsample values of the output
  7831. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  7832. @var{vsub} is 1.
  7833. @item n
  7834. the number of input frame, starting from 0
  7835. @item pos
  7836. the position in the file of the input frame, NAN if unknown
  7837. @item t
  7838. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  7839. @end table
  7840. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  7841. when evaluation is done @emph{per frame}, and will evaluate to NAN
  7842. when @option{eval} is set to @samp{init}.
  7843. Be aware that frames are taken from each input video in timestamp
  7844. order, hence, if their initial timestamps differ, it is a good idea
  7845. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  7846. have them begin in the same zero timestamp, as the example for
  7847. the @var{movie} filter does.
  7848. You can chain together more overlays but you should test the
  7849. efficiency of such approach.
  7850. @subsection Commands
  7851. This filter supports the following commands:
  7852. @table @option
  7853. @item x
  7854. @item y
  7855. Modify the x and y of the overlay input.
  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. @subsection Examples
  7861. @itemize
  7862. @item
  7863. Draw the overlay at 10 pixels from the bottom right corner of the main
  7864. video:
  7865. @example
  7866. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  7867. @end example
  7868. Using named options the example above becomes:
  7869. @example
  7870. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  7871. @end example
  7872. @item
  7873. Insert a transparent PNG logo in the bottom left corner of the input,
  7874. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  7875. @example
  7876. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  7877. @end example
  7878. @item
  7879. Insert 2 different transparent PNG logos (second logo on bottom
  7880. right corner) using the @command{ffmpeg} tool:
  7881. @example
  7882. 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
  7883. @end example
  7884. @item
  7885. Add a transparent color layer on top of the main video; @code{WxH}
  7886. must specify the size of the main input to the overlay filter:
  7887. @example
  7888. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  7889. @end example
  7890. @item
  7891. Play an original video and a filtered version (here with the deshake
  7892. filter) side by side using the @command{ffplay} tool:
  7893. @example
  7894. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  7895. @end example
  7896. The above command is the same as:
  7897. @example
  7898. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  7899. @end example
  7900. @item
  7901. Make a sliding overlay appearing from the left to the right top part of the
  7902. screen starting since time 2:
  7903. @example
  7904. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  7905. @end example
  7906. @item
  7907. Compose output by putting two input videos side to side:
  7908. @example
  7909. ffmpeg -i left.avi -i right.avi -filter_complex "
  7910. nullsrc=size=200x100 [background];
  7911. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  7912. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  7913. [background][left] overlay=shortest=1 [background+left];
  7914. [background+left][right] overlay=shortest=1:x=100 [left+right]
  7915. "
  7916. @end example
  7917. @item
  7918. Mask 10-20 seconds of a video by applying the delogo filter to a section
  7919. @example
  7920. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  7921. -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]'
  7922. masked.avi
  7923. @end example
  7924. @item
  7925. Chain several overlays in cascade:
  7926. @example
  7927. nullsrc=s=200x200 [bg];
  7928. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  7929. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  7930. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  7931. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  7932. [in3] null, [mid2] overlay=100:100 [out0]
  7933. @end example
  7934. @end itemize
  7935. @section owdenoise
  7936. Apply Overcomplete Wavelet denoiser.
  7937. The filter accepts the following options:
  7938. @table @option
  7939. @item depth
  7940. Set depth.
  7941. Larger depth values will denoise lower frequency components more, but
  7942. slow down filtering.
  7943. Must be an int in the range 8-16, default is @code{8}.
  7944. @item luma_strength, ls
  7945. Set luma strength.
  7946. Must be a double value in the range 0-1000, default is @code{1.0}.
  7947. @item chroma_strength, cs
  7948. Set chroma strength.
  7949. Must be a double value in the range 0-1000, default is @code{1.0}.
  7950. @end table
  7951. @anchor{pad}
  7952. @section pad
  7953. Add paddings to the input image, and place the original input at the
  7954. provided @var{x}, @var{y} coordinates.
  7955. It accepts the following parameters:
  7956. @table @option
  7957. @item width, w
  7958. @item height, h
  7959. Specify an expression for the size of the output image with the
  7960. paddings added. If the value for @var{width} or @var{height} is 0, the
  7961. corresponding input size is used for the output.
  7962. The @var{width} expression can reference the value set by the
  7963. @var{height} expression, and vice versa.
  7964. The default value of @var{width} and @var{height} is 0.
  7965. @item x
  7966. @item y
  7967. Specify the offsets to place the input image at within the padded area,
  7968. with respect to the top/left border of the output image.
  7969. The @var{x} expression can reference the value set by the @var{y}
  7970. expression, and vice versa.
  7971. The default value of @var{x} and @var{y} is 0.
  7972. @item color
  7973. Specify the color of the padded area. For the syntax of this option,
  7974. check the "Color" section in the ffmpeg-utils manual.
  7975. The default value of @var{color} is "black".
  7976. @end table
  7977. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  7978. options are expressions containing the following constants:
  7979. @table @option
  7980. @item in_w
  7981. @item in_h
  7982. The input video width and height.
  7983. @item iw
  7984. @item ih
  7985. These are the same as @var{in_w} and @var{in_h}.
  7986. @item out_w
  7987. @item out_h
  7988. The output width and height (the size of the padded area), as
  7989. specified by the @var{width} and @var{height} expressions.
  7990. @item ow
  7991. @item oh
  7992. These are the same as @var{out_w} and @var{out_h}.
  7993. @item x
  7994. @item y
  7995. The x and y offsets as specified by the @var{x} and @var{y}
  7996. expressions, or NAN if not yet specified.
  7997. @item a
  7998. same as @var{iw} / @var{ih}
  7999. @item sar
  8000. input sample aspect ratio
  8001. @item dar
  8002. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  8003. @item hsub
  8004. @item vsub
  8005. The horizontal and vertical chroma subsample values. For example for the
  8006. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8007. @end table
  8008. @subsection Examples
  8009. @itemize
  8010. @item
  8011. Add paddings with the color "violet" to the input video. The output video
  8012. size is 640x480, and the top-left corner of the input video is placed at
  8013. column 0, row 40
  8014. @example
  8015. pad=640:480:0:40:violet
  8016. @end example
  8017. The example above is equivalent to the following command:
  8018. @example
  8019. pad=width=640:height=480:x=0:y=40:color=violet
  8020. @end example
  8021. @item
  8022. Pad the input to get an output with dimensions increased by 3/2,
  8023. and put the input video at the center of the padded area:
  8024. @example
  8025. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  8026. @end example
  8027. @item
  8028. Pad the input to get a squared output with size equal to the maximum
  8029. value between the input width and height, and put the input video at
  8030. the center of the padded area:
  8031. @example
  8032. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  8033. @end example
  8034. @item
  8035. Pad the input to get a final w/h ratio of 16:9:
  8036. @example
  8037. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  8038. @end example
  8039. @item
  8040. In case of anamorphic video, in order to set the output display aspect
  8041. correctly, it is necessary to use @var{sar} in the expression,
  8042. according to the relation:
  8043. @example
  8044. (ih * X / ih) * sar = output_dar
  8045. X = output_dar / sar
  8046. @end example
  8047. Thus the previous example needs to be modified to:
  8048. @example
  8049. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  8050. @end example
  8051. @item
  8052. Double the output size and put the input video in the bottom-right
  8053. corner of the output padded area:
  8054. @example
  8055. pad="2*iw:2*ih:ow-iw:oh-ih"
  8056. @end example
  8057. @end itemize
  8058. @anchor{palettegen}
  8059. @section palettegen
  8060. Generate one palette for a whole video stream.
  8061. It accepts the following options:
  8062. @table @option
  8063. @item max_colors
  8064. Set the maximum number of colors to quantize in the palette.
  8065. Note: the palette will still contain 256 colors; the unused palette entries
  8066. will be black.
  8067. @item reserve_transparent
  8068. Create a palette of 255 colors maximum and reserve the last one for
  8069. transparency. Reserving the transparency color is useful for GIF optimization.
  8070. If not set, the maximum of colors in the palette will be 256. You probably want
  8071. to disable this option for a standalone image.
  8072. Set by default.
  8073. @item stats_mode
  8074. Set statistics mode.
  8075. It accepts the following values:
  8076. @table @samp
  8077. @item full
  8078. Compute full frame histograms.
  8079. @item diff
  8080. Compute histograms only for the part that differs from previous frame. This
  8081. might be relevant to give more importance to the moving part of your input if
  8082. the background is static.
  8083. @item single
  8084. Compute new histogram for each frame.
  8085. @end table
  8086. Default value is @var{full}.
  8087. @end table
  8088. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  8089. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  8090. color quantization of the palette. This information is also visible at
  8091. @var{info} logging level.
  8092. @subsection Examples
  8093. @itemize
  8094. @item
  8095. Generate a representative palette of a given video using @command{ffmpeg}:
  8096. @example
  8097. ffmpeg -i input.mkv -vf palettegen palette.png
  8098. @end example
  8099. @end itemize
  8100. @section paletteuse
  8101. Use a palette to downsample an input video stream.
  8102. The filter takes two inputs: one video stream and a palette. The palette must
  8103. be a 256 pixels image.
  8104. It accepts the following options:
  8105. @table @option
  8106. @item dither
  8107. Select dithering mode. Available algorithms are:
  8108. @table @samp
  8109. @item bayer
  8110. Ordered 8x8 bayer dithering (deterministic)
  8111. @item heckbert
  8112. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  8113. Note: this dithering is sometimes considered "wrong" and is included as a
  8114. reference.
  8115. @item floyd_steinberg
  8116. Floyd and Steingberg dithering (error diffusion)
  8117. @item sierra2
  8118. Frankie Sierra dithering v2 (error diffusion)
  8119. @item sierra2_4a
  8120. Frankie Sierra dithering v2 "Lite" (error diffusion)
  8121. @end table
  8122. Default is @var{sierra2_4a}.
  8123. @item bayer_scale
  8124. When @var{bayer} dithering is selected, this option defines the scale of the
  8125. pattern (how much the crosshatch pattern is visible). A low value means more
  8126. visible pattern for less banding, and higher value means less visible pattern
  8127. at the cost of more banding.
  8128. The option must be an integer value in the range [0,5]. Default is @var{2}.
  8129. @item diff_mode
  8130. If set, define the zone to process
  8131. @table @samp
  8132. @item rectangle
  8133. Only the changing rectangle will be reprocessed. This is similar to GIF
  8134. cropping/offsetting compression mechanism. This option can be useful for speed
  8135. if only a part of the image is changing, and has use cases such as limiting the
  8136. scope of the error diffusal @option{dither} to the rectangle that bounds the
  8137. moving scene (it leads to more deterministic output if the scene doesn't change
  8138. much, and as a result less moving noise and better GIF compression).
  8139. @end table
  8140. Default is @var{none}.
  8141. @item new
  8142. Take new palette for each output frame.
  8143. @end table
  8144. @subsection Examples
  8145. @itemize
  8146. @item
  8147. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  8148. using @command{ffmpeg}:
  8149. @example
  8150. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  8151. @end example
  8152. @end itemize
  8153. @section perspective
  8154. Correct perspective of video not recorded perpendicular to the screen.
  8155. A description of the accepted parameters follows.
  8156. @table @option
  8157. @item x0
  8158. @item y0
  8159. @item x1
  8160. @item y1
  8161. @item x2
  8162. @item y2
  8163. @item x3
  8164. @item y3
  8165. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  8166. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  8167. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  8168. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  8169. then the corners of the source will be sent to the specified coordinates.
  8170. The expressions can use the following variables:
  8171. @table @option
  8172. @item W
  8173. @item H
  8174. the width and height of video frame.
  8175. @item in
  8176. Input frame count.
  8177. @item on
  8178. Output frame count.
  8179. @end table
  8180. @item interpolation
  8181. Set interpolation for perspective correction.
  8182. It accepts the following values:
  8183. @table @samp
  8184. @item linear
  8185. @item cubic
  8186. @end table
  8187. Default value is @samp{linear}.
  8188. @item sense
  8189. Set interpretation of coordinate options.
  8190. It accepts the following values:
  8191. @table @samp
  8192. @item 0, source
  8193. Send point in the source specified by the given coordinates to
  8194. the corners of the destination.
  8195. @item 1, destination
  8196. Send the corners of the source to the point in the destination specified
  8197. by the given coordinates.
  8198. Default value is @samp{source}.
  8199. @end table
  8200. @item eval
  8201. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  8202. It accepts the following values:
  8203. @table @samp
  8204. @item init
  8205. only evaluate expressions once during the filter initialization or
  8206. when a command is processed
  8207. @item frame
  8208. evaluate expressions for each incoming frame
  8209. @end table
  8210. Default value is @samp{init}.
  8211. @end table
  8212. @section phase
  8213. Delay interlaced video by one field time so that the field order changes.
  8214. The intended use is to fix PAL movies that have been captured with the
  8215. opposite field order to the film-to-video transfer.
  8216. A description of the accepted parameters follows.
  8217. @table @option
  8218. @item mode
  8219. Set phase mode.
  8220. It accepts the following values:
  8221. @table @samp
  8222. @item t
  8223. Capture field order top-first, transfer bottom-first.
  8224. Filter will delay the bottom field.
  8225. @item b
  8226. Capture field order bottom-first, transfer top-first.
  8227. Filter will delay the top field.
  8228. @item p
  8229. Capture and transfer with the same field order. This mode only exists
  8230. for the documentation of the other options to refer to, but if you
  8231. actually select it, the filter will faithfully do nothing.
  8232. @item a
  8233. Capture field order determined automatically by field flags, transfer
  8234. opposite.
  8235. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  8236. basis using field flags. If no field information is available,
  8237. then this works just like @samp{u}.
  8238. @item u
  8239. Capture unknown or varying, transfer opposite.
  8240. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  8241. analyzing the images and selecting the alternative that produces best
  8242. match between the fields.
  8243. @item T
  8244. Capture top-first, transfer unknown or varying.
  8245. Filter selects among @samp{t} and @samp{p} using image analysis.
  8246. @item B
  8247. Capture bottom-first, transfer unknown or varying.
  8248. Filter selects among @samp{b} and @samp{p} using image analysis.
  8249. @item A
  8250. Capture determined by field flags, transfer unknown or varying.
  8251. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  8252. image analysis. If no field information is available, then this works just
  8253. like @samp{U}. This is the default mode.
  8254. @item U
  8255. Both capture and transfer unknown or varying.
  8256. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  8257. @end table
  8258. @end table
  8259. @section pixdesctest
  8260. Pixel format descriptor test filter, mainly useful for internal
  8261. testing. The output video should be equal to the input video.
  8262. For example:
  8263. @example
  8264. format=monow, pixdesctest
  8265. @end example
  8266. can be used to test the monowhite pixel format descriptor definition.
  8267. @section pp
  8268. Enable the specified chain of postprocessing subfilters using libpostproc. This
  8269. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  8270. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  8271. Each subfilter and some options have a short and a long name that can be used
  8272. interchangeably, i.e. dr/dering are the same.
  8273. The filters accept the following options:
  8274. @table @option
  8275. @item subfilters
  8276. Set postprocessing subfilters string.
  8277. @end table
  8278. All subfilters share common options to determine their scope:
  8279. @table @option
  8280. @item a/autoq
  8281. Honor the quality commands for this subfilter.
  8282. @item c/chrom
  8283. Do chrominance filtering, too (default).
  8284. @item y/nochrom
  8285. Do luminance filtering only (no chrominance).
  8286. @item n/noluma
  8287. Do chrominance filtering only (no luminance).
  8288. @end table
  8289. These options can be appended after the subfilter name, separated by a '|'.
  8290. Available subfilters are:
  8291. @table @option
  8292. @item hb/hdeblock[|difference[|flatness]]
  8293. Horizontal deblocking filter
  8294. @table @option
  8295. @item difference
  8296. Difference factor where higher values mean more deblocking (default: @code{32}).
  8297. @item flatness
  8298. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8299. @end table
  8300. @item vb/vdeblock[|difference[|flatness]]
  8301. Vertical deblocking filter
  8302. @table @option
  8303. @item difference
  8304. Difference factor where higher values mean more deblocking (default: @code{32}).
  8305. @item flatness
  8306. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8307. @end table
  8308. @item ha/hadeblock[|difference[|flatness]]
  8309. Accurate horizontal deblocking filter
  8310. @table @option
  8311. @item difference
  8312. Difference factor where higher values mean more deblocking (default: @code{32}).
  8313. @item flatness
  8314. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8315. @end table
  8316. @item va/vadeblock[|difference[|flatness]]
  8317. Accurate vertical deblocking filter
  8318. @table @option
  8319. @item difference
  8320. Difference factor where higher values mean more deblocking (default: @code{32}).
  8321. @item flatness
  8322. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8323. @end table
  8324. @end table
  8325. The horizontal and vertical deblocking filters share the difference and
  8326. flatness values so you cannot set different horizontal and vertical
  8327. thresholds.
  8328. @table @option
  8329. @item h1/x1hdeblock
  8330. Experimental horizontal deblocking filter
  8331. @item v1/x1vdeblock
  8332. Experimental vertical deblocking filter
  8333. @item dr/dering
  8334. Deringing filter
  8335. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  8336. @table @option
  8337. @item threshold1
  8338. larger -> stronger filtering
  8339. @item threshold2
  8340. larger -> stronger filtering
  8341. @item threshold3
  8342. larger -> stronger filtering
  8343. @end table
  8344. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  8345. @table @option
  8346. @item f/fullyrange
  8347. Stretch luminance to @code{0-255}.
  8348. @end table
  8349. @item lb/linblenddeint
  8350. Linear blend deinterlacing filter that deinterlaces the given block by
  8351. filtering all lines with a @code{(1 2 1)} filter.
  8352. @item li/linipoldeint
  8353. Linear interpolating deinterlacing filter that deinterlaces the given block by
  8354. linearly interpolating every second line.
  8355. @item ci/cubicipoldeint
  8356. Cubic interpolating deinterlacing filter deinterlaces the given block by
  8357. cubically interpolating every second line.
  8358. @item md/mediandeint
  8359. Median deinterlacing filter that deinterlaces the given block by applying a
  8360. median filter to every second line.
  8361. @item fd/ffmpegdeint
  8362. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  8363. second line with a @code{(-1 4 2 4 -1)} filter.
  8364. @item l5/lowpass5
  8365. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  8366. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  8367. @item fq/forceQuant[|quantizer]
  8368. Overrides the quantizer table from the input with the constant quantizer you
  8369. specify.
  8370. @table @option
  8371. @item quantizer
  8372. Quantizer to use
  8373. @end table
  8374. @item de/default
  8375. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  8376. @item fa/fast
  8377. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  8378. @item ac
  8379. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  8380. @end table
  8381. @subsection Examples
  8382. @itemize
  8383. @item
  8384. Apply horizontal and vertical deblocking, deringing and automatic
  8385. brightness/contrast:
  8386. @example
  8387. pp=hb/vb/dr/al
  8388. @end example
  8389. @item
  8390. Apply default filters without brightness/contrast correction:
  8391. @example
  8392. pp=de/-al
  8393. @end example
  8394. @item
  8395. Apply default filters and temporal denoiser:
  8396. @example
  8397. pp=default/tmpnoise|1|2|3
  8398. @end example
  8399. @item
  8400. Apply deblocking on luminance only, and switch vertical deblocking on or off
  8401. automatically depending on available CPU time:
  8402. @example
  8403. pp=hb|y/vb|a
  8404. @end example
  8405. @end itemize
  8406. @section pp7
  8407. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  8408. similar to spp = 6 with 7 point DCT, where only the center sample is
  8409. used after IDCT.
  8410. The filter accepts the following options:
  8411. @table @option
  8412. @item qp
  8413. Force a constant quantization parameter. It accepts an integer in range
  8414. 0 to 63. If not set, the filter will use the QP from the video stream
  8415. (if available).
  8416. @item mode
  8417. Set thresholding mode. Available modes are:
  8418. @table @samp
  8419. @item hard
  8420. Set hard thresholding.
  8421. @item soft
  8422. Set soft thresholding (better de-ringing effect, but likely blurrier).
  8423. @item medium
  8424. Set medium thresholding (good results, default).
  8425. @end table
  8426. @end table
  8427. @section prewitt
  8428. Apply prewitt operator to input video stream.
  8429. The filter accepts the following option:
  8430. @table @option
  8431. @item planes
  8432. Set which planes will be processed, unprocessed planes will be copied.
  8433. By default value 0xf, all planes will be processed.
  8434. @item scale
  8435. Set value which will be multiplied with filtered result.
  8436. @item delta
  8437. Set value which will be added to filtered result.
  8438. @end table
  8439. @section psnr
  8440. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  8441. Ratio) between two input videos.
  8442. This filter takes in input two input videos, the first input is
  8443. considered the "main" source and is passed unchanged to the
  8444. output. The second input is used as a "reference" video for computing
  8445. the PSNR.
  8446. Both video inputs must have the same resolution and pixel format for
  8447. this filter to work correctly. Also it assumes that both inputs
  8448. have the same number of frames, which are compared one by one.
  8449. The obtained average PSNR is printed through the logging system.
  8450. The filter stores the accumulated MSE (mean squared error) of each
  8451. frame, and at the end of the processing it is averaged across all frames
  8452. equally, and the following formula is applied to obtain the PSNR:
  8453. @example
  8454. PSNR = 10*log10(MAX^2/MSE)
  8455. @end example
  8456. Where MAX is the average of the maximum values of each component of the
  8457. image.
  8458. The description of the accepted parameters follows.
  8459. @table @option
  8460. @item stats_file, f
  8461. If specified the filter will use the named file to save the PSNR of
  8462. each individual frame. When filename equals "-" the data is sent to
  8463. standard output.
  8464. @item stats_version
  8465. Specifies which version of the stats file format to use. Details of
  8466. each format are written below.
  8467. Default value is 1.
  8468. @item stats_add_max
  8469. Determines whether the max value is output to the stats log.
  8470. Default value is 0.
  8471. Requires stats_version >= 2. If this is set and stats_version < 2,
  8472. the filter will return an error.
  8473. @end table
  8474. The file printed if @var{stats_file} is selected, contains a sequence of
  8475. key/value pairs of the form @var{key}:@var{value} for each compared
  8476. couple of frames.
  8477. If a @var{stats_version} greater than 1 is specified, a header line precedes
  8478. the list of per-frame-pair stats, with key value pairs following the frame
  8479. format with the following parameters:
  8480. @table @option
  8481. @item psnr_log_version
  8482. The version of the log file format. Will match @var{stats_version}.
  8483. @item fields
  8484. A comma separated list of the per-frame-pair parameters included in
  8485. the log.
  8486. @end table
  8487. A description of each shown per-frame-pair parameter follows:
  8488. @table @option
  8489. @item n
  8490. sequential number of the input frame, starting from 1
  8491. @item mse_avg
  8492. Mean Square Error pixel-by-pixel average difference of the compared
  8493. frames, averaged over all the image components.
  8494. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  8495. Mean Square Error pixel-by-pixel average difference of the compared
  8496. frames for the component specified by the suffix.
  8497. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  8498. Peak Signal to Noise ratio of the compared frames for the component
  8499. specified by the suffix.
  8500. @item max_avg, max_y, max_u, max_v
  8501. Maximum allowed value for each channel, and average over all
  8502. channels.
  8503. @end table
  8504. For example:
  8505. @example
  8506. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  8507. [main][ref] psnr="stats_file=stats.log" [out]
  8508. @end example
  8509. On this example the input file being processed is compared with the
  8510. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  8511. is stored in @file{stats.log}.
  8512. @anchor{pullup}
  8513. @section pullup
  8514. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  8515. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  8516. content.
  8517. The pullup filter is designed to take advantage of future context in making
  8518. its decisions. This filter is stateless in the sense that it does not lock
  8519. onto a pattern to follow, but it instead looks forward to the following
  8520. fields in order to identify matches and rebuild progressive frames.
  8521. To produce content with an even framerate, insert the fps filter after
  8522. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  8523. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  8524. The filter accepts the following options:
  8525. @table @option
  8526. @item jl
  8527. @item jr
  8528. @item jt
  8529. @item jb
  8530. These options set the amount of "junk" to ignore at the left, right, top, and
  8531. bottom of the image, respectively. Left and right are in units of 8 pixels,
  8532. while top and bottom are in units of 2 lines.
  8533. The default is 8 pixels on each side.
  8534. @item sb
  8535. Set the strict breaks. Setting this option to 1 will reduce the chances of
  8536. filter generating an occasional mismatched frame, but it may also cause an
  8537. excessive number of frames to be dropped during high motion sequences.
  8538. Conversely, setting it to -1 will make filter match fields more easily.
  8539. This may help processing of video where there is slight blurring between
  8540. the fields, but may also cause there to be interlaced frames in the output.
  8541. Default value is @code{0}.
  8542. @item mp
  8543. Set the metric plane to use. It accepts the following values:
  8544. @table @samp
  8545. @item l
  8546. Use luma plane.
  8547. @item u
  8548. Use chroma blue plane.
  8549. @item v
  8550. Use chroma red plane.
  8551. @end table
  8552. This option may be set to use chroma plane instead of the default luma plane
  8553. for doing filter's computations. This may improve accuracy on very clean
  8554. source material, but more likely will decrease accuracy, especially if there
  8555. is chroma noise (rainbow effect) or any grayscale video.
  8556. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  8557. load and make pullup usable in realtime on slow machines.
  8558. @end table
  8559. For best results (without duplicated frames in the output file) it is
  8560. necessary to change the output frame rate. For example, to inverse
  8561. telecine NTSC input:
  8562. @example
  8563. ffmpeg -i input -vf pullup -r 24000/1001 ...
  8564. @end example
  8565. @section qp
  8566. Change video quantization parameters (QP).
  8567. The filter accepts the following option:
  8568. @table @option
  8569. @item qp
  8570. Set expression for quantization parameter.
  8571. @end table
  8572. The expression is evaluated through the eval API and can contain, among others,
  8573. the following constants:
  8574. @table @var
  8575. @item known
  8576. 1 if index is not 129, 0 otherwise.
  8577. @item qp
  8578. Sequentional index starting from -129 to 128.
  8579. @end table
  8580. @subsection Examples
  8581. @itemize
  8582. @item
  8583. Some equation like:
  8584. @example
  8585. qp=2+2*sin(PI*qp)
  8586. @end example
  8587. @end itemize
  8588. @section random
  8589. Flush video frames from internal cache of frames into a random order.
  8590. No frame is discarded.
  8591. Inspired by @ref{frei0r} nervous filter.
  8592. @table @option
  8593. @item frames
  8594. Set size in number of frames of internal cache, in range from @code{2} to
  8595. @code{512}. Default is @code{30}.
  8596. @item seed
  8597. Set seed for random number generator, must be an integer included between
  8598. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  8599. less than @code{0}, the filter will try to use a good random seed on a
  8600. best effort basis.
  8601. @end table
  8602. @section readvitc
  8603. Read vertical interval timecode (VITC) information from the top lines of a
  8604. video frame.
  8605. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  8606. timecode value, if a valid timecode has been detected. Further metadata key
  8607. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  8608. timecode data has been found or not.
  8609. This filter accepts the following options:
  8610. @table @option
  8611. @item scan_max
  8612. Set the maximum number of lines to scan for VITC data. If the value is set to
  8613. @code{-1} the full video frame is scanned. Default is @code{45}.
  8614. @item thr_b
  8615. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  8616. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  8617. @item thr_w
  8618. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  8619. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  8620. @end table
  8621. @subsection Examples
  8622. @itemize
  8623. @item
  8624. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  8625. draw @code{--:--:--:--} as a placeholder:
  8626. @example
  8627. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  8628. @end example
  8629. @end itemize
  8630. @section remap
  8631. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  8632. Destination pixel at position (X, Y) will be picked from source (x, y) position
  8633. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  8634. value for pixel will be used for destination pixel.
  8635. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  8636. will have Xmap/Ymap video stream dimensions.
  8637. Xmap and Ymap input video streams are 16bit depth, single channel.
  8638. @section removegrain
  8639. The removegrain filter is a spatial denoiser for progressive video.
  8640. @table @option
  8641. @item m0
  8642. Set mode for the first plane.
  8643. @item m1
  8644. Set mode for the second plane.
  8645. @item m2
  8646. Set mode for the third plane.
  8647. @item m3
  8648. Set mode for the fourth plane.
  8649. @end table
  8650. Range of mode is from 0 to 24. Description of each mode follows:
  8651. @table @var
  8652. @item 0
  8653. Leave input plane unchanged. Default.
  8654. @item 1
  8655. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  8656. @item 2
  8657. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  8658. @item 3
  8659. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  8660. @item 4
  8661. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  8662. This is equivalent to a median filter.
  8663. @item 5
  8664. Line-sensitive clipping giving the minimal change.
  8665. @item 6
  8666. Line-sensitive clipping, intermediate.
  8667. @item 7
  8668. Line-sensitive clipping, intermediate.
  8669. @item 8
  8670. Line-sensitive clipping, intermediate.
  8671. @item 9
  8672. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  8673. @item 10
  8674. Replaces the target pixel with the closest neighbour.
  8675. @item 11
  8676. [1 2 1] horizontal and vertical kernel blur.
  8677. @item 12
  8678. Same as mode 11.
  8679. @item 13
  8680. Bob mode, interpolates top field from the line where the neighbours
  8681. pixels are the closest.
  8682. @item 14
  8683. Bob mode, interpolates bottom field from the line where the neighbours
  8684. pixels are the closest.
  8685. @item 15
  8686. Bob mode, interpolates top field. Same as 13 but with a more complicated
  8687. interpolation formula.
  8688. @item 16
  8689. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  8690. interpolation formula.
  8691. @item 17
  8692. Clips the pixel with the minimum and maximum of respectively the maximum and
  8693. minimum of each pair of opposite neighbour pixels.
  8694. @item 18
  8695. Line-sensitive clipping using opposite neighbours whose greatest distance from
  8696. the current pixel is minimal.
  8697. @item 19
  8698. Replaces the pixel with the average of its 8 neighbours.
  8699. @item 20
  8700. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  8701. @item 21
  8702. Clips pixels using the averages of opposite neighbour.
  8703. @item 22
  8704. Same as mode 21 but simpler and faster.
  8705. @item 23
  8706. Small edge and halo removal, but reputed useless.
  8707. @item 24
  8708. Similar as 23.
  8709. @end table
  8710. @section removelogo
  8711. Suppress a TV station logo, using an image file to determine which
  8712. pixels comprise the logo. It works by filling in the pixels that
  8713. comprise the logo with neighboring pixels.
  8714. The filter accepts the following options:
  8715. @table @option
  8716. @item filename, f
  8717. Set the filter bitmap file, which can be any image format supported by
  8718. libavformat. The width and height of the image file must match those of the
  8719. video stream being processed.
  8720. @end table
  8721. Pixels in the provided bitmap image with a value of zero are not
  8722. considered part of the logo, non-zero pixels are considered part of
  8723. the logo. If you use white (255) for the logo and black (0) for the
  8724. rest, you will be safe. For making the filter bitmap, it is
  8725. recommended to take a screen capture of a black frame with the logo
  8726. visible, and then using a threshold filter followed by the erode
  8727. filter once or twice.
  8728. If needed, little splotches can be fixed manually. Remember that if
  8729. logo pixels are not covered, the filter quality will be much
  8730. reduced. Marking too many pixels as part of the logo does not hurt as
  8731. much, but it will increase the amount of blurring needed to cover over
  8732. the image and will destroy more information than necessary, and extra
  8733. pixels will slow things down on a large logo.
  8734. @section repeatfields
  8735. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  8736. fields based on its value.
  8737. @section reverse
  8738. Reverse a video clip.
  8739. Warning: This filter requires memory to buffer the entire clip, so trimming
  8740. is suggested.
  8741. @subsection Examples
  8742. @itemize
  8743. @item
  8744. Take the first 5 seconds of a clip, and reverse it.
  8745. @example
  8746. trim=end=5,reverse
  8747. @end example
  8748. @end itemize
  8749. @section rotate
  8750. Rotate video by an arbitrary angle expressed in radians.
  8751. The filter accepts the following options:
  8752. A description of the optional parameters follows.
  8753. @table @option
  8754. @item angle, a
  8755. Set an expression for the angle by which to rotate the input video
  8756. clockwise, expressed as a number of radians. A negative value will
  8757. result in a counter-clockwise rotation. By default it is set to "0".
  8758. This expression is evaluated for each frame.
  8759. @item out_w, ow
  8760. Set the output width expression, default value is "iw".
  8761. This expression is evaluated just once during configuration.
  8762. @item out_h, oh
  8763. Set the output height expression, default value is "ih".
  8764. This expression is evaluated just once during configuration.
  8765. @item bilinear
  8766. Enable bilinear interpolation if set to 1, a value of 0 disables
  8767. it. Default value is 1.
  8768. @item fillcolor, c
  8769. Set the color used to fill the output area not covered by the rotated
  8770. image. For the general syntax of this option, check the "Color" section in the
  8771. ffmpeg-utils manual. If the special value "none" is selected then no
  8772. background is printed (useful for example if the background is never shown).
  8773. Default value is "black".
  8774. @end table
  8775. The expressions for the angle and the output size can contain the
  8776. following constants and functions:
  8777. @table @option
  8778. @item n
  8779. sequential number of the input frame, starting from 0. It is always NAN
  8780. before the first frame is filtered.
  8781. @item t
  8782. time in seconds of the input frame, it is set to 0 when the filter is
  8783. configured. It is always NAN before the first frame is filtered.
  8784. @item hsub
  8785. @item vsub
  8786. horizontal and vertical chroma subsample values. For example for the
  8787. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8788. @item in_w, iw
  8789. @item in_h, ih
  8790. the input video width and height
  8791. @item out_w, ow
  8792. @item out_h, oh
  8793. the output width and height, that is the size of the padded area as
  8794. specified by the @var{width} and @var{height} expressions
  8795. @item rotw(a)
  8796. @item roth(a)
  8797. the minimal width/height required for completely containing the input
  8798. video rotated by @var{a} radians.
  8799. These are only available when computing the @option{out_w} and
  8800. @option{out_h} expressions.
  8801. @end table
  8802. @subsection Examples
  8803. @itemize
  8804. @item
  8805. Rotate the input by PI/6 radians clockwise:
  8806. @example
  8807. rotate=PI/6
  8808. @end example
  8809. @item
  8810. Rotate the input by PI/6 radians counter-clockwise:
  8811. @example
  8812. rotate=-PI/6
  8813. @end example
  8814. @item
  8815. Rotate the input by 45 degrees clockwise:
  8816. @example
  8817. rotate=45*PI/180
  8818. @end example
  8819. @item
  8820. Apply a constant rotation with period T, starting from an angle of PI/3:
  8821. @example
  8822. rotate=PI/3+2*PI*t/T
  8823. @end example
  8824. @item
  8825. Make the input video rotation oscillating with a period of T
  8826. seconds and an amplitude of A radians:
  8827. @example
  8828. rotate=A*sin(2*PI/T*t)
  8829. @end example
  8830. @item
  8831. Rotate the video, output size is chosen so that the whole rotating
  8832. input video is always completely contained in the output:
  8833. @example
  8834. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  8835. @end example
  8836. @item
  8837. Rotate the video, reduce the output size so that no background is ever
  8838. shown:
  8839. @example
  8840. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  8841. @end example
  8842. @end itemize
  8843. @subsection Commands
  8844. The filter supports the following commands:
  8845. @table @option
  8846. @item a, angle
  8847. Set the angle expression.
  8848. The command accepts the same syntax of the corresponding option.
  8849. If the specified expression is not valid, it is kept at its current
  8850. value.
  8851. @end table
  8852. @section sab
  8853. Apply Shape Adaptive Blur.
  8854. The filter accepts the following options:
  8855. @table @option
  8856. @item luma_radius, lr
  8857. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  8858. value is 1.0. A greater value will result in a more blurred image, and
  8859. in slower processing.
  8860. @item luma_pre_filter_radius, lpfr
  8861. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  8862. value is 1.0.
  8863. @item luma_strength, ls
  8864. Set luma maximum difference between pixels to still be considered, must
  8865. be a value in the 0.1-100.0 range, default value is 1.0.
  8866. @item chroma_radius, cr
  8867. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  8868. greater value will result in a more blurred image, and in slower
  8869. processing.
  8870. @item chroma_pre_filter_radius, cpfr
  8871. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  8872. @item chroma_strength, cs
  8873. Set chroma maximum difference between pixels to still be considered,
  8874. must be a value in the -0.9-100.0 range.
  8875. @end table
  8876. Each chroma option value, if not explicitly specified, is set to the
  8877. corresponding luma option value.
  8878. @anchor{scale}
  8879. @section scale
  8880. Scale (resize) the input video, using the libswscale library.
  8881. The scale filter forces the output display aspect ratio to be the same
  8882. of the input, by changing the output sample aspect ratio.
  8883. If the input image format is different from the format requested by
  8884. the next filter, the scale filter will convert the input to the
  8885. requested format.
  8886. @subsection Options
  8887. The filter accepts the following options, or any of the options
  8888. supported by the libswscale scaler.
  8889. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  8890. the complete list of scaler options.
  8891. @table @option
  8892. @item width, w
  8893. @item height, h
  8894. Set the output video dimension expression. Default value is the input
  8895. dimension.
  8896. If the value is 0, the input width is used for the output.
  8897. If one of the values is -1, the scale filter will use a value that
  8898. maintains the aspect ratio of the input image, calculated from the
  8899. other specified dimension. If both of them are -1, the input size is
  8900. used
  8901. If one of the values is -n with n > 1, the scale filter will also use a value
  8902. that maintains the aspect ratio of the input image, calculated from the other
  8903. specified dimension. After that it will, however, make sure that the calculated
  8904. dimension is divisible by n and adjust the value if necessary.
  8905. See below for the list of accepted constants for use in the dimension
  8906. expression.
  8907. @item eval
  8908. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  8909. @table @samp
  8910. @item init
  8911. Only evaluate expressions once during the filter initialization or when a command is processed.
  8912. @item frame
  8913. Evaluate expressions for each incoming frame.
  8914. @end table
  8915. Default value is @samp{init}.
  8916. @item interl
  8917. Set the interlacing mode. It accepts the following values:
  8918. @table @samp
  8919. @item 1
  8920. Force interlaced aware scaling.
  8921. @item 0
  8922. Do not apply interlaced scaling.
  8923. @item -1
  8924. Select interlaced aware scaling depending on whether the source frames
  8925. are flagged as interlaced or not.
  8926. @end table
  8927. Default value is @samp{0}.
  8928. @item flags
  8929. Set libswscale scaling flags. See
  8930. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  8931. complete list of values. If not explicitly specified the filter applies
  8932. the default flags.
  8933. @item param0, param1
  8934. Set libswscale input parameters for scaling algorithms that need them. See
  8935. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  8936. complete documentation. If not explicitly specified the filter applies
  8937. empty parameters.
  8938. @item size, s
  8939. Set the video size. For the syntax of this option, check the
  8940. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8941. @item in_color_matrix
  8942. @item out_color_matrix
  8943. Set in/output YCbCr color space type.
  8944. This allows the autodetected value to be overridden as well as allows forcing
  8945. a specific value used for the output and encoder.
  8946. If not specified, the color space type depends on the pixel format.
  8947. Possible values:
  8948. @table @samp
  8949. @item auto
  8950. Choose automatically.
  8951. @item bt709
  8952. Format conforming to International Telecommunication Union (ITU)
  8953. Recommendation BT.709.
  8954. @item fcc
  8955. Set color space conforming to the United States Federal Communications
  8956. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  8957. @item bt601
  8958. Set color space conforming to:
  8959. @itemize
  8960. @item
  8961. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  8962. @item
  8963. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  8964. @item
  8965. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  8966. @end itemize
  8967. @item smpte240m
  8968. Set color space conforming to SMPTE ST 240:1999.
  8969. @end table
  8970. @item in_range
  8971. @item out_range
  8972. Set in/output YCbCr sample range.
  8973. This allows the autodetected value to be overridden as well as allows forcing
  8974. a specific value used for the output and encoder. If not specified, the
  8975. range depends on the pixel format. Possible values:
  8976. @table @samp
  8977. @item auto
  8978. Choose automatically.
  8979. @item jpeg/full/pc
  8980. Set full range (0-255 in case of 8-bit luma).
  8981. @item mpeg/tv
  8982. Set "MPEG" range (16-235 in case of 8-bit luma).
  8983. @end table
  8984. @item force_original_aspect_ratio
  8985. Enable decreasing or increasing output video width or height if necessary to
  8986. keep the original aspect ratio. Possible values:
  8987. @table @samp
  8988. @item disable
  8989. Scale the video as specified and disable this feature.
  8990. @item decrease
  8991. The output video dimensions will automatically be decreased if needed.
  8992. @item increase
  8993. The output video dimensions will automatically be increased if needed.
  8994. @end table
  8995. One useful instance of this option is that when you know a specific device's
  8996. maximum allowed resolution, you can use this to limit the output video to
  8997. that, while retaining the aspect ratio. For example, device A allows
  8998. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  8999. decrease) and specifying 1280x720 to the command line makes the output
  9000. 1280x533.
  9001. Please note that this is a different thing than specifying -1 for @option{w}
  9002. or @option{h}, you still need to specify the output resolution for this option
  9003. to work.
  9004. @end table
  9005. The values of the @option{w} and @option{h} options are expressions
  9006. containing the following constants:
  9007. @table @var
  9008. @item in_w
  9009. @item in_h
  9010. The input width and height
  9011. @item iw
  9012. @item ih
  9013. These are the same as @var{in_w} and @var{in_h}.
  9014. @item out_w
  9015. @item out_h
  9016. The output (scaled) width and height
  9017. @item ow
  9018. @item oh
  9019. These are the same as @var{out_w} and @var{out_h}
  9020. @item a
  9021. The same as @var{iw} / @var{ih}
  9022. @item sar
  9023. input sample aspect ratio
  9024. @item dar
  9025. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  9026. @item hsub
  9027. @item vsub
  9028. horizontal and vertical input chroma subsample values. For example for the
  9029. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9030. @item ohsub
  9031. @item ovsub
  9032. horizontal and vertical output chroma subsample values. For example for the
  9033. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9034. @end table
  9035. @subsection Examples
  9036. @itemize
  9037. @item
  9038. Scale the input video to a size of 200x100
  9039. @example
  9040. scale=w=200:h=100
  9041. @end example
  9042. This is equivalent to:
  9043. @example
  9044. scale=200:100
  9045. @end example
  9046. or:
  9047. @example
  9048. scale=200x100
  9049. @end example
  9050. @item
  9051. Specify a size abbreviation for the output size:
  9052. @example
  9053. scale=qcif
  9054. @end example
  9055. which can also be written as:
  9056. @example
  9057. scale=size=qcif
  9058. @end example
  9059. @item
  9060. Scale the input to 2x:
  9061. @example
  9062. scale=w=2*iw:h=2*ih
  9063. @end example
  9064. @item
  9065. The above is the same as:
  9066. @example
  9067. scale=2*in_w:2*in_h
  9068. @end example
  9069. @item
  9070. Scale the input to 2x with forced interlaced scaling:
  9071. @example
  9072. scale=2*iw:2*ih:interl=1
  9073. @end example
  9074. @item
  9075. Scale the input to half size:
  9076. @example
  9077. scale=w=iw/2:h=ih/2
  9078. @end example
  9079. @item
  9080. Increase the width, and set the height to the same size:
  9081. @example
  9082. scale=3/2*iw:ow
  9083. @end example
  9084. @item
  9085. Seek Greek harmony:
  9086. @example
  9087. scale=iw:1/PHI*iw
  9088. scale=ih*PHI:ih
  9089. @end example
  9090. @item
  9091. Increase the height, and set the width to 3/2 of the height:
  9092. @example
  9093. scale=w=3/2*oh:h=3/5*ih
  9094. @end example
  9095. @item
  9096. Increase the size, making the size a multiple of the chroma
  9097. subsample values:
  9098. @example
  9099. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  9100. @end example
  9101. @item
  9102. Increase the width to a maximum of 500 pixels,
  9103. keeping the same aspect ratio as the input:
  9104. @example
  9105. scale=w='min(500\, iw*3/2):h=-1'
  9106. @end example
  9107. @end itemize
  9108. @subsection Commands
  9109. This filter supports the following commands:
  9110. @table @option
  9111. @item width, w
  9112. @item height, h
  9113. Set the output video dimension expression.
  9114. The command accepts the same syntax of the corresponding option.
  9115. If the specified expression is not valid, it is kept at its current
  9116. value.
  9117. @end table
  9118. @section scale_npp
  9119. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  9120. format conversion on CUDA video frames. Setting the output width and height
  9121. works in the same way as for the @var{scale} filter.
  9122. The following additional options are accepted:
  9123. @table @option
  9124. @item format
  9125. The pixel format of the output CUDA frames. If set to the string "same" (the
  9126. default), the input format will be kept. Note that automatic format negotiation
  9127. and conversion is not yet supported for hardware frames
  9128. @item interp_algo
  9129. The interpolation algorithm used for resizing. One of the following:
  9130. @table @option
  9131. @item nn
  9132. Nearest neighbour.
  9133. @item linear
  9134. @item cubic
  9135. @item cubic2p_bspline
  9136. 2-parameter cubic (B=1, C=0)
  9137. @item cubic2p_catmullrom
  9138. 2-parameter cubic (B=0, C=1/2)
  9139. @item cubic2p_b05c03
  9140. 2-parameter cubic (B=1/2, C=3/10)
  9141. @item super
  9142. Supersampling
  9143. @item lanczos
  9144. @end table
  9145. @end table
  9146. @section scale2ref
  9147. Scale (resize) the input video, based on a reference video.
  9148. See the scale filter for available options, scale2ref supports the same but
  9149. uses the reference video instead of the main input as basis.
  9150. @subsection Examples
  9151. @itemize
  9152. @item
  9153. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  9154. @example
  9155. 'scale2ref[b][a];[a][b]overlay'
  9156. @end example
  9157. @end itemize
  9158. @anchor{selectivecolor}
  9159. @section selectivecolor
  9160. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  9161. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  9162. by the "purity" of the color (that is, how saturated it already is).
  9163. This filter is similar to the Adobe Photoshop Selective Color tool.
  9164. The filter accepts the following options:
  9165. @table @option
  9166. @item correction_method
  9167. Select color correction method.
  9168. Available values are:
  9169. @table @samp
  9170. @item absolute
  9171. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  9172. component value).
  9173. @item relative
  9174. Specified adjustments are relative to the original component value.
  9175. @end table
  9176. Default is @code{absolute}.
  9177. @item reds
  9178. Adjustments for red pixels (pixels where the red component is the maximum)
  9179. @item yellows
  9180. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  9181. @item greens
  9182. Adjustments for green pixels (pixels where the green component is the maximum)
  9183. @item cyans
  9184. Adjustments for cyan pixels (pixels where the red component is the minimum)
  9185. @item blues
  9186. Adjustments for blue pixels (pixels where the blue component is the maximum)
  9187. @item magentas
  9188. Adjustments for magenta pixels (pixels where the green component is the minimum)
  9189. @item whites
  9190. Adjustments for white pixels (pixels where all components are greater than 128)
  9191. @item neutrals
  9192. Adjustments for all pixels except pure black and pure white
  9193. @item blacks
  9194. Adjustments for black pixels (pixels where all components are lesser than 128)
  9195. @item psfile
  9196. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  9197. @end table
  9198. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  9199. 4 space separated floating point adjustment values in the [-1,1] range,
  9200. respectively to adjust the amount of cyan, magenta, yellow and black for the
  9201. pixels of its range.
  9202. @subsection Examples
  9203. @itemize
  9204. @item
  9205. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  9206. increase magenta by 27% in blue areas:
  9207. @example
  9208. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  9209. @end example
  9210. @item
  9211. Use a Photoshop selective color preset:
  9212. @example
  9213. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  9214. @end example
  9215. @end itemize
  9216. @anchor{separatefields}
  9217. @section separatefields
  9218. The @code{separatefields} takes a frame-based video input and splits
  9219. each frame into its components fields, producing a new half height clip
  9220. with twice the frame rate and twice the frame count.
  9221. This filter use field-dominance information in frame to decide which
  9222. of each pair of fields to place first in the output.
  9223. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  9224. @section setdar, setsar
  9225. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  9226. output video.
  9227. This is done by changing the specified Sample (aka Pixel) Aspect
  9228. Ratio, according to the following equation:
  9229. @example
  9230. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  9231. @end example
  9232. Keep in mind that the @code{setdar} filter does not modify the pixel
  9233. dimensions of the video frame. Also, the display aspect ratio set by
  9234. this filter may be changed by later filters in the filterchain,
  9235. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  9236. applied.
  9237. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  9238. the filter output video.
  9239. Note that as a consequence of the application of this filter, the
  9240. output display aspect ratio will change according to the equation
  9241. above.
  9242. Keep in mind that the sample aspect ratio set by the @code{setsar}
  9243. filter may be changed by later filters in the filterchain, e.g. if
  9244. another "setsar" or a "setdar" filter is applied.
  9245. It accepts the following parameters:
  9246. @table @option
  9247. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  9248. Set the aspect ratio used by the filter.
  9249. The parameter can be a floating point number string, an expression, or
  9250. a string of the form @var{num}:@var{den}, where @var{num} and
  9251. @var{den} are the numerator and denominator of the aspect ratio. If
  9252. the parameter is not specified, it is assumed the value "0".
  9253. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  9254. should be escaped.
  9255. @item max
  9256. Set the maximum integer value to use for expressing numerator and
  9257. denominator when reducing the expressed aspect ratio to a rational.
  9258. Default value is @code{100}.
  9259. @end table
  9260. The parameter @var{sar} is an expression containing
  9261. the following constants:
  9262. @table @option
  9263. @item E, PI, PHI
  9264. These are approximated values for the mathematical constants e
  9265. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  9266. @item w, h
  9267. The input width and height.
  9268. @item a
  9269. These are the same as @var{w} / @var{h}.
  9270. @item sar
  9271. The input sample aspect ratio.
  9272. @item dar
  9273. The input display aspect ratio. It is the same as
  9274. (@var{w} / @var{h}) * @var{sar}.
  9275. @item hsub, vsub
  9276. Horizontal and vertical chroma subsample values. For example, for the
  9277. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9278. @end table
  9279. @subsection Examples
  9280. @itemize
  9281. @item
  9282. To change the display aspect ratio to 16:9, specify one of the following:
  9283. @example
  9284. setdar=dar=1.77777
  9285. setdar=dar=16/9
  9286. @end example
  9287. @item
  9288. To change the sample aspect ratio to 10:11, specify:
  9289. @example
  9290. setsar=sar=10/11
  9291. @end example
  9292. @item
  9293. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  9294. 1000 in the aspect ratio reduction, use the command:
  9295. @example
  9296. setdar=ratio=16/9:max=1000
  9297. @end example
  9298. @end itemize
  9299. @anchor{setfield}
  9300. @section setfield
  9301. Force field for the output video frame.
  9302. The @code{setfield} filter marks the interlace type field for the
  9303. output frames. It does not change the input frame, but only sets the
  9304. corresponding property, which affects how the frame is treated by
  9305. following filters (e.g. @code{fieldorder} or @code{yadif}).
  9306. The filter accepts the following options:
  9307. @table @option
  9308. @item mode
  9309. Available values are:
  9310. @table @samp
  9311. @item auto
  9312. Keep the same field property.
  9313. @item bff
  9314. Mark the frame as bottom-field-first.
  9315. @item tff
  9316. Mark the frame as top-field-first.
  9317. @item prog
  9318. Mark the frame as progressive.
  9319. @end table
  9320. @end table
  9321. @section showinfo
  9322. Show a line containing various information for each input video frame.
  9323. The input video is not modified.
  9324. The shown line contains a sequence of key/value pairs of the form
  9325. @var{key}:@var{value}.
  9326. The following values are shown in the output:
  9327. @table @option
  9328. @item n
  9329. The (sequential) number of the input frame, starting from 0.
  9330. @item pts
  9331. The Presentation TimeStamp of the input frame, expressed as a number of
  9332. time base units. The time base unit depends on the filter input pad.
  9333. @item pts_time
  9334. The Presentation TimeStamp of the input frame, expressed as a number of
  9335. seconds.
  9336. @item pos
  9337. The position of the frame in the input stream, or -1 if this information is
  9338. unavailable and/or meaningless (for example in case of synthetic video).
  9339. @item fmt
  9340. The pixel format name.
  9341. @item sar
  9342. The sample aspect ratio of the input frame, expressed in the form
  9343. @var{num}/@var{den}.
  9344. @item s
  9345. The size of the input frame. For the syntax of this option, check the
  9346. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9347. @item i
  9348. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  9349. for bottom field first).
  9350. @item iskey
  9351. This is 1 if the frame is a key frame, 0 otherwise.
  9352. @item type
  9353. The picture type of the input frame ("I" for an I-frame, "P" for a
  9354. P-frame, "B" for a B-frame, or "?" for an unknown type).
  9355. Also refer to the documentation of the @code{AVPictureType} enum and of
  9356. the @code{av_get_picture_type_char} function defined in
  9357. @file{libavutil/avutil.h}.
  9358. @item checksum
  9359. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  9360. @item plane_checksum
  9361. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  9362. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  9363. @end table
  9364. @section showpalette
  9365. Displays the 256 colors palette of each frame. This filter is only relevant for
  9366. @var{pal8} pixel format frames.
  9367. It accepts the following option:
  9368. @table @option
  9369. @item s
  9370. Set the size of the box used to represent one palette color entry. Default is
  9371. @code{30} (for a @code{30x30} pixel box).
  9372. @end table
  9373. @section shuffleframes
  9374. Reorder and/or duplicate video frames.
  9375. It accepts the following parameters:
  9376. @table @option
  9377. @item mapping
  9378. Set the destination indexes of input frames.
  9379. This is space or '|' separated list of indexes that maps input frames to output
  9380. frames. Number of indexes also sets maximal value that each index may have.
  9381. @end table
  9382. The first frame has the index 0. The default is to keep the input unchanged.
  9383. @subsection Examples
  9384. @itemize
  9385. @item
  9386. Swap second and third frame of every three frames of the input:
  9387. @example
  9388. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  9389. @end example
  9390. @item
  9391. Swap 10th and 1st frame of every ten frames of the input:
  9392. @example
  9393. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  9394. @end example
  9395. @end itemize
  9396. @section shuffleplanes
  9397. Reorder and/or duplicate video planes.
  9398. It accepts the following parameters:
  9399. @table @option
  9400. @item map0
  9401. The index of the input plane to be used as the first output plane.
  9402. @item map1
  9403. The index of the input plane to be used as the second output plane.
  9404. @item map2
  9405. The index of the input plane to be used as the third output plane.
  9406. @item map3
  9407. The index of the input plane to be used as the fourth output plane.
  9408. @end table
  9409. The first plane has the index 0. The default is to keep the input unchanged.
  9410. @subsection Examples
  9411. @itemize
  9412. @item
  9413. Swap the second and third planes of the input:
  9414. @example
  9415. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  9416. @end example
  9417. @end itemize
  9418. @anchor{signalstats}
  9419. @section signalstats
  9420. Evaluate various visual metrics that assist in determining issues associated
  9421. with the digitization of analog video media.
  9422. By default the filter will log these metadata values:
  9423. @table @option
  9424. @item YMIN
  9425. Display the minimal Y value contained within the input frame. Expressed in
  9426. range of [0-255].
  9427. @item YLOW
  9428. Display the Y value at the 10% percentile within the input frame. Expressed in
  9429. range of [0-255].
  9430. @item YAVG
  9431. Display the average Y value within the input frame. Expressed in range of
  9432. [0-255].
  9433. @item YHIGH
  9434. Display the Y value at the 90% percentile within the input frame. Expressed in
  9435. range of [0-255].
  9436. @item YMAX
  9437. Display the maximum Y value contained within the input frame. Expressed in
  9438. range of [0-255].
  9439. @item UMIN
  9440. Display the minimal U value contained within the input frame. Expressed in
  9441. range of [0-255].
  9442. @item ULOW
  9443. Display the U value at the 10% percentile within the input frame. Expressed in
  9444. range of [0-255].
  9445. @item UAVG
  9446. Display the average U value within the input frame. Expressed in range of
  9447. [0-255].
  9448. @item UHIGH
  9449. Display the U value at the 90% percentile within the input frame. Expressed in
  9450. range of [0-255].
  9451. @item UMAX
  9452. Display the maximum U value contained within the input frame. Expressed in
  9453. range of [0-255].
  9454. @item VMIN
  9455. Display the minimal V value contained within the input frame. Expressed in
  9456. range of [0-255].
  9457. @item VLOW
  9458. Display the V value at the 10% percentile within the input frame. Expressed in
  9459. range of [0-255].
  9460. @item VAVG
  9461. Display the average V value within the input frame. Expressed in range of
  9462. [0-255].
  9463. @item VHIGH
  9464. Display the V value at the 90% percentile within the input frame. Expressed in
  9465. range of [0-255].
  9466. @item VMAX
  9467. Display the maximum V value contained within the input frame. Expressed in
  9468. range of [0-255].
  9469. @item SATMIN
  9470. Display the minimal saturation value contained within the input frame.
  9471. Expressed in range of [0-~181.02].
  9472. @item SATLOW
  9473. Display the saturation value at the 10% percentile within the input frame.
  9474. Expressed in range of [0-~181.02].
  9475. @item SATAVG
  9476. Display the average saturation value within the input frame. Expressed in range
  9477. of [0-~181.02].
  9478. @item SATHIGH
  9479. Display the saturation value at the 90% percentile within the input frame.
  9480. Expressed in range of [0-~181.02].
  9481. @item SATMAX
  9482. Display the maximum saturation value contained within the input frame.
  9483. Expressed in range of [0-~181.02].
  9484. @item HUEMED
  9485. Display the median value for hue within the input frame. Expressed in range of
  9486. [0-360].
  9487. @item HUEAVG
  9488. Display the average value for hue within the input frame. Expressed in range of
  9489. [0-360].
  9490. @item YDIF
  9491. Display the average of sample value difference between all values of the Y
  9492. plane in the current frame and corresponding values of the previous input frame.
  9493. Expressed in range of [0-255].
  9494. @item UDIF
  9495. Display the average of sample value difference between all values of the U
  9496. plane in the current frame and corresponding values of the previous input frame.
  9497. Expressed in range of [0-255].
  9498. @item VDIF
  9499. Display the average of sample value difference between all values of the V
  9500. plane in the current frame and corresponding values of the previous input frame.
  9501. Expressed in range of [0-255].
  9502. @item YBITDEPTH
  9503. Display bit depth of Y plane in current frame.
  9504. Expressed in range of [0-16].
  9505. @item UBITDEPTH
  9506. Display bit depth of U plane in current frame.
  9507. Expressed in range of [0-16].
  9508. @item VBITDEPTH
  9509. Display bit depth of V plane in current frame.
  9510. Expressed in range of [0-16].
  9511. @end table
  9512. The filter accepts the following options:
  9513. @table @option
  9514. @item stat
  9515. @item out
  9516. @option{stat} specify an additional form of image analysis.
  9517. @option{out} output video with the specified type of pixel highlighted.
  9518. Both options accept the following values:
  9519. @table @samp
  9520. @item tout
  9521. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  9522. unlike the neighboring pixels of the same field. Examples of temporal outliers
  9523. include the results of video dropouts, head clogs, or tape tracking issues.
  9524. @item vrep
  9525. Identify @var{vertical line repetition}. Vertical line repetition includes
  9526. similar rows of pixels within a frame. In born-digital video vertical line
  9527. repetition is common, but this pattern is uncommon in video digitized from an
  9528. analog source. When it occurs in video that results from the digitization of an
  9529. analog source it can indicate concealment from a dropout compensator.
  9530. @item brng
  9531. Identify pixels that fall outside of legal broadcast range.
  9532. @end table
  9533. @item color, c
  9534. Set the highlight color for the @option{out} option. The default color is
  9535. yellow.
  9536. @end table
  9537. @subsection Examples
  9538. @itemize
  9539. @item
  9540. Output data of various video metrics:
  9541. @example
  9542. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  9543. @end example
  9544. @item
  9545. Output specific data about the minimum and maximum values of the Y plane per frame:
  9546. @example
  9547. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  9548. @end example
  9549. @item
  9550. Playback video while highlighting pixels that are outside of broadcast range in red.
  9551. @example
  9552. ffplay example.mov -vf signalstats="out=brng:color=red"
  9553. @end example
  9554. @item
  9555. Playback video with signalstats metadata drawn over the frame.
  9556. @example
  9557. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  9558. @end example
  9559. The contents of signalstat_drawtext.txt used in the command are:
  9560. @example
  9561. time %@{pts:hms@}
  9562. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  9563. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  9564. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  9565. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  9566. @end example
  9567. @end itemize
  9568. @anchor{smartblur}
  9569. @section smartblur
  9570. Blur the input video without impacting the outlines.
  9571. It accepts the following options:
  9572. @table @option
  9573. @item luma_radius, lr
  9574. Set the luma radius. The option value must be a float number in
  9575. the range [0.1,5.0] that specifies the variance of the gaussian filter
  9576. used to blur the image (slower if larger). Default value is 1.0.
  9577. @item luma_strength, ls
  9578. Set the luma strength. The option value must be a float number
  9579. in the range [-1.0,1.0] that configures the blurring. A value included
  9580. in [0.0,1.0] will blur the image whereas a value included in
  9581. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  9582. @item luma_threshold, lt
  9583. Set the luma threshold used as a coefficient to determine
  9584. whether a pixel should be blurred or not. The option value must be an
  9585. integer in the range [-30,30]. A value of 0 will filter all the image,
  9586. a value included in [0,30] will filter flat areas and a value included
  9587. in [-30,0] will filter edges. Default value is 0.
  9588. @item chroma_radius, cr
  9589. Set the chroma radius. The option value must be a float number in
  9590. the range [0.1,5.0] that specifies the variance of the gaussian filter
  9591. used to blur the image (slower if larger). Default value is 1.0.
  9592. @item chroma_strength, cs
  9593. Set the chroma strength. The option value must be a float number
  9594. in the range [-1.0,1.0] that configures the blurring. A value included
  9595. in [0.0,1.0] will blur the image whereas a value included in
  9596. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  9597. @item chroma_threshold, ct
  9598. Set the chroma threshold used as a coefficient to determine
  9599. whether a pixel should be blurred or not. The option value must be an
  9600. integer in the range [-30,30]. A value of 0 will filter all the image,
  9601. a value included in [0,30] will filter flat areas and a value included
  9602. in [-30,0] will filter edges. Default value is 0.
  9603. @end table
  9604. If a chroma option is not explicitly set, the corresponding luma value
  9605. is set.
  9606. @section ssim
  9607. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  9608. This filter takes in input two input videos, the first input is
  9609. considered the "main" source and is passed unchanged to the
  9610. output. The second input is used as a "reference" video for computing
  9611. the SSIM.
  9612. Both video inputs must have the same resolution and pixel format for
  9613. this filter to work correctly. Also it assumes that both inputs
  9614. have the same number of frames, which are compared one by one.
  9615. The filter stores the calculated SSIM of each frame.
  9616. The description of the accepted parameters follows.
  9617. @table @option
  9618. @item stats_file, f
  9619. If specified the filter will use the named file to save the SSIM of
  9620. each individual frame. When filename equals "-" the data is sent to
  9621. standard output.
  9622. @end table
  9623. The file printed if @var{stats_file} is selected, contains a sequence of
  9624. key/value pairs of the form @var{key}:@var{value} for each compared
  9625. couple of frames.
  9626. A description of each shown parameter follows:
  9627. @table @option
  9628. @item n
  9629. sequential number of the input frame, starting from 1
  9630. @item Y, U, V, R, G, B
  9631. SSIM of the compared frames for the component specified by the suffix.
  9632. @item All
  9633. SSIM of the compared frames for the whole frame.
  9634. @item dB
  9635. Same as above but in dB representation.
  9636. @end table
  9637. For example:
  9638. @example
  9639. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  9640. [main][ref] ssim="stats_file=stats.log" [out]
  9641. @end example
  9642. On this example the input file being processed is compared with the
  9643. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  9644. is stored in @file{stats.log}.
  9645. Another example with both psnr and ssim at same time:
  9646. @example
  9647. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  9648. @end example
  9649. @section stereo3d
  9650. Convert between different stereoscopic image formats.
  9651. The filters accept the following options:
  9652. @table @option
  9653. @item in
  9654. Set stereoscopic image format of input.
  9655. Available values for input image formats are:
  9656. @table @samp
  9657. @item sbsl
  9658. side by side parallel (left eye left, right eye right)
  9659. @item sbsr
  9660. side by side crosseye (right eye left, left eye right)
  9661. @item sbs2l
  9662. side by side parallel with half width resolution
  9663. (left eye left, right eye right)
  9664. @item sbs2r
  9665. side by side crosseye with half width resolution
  9666. (right eye left, left eye right)
  9667. @item abl
  9668. above-below (left eye above, right eye below)
  9669. @item abr
  9670. above-below (right eye above, left eye below)
  9671. @item ab2l
  9672. above-below with half height resolution
  9673. (left eye above, right eye below)
  9674. @item ab2r
  9675. above-below with half height resolution
  9676. (right eye above, left eye below)
  9677. @item al
  9678. alternating frames (left eye first, right eye second)
  9679. @item ar
  9680. alternating frames (right eye first, left eye second)
  9681. @item irl
  9682. interleaved rows (left eye has top row, right eye starts on next row)
  9683. @item irr
  9684. interleaved rows (right eye has top row, left eye starts on next row)
  9685. @item icl
  9686. interleaved columns, left eye first
  9687. @item icr
  9688. interleaved columns, right eye first
  9689. Default value is @samp{sbsl}.
  9690. @end table
  9691. @item out
  9692. Set stereoscopic image format of output.
  9693. @table @samp
  9694. @item sbsl
  9695. side by side parallel (left eye left, right eye right)
  9696. @item sbsr
  9697. side by side crosseye (right eye left, left eye right)
  9698. @item sbs2l
  9699. side by side parallel with half width resolution
  9700. (left eye left, right eye right)
  9701. @item sbs2r
  9702. side by side crosseye with half width resolution
  9703. (right eye left, left eye right)
  9704. @item abl
  9705. above-below (left eye above, right eye below)
  9706. @item abr
  9707. above-below (right eye above, left eye below)
  9708. @item ab2l
  9709. above-below with half height resolution
  9710. (left eye above, right eye below)
  9711. @item ab2r
  9712. above-below with half height resolution
  9713. (right eye above, left eye below)
  9714. @item al
  9715. alternating frames (left eye first, right eye second)
  9716. @item ar
  9717. alternating frames (right eye first, left eye second)
  9718. @item irl
  9719. interleaved rows (left eye has top row, right eye starts on next row)
  9720. @item irr
  9721. interleaved rows (right eye has top row, left eye starts on next row)
  9722. @item arbg
  9723. anaglyph red/blue gray
  9724. (red filter on left eye, blue filter on right eye)
  9725. @item argg
  9726. anaglyph red/green gray
  9727. (red filter on left eye, green filter on right eye)
  9728. @item arcg
  9729. anaglyph red/cyan gray
  9730. (red filter on left eye, cyan filter on right eye)
  9731. @item arch
  9732. anaglyph red/cyan half colored
  9733. (red filter on left eye, cyan filter on right eye)
  9734. @item arcc
  9735. anaglyph red/cyan color
  9736. (red filter on left eye, cyan filter on right eye)
  9737. @item arcd
  9738. anaglyph red/cyan color optimized with the least squares projection of dubois
  9739. (red filter on left eye, cyan filter on right eye)
  9740. @item agmg
  9741. anaglyph green/magenta gray
  9742. (green filter on left eye, magenta filter on right eye)
  9743. @item agmh
  9744. anaglyph green/magenta half colored
  9745. (green filter on left eye, magenta filter on right eye)
  9746. @item agmc
  9747. anaglyph green/magenta colored
  9748. (green filter on left eye, magenta filter on right eye)
  9749. @item agmd
  9750. anaglyph green/magenta color optimized with the least squares projection of dubois
  9751. (green filter on left eye, magenta filter on right eye)
  9752. @item aybg
  9753. anaglyph yellow/blue gray
  9754. (yellow filter on left eye, blue filter on right eye)
  9755. @item aybh
  9756. anaglyph yellow/blue half colored
  9757. (yellow filter on left eye, blue filter on right eye)
  9758. @item aybc
  9759. anaglyph yellow/blue colored
  9760. (yellow filter on left eye, blue filter on right eye)
  9761. @item aybd
  9762. anaglyph yellow/blue color optimized with the least squares projection of dubois
  9763. (yellow filter on left eye, blue filter on right eye)
  9764. @item ml
  9765. mono output (left eye only)
  9766. @item mr
  9767. mono output (right eye only)
  9768. @item chl
  9769. checkerboard, left eye first
  9770. @item chr
  9771. checkerboard, right eye first
  9772. @item icl
  9773. interleaved columns, left eye first
  9774. @item icr
  9775. interleaved columns, right eye first
  9776. @item hdmi
  9777. HDMI frame pack
  9778. @end table
  9779. Default value is @samp{arcd}.
  9780. @end table
  9781. @subsection Examples
  9782. @itemize
  9783. @item
  9784. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  9785. @example
  9786. stereo3d=sbsl:aybd
  9787. @end example
  9788. @item
  9789. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  9790. @example
  9791. stereo3d=abl:sbsr
  9792. @end example
  9793. @end itemize
  9794. @section streamselect, astreamselect
  9795. Select video or audio streams.
  9796. The filter accepts the following options:
  9797. @table @option
  9798. @item inputs
  9799. Set number of inputs. Default is 2.
  9800. @item map
  9801. Set input indexes to remap to outputs.
  9802. @end table
  9803. @subsection Commands
  9804. The @code{streamselect} and @code{astreamselect} filter supports the following
  9805. commands:
  9806. @table @option
  9807. @item map
  9808. Set input indexes to remap to outputs.
  9809. @end table
  9810. @subsection Examples
  9811. @itemize
  9812. @item
  9813. Select first 5 seconds 1st stream and rest of time 2nd stream:
  9814. @example
  9815. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  9816. @end example
  9817. @item
  9818. Same as above, but for audio:
  9819. @example
  9820. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  9821. @end example
  9822. @end itemize
  9823. @section sobel
  9824. Apply sobel operator to input video stream.
  9825. The filter accepts the following option:
  9826. @table @option
  9827. @item planes
  9828. Set which planes will be processed, unprocessed planes will be copied.
  9829. By default value 0xf, all planes will be processed.
  9830. @item scale
  9831. Set value which will be multiplied with filtered result.
  9832. @item delta
  9833. Set value which will be added to filtered result.
  9834. @end table
  9835. @anchor{spp}
  9836. @section spp
  9837. Apply a simple postprocessing filter that compresses and decompresses the image
  9838. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  9839. and average the results.
  9840. The filter accepts the following options:
  9841. @table @option
  9842. @item quality
  9843. Set quality. This option defines the number of levels for averaging. It accepts
  9844. an integer in the range 0-6. If set to @code{0}, the filter will have no
  9845. effect. A value of @code{6} means the higher quality. For each increment of
  9846. that value the speed drops by a factor of approximately 2. Default value is
  9847. @code{3}.
  9848. @item qp
  9849. Force a constant quantization parameter. If not set, the filter will use the QP
  9850. from the video stream (if available).
  9851. @item mode
  9852. Set thresholding mode. Available modes are:
  9853. @table @samp
  9854. @item hard
  9855. Set hard thresholding (default).
  9856. @item soft
  9857. Set soft thresholding (better de-ringing effect, but likely blurrier).
  9858. @end table
  9859. @item use_bframe_qp
  9860. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  9861. option may cause flicker since the B-Frames have often larger QP. Default is
  9862. @code{0} (not enabled).
  9863. @end table
  9864. @anchor{subtitles}
  9865. @section subtitles
  9866. Draw subtitles on top of input video using the libass library.
  9867. To enable compilation of this filter you need to configure FFmpeg with
  9868. @code{--enable-libass}. This filter also requires a build with libavcodec and
  9869. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  9870. Alpha) subtitles format.
  9871. The filter accepts the following options:
  9872. @table @option
  9873. @item filename, f
  9874. Set the filename of the subtitle file to read. It must be specified.
  9875. @item original_size
  9876. Specify the size of the original video, the video for which the ASS file
  9877. was composed. For the syntax of this option, check the
  9878. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9879. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  9880. correctly scale the fonts if the aspect ratio has been changed.
  9881. @item fontsdir
  9882. Set a directory path containing fonts that can be used by the filter.
  9883. These fonts will be used in addition to whatever the font provider uses.
  9884. @item charenc
  9885. Set subtitles input character encoding. @code{subtitles} filter only. Only
  9886. useful if not UTF-8.
  9887. @item stream_index, si
  9888. Set subtitles stream index. @code{subtitles} filter only.
  9889. @item force_style
  9890. Override default style or script info parameters of the subtitles. It accepts a
  9891. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  9892. @end table
  9893. If the first key is not specified, it is assumed that the first value
  9894. specifies the @option{filename}.
  9895. For example, to render the file @file{sub.srt} on top of the input
  9896. video, use the command:
  9897. @example
  9898. subtitles=sub.srt
  9899. @end example
  9900. which is equivalent to:
  9901. @example
  9902. subtitles=filename=sub.srt
  9903. @end example
  9904. To render the default subtitles stream from file @file{video.mkv}, use:
  9905. @example
  9906. subtitles=video.mkv
  9907. @end example
  9908. To render the second subtitles stream from that file, use:
  9909. @example
  9910. subtitles=video.mkv:si=1
  9911. @end example
  9912. To make the subtitles stream from @file{sub.srt} appear in transparent green
  9913. @code{DejaVu Serif}, use:
  9914. @example
  9915. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  9916. @end example
  9917. @section super2xsai
  9918. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  9919. Interpolate) pixel art scaling algorithm.
  9920. Useful for enlarging pixel art images without reducing sharpness.
  9921. @section swaprect
  9922. Swap two rectangular objects in video.
  9923. This filter accepts the following options:
  9924. @table @option
  9925. @item w
  9926. Set object width.
  9927. @item h
  9928. Set object height.
  9929. @item x1
  9930. Set 1st rect x coordinate.
  9931. @item y1
  9932. Set 1st rect y coordinate.
  9933. @item x2
  9934. Set 2nd rect x coordinate.
  9935. @item y2
  9936. Set 2nd rect y coordinate.
  9937. All expressions are evaluated once for each frame.
  9938. @end table
  9939. The all options are expressions containing the following constants:
  9940. @table @option
  9941. @item w
  9942. @item h
  9943. The input width and height.
  9944. @item a
  9945. same as @var{w} / @var{h}
  9946. @item sar
  9947. input sample aspect ratio
  9948. @item dar
  9949. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  9950. @item n
  9951. The number of the input frame, starting from 0.
  9952. @item t
  9953. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  9954. @item pos
  9955. the position in the file of the input frame, NAN if unknown
  9956. @end table
  9957. @section swapuv
  9958. Swap U & V plane.
  9959. @section telecine
  9960. Apply telecine process to the video.
  9961. This filter accepts the following options:
  9962. @table @option
  9963. @item first_field
  9964. @table @samp
  9965. @item top, t
  9966. top field first
  9967. @item bottom, b
  9968. bottom field first
  9969. The default value is @code{top}.
  9970. @end table
  9971. @item pattern
  9972. A string of numbers representing the pulldown pattern you wish to apply.
  9973. The default value is @code{23}.
  9974. @end table
  9975. @example
  9976. Some typical patterns:
  9977. NTSC output (30i):
  9978. 27.5p: 32222
  9979. 24p: 23 (classic)
  9980. 24p: 2332 (preferred)
  9981. 20p: 33
  9982. 18p: 334
  9983. 16p: 3444
  9984. PAL output (25i):
  9985. 27.5p: 12222
  9986. 24p: 222222222223 ("Euro pulldown")
  9987. 16.67p: 33
  9988. 16p: 33333334
  9989. @end example
  9990. @section thumbnail
  9991. Select the most representative frame in a given sequence of consecutive frames.
  9992. The filter accepts the following options:
  9993. @table @option
  9994. @item n
  9995. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  9996. will pick one of them, and then handle the next batch of @var{n} frames until
  9997. the end. Default is @code{100}.
  9998. @end table
  9999. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  10000. value will result in a higher memory usage, so a high value is not recommended.
  10001. @subsection Examples
  10002. @itemize
  10003. @item
  10004. Extract one picture each 50 frames:
  10005. @example
  10006. thumbnail=50
  10007. @end example
  10008. @item
  10009. Complete example of a thumbnail creation with @command{ffmpeg}:
  10010. @example
  10011. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  10012. @end example
  10013. @end itemize
  10014. @section tile
  10015. Tile several successive frames together.
  10016. The filter accepts the following options:
  10017. @table @option
  10018. @item layout
  10019. Set the grid size (i.e. the number of lines and columns). For the syntax of
  10020. this option, check the
  10021. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10022. @item nb_frames
  10023. Set the maximum number of frames to render in the given area. It must be less
  10024. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  10025. the area will be used.
  10026. @item margin
  10027. Set the outer border margin in pixels.
  10028. @item padding
  10029. Set the inner border thickness (i.e. the number of pixels between frames). For
  10030. more advanced padding options (such as having different values for the edges),
  10031. refer to the pad video filter.
  10032. @item color
  10033. Specify the color of the unused area. For the syntax of this option, check the
  10034. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  10035. is "black".
  10036. @end table
  10037. @subsection Examples
  10038. @itemize
  10039. @item
  10040. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  10041. @example
  10042. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  10043. @end example
  10044. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  10045. duplicating each output frame to accommodate the originally detected frame
  10046. rate.
  10047. @item
  10048. Display @code{5} pictures in an area of @code{3x2} frames,
  10049. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  10050. mixed flat and named options:
  10051. @example
  10052. tile=3x2:nb_frames=5:padding=7:margin=2
  10053. @end example
  10054. @end itemize
  10055. @section tinterlace
  10056. Perform various types of temporal field interlacing.
  10057. Frames are counted starting from 1, so the first input frame is
  10058. considered odd.
  10059. The filter accepts the following options:
  10060. @table @option
  10061. @item mode
  10062. Specify the mode of the interlacing. This option can also be specified
  10063. as a value alone. See below for a list of values for this option.
  10064. Available values are:
  10065. @table @samp
  10066. @item merge, 0
  10067. Move odd frames into the upper field, even into the lower field,
  10068. generating a double height frame at half frame rate.
  10069. @example
  10070. ------> time
  10071. Input:
  10072. Frame 1 Frame 2 Frame 3 Frame 4
  10073. 11111 22222 33333 44444
  10074. 11111 22222 33333 44444
  10075. 11111 22222 33333 44444
  10076. 11111 22222 33333 44444
  10077. Output:
  10078. 11111 33333
  10079. 22222 44444
  10080. 11111 33333
  10081. 22222 44444
  10082. 11111 33333
  10083. 22222 44444
  10084. 11111 33333
  10085. 22222 44444
  10086. @end example
  10087. @item drop_even, 1
  10088. Only output odd frames, even frames are dropped, generating a frame with
  10089. unchanged height at half frame rate.
  10090. @example
  10091. ------> time
  10092. Input:
  10093. Frame 1 Frame 2 Frame 3 Frame 4
  10094. 11111 22222 33333 44444
  10095. 11111 22222 33333 44444
  10096. 11111 22222 33333 44444
  10097. 11111 22222 33333 44444
  10098. Output:
  10099. 11111 33333
  10100. 11111 33333
  10101. 11111 33333
  10102. 11111 33333
  10103. @end example
  10104. @item drop_odd, 2
  10105. Only output even frames, odd frames are dropped, generating a frame with
  10106. unchanged height at half frame rate.
  10107. @example
  10108. ------> time
  10109. Input:
  10110. Frame 1 Frame 2 Frame 3 Frame 4
  10111. 11111 22222 33333 44444
  10112. 11111 22222 33333 44444
  10113. 11111 22222 33333 44444
  10114. 11111 22222 33333 44444
  10115. Output:
  10116. 22222 44444
  10117. 22222 44444
  10118. 22222 44444
  10119. 22222 44444
  10120. @end example
  10121. @item pad, 3
  10122. Expand each frame to full height, but pad alternate lines with black,
  10123. generating a frame with double height at the same input frame rate.
  10124. @example
  10125. ------> time
  10126. Input:
  10127. Frame 1 Frame 2 Frame 3 Frame 4
  10128. 11111 22222 33333 44444
  10129. 11111 22222 33333 44444
  10130. 11111 22222 33333 44444
  10131. 11111 22222 33333 44444
  10132. Output:
  10133. 11111 ..... 33333 .....
  10134. ..... 22222 ..... 44444
  10135. 11111 ..... 33333 .....
  10136. ..... 22222 ..... 44444
  10137. 11111 ..... 33333 .....
  10138. ..... 22222 ..... 44444
  10139. 11111 ..... 33333 .....
  10140. ..... 22222 ..... 44444
  10141. @end example
  10142. @item interleave_top, 4
  10143. Interleave the upper field from odd frames with the lower field from
  10144. even frames, generating a frame with unchanged height at half frame rate.
  10145. @example
  10146. ------> time
  10147. Input:
  10148. Frame 1 Frame 2 Frame 3 Frame 4
  10149. 11111<- 22222 33333<- 44444
  10150. 11111 22222<- 33333 44444<-
  10151. 11111<- 22222 33333<- 44444
  10152. 11111 22222<- 33333 44444<-
  10153. Output:
  10154. 11111 33333
  10155. 22222 44444
  10156. 11111 33333
  10157. 22222 44444
  10158. @end example
  10159. @item interleave_bottom, 5
  10160. Interleave the lower field from odd frames with the upper field from
  10161. even frames, generating a frame with unchanged height at half frame rate.
  10162. @example
  10163. ------> time
  10164. Input:
  10165. Frame 1 Frame 2 Frame 3 Frame 4
  10166. 11111 22222<- 33333 44444<-
  10167. 11111<- 22222 33333<- 44444
  10168. 11111 22222<- 33333 44444<-
  10169. 11111<- 22222 33333<- 44444
  10170. Output:
  10171. 22222 44444
  10172. 11111 33333
  10173. 22222 44444
  10174. 11111 33333
  10175. @end example
  10176. @item interlacex2, 6
  10177. Double frame rate with unchanged height. Frames are inserted each
  10178. containing the second temporal field from the previous input frame and
  10179. the first temporal field from the next input frame. This mode relies on
  10180. the top_field_first flag. Useful for interlaced video displays with no
  10181. field synchronisation.
  10182. @example
  10183. ------> time
  10184. Input:
  10185. Frame 1 Frame 2 Frame 3 Frame 4
  10186. 11111 22222 33333 44444
  10187. 11111 22222 33333 44444
  10188. 11111 22222 33333 44444
  10189. 11111 22222 33333 44444
  10190. Output:
  10191. 11111 22222 22222 33333 33333 44444 44444
  10192. 11111 11111 22222 22222 33333 33333 44444
  10193. 11111 22222 22222 33333 33333 44444 44444
  10194. 11111 11111 22222 22222 33333 33333 44444
  10195. @end example
  10196. @item mergex2, 7
  10197. Move odd frames into the upper field, even into the lower field,
  10198. generating a double height frame at same frame rate.
  10199. @example
  10200. ------> time
  10201. Input:
  10202. Frame 1 Frame 2 Frame 3 Frame 4
  10203. 11111 22222 33333 44444
  10204. 11111 22222 33333 44444
  10205. 11111 22222 33333 44444
  10206. 11111 22222 33333 44444
  10207. Output:
  10208. 11111 33333 33333 55555
  10209. 22222 22222 44444 44444
  10210. 11111 33333 33333 55555
  10211. 22222 22222 44444 44444
  10212. 11111 33333 33333 55555
  10213. 22222 22222 44444 44444
  10214. 11111 33333 33333 55555
  10215. 22222 22222 44444 44444
  10216. @end example
  10217. @end table
  10218. Numeric values are deprecated but are accepted for backward
  10219. compatibility reasons.
  10220. Default mode is @code{merge}.
  10221. @item flags
  10222. Specify flags influencing the filter process.
  10223. Available value for @var{flags} is:
  10224. @table @option
  10225. @item low_pass_filter, vlfp
  10226. Enable vertical low-pass filtering in the filter.
  10227. Vertical low-pass filtering is required when creating an interlaced
  10228. destination from a progressive source which contains high-frequency
  10229. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  10230. patterning.
  10231. Vertical low-pass filtering can only be enabled for @option{mode}
  10232. @var{interleave_top} and @var{interleave_bottom}.
  10233. @end table
  10234. @end table
  10235. @section transpose
  10236. Transpose rows with columns in the input video and optionally flip it.
  10237. It accepts the following parameters:
  10238. @table @option
  10239. @item dir
  10240. Specify the transposition direction.
  10241. Can assume the following values:
  10242. @table @samp
  10243. @item 0, 4, cclock_flip
  10244. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  10245. @example
  10246. L.R L.l
  10247. . . -> . .
  10248. l.r R.r
  10249. @end example
  10250. @item 1, 5, clock
  10251. Rotate by 90 degrees clockwise, that is:
  10252. @example
  10253. L.R l.L
  10254. . . -> . .
  10255. l.r r.R
  10256. @end example
  10257. @item 2, 6, cclock
  10258. Rotate by 90 degrees counterclockwise, that is:
  10259. @example
  10260. L.R R.r
  10261. . . -> . .
  10262. l.r L.l
  10263. @end example
  10264. @item 3, 7, clock_flip
  10265. Rotate by 90 degrees clockwise and vertically flip, that is:
  10266. @example
  10267. L.R r.R
  10268. . . -> . .
  10269. l.r l.L
  10270. @end example
  10271. @end table
  10272. For values between 4-7, the transposition is only done if the input
  10273. video geometry is portrait and not landscape. These values are
  10274. deprecated, the @code{passthrough} option should be used instead.
  10275. Numerical values are deprecated, and should be dropped in favor of
  10276. symbolic constants.
  10277. @item passthrough
  10278. Do not apply the transposition if the input geometry matches the one
  10279. specified by the specified value. It accepts the following values:
  10280. @table @samp
  10281. @item none
  10282. Always apply transposition.
  10283. @item portrait
  10284. Preserve portrait geometry (when @var{height} >= @var{width}).
  10285. @item landscape
  10286. Preserve landscape geometry (when @var{width} >= @var{height}).
  10287. @end table
  10288. Default value is @code{none}.
  10289. @end table
  10290. For example to rotate by 90 degrees clockwise and preserve portrait
  10291. layout:
  10292. @example
  10293. transpose=dir=1:passthrough=portrait
  10294. @end example
  10295. The command above can also be specified as:
  10296. @example
  10297. transpose=1:portrait
  10298. @end example
  10299. @section trim
  10300. Trim the input so that the output contains one continuous subpart of the input.
  10301. It accepts the following parameters:
  10302. @table @option
  10303. @item start
  10304. Specify the time of the start of the kept section, i.e. the frame with the
  10305. timestamp @var{start} will be the first frame in the output.
  10306. @item end
  10307. Specify the time of the first frame that will be dropped, i.e. the frame
  10308. immediately preceding the one with the timestamp @var{end} will be the last
  10309. frame in the output.
  10310. @item start_pts
  10311. This is the same as @var{start}, except this option sets the start timestamp
  10312. in timebase units instead of seconds.
  10313. @item end_pts
  10314. This is the same as @var{end}, except this option sets the end timestamp
  10315. in timebase units instead of seconds.
  10316. @item duration
  10317. The maximum duration of the output in seconds.
  10318. @item start_frame
  10319. The number of the first frame that should be passed to the output.
  10320. @item end_frame
  10321. The number of the first frame that should be dropped.
  10322. @end table
  10323. @option{start}, @option{end}, and @option{duration} are expressed as time
  10324. duration specifications; see
  10325. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  10326. for the accepted syntax.
  10327. Note that the first two sets of the start/end options and the @option{duration}
  10328. option look at the frame timestamp, while the _frame variants simply count the
  10329. frames that pass through the filter. Also note that this filter does not modify
  10330. the timestamps. If you wish for the output timestamps to start at zero, insert a
  10331. setpts filter after the trim filter.
  10332. If multiple start or end options are set, this filter tries to be greedy and
  10333. keep all the frames that match at least one of the specified constraints. To keep
  10334. only the part that matches all the constraints at once, chain multiple trim
  10335. filters.
  10336. The defaults are such that all the input is kept. So it is possible to set e.g.
  10337. just the end values to keep everything before the specified time.
  10338. Examples:
  10339. @itemize
  10340. @item
  10341. Drop everything except the second minute of input:
  10342. @example
  10343. ffmpeg -i INPUT -vf trim=60:120
  10344. @end example
  10345. @item
  10346. Keep only the first second:
  10347. @example
  10348. ffmpeg -i INPUT -vf trim=duration=1
  10349. @end example
  10350. @end itemize
  10351. @anchor{unsharp}
  10352. @section unsharp
  10353. Sharpen or blur the input video.
  10354. It accepts the following parameters:
  10355. @table @option
  10356. @item luma_msize_x, lx
  10357. Set the luma matrix horizontal size. It must be an odd integer between
  10358. 3 and 23. The default value is 5.
  10359. @item luma_msize_y, ly
  10360. Set the luma matrix vertical size. It must be an odd integer between 3
  10361. and 23. The default value is 5.
  10362. @item luma_amount, la
  10363. Set the luma effect strength. It must be a floating point number, reasonable
  10364. values lay between -1.5 and 1.5.
  10365. Negative values will blur the input video, while positive values will
  10366. sharpen it, a value of zero will disable the effect.
  10367. Default value is 1.0.
  10368. @item chroma_msize_x, cx
  10369. Set the chroma matrix horizontal size. It must be an odd integer
  10370. between 3 and 23. The default value is 5.
  10371. @item chroma_msize_y, cy
  10372. Set the chroma matrix vertical size. It must be an odd integer
  10373. between 3 and 23. The default value is 5.
  10374. @item chroma_amount, ca
  10375. Set the chroma effect strength. It must be a floating point number, reasonable
  10376. values lay between -1.5 and 1.5.
  10377. Negative values will blur the input video, while positive values will
  10378. sharpen it, a value of zero will disable the effect.
  10379. Default value is 0.0.
  10380. @item opencl
  10381. If set to 1, specify using OpenCL capabilities, only available if
  10382. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  10383. @end table
  10384. All parameters are optional and default to the equivalent of the
  10385. string '5:5:1.0:5:5:0.0'.
  10386. @subsection Examples
  10387. @itemize
  10388. @item
  10389. Apply strong luma sharpen effect:
  10390. @example
  10391. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  10392. @end example
  10393. @item
  10394. Apply a strong blur of both luma and chroma parameters:
  10395. @example
  10396. unsharp=7:7:-2:7:7:-2
  10397. @end example
  10398. @end itemize
  10399. @section uspp
  10400. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  10401. the image at several (or - in the case of @option{quality} level @code{8} - all)
  10402. shifts and average the results.
  10403. The way this differs from the behavior of spp is that uspp actually encodes &
  10404. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  10405. DCT similar to MJPEG.
  10406. The filter accepts the following options:
  10407. @table @option
  10408. @item quality
  10409. Set quality. This option defines the number of levels for averaging. It accepts
  10410. an integer in the range 0-8. If set to @code{0}, the filter will have no
  10411. effect. A value of @code{8} means the higher quality. For each increment of
  10412. that value the speed drops by a factor of approximately 2. Default value is
  10413. @code{3}.
  10414. @item qp
  10415. Force a constant quantization parameter. If not set, the filter will use the QP
  10416. from the video stream (if available).
  10417. @end table
  10418. @section vaguedenoiser
  10419. Apply a wavelet based denoiser.
  10420. It transforms each frame from the video input into the wavelet domain,
  10421. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  10422. the obtained coefficients. It does an inverse wavelet transform after.
  10423. Due to wavelet properties, it should give a nice smoothed result, and
  10424. reduced noise, without blurring picture features.
  10425. This filter accepts the following options:
  10426. @table @option
  10427. @item threshold
  10428. The filtering strength. The higher, the more filtered the video will be.
  10429. Hard thresholding can use a higher threshold than soft thresholding
  10430. before the video looks overfiltered.
  10431. @item method
  10432. The filtering method the filter will use.
  10433. It accepts the following values:
  10434. @table @samp
  10435. @item hard
  10436. All values under the threshold will be zeroed.
  10437. @item soft
  10438. All values under the threshold will be zeroed. All values above will be
  10439. reduced by the threshold.
  10440. @item garrote
  10441. Scales or nullifies coefficients - intermediary between (more) soft and
  10442. (less) hard thresholding.
  10443. @end table
  10444. @item nsteps
  10445. Number of times, the wavelet will decompose the picture. Picture can't
  10446. be decomposed beyond a particular point (typically, 8 for a 640x480
  10447. frame - as 2^9 = 512 > 480)
  10448. @item percent
  10449. Partial of full denoising (limited coefficients shrinking), from 0 to 100.
  10450. @item planes
  10451. A list of the planes to process. By default all planes are processed.
  10452. @end table
  10453. @section vectorscope
  10454. Display 2 color component values in the two dimensional graph (which is called
  10455. a vectorscope).
  10456. This filter accepts the following options:
  10457. @table @option
  10458. @item mode, m
  10459. Set vectorscope mode.
  10460. It accepts the following values:
  10461. @table @samp
  10462. @item gray
  10463. Gray values are displayed on graph, higher brightness means more pixels have
  10464. same component color value on location in graph. This is the default mode.
  10465. @item color
  10466. Gray values are displayed on graph. Surrounding pixels values which are not
  10467. present in video frame are drawn in gradient of 2 color components which are
  10468. set by option @code{x} and @code{y}. The 3rd color component is static.
  10469. @item color2
  10470. Actual color components values present in video frame are displayed on graph.
  10471. @item color3
  10472. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  10473. on graph increases value of another color component, which is luminance by
  10474. default values of @code{x} and @code{y}.
  10475. @item color4
  10476. Actual colors present in video frame are displayed on graph. If two different
  10477. colors map to same position on graph then color with higher value of component
  10478. not present in graph is picked.
  10479. @item color5
  10480. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  10481. component picked from radial gradient.
  10482. @end table
  10483. @item x
  10484. Set which color component will be represented on X-axis. Default is @code{1}.
  10485. @item y
  10486. Set which color component will be represented on Y-axis. Default is @code{2}.
  10487. @item intensity, i
  10488. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  10489. of color component which represents frequency of (X, Y) location in graph.
  10490. @item envelope, e
  10491. @table @samp
  10492. @item none
  10493. No envelope, this is default.
  10494. @item instant
  10495. Instant envelope, even darkest single pixel will be clearly highlighted.
  10496. @item peak
  10497. Hold maximum and minimum values presented in graph over time. This way you
  10498. can still spot out of range values without constantly looking at vectorscope.
  10499. @item peak+instant
  10500. Peak and instant envelope combined together.
  10501. @end table
  10502. @item graticule, g
  10503. Set what kind of graticule to draw.
  10504. @table @samp
  10505. @item none
  10506. @item green
  10507. @item color
  10508. @end table
  10509. @item opacity, o
  10510. Set graticule opacity.
  10511. @item flags, f
  10512. Set graticule flags.
  10513. @table @samp
  10514. @item white
  10515. Draw graticule for white point.
  10516. @item black
  10517. Draw graticule for black point.
  10518. @item name
  10519. Draw color points short names.
  10520. @end table
  10521. @item bgopacity, b
  10522. Set background opacity.
  10523. @item lthreshold, l
  10524. Set low threshold for color component not represented on X or Y axis.
  10525. Values lower than this value will be ignored. Default is 0.
  10526. Note this value is multiplied with actual max possible value one pixel component
  10527. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  10528. is 0.1 * 255 = 25.
  10529. @item hthreshold, h
  10530. Set high threshold for color component not represented on X or Y axis.
  10531. Values higher than this value will be ignored. Default is 1.
  10532. Note this value is multiplied with actual max possible value one pixel component
  10533. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  10534. is 0.9 * 255 = 230.
  10535. @item colorspace, c
  10536. Set what kind of colorspace to use when drawing graticule.
  10537. @table @samp
  10538. @item auto
  10539. @item 601
  10540. @item 709
  10541. @end table
  10542. Default is auto.
  10543. @end table
  10544. @anchor{vidstabdetect}
  10545. @section vidstabdetect
  10546. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  10547. @ref{vidstabtransform} for pass 2.
  10548. This filter generates a file with relative translation and rotation
  10549. transform information about subsequent frames, which is then used by
  10550. the @ref{vidstabtransform} filter.
  10551. To enable compilation of this filter you need to configure FFmpeg with
  10552. @code{--enable-libvidstab}.
  10553. This filter accepts the following options:
  10554. @table @option
  10555. @item result
  10556. Set the path to the file used to write the transforms information.
  10557. Default value is @file{transforms.trf}.
  10558. @item shakiness
  10559. Set how shaky the video is and how quick the camera is. It accepts an
  10560. integer in the range 1-10, a value of 1 means little shakiness, a
  10561. value of 10 means strong shakiness. Default value is 5.
  10562. @item accuracy
  10563. Set the accuracy of the detection process. It must be a value in the
  10564. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  10565. accuracy. Default value is 15.
  10566. @item stepsize
  10567. Set stepsize of the search process. The region around minimum is
  10568. scanned with 1 pixel resolution. Default value is 6.
  10569. @item mincontrast
  10570. Set minimum contrast. Below this value a local measurement field is
  10571. discarded. Must be a floating point value in the range 0-1. Default
  10572. value is 0.3.
  10573. @item tripod
  10574. Set reference frame number for tripod mode.
  10575. If enabled, the motion of the frames is compared to a reference frame
  10576. in the filtered stream, identified by the specified number. The idea
  10577. is to compensate all movements in a more-or-less static scene and keep
  10578. the camera view absolutely still.
  10579. If set to 0, it is disabled. The frames are counted starting from 1.
  10580. @item show
  10581. Show fields and transforms in the resulting frames. It accepts an
  10582. integer in the range 0-2. Default value is 0, which disables any
  10583. visualization.
  10584. @end table
  10585. @subsection Examples
  10586. @itemize
  10587. @item
  10588. Use default values:
  10589. @example
  10590. vidstabdetect
  10591. @end example
  10592. @item
  10593. Analyze strongly shaky movie and put the results in file
  10594. @file{mytransforms.trf}:
  10595. @example
  10596. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  10597. @end example
  10598. @item
  10599. Visualize the result of internal transformations in the resulting
  10600. video:
  10601. @example
  10602. vidstabdetect=show=1
  10603. @end example
  10604. @item
  10605. Analyze a video with medium shakiness using @command{ffmpeg}:
  10606. @example
  10607. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  10608. @end example
  10609. @end itemize
  10610. @anchor{vidstabtransform}
  10611. @section vidstabtransform
  10612. Video stabilization/deshaking: pass 2 of 2,
  10613. see @ref{vidstabdetect} for pass 1.
  10614. Read a file with transform information for each frame and
  10615. apply/compensate them. Together with the @ref{vidstabdetect}
  10616. filter this can be used to deshake videos. See also
  10617. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  10618. the @ref{unsharp} filter, see below.
  10619. To enable compilation of this filter you need to configure FFmpeg with
  10620. @code{--enable-libvidstab}.
  10621. @subsection Options
  10622. @table @option
  10623. @item input
  10624. Set path to the file used to read the transforms. Default value is
  10625. @file{transforms.trf}.
  10626. @item smoothing
  10627. Set the number of frames (value*2 + 1) used for lowpass filtering the
  10628. camera movements. Default value is 10.
  10629. For example a number of 10 means that 21 frames are used (10 in the
  10630. past and 10 in the future) to smoothen the motion in the video. A
  10631. larger value leads to a smoother video, but limits the acceleration of
  10632. the camera (pan/tilt movements). 0 is a special case where a static
  10633. camera is simulated.
  10634. @item optalgo
  10635. Set the camera path optimization algorithm.
  10636. Accepted values are:
  10637. @table @samp
  10638. @item gauss
  10639. gaussian kernel low-pass filter on camera motion (default)
  10640. @item avg
  10641. averaging on transformations
  10642. @end table
  10643. @item maxshift
  10644. Set maximal number of pixels to translate frames. Default value is -1,
  10645. meaning no limit.
  10646. @item maxangle
  10647. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  10648. value is -1, meaning no limit.
  10649. @item crop
  10650. Specify how to deal with borders that may be visible due to movement
  10651. compensation.
  10652. Available values are:
  10653. @table @samp
  10654. @item keep
  10655. keep image information from previous frame (default)
  10656. @item black
  10657. fill the border black
  10658. @end table
  10659. @item invert
  10660. Invert transforms if set to 1. Default value is 0.
  10661. @item relative
  10662. Consider transforms as relative to previous frame if set to 1,
  10663. absolute if set to 0. Default value is 0.
  10664. @item zoom
  10665. Set percentage to zoom. A positive value will result in a zoom-in
  10666. effect, a negative value in a zoom-out effect. Default value is 0 (no
  10667. zoom).
  10668. @item optzoom
  10669. Set optimal zooming to avoid borders.
  10670. Accepted values are:
  10671. @table @samp
  10672. @item 0
  10673. disabled
  10674. @item 1
  10675. optimal static zoom value is determined (only very strong movements
  10676. will lead to visible borders) (default)
  10677. @item 2
  10678. optimal adaptive zoom value is determined (no borders will be
  10679. visible), see @option{zoomspeed}
  10680. @end table
  10681. Note that the value given at zoom is added to the one calculated here.
  10682. @item zoomspeed
  10683. Set percent to zoom maximally each frame (enabled when
  10684. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  10685. 0.25.
  10686. @item interpol
  10687. Specify type of interpolation.
  10688. Available values are:
  10689. @table @samp
  10690. @item no
  10691. no interpolation
  10692. @item linear
  10693. linear only horizontal
  10694. @item bilinear
  10695. linear in both directions (default)
  10696. @item bicubic
  10697. cubic in both directions (slow)
  10698. @end table
  10699. @item tripod
  10700. Enable virtual tripod mode if set to 1, which is equivalent to
  10701. @code{relative=0:smoothing=0}. Default value is 0.
  10702. Use also @code{tripod} option of @ref{vidstabdetect}.
  10703. @item debug
  10704. Increase log verbosity if set to 1. Also the detected global motions
  10705. are written to the temporary file @file{global_motions.trf}. Default
  10706. value is 0.
  10707. @end table
  10708. @subsection Examples
  10709. @itemize
  10710. @item
  10711. Use @command{ffmpeg} for a typical stabilization with default values:
  10712. @example
  10713. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  10714. @end example
  10715. Note the use of the @ref{unsharp} filter which is always recommended.
  10716. @item
  10717. Zoom in a bit more and load transform data from a given file:
  10718. @example
  10719. vidstabtransform=zoom=5:input="mytransforms.trf"
  10720. @end example
  10721. @item
  10722. Smoothen the video even more:
  10723. @example
  10724. vidstabtransform=smoothing=30
  10725. @end example
  10726. @end itemize
  10727. @section vflip
  10728. Flip the input video vertically.
  10729. For example, to vertically flip a video with @command{ffmpeg}:
  10730. @example
  10731. ffmpeg -i in.avi -vf "vflip" out.avi
  10732. @end example
  10733. @anchor{vignette}
  10734. @section vignette
  10735. Make or reverse a natural vignetting effect.
  10736. The filter accepts the following options:
  10737. @table @option
  10738. @item angle, a
  10739. Set lens angle expression as a number of radians.
  10740. The value is clipped in the @code{[0,PI/2]} range.
  10741. Default value: @code{"PI/5"}
  10742. @item x0
  10743. @item y0
  10744. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  10745. by default.
  10746. @item mode
  10747. Set forward/backward mode.
  10748. Available modes are:
  10749. @table @samp
  10750. @item forward
  10751. The larger the distance from the central point, the darker the image becomes.
  10752. @item backward
  10753. The larger the distance from the central point, the brighter the image becomes.
  10754. This can be used to reverse a vignette effect, though there is no automatic
  10755. detection to extract the lens @option{angle} and other settings (yet). It can
  10756. also be used to create a burning effect.
  10757. @end table
  10758. Default value is @samp{forward}.
  10759. @item eval
  10760. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  10761. It accepts the following values:
  10762. @table @samp
  10763. @item init
  10764. Evaluate expressions only once during the filter initialization.
  10765. @item frame
  10766. Evaluate expressions for each incoming frame. This is way slower than the
  10767. @samp{init} mode since it requires all the scalers to be re-computed, but it
  10768. allows advanced dynamic expressions.
  10769. @end table
  10770. Default value is @samp{init}.
  10771. @item dither
  10772. Set dithering to reduce the circular banding effects. Default is @code{1}
  10773. (enabled).
  10774. @item aspect
  10775. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  10776. Setting this value to the SAR of the input will make a rectangular vignetting
  10777. following the dimensions of the video.
  10778. Default is @code{1/1}.
  10779. @end table
  10780. @subsection Expressions
  10781. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  10782. following parameters.
  10783. @table @option
  10784. @item w
  10785. @item h
  10786. input width and height
  10787. @item n
  10788. the number of input frame, starting from 0
  10789. @item pts
  10790. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  10791. @var{TB} units, NAN if undefined
  10792. @item r
  10793. frame rate of the input video, NAN if the input frame rate is unknown
  10794. @item t
  10795. the PTS (Presentation TimeStamp) of the filtered video frame,
  10796. expressed in seconds, NAN if undefined
  10797. @item tb
  10798. time base of the input video
  10799. @end table
  10800. @subsection Examples
  10801. @itemize
  10802. @item
  10803. Apply simple strong vignetting effect:
  10804. @example
  10805. vignette=PI/4
  10806. @end example
  10807. @item
  10808. Make a flickering vignetting:
  10809. @example
  10810. vignette='PI/4+random(1)*PI/50':eval=frame
  10811. @end example
  10812. @end itemize
  10813. @section vstack
  10814. Stack input videos vertically.
  10815. All streams must be of same pixel format and of same width.
  10816. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  10817. to create same output.
  10818. The filter accept the following option:
  10819. @table @option
  10820. @item inputs
  10821. Set number of input streams. Default is 2.
  10822. @item shortest
  10823. If set to 1, force the output to terminate when the shortest input
  10824. terminates. Default value is 0.
  10825. @end table
  10826. @section w3fdif
  10827. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  10828. Deinterlacing Filter").
  10829. Based on the process described by Martin Weston for BBC R&D, and
  10830. implemented based on the de-interlace algorithm written by Jim
  10831. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  10832. uses filter coefficients calculated by BBC R&D.
  10833. There are two sets of filter coefficients, so called "simple":
  10834. and "complex". Which set of filter coefficients is used can
  10835. be set by passing an optional parameter:
  10836. @table @option
  10837. @item filter
  10838. Set the interlacing filter coefficients. Accepts one of the following values:
  10839. @table @samp
  10840. @item simple
  10841. Simple filter coefficient set.
  10842. @item complex
  10843. More-complex filter coefficient set.
  10844. @end table
  10845. Default value is @samp{complex}.
  10846. @item deint
  10847. Specify which frames to deinterlace. Accept one of the following values:
  10848. @table @samp
  10849. @item all
  10850. Deinterlace all frames,
  10851. @item interlaced
  10852. Only deinterlace frames marked as interlaced.
  10853. @end table
  10854. Default value is @samp{all}.
  10855. @end table
  10856. @section waveform
  10857. Video waveform monitor.
  10858. The waveform monitor plots color component intensity. By default luminance
  10859. only. Each column of the waveform corresponds to a column of pixels in the
  10860. source video.
  10861. It accepts the following options:
  10862. @table @option
  10863. @item mode, m
  10864. Can be either @code{row}, or @code{column}. Default is @code{column}.
  10865. In row mode, the graph on the left side represents color component value 0 and
  10866. the right side represents value = 255. In column mode, the top side represents
  10867. color component value = 0 and bottom side represents value = 255.
  10868. @item intensity, i
  10869. Set intensity. Smaller values are useful to find out how many values of the same
  10870. luminance are distributed across input rows/columns.
  10871. Default value is @code{0.04}. Allowed range is [0, 1].
  10872. @item mirror, r
  10873. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  10874. In mirrored mode, higher values will be represented on the left
  10875. side for @code{row} mode and at the top for @code{column} mode. Default is
  10876. @code{1} (mirrored).
  10877. @item display, d
  10878. Set display mode.
  10879. It accepts the following values:
  10880. @table @samp
  10881. @item overlay
  10882. Presents information identical to that in the @code{parade}, except
  10883. that the graphs representing color components are superimposed directly
  10884. over one another.
  10885. This display mode makes it easier to spot relative differences or similarities
  10886. in overlapping areas of the color components that are supposed to be identical,
  10887. such as neutral whites, grays, or blacks.
  10888. @item stack
  10889. Display separate graph for the color components side by side in
  10890. @code{row} mode or one below the other in @code{column} mode.
  10891. @item parade
  10892. Display separate graph for the color components side by side in
  10893. @code{column} mode or one below the other in @code{row} mode.
  10894. Using this display mode makes it easy to spot color casts in the highlights
  10895. and shadows of an image, by comparing the contours of the top and the bottom
  10896. graphs of each waveform. Since whites, grays, and blacks are characterized
  10897. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  10898. should display three waveforms of roughly equal width/height. If not, the
  10899. correction is easy to perform by making level adjustments the three waveforms.
  10900. @end table
  10901. Default is @code{stack}.
  10902. @item components, c
  10903. Set which color components to display. Default is 1, which means only luminance
  10904. or red color component if input is in RGB colorspace. If is set for example to
  10905. 7 it will display all 3 (if) available color components.
  10906. @item envelope, e
  10907. @table @samp
  10908. @item none
  10909. No envelope, this is default.
  10910. @item instant
  10911. Instant envelope, minimum and maximum values presented in graph will be easily
  10912. visible even with small @code{step} value.
  10913. @item peak
  10914. Hold minimum and maximum values presented in graph across time. This way you
  10915. can still spot out of range values without constantly looking at waveforms.
  10916. @item peak+instant
  10917. Peak and instant envelope combined together.
  10918. @end table
  10919. @item filter, f
  10920. @table @samp
  10921. @item lowpass
  10922. No filtering, this is default.
  10923. @item flat
  10924. Luma and chroma combined together.
  10925. @item aflat
  10926. Similar as above, but shows difference between blue and red chroma.
  10927. @item chroma
  10928. Displays only chroma.
  10929. @item color
  10930. Displays actual color value on waveform.
  10931. @item acolor
  10932. Similar as above, but with luma showing frequency of chroma values.
  10933. @end table
  10934. @item graticule, g
  10935. Set which graticule to display.
  10936. @table @samp
  10937. @item none
  10938. Do not display graticule.
  10939. @item green
  10940. Display green graticule showing legal broadcast ranges.
  10941. @end table
  10942. @item opacity, o
  10943. Set graticule opacity.
  10944. @item flags, fl
  10945. Set graticule flags.
  10946. @table @samp
  10947. @item numbers
  10948. Draw numbers above lines. By default enabled.
  10949. @item dots
  10950. Draw dots instead of lines.
  10951. @end table
  10952. @item scale, s
  10953. Set scale used for displaying graticule.
  10954. @table @samp
  10955. @item digital
  10956. @item millivolts
  10957. @item ire
  10958. @end table
  10959. Default is digital.
  10960. @item bgopacity, b
  10961. Set background opacity.
  10962. @end table
  10963. @section weave
  10964. The @code{weave} takes a field-based video input and join
  10965. each two sequential fields into single frame, producing a new double
  10966. height clip with half the frame rate and half the frame count.
  10967. It accepts the following option:
  10968. @table @option
  10969. @item first_field
  10970. Set first field. Available values are:
  10971. @table @samp
  10972. @item top, t
  10973. Set the frame as top-field-first.
  10974. @item bottom, b
  10975. Set the frame as bottom-field-first.
  10976. @end table
  10977. @end table
  10978. @subsection Examples
  10979. @itemize
  10980. @item
  10981. Interlace video using @ref{select} and @ref{separatefields} filter:
  10982. @example
  10983. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  10984. @end example
  10985. @end itemize
  10986. @section xbr
  10987. Apply the xBR high-quality magnification filter which is designed for pixel
  10988. art. It follows a set of edge-detection rules, see
  10989. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  10990. It accepts the following option:
  10991. @table @option
  10992. @item n
  10993. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  10994. @code{3xBR} and @code{4} for @code{4xBR}.
  10995. Default is @code{3}.
  10996. @end table
  10997. @anchor{yadif}
  10998. @section yadif
  10999. Deinterlace the input video ("yadif" means "yet another deinterlacing
  11000. filter").
  11001. It accepts the following parameters:
  11002. @table @option
  11003. @item mode
  11004. The interlacing mode to adopt. It accepts one of the following values:
  11005. @table @option
  11006. @item 0, send_frame
  11007. Output one frame for each frame.
  11008. @item 1, send_field
  11009. Output one frame for each field.
  11010. @item 2, send_frame_nospatial
  11011. Like @code{send_frame}, but it skips the spatial interlacing check.
  11012. @item 3, send_field_nospatial
  11013. Like @code{send_field}, but it skips the spatial interlacing check.
  11014. @end table
  11015. The default value is @code{send_frame}.
  11016. @item parity
  11017. The picture field parity assumed for the input interlaced video. It accepts one
  11018. of the following values:
  11019. @table @option
  11020. @item 0, tff
  11021. Assume the top field is first.
  11022. @item 1, bff
  11023. Assume the bottom field is first.
  11024. @item -1, auto
  11025. Enable automatic detection of field parity.
  11026. @end table
  11027. The default value is @code{auto}.
  11028. If the interlacing is unknown or the decoder does not export this information,
  11029. top field first will be assumed.
  11030. @item deint
  11031. Specify which frames to deinterlace. Accept one of the following
  11032. values:
  11033. @table @option
  11034. @item 0, all
  11035. Deinterlace all frames.
  11036. @item 1, interlaced
  11037. Only deinterlace frames marked as interlaced.
  11038. @end table
  11039. The default value is @code{all}.
  11040. @end table
  11041. @section zoompan
  11042. Apply Zoom & Pan effect.
  11043. This filter accepts the following options:
  11044. @table @option
  11045. @item zoom, z
  11046. Set the zoom expression. Default is 1.
  11047. @item x
  11048. @item y
  11049. Set the x and y expression. Default is 0.
  11050. @item d
  11051. Set the duration expression in number of frames.
  11052. This sets for how many number of frames effect will last for
  11053. single input image.
  11054. @item s
  11055. Set the output image size, default is 'hd720'.
  11056. @item fps
  11057. Set the output frame rate, default is '25'.
  11058. @end table
  11059. Each expression can contain the following constants:
  11060. @table @option
  11061. @item in_w, iw
  11062. Input width.
  11063. @item in_h, ih
  11064. Input height.
  11065. @item out_w, ow
  11066. Output width.
  11067. @item out_h, oh
  11068. Output height.
  11069. @item in
  11070. Input frame count.
  11071. @item on
  11072. Output frame count.
  11073. @item x
  11074. @item y
  11075. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  11076. for current input frame.
  11077. @item px
  11078. @item py
  11079. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  11080. not yet such frame (first input frame).
  11081. @item zoom
  11082. Last calculated zoom from 'z' expression for current input frame.
  11083. @item pzoom
  11084. Last calculated zoom of last output frame of previous input frame.
  11085. @item duration
  11086. Number of output frames for current input frame. Calculated from 'd' expression
  11087. for each input frame.
  11088. @item pduration
  11089. number of output frames created for previous input frame
  11090. @item a
  11091. Rational number: input width / input height
  11092. @item sar
  11093. sample aspect ratio
  11094. @item dar
  11095. display aspect ratio
  11096. @end table
  11097. @subsection Examples
  11098. @itemize
  11099. @item
  11100. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  11101. @example
  11102. 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
  11103. @end example
  11104. @item
  11105. Zoom-in up to 1.5 and pan always at center of picture:
  11106. @example
  11107. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  11108. @end example
  11109. @item
  11110. Same as above but without pausing:
  11111. @example
  11112. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  11113. @end example
  11114. @end itemize
  11115. @section zscale
  11116. Scale (resize) the input video, using the z.lib library:
  11117. https://github.com/sekrit-twc/zimg.
  11118. The zscale filter forces the output display aspect ratio to be the same
  11119. as the input, by changing the output sample aspect ratio.
  11120. If the input image format is different from the format requested by
  11121. the next filter, the zscale filter will convert the input to the
  11122. requested format.
  11123. @subsection Options
  11124. The filter accepts the following options.
  11125. @table @option
  11126. @item width, w
  11127. @item height, h
  11128. Set the output video dimension expression. Default value is the input
  11129. dimension.
  11130. If the @var{width} or @var{w} is 0, the input width is used for the output.
  11131. If the @var{height} or @var{h} is 0, the input height is used for the output.
  11132. If one of the values is -1, the zscale filter will use a value that
  11133. maintains the aspect ratio of the input image, calculated from the
  11134. other specified dimension. If both of them are -1, the input size is
  11135. used
  11136. If one of the values is -n with n > 1, the zscale filter will also use a value
  11137. that maintains the aspect ratio of the input image, calculated from the other
  11138. specified dimension. After that it will, however, make sure that the calculated
  11139. dimension is divisible by n and adjust the value if necessary.
  11140. See below for the list of accepted constants for use in the dimension
  11141. expression.
  11142. @item size, s
  11143. Set the video size. For the syntax of this option, check the
  11144. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11145. @item dither, d
  11146. Set the dither type.
  11147. Possible values are:
  11148. @table @var
  11149. @item none
  11150. @item ordered
  11151. @item random
  11152. @item error_diffusion
  11153. @end table
  11154. Default is none.
  11155. @item filter, f
  11156. Set the resize filter type.
  11157. Possible values are:
  11158. @table @var
  11159. @item point
  11160. @item bilinear
  11161. @item bicubic
  11162. @item spline16
  11163. @item spline36
  11164. @item lanczos
  11165. @end table
  11166. Default is bilinear.
  11167. @item range, r
  11168. Set the color range.
  11169. Possible values are:
  11170. @table @var
  11171. @item input
  11172. @item limited
  11173. @item full
  11174. @end table
  11175. Default is same as input.
  11176. @item primaries, p
  11177. Set the color primaries.
  11178. Possible values are:
  11179. @table @var
  11180. @item input
  11181. @item 709
  11182. @item unspecified
  11183. @item 170m
  11184. @item 240m
  11185. @item 2020
  11186. @end table
  11187. Default is same as input.
  11188. @item transfer, t
  11189. Set the transfer characteristics.
  11190. Possible values are:
  11191. @table @var
  11192. @item input
  11193. @item 709
  11194. @item unspecified
  11195. @item 601
  11196. @item linear
  11197. @item 2020_10
  11198. @item 2020_12
  11199. @end table
  11200. Default is same as input.
  11201. @item matrix, m
  11202. Set the colorspace matrix.
  11203. Possible value are:
  11204. @table @var
  11205. @item input
  11206. @item 709
  11207. @item unspecified
  11208. @item 470bg
  11209. @item 170m
  11210. @item 2020_ncl
  11211. @item 2020_cl
  11212. @end table
  11213. Default is same as input.
  11214. @item rangein, rin
  11215. Set the input color range.
  11216. Possible values are:
  11217. @table @var
  11218. @item input
  11219. @item limited
  11220. @item full
  11221. @end table
  11222. Default is same as input.
  11223. @item primariesin, pin
  11224. Set the input color primaries.
  11225. Possible values are:
  11226. @table @var
  11227. @item input
  11228. @item 709
  11229. @item unspecified
  11230. @item 170m
  11231. @item 240m
  11232. @item 2020
  11233. @end table
  11234. Default is same as input.
  11235. @item transferin, tin
  11236. Set the input transfer characteristics.
  11237. Possible values are:
  11238. @table @var
  11239. @item input
  11240. @item 709
  11241. @item unspecified
  11242. @item 601
  11243. @item linear
  11244. @item 2020_10
  11245. @item 2020_12
  11246. @end table
  11247. Default is same as input.
  11248. @item matrixin, min
  11249. Set the input colorspace matrix.
  11250. Possible value are:
  11251. @table @var
  11252. @item input
  11253. @item 709
  11254. @item unspecified
  11255. @item 470bg
  11256. @item 170m
  11257. @item 2020_ncl
  11258. @item 2020_cl
  11259. @end table
  11260. @item chromal, c
  11261. Set the output chroma location.
  11262. Possible values are:
  11263. @table @var
  11264. @item input
  11265. @item left
  11266. @item center
  11267. @item topleft
  11268. @item top
  11269. @item bottomleft
  11270. @item bottom
  11271. @end table
  11272. @item chromalin, cin
  11273. Set the input chroma location.
  11274. Possible values are:
  11275. @table @var
  11276. @item input
  11277. @item left
  11278. @item center
  11279. @item topleft
  11280. @item top
  11281. @item bottomleft
  11282. @item bottom
  11283. @end table
  11284. @end table
  11285. The values of the @option{w} and @option{h} options are expressions
  11286. containing the following constants:
  11287. @table @var
  11288. @item in_w
  11289. @item in_h
  11290. The input width and height
  11291. @item iw
  11292. @item ih
  11293. These are the same as @var{in_w} and @var{in_h}.
  11294. @item out_w
  11295. @item out_h
  11296. The output (scaled) width and height
  11297. @item ow
  11298. @item oh
  11299. These are the same as @var{out_w} and @var{out_h}
  11300. @item a
  11301. The same as @var{iw} / @var{ih}
  11302. @item sar
  11303. input sample aspect ratio
  11304. @item dar
  11305. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  11306. @item hsub
  11307. @item vsub
  11308. horizontal and vertical input chroma subsample values. For example for the
  11309. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11310. @item ohsub
  11311. @item ovsub
  11312. horizontal and vertical output chroma subsample values. For example for the
  11313. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11314. @end table
  11315. @table @option
  11316. @end table
  11317. @c man end VIDEO FILTERS
  11318. @chapter Video Sources
  11319. @c man begin VIDEO SOURCES
  11320. Below is a description of the currently available video sources.
  11321. @section buffer
  11322. Buffer video frames, and make them available to the filter chain.
  11323. This source is mainly intended for a programmatic use, in particular
  11324. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  11325. It accepts the following parameters:
  11326. @table @option
  11327. @item video_size
  11328. Specify the size (width and height) of the buffered video frames. For the
  11329. syntax of this option, check the
  11330. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11331. @item width
  11332. The input video width.
  11333. @item height
  11334. The input video height.
  11335. @item pix_fmt
  11336. A string representing the pixel format of the buffered video frames.
  11337. It may be a number corresponding to a pixel format, or a pixel format
  11338. name.
  11339. @item time_base
  11340. Specify the timebase assumed by the timestamps of the buffered frames.
  11341. @item frame_rate
  11342. Specify the frame rate expected for the video stream.
  11343. @item pixel_aspect, sar
  11344. The sample (pixel) aspect ratio of the input video.
  11345. @item sws_param
  11346. Specify the optional parameters to be used for the scale filter which
  11347. is automatically inserted when an input change is detected in the
  11348. input size or format.
  11349. @item hw_frames_ctx
  11350. When using a hardware pixel format, this should be a reference to an
  11351. AVHWFramesContext describing input frames.
  11352. @end table
  11353. For example:
  11354. @example
  11355. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  11356. @end example
  11357. will instruct the source to accept video frames with size 320x240 and
  11358. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  11359. square pixels (1:1 sample aspect ratio).
  11360. Since the pixel format with name "yuv410p" corresponds to the number 6
  11361. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  11362. this example corresponds to:
  11363. @example
  11364. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  11365. @end example
  11366. Alternatively, the options can be specified as a flat string, but this
  11367. syntax is deprecated:
  11368. @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}]
  11369. @section cellauto
  11370. Create a pattern generated by an elementary cellular automaton.
  11371. The initial state of the cellular automaton can be defined through the
  11372. @option{filename} and @option{pattern} options. If such options are
  11373. not specified an initial state is created randomly.
  11374. At each new frame a new row in the video is filled with the result of
  11375. the cellular automaton next generation. The behavior when the whole
  11376. frame is filled is defined by the @option{scroll} option.
  11377. This source accepts the following options:
  11378. @table @option
  11379. @item filename, f
  11380. Read the initial cellular automaton state, i.e. the starting row, from
  11381. the specified file.
  11382. In the file, each non-whitespace character is considered an alive
  11383. cell, a newline will terminate the row, and further characters in the
  11384. file will be ignored.
  11385. @item pattern, p
  11386. Read the initial cellular automaton state, i.e. the starting row, from
  11387. the specified string.
  11388. Each non-whitespace character in the string is considered an alive
  11389. cell, a newline will terminate the row, and further characters in the
  11390. string will be ignored.
  11391. @item rate, r
  11392. Set the video rate, that is the number of frames generated per second.
  11393. Default is 25.
  11394. @item random_fill_ratio, ratio
  11395. Set the random fill ratio for the initial cellular automaton row. It
  11396. is a floating point number value ranging from 0 to 1, defaults to
  11397. 1/PHI.
  11398. This option is ignored when a file or a pattern is specified.
  11399. @item random_seed, seed
  11400. Set the seed for filling randomly the initial row, must be an integer
  11401. included between 0 and UINT32_MAX. If not specified, or if explicitly
  11402. set to -1, the filter will try to use a good random seed on a best
  11403. effort basis.
  11404. @item rule
  11405. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  11406. Default value is 110.
  11407. @item size, s
  11408. Set the size of the output video. For the syntax of this option, check the
  11409. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11410. If @option{filename} or @option{pattern} is specified, the size is set
  11411. by default to the width of the specified initial state row, and the
  11412. height is set to @var{width} * PHI.
  11413. If @option{size} is set, it must contain the width of the specified
  11414. pattern string, and the specified pattern will be centered in the
  11415. larger row.
  11416. If a filename or a pattern string is not specified, the size value
  11417. defaults to "320x518" (used for a randomly generated initial state).
  11418. @item scroll
  11419. If set to 1, scroll the output upward when all the rows in the output
  11420. have been already filled. If set to 0, the new generated row will be
  11421. written over the top row just after the bottom row is filled.
  11422. Defaults to 1.
  11423. @item start_full, full
  11424. If set to 1, completely fill the output with generated rows before
  11425. outputting the first frame.
  11426. This is the default behavior, for disabling set the value to 0.
  11427. @item stitch
  11428. If set to 1, stitch the left and right row edges together.
  11429. This is the default behavior, for disabling set the value to 0.
  11430. @end table
  11431. @subsection Examples
  11432. @itemize
  11433. @item
  11434. Read the initial state from @file{pattern}, and specify an output of
  11435. size 200x400.
  11436. @example
  11437. cellauto=f=pattern:s=200x400
  11438. @end example
  11439. @item
  11440. Generate a random initial row with a width of 200 cells, with a fill
  11441. ratio of 2/3:
  11442. @example
  11443. cellauto=ratio=2/3:s=200x200
  11444. @end example
  11445. @item
  11446. Create a pattern generated by rule 18 starting by a single alive cell
  11447. centered on an initial row with width 100:
  11448. @example
  11449. cellauto=p=@@:s=100x400:full=0:rule=18
  11450. @end example
  11451. @item
  11452. Specify a more elaborated initial pattern:
  11453. @example
  11454. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  11455. @end example
  11456. @end itemize
  11457. @anchor{coreimagesrc}
  11458. @section coreimagesrc
  11459. Video source generated on GPU using Apple's CoreImage API on OSX.
  11460. This video source is a specialized version of the @ref{coreimage} video filter.
  11461. Use a core image generator at the beginning of the applied filterchain to
  11462. generate the content.
  11463. The coreimagesrc video source accepts the following options:
  11464. @table @option
  11465. @item list_generators
  11466. List all available generators along with all their respective options as well as
  11467. possible minimum and maximum values along with the default values.
  11468. @example
  11469. list_generators=true
  11470. @end example
  11471. @item size, s
  11472. Specify the size of the sourced video. For the syntax of this option, check the
  11473. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11474. The default value is @code{320x240}.
  11475. @item rate, r
  11476. Specify the frame rate of the sourced video, as the number of frames
  11477. generated per second. It has to be a string in the format
  11478. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  11479. number or a valid video frame rate abbreviation. The default value is
  11480. "25".
  11481. @item sar
  11482. Set the sample aspect ratio of the sourced video.
  11483. @item duration, d
  11484. Set the duration of the sourced video. See
  11485. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11486. for the accepted syntax.
  11487. If not specified, or the expressed duration is negative, the video is
  11488. supposed to be generated forever.
  11489. @end table
  11490. Additionally, all options of the @ref{coreimage} video filter are accepted.
  11491. A complete filterchain can be used for further processing of the
  11492. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  11493. and examples for details.
  11494. @subsection Examples
  11495. @itemize
  11496. @item
  11497. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  11498. given as complete and escaped command-line for Apple's standard bash shell:
  11499. @example
  11500. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  11501. @end example
  11502. This example is equivalent to the QRCode example of @ref{coreimage} without the
  11503. need for a nullsrc video source.
  11504. @end itemize
  11505. @section mandelbrot
  11506. Generate a Mandelbrot set fractal, and progressively zoom towards the
  11507. point specified with @var{start_x} and @var{start_y}.
  11508. This source accepts the following options:
  11509. @table @option
  11510. @item end_pts
  11511. Set the terminal pts value. Default value is 400.
  11512. @item end_scale
  11513. Set the terminal scale value.
  11514. Must be a floating point value. Default value is 0.3.
  11515. @item inner
  11516. Set the inner coloring mode, that is the algorithm used to draw the
  11517. Mandelbrot fractal internal region.
  11518. It shall assume one of the following values:
  11519. @table @option
  11520. @item black
  11521. Set black mode.
  11522. @item convergence
  11523. Show time until convergence.
  11524. @item mincol
  11525. Set color based on point closest to the origin of the iterations.
  11526. @item period
  11527. Set period mode.
  11528. @end table
  11529. Default value is @var{mincol}.
  11530. @item bailout
  11531. Set the bailout value. Default value is 10.0.
  11532. @item maxiter
  11533. Set the maximum of iterations performed by the rendering
  11534. algorithm. Default value is 7189.
  11535. @item outer
  11536. Set outer coloring mode.
  11537. It shall assume one of following values:
  11538. @table @option
  11539. @item iteration_count
  11540. Set iteration cound mode.
  11541. @item normalized_iteration_count
  11542. set normalized iteration count mode.
  11543. @end table
  11544. Default value is @var{normalized_iteration_count}.
  11545. @item rate, r
  11546. Set frame rate, expressed as number of frames per second. Default
  11547. value is "25".
  11548. @item size, s
  11549. Set frame size. For the syntax of this option, check the "Video
  11550. size" section in the ffmpeg-utils manual. Default value is "640x480".
  11551. @item start_scale
  11552. Set the initial scale value. Default value is 3.0.
  11553. @item start_x
  11554. Set the initial x position. Must be a floating point value between
  11555. -100 and 100. Default value is -0.743643887037158704752191506114774.
  11556. @item start_y
  11557. Set the initial y position. Must be a floating point value between
  11558. -100 and 100. Default value is -0.131825904205311970493132056385139.
  11559. @end table
  11560. @section mptestsrc
  11561. Generate various test patterns, as generated by the MPlayer test filter.
  11562. The size of the generated video is fixed, and is 256x256.
  11563. This source is useful in particular for testing encoding features.
  11564. This source accepts the following options:
  11565. @table @option
  11566. @item rate, r
  11567. Specify the frame rate of the sourced video, as the number of frames
  11568. generated per second. It has to be a string in the format
  11569. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  11570. number or a valid video frame rate abbreviation. The default value is
  11571. "25".
  11572. @item duration, d
  11573. Set the duration of the sourced video. See
  11574. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11575. for the accepted syntax.
  11576. If not specified, or the expressed duration is negative, the video is
  11577. supposed to be generated forever.
  11578. @item test, t
  11579. Set the number or the name of the test to perform. Supported tests are:
  11580. @table @option
  11581. @item dc_luma
  11582. @item dc_chroma
  11583. @item freq_luma
  11584. @item freq_chroma
  11585. @item amp_luma
  11586. @item amp_chroma
  11587. @item cbp
  11588. @item mv
  11589. @item ring1
  11590. @item ring2
  11591. @item all
  11592. @end table
  11593. Default value is "all", which will cycle through the list of all tests.
  11594. @end table
  11595. Some examples:
  11596. @example
  11597. mptestsrc=t=dc_luma
  11598. @end example
  11599. will generate a "dc_luma" test pattern.
  11600. @section frei0r_src
  11601. Provide a frei0r source.
  11602. To enable compilation of this filter you need to install the frei0r
  11603. header and configure FFmpeg with @code{--enable-frei0r}.
  11604. This source accepts the following parameters:
  11605. @table @option
  11606. @item size
  11607. The size of the video to generate. For the syntax of this option, check the
  11608. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11609. @item framerate
  11610. The framerate of the generated video. It may be a string of the form
  11611. @var{num}/@var{den} or a frame rate abbreviation.
  11612. @item filter_name
  11613. The name to the frei0r source to load. For more information regarding frei0r and
  11614. how to set the parameters, read the @ref{frei0r} section in the video filters
  11615. documentation.
  11616. @item filter_params
  11617. A '|'-separated list of parameters to pass to the frei0r source.
  11618. @end table
  11619. For example, to generate a frei0r partik0l source with size 200x200
  11620. and frame rate 10 which is overlaid on the overlay filter main input:
  11621. @example
  11622. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  11623. @end example
  11624. @section life
  11625. Generate a life pattern.
  11626. This source is based on a generalization of John Conway's life game.
  11627. The sourced input represents a life grid, each pixel represents a cell
  11628. which can be in one of two possible states, alive or dead. Every cell
  11629. interacts with its eight neighbours, which are the cells that are
  11630. horizontally, vertically, or diagonally adjacent.
  11631. At each interaction the grid evolves according to the adopted rule,
  11632. which specifies the number of neighbor alive cells which will make a
  11633. cell stay alive or born. The @option{rule} option allows one to specify
  11634. the rule to adopt.
  11635. This source accepts the following options:
  11636. @table @option
  11637. @item filename, f
  11638. Set the file from which to read the initial grid state. In the file,
  11639. each non-whitespace character is considered an alive cell, and newline
  11640. is used to delimit the end of each row.
  11641. If this option is not specified, the initial grid is generated
  11642. randomly.
  11643. @item rate, r
  11644. Set the video rate, that is the number of frames generated per second.
  11645. Default is 25.
  11646. @item random_fill_ratio, ratio
  11647. Set the random fill ratio for the initial random grid. It is a
  11648. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  11649. It is ignored when a file is specified.
  11650. @item random_seed, seed
  11651. Set the seed for filling the initial random grid, must be an integer
  11652. included between 0 and UINT32_MAX. If not specified, or if explicitly
  11653. set to -1, the filter will try to use a good random seed on a best
  11654. effort basis.
  11655. @item rule
  11656. Set the life rule.
  11657. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  11658. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  11659. @var{NS} specifies the number of alive neighbor cells which make a
  11660. live cell stay alive, and @var{NB} the number of alive neighbor cells
  11661. which make a dead cell to become alive (i.e. to "born").
  11662. "s" and "b" can be used in place of "S" and "B", respectively.
  11663. Alternatively a rule can be specified by an 18-bits integer. The 9
  11664. high order bits are used to encode the next cell state if it is alive
  11665. for each number of neighbor alive cells, the low order bits specify
  11666. the rule for "borning" new cells. Higher order bits encode for an
  11667. higher number of neighbor cells.
  11668. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  11669. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  11670. Default value is "S23/B3", which is the original Conway's game of life
  11671. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  11672. cells, and will born a new cell if there are three alive cells around
  11673. a dead cell.
  11674. @item size, s
  11675. Set the size of the output video. For the syntax of this option, check the
  11676. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11677. If @option{filename} is specified, the size is set by default to the
  11678. same size of the input file. If @option{size} is set, it must contain
  11679. the size specified in the input file, and the initial grid defined in
  11680. that file is centered in the larger resulting area.
  11681. If a filename is not specified, the size value defaults to "320x240"
  11682. (used for a randomly generated initial grid).
  11683. @item stitch
  11684. If set to 1, stitch the left and right grid edges together, and the
  11685. top and bottom edges also. Defaults to 1.
  11686. @item mold
  11687. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  11688. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  11689. value from 0 to 255.
  11690. @item life_color
  11691. Set the color of living (or new born) cells.
  11692. @item death_color
  11693. Set the color of dead cells. If @option{mold} is set, this is the first color
  11694. used to represent a dead cell.
  11695. @item mold_color
  11696. Set mold color, for definitely dead and moldy cells.
  11697. For the syntax of these 3 color options, check the "Color" section in the
  11698. ffmpeg-utils manual.
  11699. @end table
  11700. @subsection Examples
  11701. @itemize
  11702. @item
  11703. Read a grid from @file{pattern}, and center it on a grid of size
  11704. 300x300 pixels:
  11705. @example
  11706. life=f=pattern:s=300x300
  11707. @end example
  11708. @item
  11709. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  11710. @example
  11711. life=ratio=2/3:s=200x200
  11712. @end example
  11713. @item
  11714. Specify a custom rule for evolving a randomly generated grid:
  11715. @example
  11716. life=rule=S14/B34
  11717. @end example
  11718. @item
  11719. Full example with slow death effect (mold) using @command{ffplay}:
  11720. @example
  11721. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  11722. @end example
  11723. @end itemize
  11724. @anchor{allrgb}
  11725. @anchor{allyuv}
  11726. @anchor{color}
  11727. @anchor{haldclutsrc}
  11728. @anchor{nullsrc}
  11729. @anchor{rgbtestsrc}
  11730. @anchor{smptebars}
  11731. @anchor{smptehdbars}
  11732. @anchor{testsrc}
  11733. @anchor{testsrc2}
  11734. @anchor{yuvtestsrc}
  11735. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  11736. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  11737. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  11738. The @code{color} source provides an uniformly colored input.
  11739. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  11740. @ref{haldclut} filter.
  11741. The @code{nullsrc} source returns unprocessed video frames. It is
  11742. mainly useful to be employed in analysis / debugging tools, or as the
  11743. source for filters which ignore the input data.
  11744. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  11745. detecting RGB vs BGR issues. You should see a red, green and blue
  11746. stripe from top to bottom.
  11747. The @code{smptebars} source generates a color bars pattern, based on
  11748. the SMPTE Engineering Guideline EG 1-1990.
  11749. The @code{smptehdbars} source generates a color bars pattern, based on
  11750. the SMPTE RP 219-2002.
  11751. The @code{testsrc} source generates a test video pattern, showing a
  11752. color pattern, a scrolling gradient and a timestamp. This is mainly
  11753. intended for testing purposes.
  11754. The @code{testsrc2} source is similar to testsrc, but supports more
  11755. pixel formats instead of just @code{rgb24}. This allows using it as an
  11756. input for other tests without requiring a format conversion.
  11757. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  11758. see a y, cb and cr stripe from top to bottom.
  11759. The sources accept the following parameters:
  11760. @table @option
  11761. @item color, c
  11762. Specify the color of the source, only available in the @code{color}
  11763. source. For the syntax of this option, check the "Color" section in the
  11764. ffmpeg-utils manual.
  11765. @item level
  11766. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  11767. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  11768. pixels to be used as identity matrix for 3D lookup tables. Each component is
  11769. coded on a @code{1/(N*N)} scale.
  11770. @item size, s
  11771. Specify the size of the sourced video. For the syntax of this option, check the
  11772. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11773. The default value is @code{320x240}.
  11774. This option is not available with the @code{haldclutsrc} filter.
  11775. @item rate, r
  11776. Specify the frame rate of the sourced video, as the number of frames
  11777. generated per second. It has to be a string in the format
  11778. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  11779. number or a valid video frame rate abbreviation. The default value is
  11780. "25".
  11781. @item sar
  11782. Set the sample aspect ratio of the sourced video.
  11783. @item duration, d
  11784. Set the duration of the sourced video. See
  11785. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11786. for the accepted syntax.
  11787. If not specified, or the expressed duration is negative, the video is
  11788. supposed to be generated forever.
  11789. @item decimals, n
  11790. Set the number of decimals to show in the timestamp, only available in the
  11791. @code{testsrc} source.
  11792. The displayed timestamp value will correspond to the original
  11793. timestamp value multiplied by the power of 10 of the specified
  11794. value. Default value is 0.
  11795. @end table
  11796. For example the following:
  11797. @example
  11798. testsrc=duration=5.3:size=qcif:rate=10
  11799. @end example
  11800. will generate a video with a duration of 5.3 seconds, with size
  11801. 176x144 and a frame rate of 10 frames per second.
  11802. The following graph description will generate a red source
  11803. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  11804. frames per second.
  11805. @example
  11806. color=c=red@@0.2:s=qcif:r=10
  11807. @end example
  11808. If the input content is to be ignored, @code{nullsrc} can be used. The
  11809. following command generates noise in the luminance plane by employing
  11810. the @code{geq} filter:
  11811. @example
  11812. nullsrc=s=256x256, geq=random(1)*255:128:128
  11813. @end example
  11814. @subsection Commands
  11815. The @code{color} source supports the following commands:
  11816. @table @option
  11817. @item c, color
  11818. Set the color of the created image. Accepts the same syntax of the
  11819. corresponding @option{color} option.
  11820. @end table
  11821. @c man end VIDEO SOURCES
  11822. @chapter Video Sinks
  11823. @c man begin VIDEO SINKS
  11824. Below is a description of the currently available video sinks.
  11825. @section buffersink
  11826. Buffer video frames, and make them available to the end of the filter
  11827. graph.
  11828. This sink is mainly intended for programmatic use, in particular
  11829. through the interface defined in @file{libavfilter/buffersink.h}
  11830. or the options system.
  11831. It accepts a pointer to an AVBufferSinkContext structure, which
  11832. defines the incoming buffers' formats, to be passed as the opaque
  11833. parameter to @code{avfilter_init_filter} for initialization.
  11834. @section nullsink
  11835. Null video sink: do absolutely nothing with the input video. It is
  11836. mainly useful as a template and for use in analysis / debugging
  11837. tools.
  11838. @c man end VIDEO SINKS
  11839. @chapter Multimedia Filters
  11840. @c man begin MULTIMEDIA FILTERS
  11841. Below is a description of the currently available multimedia filters.
  11842. @section ahistogram
  11843. Convert input audio to a video output, displaying the volume histogram.
  11844. The filter accepts the following options:
  11845. @table @option
  11846. @item dmode
  11847. Specify how histogram is calculated.
  11848. It accepts the following values:
  11849. @table @samp
  11850. @item single
  11851. Use single histogram for all channels.
  11852. @item separate
  11853. Use separate histogram for each channel.
  11854. @end table
  11855. Default is @code{single}.
  11856. @item rate, r
  11857. Set frame rate, expressed as number of frames per second. Default
  11858. value is "25".
  11859. @item size, s
  11860. Specify the video size for the output. For the syntax of this option, check the
  11861. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11862. Default value is @code{hd720}.
  11863. @item scale
  11864. Set display scale.
  11865. It accepts the following values:
  11866. @table @samp
  11867. @item log
  11868. logarithmic
  11869. @item sqrt
  11870. square root
  11871. @item cbrt
  11872. cubic root
  11873. @item lin
  11874. linear
  11875. @item rlog
  11876. reverse logarithmic
  11877. @end table
  11878. Default is @code{log}.
  11879. @item ascale
  11880. Set amplitude scale.
  11881. It accepts the following values:
  11882. @table @samp
  11883. @item log
  11884. logarithmic
  11885. @item lin
  11886. linear
  11887. @end table
  11888. Default is @code{log}.
  11889. @item acount
  11890. Set how much frames to accumulate in histogram.
  11891. Defauls is 1. Setting this to -1 accumulates all frames.
  11892. @item rheight
  11893. Set histogram ratio of window height.
  11894. @item slide
  11895. Set sonogram sliding.
  11896. It accepts the following values:
  11897. @table @samp
  11898. @item replace
  11899. replace old rows with new ones.
  11900. @item scroll
  11901. scroll from top to bottom.
  11902. @end table
  11903. Default is @code{replace}.
  11904. @end table
  11905. @section aphasemeter
  11906. Convert input audio to a video output, displaying the audio phase.
  11907. The filter accepts the following options:
  11908. @table @option
  11909. @item rate, r
  11910. Set the output frame rate. Default value is @code{25}.
  11911. @item size, s
  11912. Set the video size for the output. For the syntax of this option, check the
  11913. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11914. Default value is @code{800x400}.
  11915. @item rc
  11916. @item gc
  11917. @item bc
  11918. Specify the red, green, blue contrast. Default values are @code{2},
  11919. @code{7} and @code{1}.
  11920. Allowed range is @code{[0, 255]}.
  11921. @item mpc
  11922. Set color which will be used for drawing median phase. If color is
  11923. @code{none} which is default, no median phase value will be drawn.
  11924. @end table
  11925. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  11926. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  11927. The @code{-1} means left and right channels are completely out of phase and
  11928. @code{1} means channels are in phase.
  11929. @section avectorscope
  11930. Convert input audio to a video output, representing the audio vector
  11931. scope.
  11932. The filter is used to measure the difference between channels of stereo
  11933. audio stream. A monoaural signal, consisting of identical left and right
  11934. signal, results in straight vertical line. Any stereo separation is visible
  11935. as a deviation from this line, creating a Lissajous figure.
  11936. If the straight (or deviation from it) but horizontal line appears this
  11937. indicates that the left and right channels are out of phase.
  11938. The filter accepts the following options:
  11939. @table @option
  11940. @item mode, m
  11941. Set the vectorscope mode.
  11942. Available values are:
  11943. @table @samp
  11944. @item lissajous
  11945. Lissajous rotated by 45 degrees.
  11946. @item lissajous_xy
  11947. Same as above but not rotated.
  11948. @item polar
  11949. Shape resembling half of circle.
  11950. @end table
  11951. Default value is @samp{lissajous}.
  11952. @item size, s
  11953. Set the video size for the output. For the syntax of this option, check the
  11954. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11955. Default value is @code{400x400}.
  11956. @item rate, r
  11957. Set the output frame rate. Default value is @code{25}.
  11958. @item rc
  11959. @item gc
  11960. @item bc
  11961. @item ac
  11962. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  11963. @code{160}, @code{80} and @code{255}.
  11964. Allowed range is @code{[0, 255]}.
  11965. @item rf
  11966. @item gf
  11967. @item bf
  11968. @item af
  11969. Specify the red, green, blue and alpha fade. Default values are @code{15},
  11970. @code{10}, @code{5} and @code{5}.
  11971. Allowed range is @code{[0, 255]}.
  11972. @item zoom
  11973. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[1, 10]}.
  11974. @item draw
  11975. Set the vectorscope drawing mode.
  11976. Available values are:
  11977. @table @samp
  11978. @item dot
  11979. Draw dot for each sample.
  11980. @item line
  11981. Draw line between previous and current sample.
  11982. @end table
  11983. Default value is @samp{dot}.
  11984. @item scale
  11985. Specify amplitude scale of audio samples.
  11986. Available values are:
  11987. @table @samp
  11988. @item lin
  11989. Linear.
  11990. @item sqrt
  11991. Square root.
  11992. @item cbrt
  11993. Cubic root.
  11994. @item log
  11995. Logarithmic.
  11996. @end table
  11997. @end table
  11998. @subsection Examples
  11999. @itemize
  12000. @item
  12001. Complete example using @command{ffplay}:
  12002. @example
  12003. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  12004. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  12005. @end example
  12006. @end itemize
  12007. @section bench, abench
  12008. Benchmark part of a filtergraph.
  12009. The filter accepts the following options:
  12010. @table @option
  12011. @item action
  12012. Start or stop a timer.
  12013. Available values are:
  12014. @table @samp
  12015. @item start
  12016. Get the current time, set it as frame metadata (using the key
  12017. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  12018. @item stop
  12019. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  12020. the input frame metadata to get the time difference. Time difference, average,
  12021. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  12022. @code{min}) are then printed. The timestamps are expressed in seconds.
  12023. @end table
  12024. @end table
  12025. @subsection Examples
  12026. @itemize
  12027. @item
  12028. Benchmark @ref{selectivecolor} filter:
  12029. @example
  12030. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  12031. @end example
  12032. @end itemize
  12033. @section concat
  12034. Concatenate audio and video streams, joining them together one after the
  12035. other.
  12036. The filter works on segments of synchronized video and audio streams. All
  12037. segments must have the same number of streams of each type, and that will
  12038. also be the number of streams at output.
  12039. The filter accepts the following options:
  12040. @table @option
  12041. @item n
  12042. Set the number of segments. Default is 2.
  12043. @item v
  12044. Set the number of output video streams, that is also the number of video
  12045. streams in each segment. Default is 1.
  12046. @item a
  12047. Set the number of output audio streams, that is also the number of audio
  12048. streams in each segment. Default is 0.
  12049. @item unsafe
  12050. Activate unsafe mode: do not fail if segments have a different format.
  12051. @end table
  12052. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  12053. @var{a} audio outputs.
  12054. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  12055. segment, in the same order as the outputs, then the inputs for the second
  12056. segment, etc.
  12057. Related streams do not always have exactly the same duration, for various
  12058. reasons including codec frame size or sloppy authoring. For that reason,
  12059. related synchronized streams (e.g. a video and its audio track) should be
  12060. concatenated at once. The concat filter will use the duration of the longest
  12061. stream in each segment (except the last one), and if necessary pad shorter
  12062. audio streams with silence.
  12063. For this filter to work correctly, all segments must start at timestamp 0.
  12064. All corresponding streams must have the same parameters in all segments; the
  12065. filtering system will automatically select a common pixel format for video
  12066. streams, and a common sample format, sample rate and channel layout for
  12067. audio streams, but other settings, such as resolution, must be converted
  12068. explicitly by the user.
  12069. Different frame rates are acceptable but will result in variable frame rate
  12070. at output; be sure to configure the output file to handle it.
  12071. @subsection Examples
  12072. @itemize
  12073. @item
  12074. Concatenate an opening, an episode and an ending, all in bilingual version
  12075. (video in stream 0, audio in streams 1 and 2):
  12076. @example
  12077. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  12078. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  12079. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  12080. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  12081. @end example
  12082. @item
  12083. Concatenate two parts, handling audio and video separately, using the
  12084. (a)movie sources, and adjusting the resolution:
  12085. @example
  12086. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  12087. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  12088. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  12089. @end example
  12090. Note that a desync will happen at the stitch if the audio and video streams
  12091. do not have exactly the same duration in the first file.
  12092. @end itemize
  12093. @section drawgraph, adrawgraph
  12094. Draw a graph using input video or audio metadata.
  12095. It accepts the following parameters:
  12096. @table @option
  12097. @item m1
  12098. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  12099. @item fg1
  12100. Set 1st foreground color expression.
  12101. @item m2
  12102. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  12103. @item fg2
  12104. Set 2nd foreground color expression.
  12105. @item m3
  12106. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  12107. @item fg3
  12108. Set 3rd foreground color expression.
  12109. @item m4
  12110. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  12111. @item fg4
  12112. Set 4th foreground color expression.
  12113. @item min
  12114. Set minimal value of metadata value.
  12115. @item max
  12116. Set maximal value of metadata value.
  12117. @item bg
  12118. Set graph background color. Default is white.
  12119. @item mode
  12120. Set graph mode.
  12121. Available values for mode is:
  12122. @table @samp
  12123. @item bar
  12124. @item dot
  12125. @item line
  12126. @end table
  12127. Default is @code{line}.
  12128. @item slide
  12129. Set slide mode.
  12130. Available values for slide is:
  12131. @table @samp
  12132. @item frame
  12133. Draw new frame when right border is reached.
  12134. @item replace
  12135. Replace old columns with new ones.
  12136. @item scroll
  12137. Scroll from right to left.
  12138. @item rscroll
  12139. Scroll from left to right.
  12140. @item picture
  12141. Draw single picture.
  12142. @end table
  12143. Default is @code{frame}.
  12144. @item size
  12145. Set size of graph video. For the syntax of this option, check the
  12146. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12147. The default value is @code{900x256}.
  12148. The foreground color expressions can use the following variables:
  12149. @table @option
  12150. @item MIN
  12151. Minimal value of metadata value.
  12152. @item MAX
  12153. Maximal value of metadata value.
  12154. @item VAL
  12155. Current metadata key value.
  12156. @end table
  12157. The color is defined as 0xAABBGGRR.
  12158. @end table
  12159. Example using metadata from @ref{signalstats} filter:
  12160. @example
  12161. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  12162. @end example
  12163. Example using metadata from @ref{ebur128} filter:
  12164. @example
  12165. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  12166. @end example
  12167. @anchor{ebur128}
  12168. @section ebur128
  12169. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  12170. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  12171. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  12172. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  12173. The filter also has a video output (see the @var{video} option) with a real
  12174. time graph to observe the loudness evolution. The graphic contains the logged
  12175. message mentioned above, so it is not printed anymore when this option is set,
  12176. unless the verbose logging is set. The main graphing area contains the
  12177. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  12178. the momentary loudness (400 milliseconds).
  12179. More information about the Loudness Recommendation EBU R128 on
  12180. @url{http://tech.ebu.ch/loudness}.
  12181. The filter accepts the following options:
  12182. @table @option
  12183. @item video
  12184. Activate the video output. The audio stream is passed unchanged whether this
  12185. option is set or no. The video stream will be the first output stream if
  12186. activated. Default is @code{0}.
  12187. @item size
  12188. Set the video size. This option is for video only. For the syntax of this
  12189. option, check the
  12190. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12191. Default and minimum resolution is @code{640x480}.
  12192. @item meter
  12193. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  12194. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  12195. other integer value between this range is allowed.
  12196. @item metadata
  12197. Set metadata injection. If set to @code{1}, the audio input will be segmented
  12198. into 100ms output frames, each of them containing various loudness information
  12199. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  12200. Default is @code{0}.
  12201. @item framelog
  12202. Force the frame logging level.
  12203. Available values are:
  12204. @table @samp
  12205. @item info
  12206. information logging level
  12207. @item verbose
  12208. verbose logging level
  12209. @end table
  12210. By default, the logging level is set to @var{info}. If the @option{video} or
  12211. the @option{metadata} options are set, it switches to @var{verbose}.
  12212. @item peak
  12213. Set peak mode(s).
  12214. Available modes can be cumulated (the option is a @code{flag} type). Possible
  12215. values are:
  12216. @table @samp
  12217. @item none
  12218. Disable any peak mode (default).
  12219. @item sample
  12220. Enable sample-peak mode.
  12221. Simple peak mode looking for the higher sample value. It logs a message
  12222. for sample-peak (identified by @code{SPK}).
  12223. @item true
  12224. Enable true-peak mode.
  12225. If enabled, the peak lookup is done on an over-sampled version of the input
  12226. stream for better peak accuracy. It logs a message for true-peak.
  12227. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  12228. This mode requires a build with @code{libswresample}.
  12229. @end table
  12230. @item dualmono
  12231. Treat mono input files as "dual mono". If a mono file is intended for playback
  12232. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  12233. If set to @code{true}, this option will compensate for this effect.
  12234. Multi-channel input files are not affected by this option.
  12235. @item panlaw
  12236. Set a specific pan law to be used for the measurement of dual mono files.
  12237. This parameter is optional, and has a default value of -3.01dB.
  12238. @end table
  12239. @subsection Examples
  12240. @itemize
  12241. @item
  12242. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  12243. @example
  12244. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  12245. @end example
  12246. @item
  12247. Run an analysis with @command{ffmpeg}:
  12248. @example
  12249. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  12250. @end example
  12251. @end itemize
  12252. @section interleave, ainterleave
  12253. Temporally interleave frames from several inputs.
  12254. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  12255. These filters read frames from several inputs and send the oldest
  12256. queued frame to the output.
  12257. Input streams must have well defined, monotonically increasing frame
  12258. timestamp values.
  12259. In order to submit one frame to output, these filters need to enqueue
  12260. at least one frame for each input, so they cannot work in case one
  12261. input is not yet terminated and will not receive incoming frames.
  12262. For example consider the case when one input is a @code{select} filter
  12263. which always drops input frames. The @code{interleave} filter will keep
  12264. reading from that input, but it will never be able to send new frames
  12265. to output until the input sends an end-of-stream signal.
  12266. Also, depending on inputs synchronization, the filters will drop
  12267. frames in case one input receives more frames than the other ones, and
  12268. the queue is already filled.
  12269. These filters accept the following options:
  12270. @table @option
  12271. @item nb_inputs, n
  12272. Set the number of different inputs, it is 2 by default.
  12273. @end table
  12274. @subsection Examples
  12275. @itemize
  12276. @item
  12277. Interleave frames belonging to different streams using @command{ffmpeg}:
  12278. @example
  12279. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  12280. @end example
  12281. @item
  12282. Add flickering blur effect:
  12283. @example
  12284. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  12285. @end example
  12286. @end itemize
  12287. @section metadata, ametadata
  12288. Manipulate frame metadata.
  12289. This filter accepts the following options:
  12290. @table @option
  12291. @item mode
  12292. Set mode of operation of the filter.
  12293. Can be one of the following:
  12294. @table @samp
  12295. @item select
  12296. If both @code{value} and @code{key} is set, select frames
  12297. which have such metadata. If only @code{key} is set, select
  12298. every frame that has such key in metadata.
  12299. @item add
  12300. Add new metadata @code{key} and @code{value}. If key is already available
  12301. do nothing.
  12302. @item modify
  12303. Modify value of already present key.
  12304. @item delete
  12305. If @code{value} is set, delete only keys that have such value.
  12306. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  12307. the frame.
  12308. @item print
  12309. Print key and its value if metadata was found. If @code{key} is not set print all
  12310. metadata values available in frame.
  12311. @end table
  12312. @item key
  12313. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  12314. @item value
  12315. Set metadata value which will be used. This option is mandatory for
  12316. @code{modify} and @code{add} mode.
  12317. @item function
  12318. Which function to use when comparing metadata value and @code{value}.
  12319. Can be one of following:
  12320. @table @samp
  12321. @item same_str
  12322. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  12323. @item starts_with
  12324. Values are interpreted as strings, returns true if metadata value starts with
  12325. the @code{value} option string.
  12326. @item less
  12327. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  12328. @item equal
  12329. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  12330. @item greater
  12331. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  12332. @item expr
  12333. Values are interpreted as floats, returns true if expression from option @code{expr}
  12334. evaluates to true.
  12335. @end table
  12336. @item expr
  12337. Set expression which is used when @code{function} is set to @code{expr}.
  12338. The expression is evaluated through the eval API and can contain the following
  12339. constants:
  12340. @table @option
  12341. @item VALUE1
  12342. Float representation of @code{value} from metadata key.
  12343. @item VALUE2
  12344. Float representation of @code{value} as supplied by user in @code{value} option.
  12345. @item file
  12346. If specified in @code{print} mode, output is written to the named file. Instead of
  12347. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  12348. for standard output. If @code{file} option is not set, output is written to the log
  12349. with AV_LOG_INFO loglevel.
  12350. @end table
  12351. @end table
  12352. @subsection Examples
  12353. @itemize
  12354. @item
  12355. Print all metadata values for frames with key @code{lavfi.singnalstats.YDIF} with values
  12356. between 0 and 1.
  12357. @example
  12358. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  12359. @end example
  12360. @item
  12361. Print silencedetect output to file @file{metadata.txt}.
  12362. @example
  12363. silencedetect,ametadata=mode=print:file=metadata.txt
  12364. @end example
  12365. @item
  12366. Direct all metadata to a pipe with file descriptor 4.
  12367. @example
  12368. metadata=mode=print:file='pipe\:4'
  12369. @end example
  12370. @end itemize
  12371. @section perms, aperms
  12372. Set read/write permissions for the output frames.
  12373. These filters are mainly aimed at developers to test direct path in the
  12374. following filter in the filtergraph.
  12375. The filters accept the following options:
  12376. @table @option
  12377. @item mode
  12378. Select the permissions mode.
  12379. It accepts the following values:
  12380. @table @samp
  12381. @item none
  12382. Do nothing. This is the default.
  12383. @item ro
  12384. Set all the output frames read-only.
  12385. @item rw
  12386. Set all the output frames directly writable.
  12387. @item toggle
  12388. Make the frame read-only if writable, and writable if read-only.
  12389. @item random
  12390. Set each output frame read-only or writable randomly.
  12391. @end table
  12392. @item seed
  12393. Set the seed for the @var{random} mode, must be an integer included between
  12394. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  12395. @code{-1}, the filter will try to use a good random seed on a best effort
  12396. basis.
  12397. @end table
  12398. Note: in case of auto-inserted filter between the permission filter and the
  12399. following one, the permission might not be received as expected in that
  12400. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  12401. perms/aperms filter can avoid this problem.
  12402. @section realtime, arealtime
  12403. Slow down filtering to match real time approximatively.
  12404. These filters will pause the filtering for a variable amount of time to
  12405. match the output rate with the input timestamps.
  12406. They are similar to the @option{re} option to @code{ffmpeg}.
  12407. They accept the following options:
  12408. @table @option
  12409. @item limit
  12410. Time limit for the pauses. Any pause longer than that will be considered
  12411. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  12412. @end table
  12413. @anchor{select}
  12414. @section select, aselect
  12415. Select frames to pass in output.
  12416. This filter accepts the following options:
  12417. @table @option
  12418. @item expr, e
  12419. Set expression, which is evaluated for each input frame.
  12420. If the expression is evaluated to zero, the frame is discarded.
  12421. If the evaluation result is negative or NaN, the frame is sent to the
  12422. first output; otherwise it is sent to the output with index
  12423. @code{ceil(val)-1}, assuming that the input index starts from 0.
  12424. For example a value of @code{1.2} corresponds to the output with index
  12425. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  12426. @item outputs, n
  12427. Set the number of outputs. The output to which to send the selected
  12428. frame is based on the result of the evaluation. Default value is 1.
  12429. @end table
  12430. The expression can contain the following constants:
  12431. @table @option
  12432. @item n
  12433. The (sequential) number of the filtered frame, starting from 0.
  12434. @item selected_n
  12435. The (sequential) number of the selected frame, starting from 0.
  12436. @item prev_selected_n
  12437. The sequential number of the last selected frame. It's NAN if undefined.
  12438. @item TB
  12439. The timebase of the input timestamps.
  12440. @item pts
  12441. The PTS (Presentation TimeStamp) of the filtered video frame,
  12442. expressed in @var{TB} units. It's NAN if undefined.
  12443. @item t
  12444. The PTS of the filtered video frame,
  12445. expressed in seconds. It's NAN if undefined.
  12446. @item prev_pts
  12447. The PTS of the previously filtered video frame. It's NAN if undefined.
  12448. @item prev_selected_pts
  12449. The PTS of the last previously filtered video frame. It's NAN if undefined.
  12450. @item prev_selected_t
  12451. The PTS of the last previously selected video frame. It's NAN if undefined.
  12452. @item start_pts
  12453. The PTS of the first video frame in the video. It's NAN if undefined.
  12454. @item start_t
  12455. The time of the first video frame in the video. It's NAN if undefined.
  12456. @item pict_type @emph{(video only)}
  12457. The type of the filtered frame. It can assume one of the following
  12458. values:
  12459. @table @option
  12460. @item I
  12461. @item P
  12462. @item B
  12463. @item S
  12464. @item SI
  12465. @item SP
  12466. @item BI
  12467. @end table
  12468. @item interlace_type @emph{(video only)}
  12469. The frame interlace type. It can assume one of the following values:
  12470. @table @option
  12471. @item PROGRESSIVE
  12472. The frame is progressive (not interlaced).
  12473. @item TOPFIRST
  12474. The frame is top-field-first.
  12475. @item BOTTOMFIRST
  12476. The frame is bottom-field-first.
  12477. @end table
  12478. @item consumed_sample_n @emph{(audio only)}
  12479. the number of selected samples before the current frame
  12480. @item samples_n @emph{(audio only)}
  12481. the number of samples in the current frame
  12482. @item sample_rate @emph{(audio only)}
  12483. the input sample rate
  12484. @item key
  12485. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  12486. @item pos
  12487. the position in the file of the filtered frame, -1 if the information
  12488. is not available (e.g. for synthetic video)
  12489. @item scene @emph{(video only)}
  12490. value between 0 and 1 to indicate a new scene; a low value reflects a low
  12491. probability for the current frame to introduce a new scene, while a higher
  12492. value means the current frame is more likely to be one (see the example below)
  12493. @item concatdec_select
  12494. The concat demuxer can select only part of a concat input file by setting an
  12495. inpoint and an outpoint, but the output packets may not be entirely contained
  12496. in the selected interval. By using this variable, it is possible to skip frames
  12497. generated by the concat demuxer which are not exactly contained in the selected
  12498. interval.
  12499. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  12500. and the @var{lavf.concat.duration} packet metadata values which are also
  12501. present in the decoded frames.
  12502. The @var{concatdec_select} variable is -1 if the frame pts is at least
  12503. start_time and either the duration metadata is missing or the frame pts is less
  12504. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  12505. missing.
  12506. That basically means that an input frame is selected if its pts is within the
  12507. interval set by the concat demuxer.
  12508. @end table
  12509. The default value of the select expression is "1".
  12510. @subsection Examples
  12511. @itemize
  12512. @item
  12513. Select all frames in input:
  12514. @example
  12515. select
  12516. @end example
  12517. The example above is the same as:
  12518. @example
  12519. select=1
  12520. @end example
  12521. @item
  12522. Skip all frames:
  12523. @example
  12524. select=0
  12525. @end example
  12526. @item
  12527. Select only I-frames:
  12528. @example
  12529. select='eq(pict_type\,I)'
  12530. @end example
  12531. @item
  12532. Select one frame every 100:
  12533. @example
  12534. select='not(mod(n\,100))'
  12535. @end example
  12536. @item
  12537. Select only frames contained in the 10-20 time interval:
  12538. @example
  12539. select=between(t\,10\,20)
  12540. @end example
  12541. @item
  12542. Select only I-frames contained in the 10-20 time interval:
  12543. @example
  12544. select=between(t\,10\,20)*eq(pict_type\,I)
  12545. @end example
  12546. @item
  12547. Select frames with a minimum distance of 10 seconds:
  12548. @example
  12549. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  12550. @end example
  12551. @item
  12552. Use aselect to select only audio frames with samples number > 100:
  12553. @example
  12554. aselect='gt(samples_n\,100)'
  12555. @end example
  12556. @item
  12557. Create a mosaic of the first scenes:
  12558. @example
  12559. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  12560. @end example
  12561. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  12562. choice.
  12563. @item
  12564. Send even and odd frames to separate outputs, and compose them:
  12565. @example
  12566. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  12567. @end example
  12568. @item
  12569. Select useful frames from an ffconcat file which is using inpoints and
  12570. outpoints but where the source files are not intra frame only.
  12571. @example
  12572. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  12573. @end example
  12574. @end itemize
  12575. @section sendcmd, asendcmd
  12576. Send commands to filters in the filtergraph.
  12577. These filters read commands to be sent to other filters in the
  12578. filtergraph.
  12579. @code{sendcmd} must be inserted between two video filters,
  12580. @code{asendcmd} must be inserted between two audio filters, but apart
  12581. from that they act the same way.
  12582. The specification of commands can be provided in the filter arguments
  12583. with the @var{commands} option, or in a file specified by the
  12584. @var{filename} option.
  12585. These filters accept the following options:
  12586. @table @option
  12587. @item commands, c
  12588. Set the commands to be read and sent to the other filters.
  12589. @item filename, f
  12590. Set the filename of the commands to be read and sent to the other
  12591. filters.
  12592. @end table
  12593. @subsection Commands syntax
  12594. A commands description consists of a sequence of interval
  12595. specifications, comprising a list of commands to be executed when a
  12596. particular event related to that interval occurs. The occurring event
  12597. is typically the current frame time entering or leaving a given time
  12598. interval.
  12599. An interval is specified by the following syntax:
  12600. @example
  12601. @var{START}[-@var{END}] @var{COMMANDS};
  12602. @end example
  12603. The time interval is specified by the @var{START} and @var{END} times.
  12604. @var{END} is optional and defaults to the maximum time.
  12605. The current frame time is considered within the specified interval if
  12606. it is included in the interval [@var{START}, @var{END}), that is when
  12607. the time is greater or equal to @var{START} and is lesser than
  12608. @var{END}.
  12609. @var{COMMANDS} consists of a sequence of one or more command
  12610. specifications, separated by ",", relating to that interval. The
  12611. syntax of a command specification is given by:
  12612. @example
  12613. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  12614. @end example
  12615. @var{FLAGS} is optional and specifies the type of events relating to
  12616. the time interval which enable sending the specified command, and must
  12617. be a non-null sequence of identifier flags separated by "+" or "|" and
  12618. enclosed between "[" and "]".
  12619. The following flags are recognized:
  12620. @table @option
  12621. @item enter
  12622. The command is sent when the current frame timestamp enters the
  12623. specified interval. In other words, the command is sent when the
  12624. previous frame timestamp was not in the given interval, and the
  12625. current is.
  12626. @item leave
  12627. The command is sent when the current frame timestamp leaves the
  12628. specified interval. In other words, the command is sent when the
  12629. previous frame timestamp was in the given interval, and the
  12630. current is not.
  12631. @end table
  12632. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  12633. assumed.
  12634. @var{TARGET} specifies the target of the command, usually the name of
  12635. the filter class or a specific filter instance name.
  12636. @var{COMMAND} specifies the name of the command for the target filter.
  12637. @var{ARG} is optional and specifies the optional list of argument for
  12638. the given @var{COMMAND}.
  12639. Between one interval specification and another, whitespaces, or
  12640. sequences of characters starting with @code{#} until the end of line,
  12641. are ignored and can be used to annotate comments.
  12642. A simplified BNF description of the commands specification syntax
  12643. follows:
  12644. @example
  12645. @var{COMMAND_FLAG} ::= "enter" | "leave"
  12646. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  12647. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  12648. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  12649. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  12650. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  12651. @end example
  12652. @subsection Examples
  12653. @itemize
  12654. @item
  12655. Specify audio tempo change at second 4:
  12656. @example
  12657. asendcmd=c='4.0 atempo tempo 1.5',atempo
  12658. @end example
  12659. @item
  12660. Specify a list of drawtext and hue commands in a file.
  12661. @example
  12662. # show text in the interval 5-10
  12663. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  12664. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  12665. # desaturate the image in the interval 15-20
  12666. 15.0-20.0 [enter] hue s 0,
  12667. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  12668. [leave] hue s 1,
  12669. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  12670. # apply an exponential saturation fade-out effect, starting from time 25
  12671. 25 [enter] hue s exp(25-t)
  12672. @end example
  12673. A filtergraph allowing to read and process the above command list
  12674. stored in a file @file{test.cmd}, can be specified with:
  12675. @example
  12676. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  12677. @end example
  12678. @end itemize
  12679. @anchor{setpts}
  12680. @section setpts, asetpts
  12681. Change the PTS (presentation timestamp) of the input frames.
  12682. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  12683. This filter accepts the following options:
  12684. @table @option
  12685. @item expr
  12686. The expression which is evaluated for each frame to construct its timestamp.
  12687. @end table
  12688. The expression is evaluated through the eval API and can contain the following
  12689. constants:
  12690. @table @option
  12691. @item FRAME_RATE
  12692. frame rate, only defined for constant frame-rate video
  12693. @item PTS
  12694. The presentation timestamp in input
  12695. @item N
  12696. The count of the input frame for video or the number of consumed samples,
  12697. not including the current frame for audio, starting from 0.
  12698. @item NB_CONSUMED_SAMPLES
  12699. The number of consumed samples, not including the current frame (only
  12700. audio)
  12701. @item NB_SAMPLES, S
  12702. The number of samples in the current frame (only audio)
  12703. @item SAMPLE_RATE, SR
  12704. The audio sample rate.
  12705. @item STARTPTS
  12706. The PTS of the first frame.
  12707. @item STARTT
  12708. the time in seconds of the first frame
  12709. @item INTERLACED
  12710. State whether the current frame is interlaced.
  12711. @item T
  12712. the time in seconds of the current frame
  12713. @item POS
  12714. original position in the file of the frame, or undefined if undefined
  12715. for the current frame
  12716. @item PREV_INPTS
  12717. The previous input PTS.
  12718. @item PREV_INT
  12719. previous input time in seconds
  12720. @item PREV_OUTPTS
  12721. The previous output PTS.
  12722. @item PREV_OUTT
  12723. previous output time in seconds
  12724. @item RTCTIME
  12725. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  12726. instead.
  12727. @item RTCSTART
  12728. The wallclock (RTC) time at the start of the movie in microseconds.
  12729. @item TB
  12730. The timebase of the input timestamps.
  12731. @end table
  12732. @subsection Examples
  12733. @itemize
  12734. @item
  12735. Start counting PTS from zero
  12736. @example
  12737. setpts=PTS-STARTPTS
  12738. @end example
  12739. @item
  12740. Apply fast motion effect:
  12741. @example
  12742. setpts=0.5*PTS
  12743. @end example
  12744. @item
  12745. Apply slow motion effect:
  12746. @example
  12747. setpts=2.0*PTS
  12748. @end example
  12749. @item
  12750. Set fixed rate of 25 frames per second:
  12751. @example
  12752. setpts=N/(25*TB)
  12753. @end example
  12754. @item
  12755. Set fixed rate 25 fps with some jitter:
  12756. @example
  12757. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  12758. @end example
  12759. @item
  12760. Apply an offset of 10 seconds to the input PTS:
  12761. @example
  12762. setpts=PTS+10/TB
  12763. @end example
  12764. @item
  12765. Generate timestamps from a "live source" and rebase onto the current timebase:
  12766. @example
  12767. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  12768. @end example
  12769. @item
  12770. Generate timestamps by counting samples:
  12771. @example
  12772. asetpts=N/SR/TB
  12773. @end example
  12774. @end itemize
  12775. @section settb, asettb
  12776. Set the timebase to use for the output frames timestamps.
  12777. It is mainly useful for testing timebase configuration.
  12778. It accepts the following parameters:
  12779. @table @option
  12780. @item expr, tb
  12781. The expression which is evaluated into the output timebase.
  12782. @end table
  12783. The value for @option{tb} is an arithmetic expression representing a
  12784. rational. The expression can contain the constants "AVTB" (the default
  12785. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  12786. audio only). Default value is "intb".
  12787. @subsection Examples
  12788. @itemize
  12789. @item
  12790. Set the timebase to 1/25:
  12791. @example
  12792. settb=expr=1/25
  12793. @end example
  12794. @item
  12795. Set the timebase to 1/10:
  12796. @example
  12797. settb=expr=0.1
  12798. @end example
  12799. @item
  12800. Set the timebase to 1001/1000:
  12801. @example
  12802. settb=1+0.001
  12803. @end example
  12804. @item
  12805. Set the timebase to 2*intb:
  12806. @example
  12807. settb=2*intb
  12808. @end example
  12809. @item
  12810. Set the default timebase value:
  12811. @example
  12812. settb=AVTB
  12813. @end example
  12814. @end itemize
  12815. @section showcqt
  12816. Convert input audio to a video output representing frequency spectrum
  12817. logarithmically using Brown-Puckette constant Q transform algorithm with
  12818. direct frequency domain coefficient calculation (but the transform itself
  12819. is not really constant Q, instead the Q factor is actually variable/clamped),
  12820. with musical tone scale, from E0 to D#10.
  12821. The filter accepts the following options:
  12822. @table @option
  12823. @item size, s
  12824. Specify the video size for the output. It must be even. For the syntax of this option,
  12825. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12826. Default value is @code{1920x1080}.
  12827. @item fps, rate, r
  12828. Set the output frame rate. Default value is @code{25}.
  12829. @item bar_h
  12830. Set the bargraph height. It must be even. Default value is @code{-1} which
  12831. computes the bargraph height automatically.
  12832. @item axis_h
  12833. Set the axis height. It must be even. Default value is @code{-1} which computes
  12834. the axis height automatically.
  12835. @item sono_h
  12836. Set the sonogram height. It must be even. Default value is @code{-1} which
  12837. computes the sonogram height automatically.
  12838. @item fullhd
  12839. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  12840. instead. Default value is @code{1}.
  12841. @item sono_v, volume
  12842. Specify the sonogram volume expression. It can contain variables:
  12843. @table @option
  12844. @item bar_v
  12845. the @var{bar_v} evaluated expression
  12846. @item frequency, freq, f
  12847. the frequency where it is evaluated
  12848. @item timeclamp, tc
  12849. the value of @var{timeclamp} option
  12850. @end table
  12851. and functions:
  12852. @table @option
  12853. @item a_weighting(f)
  12854. A-weighting of equal loudness
  12855. @item b_weighting(f)
  12856. B-weighting of equal loudness
  12857. @item c_weighting(f)
  12858. C-weighting of equal loudness.
  12859. @end table
  12860. Default value is @code{16}.
  12861. @item bar_v, volume2
  12862. Specify the bargraph volume expression. It can contain variables:
  12863. @table @option
  12864. @item sono_v
  12865. the @var{sono_v} evaluated expression
  12866. @item frequency, freq, f
  12867. the frequency where it is evaluated
  12868. @item timeclamp, tc
  12869. the value of @var{timeclamp} option
  12870. @end table
  12871. and functions:
  12872. @table @option
  12873. @item a_weighting(f)
  12874. A-weighting of equal loudness
  12875. @item b_weighting(f)
  12876. B-weighting of equal loudness
  12877. @item c_weighting(f)
  12878. C-weighting of equal loudness.
  12879. @end table
  12880. Default value is @code{sono_v}.
  12881. @item sono_g, gamma
  12882. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  12883. higher gamma makes the spectrum having more range. Default value is @code{3}.
  12884. Acceptable range is @code{[1, 7]}.
  12885. @item bar_g, gamma2
  12886. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  12887. @code{[1, 7]}.
  12888. @item timeclamp, tc
  12889. Specify the transform timeclamp. At low frequency, there is trade-off between
  12890. accuracy in time domain and frequency domain. If timeclamp is lower,
  12891. event in time domain is represented more accurately (such as fast bass drum),
  12892. otherwise event in frequency domain is represented more accurately
  12893. (such as bass guitar). Acceptable range is @code{[0.1, 1]}. Default value is @code{0.17}.
  12894. @item basefreq
  12895. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  12896. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  12897. @item endfreq
  12898. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  12899. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  12900. @item coeffclamp
  12901. This option is deprecated and ignored.
  12902. @item tlength
  12903. Specify the transform length in time domain. Use this option to control accuracy
  12904. trade-off between time domain and frequency domain at every frequency sample.
  12905. It can contain variables:
  12906. @table @option
  12907. @item frequency, freq, f
  12908. the frequency where it is evaluated
  12909. @item timeclamp, tc
  12910. the value of @var{timeclamp} option.
  12911. @end table
  12912. Default value is @code{384*tc/(384+tc*f)}.
  12913. @item count
  12914. Specify the transform count for every video frame. Default value is @code{6}.
  12915. Acceptable range is @code{[1, 30]}.
  12916. @item fcount
  12917. Specify the transform count for every single pixel. Default value is @code{0},
  12918. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  12919. @item fontfile
  12920. Specify font file for use with freetype to draw the axis. If not specified,
  12921. use embedded font. Note that drawing with font file or embedded font is not
  12922. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  12923. option instead.
  12924. @item font
  12925. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  12926. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  12927. @item fontcolor
  12928. Specify font color expression. This is arithmetic expression that should return
  12929. integer value 0xRRGGBB. It can contain variables:
  12930. @table @option
  12931. @item frequency, freq, f
  12932. the frequency where it is evaluated
  12933. @item timeclamp, tc
  12934. the value of @var{timeclamp} option
  12935. @end table
  12936. and functions:
  12937. @table @option
  12938. @item midi(f)
  12939. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  12940. @item r(x), g(x), b(x)
  12941. red, green, and blue value of intensity x.
  12942. @end table
  12943. Default value is @code{st(0, (midi(f)-59.5)/12);
  12944. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  12945. r(1-ld(1)) + b(ld(1))}.
  12946. @item axisfile
  12947. Specify image file to draw the axis. This option override @var{fontfile} and
  12948. @var{fontcolor} option.
  12949. @item axis, text
  12950. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  12951. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  12952. Default value is @code{1}.
  12953. @item csp
  12954. Set colorspace. The accepted values are:
  12955. @table @samp
  12956. @item unspecified
  12957. Unspecified (default)
  12958. @item bt709
  12959. BT.709
  12960. @item fcc
  12961. FCC
  12962. @item bt470bg
  12963. BT.470BG or BT.601-6 625
  12964. @item smpte170m
  12965. SMPTE-170M or BT.601-6 525
  12966. @item smpte240m
  12967. SMPTE-240M
  12968. @item bt2020ncl
  12969. BT.2020 with non-constant luminance
  12970. @end table
  12971. @item cscheme
  12972. Set spectrogram color scheme. This is list of floating point values with format
  12973. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  12974. The default is @code{1|0.5|0|0|0.5|1}.
  12975. @end table
  12976. @subsection Examples
  12977. @itemize
  12978. @item
  12979. Playing audio while showing the spectrum:
  12980. @example
  12981. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  12982. @end example
  12983. @item
  12984. Same as above, but with frame rate 30 fps:
  12985. @example
  12986. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  12987. @end example
  12988. @item
  12989. Playing at 1280x720:
  12990. @example
  12991. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  12992. @end example
  12993. @item
  12994. Disable sonogram display:
  12995. @example
  12996. sono_h=0
  12997. @end example
  12998. @item
  12999. A1 and its harmonics: A1, A2, (near)E3, A3:
  13000. @example
  13001. 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),
  13002. asplit[a][out1]; [a] showcqt [out0]'
  13003. @end example
  13004. @item
  13005. Same as above, but with more accuracy in frequency domain:
  13006. @example
  13007. 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),
  13008. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  13009. @end example
  13010. @item
  13011. Custom volume:
  13012. @example
  13013. bar_v=10:sono_v=bar_v*a_weighting(f)
  13014. @end example
  13015. @item
  13016. Custom gamma, now spectrum is linear to the amplitude.
  13017. @example
  13018. bar_g=2:sono_g=2
  13019. @end example
  13020. @item
  13021. Custom tlength equation:
  13022. @example
  13023. 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)))'
  13024. @end example
  13025. @item
  13026. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  13027. @example
  13028. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  13029. @end example
  13030. @item
  13031. Custom font using fontconfig:
  13032. @example
  13033. font='Courier New,Monospace,mono|bold'
  13034. @end example
  13035. @item
  13036. Custom frequency range with custom axis using image file:
  13037. @example
  13038. axisfile=myaxis.png:basefreq=40:endfreq=10000
  13039. @end example
  13040. @end itemize
  13041. @section showfreqs
  13042. Convert input audio to video output representing the audio power spectrum.
  13043. Audio amplitude is on Y-axis while frequency is on X-axis.
  13044. The filter accepts the following options:
  13045. @table @option
  13046. @item size, s
  13047. Specify size of video. For the syntax of this option, check the
  13048. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13049. Default is @code{1024x512}.
  13050. @item mode
  13051. Set display mode.
  13052. This set how each frequency bin will be represented.
  13053. It accepts the following values:
  13054. @table @samp
  13055. @item line
  13056. @item bar
  13057. @item dot
  13058. @end table
  13059. Default is @code{bar}.
  13060. @item ascale
  13061. Set amplitude scale.
  13062. It accepts the following values:
  13063. @table @samp
  13064. @item lin
  13065. Linear scale.
  13066. @item sqrt
  13067. Square root scale.
  13068. @item cbrt
  13069. Cubic root scale.
  13070. @item log
  13071. Logarithmic scale.
  13072. @end table
  13073. Default is @code{log}.
  13074. @item fscale
  13075. Set frequency scale.
  13076. It accepts the following values:
  13077. @table @samp
  13078. @item lin
  13079. Linear scale.
  13080. @item log
  13081. Logarithmic scale.
  13082. @item rlog
  13083. Reverse logarithmic scale.
  13084. @end table
  13085. Default is @code{lin}.
  13086. @item win_size
  13087. Set window size.
  13088. It accepts the following values:
  13089. @table @samp
  13090. @item w16
  13091. @item w32
  13092. @item w64
  13093. @item w128
  13094. @item w256
  13095. @item w512
  13096. @item w1024
  13097. @item w2048
  13098. @item w4096
  13099. @item w8192
  13100. @item w16384
  13101. @item w32768
  13102. @item w65536
  13103. @end table
  13104. Default is @code{w2048}
  13105. @item win_func
  13106. Set windowing function.
  13107. It accepts the following values:
  13108. @table @samp
  13109. @item rect
  13110. @item bartlett
  13111. @item hanning
  13112. @item hamming
  13113. @item blackman
  13114. @item welch
  13115. @item flattop
  13116. @item bharris
  13117. @item bnuttall
  13118. @item bhann
  13119. @item sine
  13120. @item nuttall
  13121. @item lanczos
  13122. @item gauss
  13123. @item tukey
  13124. @item dolph
  13125. @item cauchy
  13126. @item parzen
  13127. @item poisson
  13128. @end table
  13129. Default is @code{hanning}.
  13130. @item overlap
  13131. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  13132. which means optimal overlap for selected window function will be picked.
  13133. @item averaging
  13134. Set time averaging. Setting this to 0 will display current maximal peaks.
  13135. Default is @code{1}, which means time averaging is disabled.
  13136. @item colors
  13137. Specify list of colors separated by space or by '|' which will be used to
  13138. draw channel frequencies. Unrecognized or missing colors will be replaced
  13139. by white color.
  13140. @item cmode
  13141. Set channel display mode.
  13142. It accepts the following values:
  13143. @table @samp
  13144. @item combined
  13145. @item separate
  13146. @end table
  13147. Default is @code{combined}.
  13148. @item minamp
  13149. Set minimum amplitude used in @code{log} amplitude scaler.
  13150. @end table
  13151. @anchor{showspectrum}
  13152. @section showspectrum
  13153. Convert input audio to a video output, representing the audio frequency
  13154. spectrum.
  13155. The filter accepts the following options:
  13156. @table @option
  13157. @item size, s
  13158. Specify the video size for the output. For the syntax of this option, check the
  13159. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13160. Default value is @code{640x512}.
  13161. @item slide
  13162. Specify how the spectrum should slide along the window.
  13163. It accepts the following values:
  13164. @table @samp
  13165. @item replace
  13166. the samples start again on the left when they reach the right
  13167. @item scroll
  13168. the samples scroll from right to left
  13169. @item fullframe
  13170. frames are only produced when the samples reach the right
  13171. @item rscroll
  13172. the samples scroll from left to right
  13173. @end table
  13174. Default value is @code{replace}.
  13175. @item mode
  13176. Specify display mode.
  13177. It accepts the following values:
  13178. @table @samp
  13179. @item combined
  13180. all channels are displayed in the same row
  13181. @item separate
  13182. all channels are displayed in separate rows
  13183. @end table
  13184. Default value is @samp{combined}.
  13185. @item color
  13186. Specify display color mode.
  13187. It accepts the following values:
  13188. @table @samp
  13189. @item channel
  13190. each channel is displayed in a separate color
  13191. @item intensity
  13192. each channel is displayed using the same color scheme
  13193. @item rainbow
  13194. each channel is displayed using the rainbow color scheme
  13195. @item moreland
  13196. each channel is displayed using the moreland color scheme
  13197. @item nebulae
  13198. each channel is displayed using the nebulae color scheme
  13199. @item fire
  13200. each channel is displayed using the fire color scheme
  13201. @item fiery
  13202. each channel is displayed using the fiery color scheme
  13203. @item fruit
  13204. each channel is displayed using the fruit color scheme
  13205. @item cool
  13206. each channel is displayed using the cool color scheme
  13207. @end table
  13208. Default value is @samp{channel}.
  13209. @item scale
  13210. Specify scale used for calculating intensity color values.
  13211. It accepts the following values:
  13212. @table @samp
  13213. @item lin
  13214. linear
  13215. @item sqrt
  13216. square root, default
  13217. @item cbrt
  13218. cubic root
  13219. @item log
  13220. logarithmic
  13221. @item 4thrt
  13222. 4th root
  13223. @item 5thrt
  13224. 5th root
  13225. @end table
  13226. Default value is @samp{sqrt}.
  13227. @item saturation
  13228. Set saturation modifier for displayed colors. Negative values provide
  13229. alternative color scheme. @code{0} is no saturation at all.
  13230. Saturation must be in [-10.0, 10.0] range.
  13231. Default value is @code{1}.
  13232. @item win_func
  13233. Set window function.
  13234. It accepts the following values:
  13235. @table @samp
  13236. @item rect
  13237. @item bartlett
  13238. @item hann
  13239. @item hanning
  13240. @item hamming
  13241. @item blackman
  13242. @item welch
  13243. @item flattop
  13244. @item bharris
  13245. @item bnuttall
  13246. @item bhann
  13247. @item sine
  13248. @item nuttall
  13249. @item lanczos
  13250. @item gauss
  13251. @item tukey
  13252. @item dolph
  13253. @item cauchy
  13254. @item parzen
  13255. @item poisson
  13256. @end table
  13257. Default value is @code{hann}.
  13258. @item orientation
  13259. Set orientation of time vs frequency axis. Can be @code{vertical} or
  13260. @code{horizontal}. Default is @code{vertical}.
  13261. @item overlap
  13262. Set ratio of overlap window. Default value is @code{0}.
  13263. When value is @code{1} overlap is set to recommended size for specific
  13264. window function currently used.
  13265. @item gain
  13266. Set scale gain for calculating intensity color values.
  13267. Default value is @code{1}.
  13268. @item data
  13269. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  13270. @item rotation
  13271. Set color rotation, must be in [-1.0, 1.0] range.
  13272. Default value is @code{0}.
  13273. @end table
  13274. The usage is very similar to the showwaves filter; see the examples in that
  13275. section.
  13276. @subsection Examples
  13277. @itemize
  13278. @item
  13279. Large window with logarithmic color scaling:
  13280. @example
  13281. showspectrum=s=1280x480:scale=log
  13282. @end example
  13283. @item
  13284. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  13285. @example
  13286. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  13287. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  13288. @end example
  13289. @end itemize
  13290. @section showspectrumpic
  13291. Convert input audio to a single video frame, representing the audio frequency
  13292. spectrum.
  13293. The filter accepts the following options:
  13294. @table @option
  13295. @item size, s
  13296. Specify the video size for the output. For the syntax of this option, check the
  13297. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13298. Default value is @code{4096x2048}.
  13299. @item mode
  13300. Specify display mode.
  13301. It accepts the following values:
  13302. @table @samp
  13303. @item combined
  13304. all channels are displayed in the same row
  13305. @item separate
  13306. all channels are displayed in separate rows
  13307. @end table
  13308. Default value is @samp{combined}.
  13309. @item color
  13310. Specify display color mode.
  13311. It accepts the following values:
  13312. @table @samp
  13313. @item channel
  13314. each channel is displayed in a separate color
  13315. @item intensity
  13316. each channel is displayed using the same color scheme
  13317. @item rainbow
  13318. each channel is displayed using the rainbow color scheme
  13319. @item moreland
  13320. each channel is displayed using the moreland color scheme
  13321. @item nebulae
  13322. each channel is displayed using the nebulae color scheme
  13323. @item fire
  13324. each channel is displayed using the fire color scheme
  13325. @item fiery
  13326. each channel is displayed using the fiery color scheme
  13327. @item fruit
  13328. each channel is displayed using the fruit color scheme
  13329. @item cool
  13330. each channel is displayed using the cool color scheme
  13331. @end table
  13332. Default value is @samp{intensity}.
  13333. @item scale
  13334. Specify scale used for calculating intensity color values.
  13335. It accepts the following values:
  13336. @table @samp
  13337. @item lin
  13338. linear
  13339. @item sqrt
  13340. square root, default
  13341. @item cbrt
  13342. cubic root
  13343. @item log
  13344. logarithmic
  13345. @item 4thrt
  13346. 4th root
  13347. @item 5thrt
  13348. 5th root
  13349. @end table
  13350. Default value is @samp{log}.
  13351. @item saturation
  13352. Set saturation modifier for displayed colors. Negative values provide
  13353. alternative color scheme. @code{0} is no saturation at all.
  13354. Saturation must be in [-10.0, 10.0] range.
  13355. Default value is @code{1}.
  13356. @item win_func
  13357. Set window function.
  13358. It accepts the following values:
  13359. @table @samp
  13360. @item rect
  13361. @item bartlett
  13362. @item hann
  13363. @item hanning
  13364. @item hamming
  13365. @item blackman
  13366. @item welch
  13367. @item flattop
  13368. @item bharris
  13369. @item bnuttall
  13370. @item bhann
  13371. @item sine
  13372. @item nuttall
  13373. @item lanczos
  13374. @item gauss
  13375. @item tukey
  13376. @item dolph
  13377. @item cauchy
  13378. @item parzen
  13379. @item poisson
  13380. @end table
  13381. Default value is @code{hann}.
  13382. @item orientation
  13383. Set orientation of time vs frequency axis. Can be @code{vertical} or
  13384. @code{horizontal}. Default is @code{vertical}.
  13385. @item gain
  13386. Set scale gain for calculating intensity color values.
  13387. Default value is @code{1}.
  13388. @item legend
  13389. Draw time and frequency axes and legends. Default is enabled.
  13390. @item rotation
  13391. Set color rotation, must be in [-1.0, 1.0] range.
  13392. Default value is @code{0}.
  13393. @end table
  13394. @subsection Examples
  13395. @itemize
  13396. @item
  13397. Extract an audio spectrogram of a whole audio track
  13398. in a 1024x1024 picture using @command{ffmpeg}:
  13399. @example
  13400. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  13401. @end example
  13402. @end itemize
  13403. @section showvolume
  13404. Convert input audio volume to a video output.
  13405. The filter accepts the following options:
  13406. @table @option
  13407. @item rate, r
  13408. Set video rate.
  13409. @item b
  13410. Set border width, allowed range is [0, 5]. Default is 1.
  13411. @item w
  13412. Set channel width, allowed range is [80, 8192]. Default is 400.
  13413. @item h
  13414. Set channel height, allowed range is [1, 900]. Default is 20.
  13415. @item f
  13416. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  13417. @item c
  13418. Set volume color expression.
  13419. The expression can use the following variables:
  13420. @table @option
  13421. @item VOLUME
  13422. Current max volume of channel in dB.
  13423. @item PEAK
  13424. Current peak.
  13425. @item CHANNEL
  13426. Current channel number, starting from 0.
  13427. @end table
  13428. @item t
  13429. If set, displays channel names. Default is enabled.
  13430. @item v
  13431. If set, displays volume values. Default is enabled.
  13432. @item o
  13433. Set orientation, can be @code{horizontal} or @code{vertical},
  13434. default is @code{horizontal}.
  13435. @item s
  13436. Set step size, allowed range s [0, 5]. Default is 0, which means
  13437. step is disabled.
  13438. @end table
  13439. @section showwaves
  13440. Convert input audio to a video output, representing the samples waves.
  13441. The filter accepts the following options:
  13442. @table @option
  13443. @item size, s
  13444. Specify the video size for the output. For the syntax of this option, check the
  13445. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13446. Default value is @code{600x240}.
  13447. @item mode
  13448. Set display mode.
  13449. Available values are:
  13450. @table @samp
  13451. @item point
  13452. Draw a point for each sample.
  13453. @item line
  13454. Draw a vertical line for each sample.
  13455. @item p2p
  13456. Draw a point for each sample and a line between them.
  13457. @item cline
  13458. Draw a centered vertical line for each sample.
  13459. @end table
  13460. Default value is @code{point}.
  13461. @item n
  13462. Set the number of samples which are printed on the same column. A
  13463. larger value will decrease the frame rate. Must be a positive
  13464. integer. This option can be set only if the value for @var{rate}
  13465. is not explicitly specified.
  13466. @item rate, r
  13467. Set the (approximate) output frame rate. This is done by setting the
  13468. option @var{n}. Default value is "25".
  13469. @item split_channels
  13470. Set if channels should be drawn separately or overlap. Default value is 0.
  13471. @item colors
  13472. Set colors separated by '|' which are going to be used for drawing of each channel.
  13473. @item scale
  13474. Set amplitude scale.
  13475. Available values are:
  13476. @table @samp
  13477. @item lin
  13478. Linear.
  13479. @item log
  13480. Logarithmic.
  13481. @item sqrt
  13482. Square root.
  13483. @item cbrt
  13484. Cubic root.
  13485. @end table
  13486. Default is linear.
  13487. @end table
  13488. @subsection Examples
  13489. @itemize
  13490. @item
  13491. Output the input file audio and the corresponding video representation
  13492. at the same time:
  13493. @example
  13494. amovie=a.mp3,asplit[out0],showwaves[out1]
  13495. @end example
  13496. @item
  13497. Create a synthetic signal and show it with showwaves, forcing a
  13498. frame rate of 30 frames per second:
  13499. @example
  13500. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  13501. @end example
  13502. @end itemize
  13503. @section showwavespic
  13504. Convert input audio to a single video frame, representing the samples waves.
  13505. The filter accepts the following options:
  13506. @table @option
  13507. @item size, s
  13508. Specify the video size for the output. For the syntax of this option, check the
  13509. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13510. Default value is @code{600x240}.
  13511. @item split_channels
  13512. Set if channels should be drawn separately or overlap. Default value is 0.
  13513. @item colors
  13514. Set colors separated by '|' which are going to be used for drawing of each channel.
  13515. @item scale
  13516. Set amplitude scale. Can be linear @code{lin} or logarithmic @code{log}.
  13517. Default is linear.
  13518. @end table
  13519. @subsection Examples
  13520. @itemize
  13521. @item
  13522. Extract a channel split representation of the wave form of a whole audio track
  13523. in a 1024x800 picture using @command{ffmpeg}:
  13524. @example
  13525. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  13526. @end example
  13527. @end itemize
  13528. @section sidedata, asidedata
  13529. Delete frame side data, or select frames based on it.
  13530. This filter accepts the following options:
  13531. @table @option
  13532. @item mode
  13533. Set mode of operation of the filter.
  13534. Can be one of the following:
  13535. @table @samp
  13536. @item select
  13537. Select every frame with side data of @code{type}.
  13538. @item delete
  13539. Delete side data of @code{type}. If @code{type} is not set, delete all side
  13540. data in the frame.
  13541. @end table
  13542. @item type
  13543. Set side data type used with all modes. Must be set for @code{select} mode. For
  13544. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  13545. in @file{libavutil/frame.h}. For example, to choose
  13546. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  13547. @end table
  13548. @section spectrumsynth
  13549. Sythesize audio from 2 input video spectrums, first input stream represents
  13550. magnitude across time and second represents phase across time.
  13551. The filter will transform from frequency domain as displayed in videos back
  13552. to time domain as presented in audio output.
  13553. This filter is primarily created for reversing processed @ref{showspectrum}
  13554. filter outputs, but can synthesize sound from other spectrograms too.
  13555. But in such case results are going to be poor if the phase data is not
  13556. available, because in such cases phase data need to be recreated, usually
  13557. its just recreated from random noise.
  13558. For best results use gray only output (@code{channel} color mode in
  13559. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  13560. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  13561. @code{data} option. Inputs videos should generally use @code{fullframe}
  13562. slide mode as that saves resources needed for decoding video.
  13563. The filter accepts the following options:
  13564. @table @option
  13565. @item sample_rate
  13566. Specify sample rate of output audio, the sample rate of audio from which
  13567. spectrum was generated may differ.
  13568. @item channels
  13569. Set number of channels represented in input video spectrums.
  13570. @item scale
  13571. Set scale which was used when generating magnitude input spectrum.
  13572. Can be @code{lin} or @code{log}. Default is @code{log}.
  13573. @item slide
  13574. Set slide which was used when generating inputs spectrums.
  13575. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  13576. Default is @code{fullframe}.
  13577. @item win_func
  13578. Set window function used for resynthesis.
  13579. @item overlap
  13580. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  13581. which means optimal overlap for selected window function will be picked.
  13582. @item orientation
  13583. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  13584. Default is @code{vertical}.
  13585. @end table
  13586. @subsection Examples
  13587. @itemize
  13588. @item
  13589. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  13590. then resynthesize videos back to audio with spectrumsynth:
  13591. @example
  13592. 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
  13593. 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
  13594. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  13595. @end example
  13596. @end itemize
  13597. @section split, asplit
  13598. Split input into several identical outputs.
  13599. @code{asplit} works with audio input, @code{split} with video.
  13600. The filter accepts a single parameter which specifies the number of outputs. If
  13601. unspecified, it defaults to 2.
  13602. @subsection Examples
  13603. @itemize
  13604. @item
  13605. Create two separate outputs from the same input:
  13606. @example
  13607. [in] split [out0][out1]
  13608. @end example
  13609. @item
  13610. To create 3 or more outputs, you need to specify the number of
  13611. outputs, like in:
  13612. @example
  13613. [in] asplit=3 [out0][out1][out2]
  13614. @end example
  13615. @item
  13616. Create two separate outputs from the same input, one cropped and
  13617. one padded:
  13618. @example
  13619. [in] split [splitout1][splitout2];
  13620. [splitout1] crop=100:100:0:0 [cropout];
  13621. [splitout2] pad=200:200:100:100 [padout];
  13622. @end example
  13623. @item
  13624. Create 5 copies of the input audio with @command{ffmpeg}:
  13625. @example
  13626. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  13627. @end example
  13628. @end itemize
  13629. @section zmq, azmq
  13630. Receive commands sent through a libzmq client, and forward them to
  13631. filters in the filtergraph.
  13632. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  13633. must be inserted between two video filters, @code{azmq} between two
  13634. audio filters.
  13635. To enable these filters you need to install the libzmq library and
  13636. headers and configure FFmpeg with @code{--enable-libzmq}.
  13637. For more information about libzmq see:
  13638. @url{http://www.zeromq.org/}
  13639. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  13640. receives messages sent through a network interface defined by the
  13641. @option{bind_address} option.
  13642. The received message must be in the form:
  13643. @example
  13644. @var{TARGET} @var{COMMAND} [@var{ARG}]
  13645. @end example
  13646. @var{TARGET} specifies the target of the command, usually the name of
  13647. the filter class or a specific filter instance name.
  13648. @var{COMMAND} specifies the name of the command for the target filter.
  13649. @var{ARG} is optional and specifies the optional argument list for the
  13650. given @var{COMMAND}.
  13651. Upon reception, the message is processed and the corresponding command
  13652. is injected into the filtergraph. Depending on the result, the filter
  13653. will send a reply to the client, adopting the format:
  13654. @example
  13655. @var{ERROR_CODE} @var{ERROR_REASON}
  13656. @var{MESSAGE}
  13657. @end example
  13658. @var{MESSAGE} is optional.
  13659. @subsection Examples
  13660. Look at @file{tools/zmqsend} for an example of a zmq client which can
  13661. be used to send commands processed by these filters.
  13662. Consider the following filtergraph generated by @command{ffplay}
  13663. @example
  13664. ffplay -dumpgraph 1 -f lavfi "
  13665. color=s=100x100:c=red [l];
  13666. color=s=100x100:c=blue [r];
  13667. nullsrc=s=200x100, zmq [bg];
  13668. [bg][l] overlay [bg+l];
  13669. [bg+l][r] overlay=x=100 "
  13670. @end example
  13671. To change the color of the left side of the video, the following
  13672. command can be used:
  13673. @example
  13674. echo Parsed_color_0 c yellow | tools/zmqsend
  13675. @end example
  13676. To change the right side:
  13677. @example
  13678. echo Parsed_color_1 c pink | tools/zmqsend
  13679. @end example
  13680. @c man end MULTIMEDIA FILTERS
  13681. @chapter Multimedia Sources
  13682. @c man begin MULTIMEDIA SOURCES
  13683. Below is a description of the currently available multimedia sources.
  13684. @section amovie
  13685. This is the same as @ref{movie} source, except it selects an audio
  13686. stream by default.
  13687. @anchor{movie}
  13688. @section movie
  13689. Read audio and/or video stream(s) from a movie container.
  13690. It accepts the following parameters:
  13691. @table @option
  13692. @item filename
  13693. The name of the resource to read (not necessarily a file; it can also be a
  13694. device or a stream accessed through some protocol).
  13695. @item format_name, f
  13696. Specifies the format assumed for the movie to read, and can be either
  13697. the name of a container or an input device. If not specified, the
  13698. format is guessed from @var{movie_name} or by probing.
  13699. @item seek_point, sp
  13700. Specifies the seek point in seconds. The frames will be output
  13701. starting from this seek point. The parameter is evaluated with
  13702. @code{av_strtod}, so the numerical value may be suffixed by an IS
  13703. postfix. The default value is "0".
  13704. @item streams, s
  13705. Specifies the streams to read. Several streams can be specified,
  13706. separated by "+". The source will then have as many outputs, in the
  13707. same order. The syntax is explained in the ``Stream specifiers''
  13708. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  13709. respectively the default (best suited) video and audio stream. Default
  13710. is "dv", or "da" if the filter is called as "amovie".
  13711. @item stream_index, si
  13712. Specifies the index of the video stream to read. If the value is -1,
  13713. the most suitable video stream will be automatically selected. The default
  13714. value is "-1". Deprecated. If the filter is called "amovie", it will select
  13715. audio instead of video.
  13716. @item loop
  13717. Specifies how many times to read the stream in sequence.
  13718. If the value is less than 1, the stream will be read again and again.
  13719. Default value is "1".
  13720. Note that when the movie is looped the source timestamps are not
  13721. changed, so it will generate non monotonically increasing timestamps.
  13722. @item discontinuity
  13723. Specifies the time difference between frames above which the point is
  13724. considered a timestamp discontinuity which is removed by adjusting the later
  13725. timestamps.
  13726. @end table
  13727. It allows overlaying a second video on top of the main input of
  13728. a filtergraph, as shown in this graph:
  13729. @example
  13730. input -----------> deltapts0 --> overlay --> output
  13731. ^
  13732. |
  13733. movie --> scale--> deltapts1 -------+
  13734. @end example
  13735. @subsection Examples
  13736. @itemize
  13737. @item
  13738. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  13739. on top of the input labelled "in":
  13740. @example
  13741. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  13742. [in] setpts=PTS-STARTPTS [main];
  13743. [main][over] overlay=16:16 [out]
  13744. @end example
  13745. @item
  13746. Read from a video4linux2 device, and overlay it on top of the input
  13747. labelled "in":
  13748. @example
  13749. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  13750. [in] setpts=PTS-STARTPTS [main];
  13751. [main][over] overlay=16:16 [out]
  13752. @end example
  13753. @item
  13754. Read the first video stream and the audio stream with id 0x81 from
  13755. dvd.vob; the video is connected to the pad named "video" and the audio is
  13756. connected to the pad named "audio":
  13757. @example
  13758. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  13759. @end example
  13760. @end itemize
  13761. @subsection Commands
  13762. Both movie and amovie support the following commands:
  13763. @table @option
  13764. @item seek
  13765. Perform seek using "av_seek_frame".
  13766. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  13767. @itemize
  13768. @item
  13769. @var{stream_index}: If stream_index is -1, a default
  13770. stream is selected, and @var{timestamp} is automatically converted
  13771. from AV_TIME_BASE units to the stream specific time_base.
  13772. @item
  13773. @var{timestamp}: Timestamp in AVStream.time_base units
  13774. or, if no stream is specified, in AV_TIME_BASE units.
  13775. @item
  13776. @var{flags}: Flags which select direction and seeking mode.
  13777. @end itemize
  13778. @item get_duration
  13779. Get movie duration in AV_TIME_BASE units.
  13780. @end table
  13781. @c man end MULTIMEDIA SOURCES