filters.texi 506 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055
  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}@@@var{id}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program optionally followed by "@@@var{id}".
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{FILTER_NAME} ::= @var{NAME}["@@"@var{NAME}]
  173. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  174. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  175. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  176. @var{FILTER} ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  177. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  178. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  179. @end example
  180. @section Notes on filtergraph escaping
  181. Filtergraph description composition entails several levels of
  182. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  183. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  184. information about the employed escaping procedure.
  185. A first level escaping affects the content of each filter option
  186. value, which may contain the special character @code{:} used to
  187. separate values, or one of the escaping characters @code{\'}.
  188. A second level escaping affects the whole filter description, which
  189. may contain the escaping characters @code{\'} or the special
  190. characters @code{[],;} used by the filtergraph description.
  191. Finally, when you specify a filtergraph on a shell commandline, you
  192. need to perform a third level escaping for the shell special
  193. characters contained within it.
  194. For example, consider the following string to be embedded in
  195. the @ref{drawtext} filter description @option{text} value:
  196. @example
  197. this is a 'string': may contain one, or more, special characters
  198. @end example
  199. This string contains the @code{'} special escaping character, and the
  200. @code{:} special character, so it needs to be escaped in this way:
  201. @example
  202. text=this is a \'string\'\: may contain one, or more, special characters
  203. @end example
  204. A second level of escaping is required when embedding the filter
  205. description in a filtergraph description, in order to escape all the
  206. filtergraph special characters. Thus the example above becomes:
  207. @example
  208. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  209. @end example
  210. (note that in addition to the @code{\'} escaping special characters,
  211. also @code{,} needs to be escaped).
  212. Finally an additional level of escaping is needed when writing the
  213. filtergraph description in a shell command, which depends on the
  214. escaping rules of the adopted shell. For example, assuming that
  215. @code{\} is special and needs to be escaped with another @code{\}, the
  216. previous string will finally result in:
  217. @example
  218. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  219. @end example
  220. @chapter Timeline editing
  221. Some filters support a generic @option{enable} option. For the filters
  222. supporting timeline editing, this option can be set to an expression which is
  223. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  224. the filter will be enabled, otherwise the frame will be sent unchanged to the
  225. next filter in the filtergraph.
  226. The expression accepts the following values:
  227. @table @samp
  228. @item t
  229. timestamp expressed in seconds, NAN if the input timestamp is unknown
  230. @item n
  231. sequential number of the input frame, starting from 0
  232. @item pos
  233. the position in the file of the input frame, NAN if unknown
  234. @item w
  235. @item h
  236. width and height of the input frame if video
  237. @end table
  238. Additionally, these filters support an @option{enable} command that can be used
  239. to re-define the expression.
  240. Like any other filtering option, the @option{enable} option follows the same
  241. rules.
  242. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  243. minutes, and a @ref{curves} filter starting at 3 seconds:
  244. @example
  245. smartblur = enable='between(t,10,3*60)',
  246. curves = enable='gte(t,3)' : preset=cross_process
  247. @end example
  248. See @code{ffmpeg -filters} to view which filters have timeline support.
  249. @c man end FILTERGRAPH DESCRIPTION
  250. @chapter Audio Filters
  251. @c man begin AUDIO FILTERS
  252. When you configure your FFmpeg build, you can disable any of the
  253. existing filters using @code{--disable-filters}.
  254. The configure output will show the audio filters included in your
  255. build.
  256. Below is a description of the currently available audio filters.
  257. @section acompressor
  258. A compressor is mainly used to reduce the dynamic range of a signal.
  259. Especially modern music is mostly compressed at a high ratio to
  260. improve the overall loudness. It's done to get the highest attention
  261. of a listener, "fatten" the sound and bring more "power" to the track.
  262. If a signal is compressed too much it may sound dull or "dead"
  263. afterwards or it may start to "pump" (which could be a powerful effect
  264. but can also destroy a track completely).
  265. The right compression is the key to reach a professional sound and is
  266. the high art of mixing and mastering. Because of its complex settings
  267. it may take a long time to get the right feeling for this kind of effect.
  268. Compression is done by detecting the volume above a chosen level
  269. @code{threshold} and dividing it by the factor set with @code{ratio}.
  270. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  271. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  272. the signal would cause distortion of the waveform the reduction can be
  273. levelled over the time. This is done by setting "Attack" and "Release".
  274. @code{attack} determines how long the signal has to rise above the threshold
  275. before any reduction will occur and @code{release} sets the time the signal
  276. has to fall below the threshold to reduce the reduction again. Shorter signals
  277. than the chosen attack time will be left untouched.
  278. The overall reduction of the signal can be made up afterwards with the
  279. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  280. raising the makeup to this level results in a signal twice as loud than the
  281. source. To gain a softer entry in the compression the @code{knee} flattens the
  282. hard edge at the threshold in the range of the chosen decibels.
  283. The filter accepts the following options:
  284. @table @option
  285. @item level_in
  286. Set input gain. Default is 1. Range is between 0.015625 and 64.
  287. @item threshold
  288. If a signal of stream rises above this level it will affect the gain
  289. reduction.
  290. By default it is 0.125. Range is between 0.00097563 and 1.
  291. @item ratio
  292. Set a ratio by which the signal is reduced. 1:2 means that if the level
  293. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  294. Default is 2. Range is between 1 and 20.
  295. @item attack
  296. Amount of milliseconds the signal has to rise above the threshold before gain
  297. reduction starts. Default is 20. Range is between 0.01 and 2000.
  298. @item release
  299. Amount of milliseconds the signal has to fall below the threshold before
  300. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  301. @item makeup
  302. Set the amount by how much signal will be amplified after processing.
  303. Default is 1. Range is from 1 to 64.
  304. @item knee
  305. Curve the sharp knee around the threshold to enter gain reduction more softly.
  306. Default is 2.82843. Range is between 1 and 8.
  307. @item link
  308. Choose if the @code{average} level between all channels of input stream
  309. or the louder(@code{maximum}) channel of input stream affects the
  310. reduction. Default is @code{average}.
  311. @item detection
  312. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  313. of @code{rms}. Default is @code{rms} which is mostly smoother.
  314. @item mix
  315. How much to use compressed signal in output. Default is 1.
  316. Range is between 0 and 1.
  317. @end table
  318. @section acopy
  319. Copy the input audio source unchanged to the output. This is mainly useful for
  320. testing purposes.
  321. @section acrossfade
  322. Apply cross fade from one input audio stream to another input audio stream.
  323. The cross fade is applied for specified duration near the end of first stream.
  324. The filter accepts the following options:
  325. @table @option
  326. @item nb_samples, ns
  327. Specify the number of samples for which the cross fade effect has to last.
  328. At the end of the cross fade effect the first input audio will be completely
  329. silent. Default is 44100.
  330. @item duration, d
  331. Specify the duration of the cross fade effect. See
  332. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  333. for the accepted syntax.
  334. By default the duration is determined by @var{nb_samples}.
  335. If set this option is used instead of @var{nb_samples}.
  336. @item overlap, o
  337. Should first stream end overlap with second stream start. Default is enabled.
  338. @item curve1
  339. Set curve for cross fade transition for first stream.
  340. @item curve2
  341. Set curve for cross fade transition for second stream.
  342. For description of available curve types see @ref{afade} filter description.
  343. @end table
  344. @subsection Examples
  345. @itemize
  346. @item
  347. Cross fade from one input to another:
  348. @example
  349. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  350. @end example
  351. @item
  352. Cross fade from one input to another but without overlapping:
  353. @example
  354. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  355. @end example
  356. @end itemize
  357. @section acrusher
  358. Reduce audio bit resolution.
  359. This filter is bit crusher with enhanced functionality. A bit crusher
  360. is used to audibly reduce number of bits an audio signal is sampled
  361. with. This doesn't change the bit depth at all, it just produces the
  362. effect. Material reduced in bit depth sounds more harsh and "digital".
  363. This filter is able to even round to continuous values instead of discrete
  364. bit depths.
  365. Additionally it has a D/C offset which results in different crushing of
  366. the lower and the upper half of the signal.
  367. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  368. Another feature of this filter is the logarithmic mode.
  369. This setting switches from linear distances between bits to logarithmic ones.
  370. The result is a much more "natural" sounding crusher which doesn't gate low
  371. signals for example. The human ear has a logarithmic perception, too
  372. so this kind of crushing is much more pleasant.
  373. Logarithmic crushing is also able to get anti-aliased.
  374. The filter accepts the following options:
  375. @table @option
  376. @item level_in
  377. Set level in.
  378. @item level_out
  379. Set level out.
  380. @item bits
  381. Set bit reduction.
  382. @item mix
  383. Set mixing amount.
  384. @item mode
  385. Can be linear: @code{lin} or logarithmic: @code{log}.
  386. @item dc
  387. Set DC.
  388. @item aa
  389. Set anti-aliasing.
  390. @item samples
  391. Set sample reduction.
  392. @item lfo
  393. Enable LFO. By default disabled.
  394. @item lforange
  395. Set LFO range.
  396. @item lforate
  397. Set LFO rate.
  398. @end table
  399. @section adelay
  400. Delay one or more audio channels.
  401. Samples in delayed channel are filled with silence.
  402. The filter accepts the following option:
  403. @table @option
  404. @item delays
  405. Set list of delays in milliseconds for each channel separated by '|'.
  406. At least one delay greater than 0 should be provided.
  407. Unused delays will be silently ignored. If number of given delays is
  408. smaller than number of channels all remaining channels will not be delayed.
  409. If you want to delay exact number of samples, append 'S' to number.
  410. @end table
  411. @subsection Examples
  412. @itemize
  413. @item
  414. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  415. the second channel (and any other channels that may be present) unchanged.
  416. @example
  417. adelay=1500|0|500
  418. @end example
  419. @item
  420. Delay second channel by 500 samples, the third channel by 700 samples and leave
  421. the first channel (and any other channels that may be present) unchanged.
  422. @example
  423. adelay=0|500S|700S
  424. @end example
  425. @end itemize
  426. @section aecho
  427. Apply echoing to the input audio.
  428. Echoes are reflected sound and can occur naturally amongst mountains
  429. (and sometimes large buildings) when talking or shouting; digital echo
  430. effects emulate this behaviour and are often used to help fill out the
  431. sound of a single instrument or vocal. The time difference between the
  432. original signal and the reflection is the @code{delay}, and the
  433. loudness of the reflected signal is the @code{decay}.
  434. Multiple echoes can have different delays and decays.
  435. A description of the accepted parameters follows.
  436. @table @option
  437. @item in_gain
  438. Set input gain of reflected signal. Default is @code{0.6}.
  439. @item out_gain
  440. Set output gain of reflected signal. Default is @code{0.3}.
  441. @item delays
  442. Set list of time intervals in milliseconds between original signal and reflections
  443. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  444. Default is @code{1000}.
  445. @item decays
  446. Set list of loudnesses of reflected signals separated by '|'.
  447. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  448. Default is @code{0.5}.
  449. @end table
  450. @subsection Examples
  451. @itemize
  452. @item
  453. Make it sound as if there are twice as many instruments as are actually playing:
  454. @example
  455. aecho=0.8:0.88:60:0.4
  456. @end example
  457. @item
  458. If delay is very short, then it sound like a (metallic) robot playing music:
  459. @example
  460. aecho=0.8:0.88:6:0.4
  461. @end example
  462. @item
  463. A longer delay will sound like an open air concert in the mountains:
  464. @example
  465. aecho=0.8:0.9:1000:0.3
  466. @end example
  467. @item
  468. Same as above but with one more mountain:
  469. @example
  470. aecho=0.8:0.9:1000|1800:0.3|0.25
  471. @end example
  472. @end itemize
  473. @section aemphasis
  474. Audio emphasis filter creates or restores material directly taken from LPs or
  475. emphased CDs with different filter curves. E.g. to store music on vinyl the
  476. signal has to be altered by a filter first to even out the disadvantages of
  477. this recording medium.
  478. Once the material is played back the inverse filter has to be applied to
  479. restore the distortion of the frequency response.
  480. The filter accepts the following options:
  481. @table @option
  482. @item level_in
  483. Set input gain.
  484. @item level_out
  485. Set output gain.
  486. @item mode
  487. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  488. use @code{production} mode. Default is @code{reproduction} mode.
  489. @item type
  490. Set filter type. Selects medium. Can be one of the following:
  491. @table @option
  492. @item col
  493. select Columbia.
  494. @item emi
  495. select EMI.
  496. @item bsi
  497. select BSI (78RPM).
  498. @item riaa
  499. select RIAA.
  500. @item cd
  501. select Compact Disc (CD).
  502. @item 50fm
  503. select 50µs (FM).
  504. @item 75fm
  505. select 75µs (FM).
  506. @item 50kf
  507. select 50µs (FM-KF).
  508. @item 75kf
  509. select 75µs (FM-KF).
  510. @end table
  511. @end table
  512. @section aeval
  513. Modify an audio signal according to the specified expressions.
  514. This filter accepts one or more expressions (one for each channel),
  515. which are evaluated and used to modify a corresponding audio signal.
  516. It accepts the following parameters:
  517. @table @option
  518. @item exprs
  519. Set the '|'-separated expressions list for each separate channel. If
  520. the number of input channels is greater than the number of
  521. expressions, the last specified expression is used for the remaining
  522. output channels.
  523. @item channel_layout, c
  524. Set output channel layout. If not specified, the channel layout is
  525. specified by the number of expressions. If set to @samp{same}, it will
  526. use by default the same input channel layout.
  527. @end table
  528. Each expression in @var{exprs} can contain the following constants and functions:
  529. @table @option
  530. @item ch
  531. channel number of the current expression
  532. @item n
  533. number of the evaluated sample, starting from 0
  534. @item s
  535. sample rate
  536. @item t
  537. time of the evaluated sample expressed in seconds
  538. @item nb_in_channels
  539. @item nb_out_channels
  540. input and output number of channels
  541. @item val(CH)
  542. the value of input channel with number @var{CH}
  543. @end table
  544. Note: this filter is slow. For faster processing you should use a
  545. dedicated filter.
  546. @subsection Examples
  547. @itemize
  548. @item
  549. Half volume:
  550. @example
  551. aeval=val(ch)/2:c=same
  552. @end example
  553. @item
  554. Invert phase of the second channel:
  555. @example
  556. aeval=val(0)|-val(1)
  557. @end example
  558. @end itemize
  559. @anchor{afade}
  560. @section afade
  561. Apply fade-in/out effect to input audio.
  562. A description of the accepted parameters follows.
  563. @table @option
  564. @item type, t
  565. Specify the effect type, can be either @code{in} for fade-in, or
  566. @code{out} for a fade-out effect. Default is @code{in}.
  567. @item start_sample, ss
  568. Specify the number of the start sample for starting to apply the fade
  569. effect. Default is 0.
  570. @item nb_samples, ns
  571. Specify the number of samples for which the fade effect has to last. At
  572. the end of the fade-in effect the output audio will have the same
  573. volume as the input audio, at the end of the fade-out transition
  574. the output audio will be silence. Default is 44100.
  575. @item start_time, st
  576. Specify the start time of the fade effect. Default is 0.
  577. The value must be specified as a time duration; see
  578. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  579. for the accepted syntax.
  580. If set this option is used instead of @var{start_sample}.
  581. @item duration, d
  582. Specify the duration of the fade effect. See
  583. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  584. for the accepted syntax.
  585. At the end of the fade-in effect the output audio will have the same
  586. volume as the input audio, at the end of the fade-out transition
  587. the output audio will be silence.
  588. By default the duration is determined by @var{nb_samples}.
  589. If set this option is used instead of @var{nb_samples}.
  590. @item curve
  591. Set curve for fade transition.
  592. It accepts the following values:
  593. @table @option
  594. @item tri
  595. select triangular, linear slope (default)
  596. @item qsin
  597. select quarter of sine wave
  598. @item hsin
  599. select half of sine wave
  600. @item esin
  601. select exponential sine wave
  602. @item log
  603. select logarithmic
  604. @item ipar
  605. select inverted parabola
  606. @item qua
  607. select quadratic
  608. @item cub
  609. select cubic
  610. @item squ
  611. select square root
  612. @item cbr
  613. select cubic root
  614. @item par
  615. select parabola
  616. @item exp
  617. select exponential
  618. @item iqsin
  619. select inverted quarter of sine wave
  620. @item ihsin
  621. select inverted half of sine wave
  622. @item dese
  623. select double-exponential seat
  624. @item desi
  625. select double-exponential sigmoid
  626. @end table
  627. @end table
  628. @subsection Examples
  629. @itemize
  630. @item
  631. Fade in first 15 seconds of audio:
  632. @example
  633. afade=t=in:ss=0:d=15
  634. @end example
  635. @item
  636. Fade out last 25 seconds of a 900 seconds audio:
  637. @example
  638. afade=t=out:st=875:d=25
  639. @end example
  640. @end itemize
  641. @section afftfilt
  642. Apply arbitrary expressions to samples in frequency domain.
  643. @table @option
  644. @item real
  645. Set frequency domain real expression for each separate channel separated
  646. by '|'. Default is "1".
  647. If the number of input channels is greater than the number of
  648. expressions, the last specified expression is used for the remaining
  649. output channels.
  650. @item imag
  651. Set frequency domain imaginary expression for each separate channel
  652. separated by '|'. If not set, @var{real} option is used.
  653. Each expression in @var{real} and @var{imag} can contain the following
  654. constants:
  655. @table @option
  656. @item sr
  657. sample rate
  658. @item b
  659. current frequency bin number
  660. @item nb
  661. number of available bins
  662. @item ch
  663. channel number of the current expression
  664. @item chs
  665. number of channels
  666. @item pts
  667. current frame pts
  668. @end table
  669. @item win_size
  670. Set window size.
  671. It accepts the following values:
  672. @table @samp
  673. @item w16
  674. @item w32
  675. @item w64
  676. @item w128
  677. @item w256
  678. @item w512
  679. @item w1024
  680. @item w2048
  681. @item w4096
  682. @item w8192
  683. @item w16384
  684. @item w32768
  685. @item w65536
  686. @end table
  687. Default is @code{w4096}
  688. @item win_func
  689. Set window function. Default is @code{hann}.
  690. @item overlap
  691. Set window overlap. If set to 1, the recommended overlap for selected
  692. window function will be picked. Default is @code{0.75}.
  693. @end table
  694. @subsection Examples
  695. @itemize
  696. @item
  697. Leave almost only low frequencies in audio:
  698. @example
  699. afftfilt="1-clip((b/nb)*b,0,1)"
  700. @end example
  701. @end itemize
  702. @section afir
  703. Apply an arbitrary Frequency Impulse Response filter.
  704. This filter is designed for applying long FIR filters,
  705. up to 30 seconds long.
  706. It can be used as component for digital crossover filters,
  707. room equalization, cross talk cancellation, wavefield synthesis,
  708. auralization, ambiophonics and ambisonics.
  709. This filter uses second stream as FIR coefficients.
  710. If second stream holds single channel, it will be used
  711. for all input channels in first stream, otherwise
  712. number of channels in second stream must be same as
  713. number of channels in first stream.
  714. It accepts the following parameters:
  715. @table @option
  716. @item dry
  717. Set dry gain. This sets input gain.
  718. @item wet
  719. Set wet gain. This sets final output gain.
  720. @item length
  721. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  722. @item again
  723. Enable applying gain measured from power of IR.
  724. @end table
  725. @subsection Examples
  726. @itemize
  727. @item
  728. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  729. @example
  730. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  731. @end example
  732. @end itemize
  733. @anchor{aformat}
  734. @section aformat
  735. Set output format constraints for the input audio. The framework will
  736. negotiate the most appropriate format to minimize conversions.
  737. It accepts the following parameters:
  738. @table @option
  739. @item sample_fmts
  740. A '|'-separated list of requested sample formats.
  741. @item sample_rates
  742. A '|'-separated list of requested sample rates.
  743. @item channel_layouts
  744. A '|'-separated list of requested channel layouts.
  745. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  746. for the required syntax.
  747. @end table
  748. If a parameter is omitted, all values are allowed.
  749. Force the output to either unsigned 8-bit or signed 16-bit stereo
  750. @example
  751. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  752. @end example
  753. @section agate
  754. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  755. processing reduces disturbing noise between useful signals.
  756. Gating is done by detecting the volume below a chosen level @var{threshold}
  757. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  758. floor is set via @var{range}. Because an exact manipulation of the signal
  759. would cause distortion of the waveform the reduction can be levelled over
  760. time. This is done by setting @var{attack} and @var{release}.
  761. @var{attack} determines how long the signal has to fall below the threshold
  762. before any reduction will occur and @var{release} sets the time the signal
  763. has to rise above the threshold to reduce the reduction again.
  764. Shorter signals than the chosen attack time will be left untouched.
  765. @table @option
  766. @item level_in
  767. Set input level before filtering.
  768. Default is 1. Allowed range is from 0.015625 to 64.
  769. @item range
  770. Set the level of gain reduction when the signal is below the threshold.
  771. Default is 0.06125. Allowed range is from 0 to 1.
  772. @item threshold
  773. If a signal rises above this level the gain reduction is released.
  774. Default is 0.125. Allowed range is from 0 to 1.
  775. @item ratio
  776. Set a ratio by which the signal is reduced.
  777. Default is 2. Allowed range is from 1 to 9000.
  778. @item attack
  779. Amount of milliseconds the signal has to rise above the threshold before gain
  780. reduction stops.
  781. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  782. @item release
  783. Amount of milliseconds the signal has to fall below the threshold before the
  784. reduction is increased again. Default is 250 milliseconds.
  785. Allowed range is from 0.01 to 9000.
  786. @item makeup
  787. Set amount of amplification of signal after processing.
  788. Default is 1. Allowed range is from 1 to 64.
  789. @item knee
  790. Curve the sharp knee around the threshold to enter gain reduction more softly.
  791. Default is 2.828427125. Allowed range is from 1 to 8.
  792. @item detection
  793. Choose if exact signal should be taken for detection or an RMS like one.
  794. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  795. @item link
  796. Choose if the average level between all channels or the louder channel affects
  797. the reduction.
  798. Default is @code{average}. Can be @code{average} or @code{maximum}.
  799. @end table
  800. @section alimiter
  801. The limiter prevents an input signal from rising over a desired threshold.
  802. This limiter uses lookahead technology to prevent your signal from distorting.
  803. It means that there is a small delay after the signal is processed. Keep in mind
  804. that the delay it produces is the attack time you set.
  805. The filter accepts the following options:
  806. @table @option
  807. @item level_in
  808. Set input gain. Default is 1.
  809. @item level_out
  810. Set output gain. Default is 1.
  811. @item limit
  812. Don't let signals above this level pass the limiter. Default is 1.
  813. @item attack
  814. The limiter will reach its attenuation level in this amount of time in
  815. milliseconds. Default is 5 milliseconds.
  816. @item release
  817. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  818. Default is 50 milliseconds.
  819. @item asc
  820. When gain reduction is always needed ASC takes care of releasing to an
  821. average reduction level rather than reaching a reduction of 0 in the release
  822. time.
  823. @item asc_level
  824. Select how much the release time is affected by ASC, 0 means nearly no changes
  825. in release time while 1 produces higher release times.
  826. @item level
  827. Auto level output signal. Default is enabled.
  828. This normalizes audio back to 0dB if enabled.
  829. @end table
  830. Depending on picked setting it is recommended to upsample input 2x or 4x times
  831. with @ref{aresample} before applying this filter.
  832. @section allpass
  833. Apply a two-pole all-pass filter with central frequency (in Hz)
  834. @var{frequency}, and filter-width @var{width}.
  835. An all-pass filter changes the audio's frequency to phase relationship
  836. without changing its frequency to amplitude relationship.
  837. The filter accepts the following options:
  838. @table @option
  839. @item frequency, f
  840. Set frequency in Hz.
  841. @item width_type, t
  842. Set method to specify band-width of filter.
  843. @table @option
  844. @item h
  845. Hz
  846. @item q
  847. Q-Factor
  848. @item o
  849. octave
  850. @item s
  851. slope
  852. @end table
  853. @item width, w
  854. Specify the band-width of a filter in width_type units.
  855. @item channels, c
  856. Specify which channels to filter, by default all available are filtered.
  857. @end table
  858. @section aloop
  859. Loop audio samples.
  860. The filter accepts the following options:
  861. @table @option
  862. @item loop
  863. Set the number of loops.
  864. @item size
  865. Set maximal number of samples.
  866. @item start
  867. Set first sample of loop.
  868. @end table
  869. @anchor{amerge}
  870. @section amerge
  871. Merge two or more audio streams into a single multi-channel stream.
  872. The filter accepts the following options:
  873. @table @option
  874. @item inputs
  875. Set the number of inputs. Default is 2.
  876. @end table
  877. If the channel layouts of the inputs are disjoint, and therefore compatible,
  878. the channel layout of the output will be set accordingly and the channels
  879. will be reordered as necessary. If the channel layouts of the inputs are not
  880. disjoint, the output will have all the channels of the first input then all
  881. the channels of the second input, in that order, and the channel layout of
  882. the output will be the default value corresponding to the total number of
  883. channels.
  884. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  885. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  886. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  887. first input, b1 is the first channel of the second input).
  888. On the other hand, if both input are in stereo, the output channels will be
  889. in the default order: a1, a2, b1, b2, and the channel layout will be
  890. arbitrarily set to 4.0, which may or may not be the expected value.
  891. All inputs must have the same sample rate, and format.
  892. If inputs do not have the same duration, the output will stop with the
  893. shortest.
  894. @subsection Examples
  895. @itemize
  896. @item
  897. Merge two mono files into a stereo stream:
  898. @example
  899. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  900. @end example
  901. @item
  902. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  903. @example
  904. 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
  905. @end example
  906. @end itemize
  907. @section amix
  908. Mixes multiple audio inputs into a single output.
  909. Note that this filter only supports float samples (the @var{amerge}
  910. and @var{pan} audio filters support many formats). If the @var{amix}
  911. input has integer samples then @ref{aresample} will be automatically
  912. inserted to perform the conversion to float samples.
  913. For example
  914. @example
  915. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  916. @end example
  917. will mix 3 input audio streams to a single output with the same duration as the
  918. first input and a dropout transition time of 3 seconds.
  919. It accepts the following parameters:
  920. @table @option
  921. @item inputs
  922. The number of inputs. If unspecified, it defaults to 2.
  923. @item duration
  924. How to determine the end-of-stream.
  925. @table @option
  926. @item longest
  927. The duration of the longest input. (default)
  928. @item shortest
  929. The duration of the shortest input.
  930. @item first
  931. The duration of the first input.
  932. @end table
  933. @item dropout_transition
  934. The transition time, in seconds, for volume renormalization when an input
  935. stream ends. The default value is 2 seconds.
  936. @end table
  937. @section anequalizer
  938. High-order parametric multiband equalizer for each channel.
  939. It accepts the following parameters:
  940. @table @option
  941. @item params
  942. This option string is in format:
  943. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  944. Each equalizer band is separated by '|'.
  945. @table @option
  946. @item chn
  947. Set channel number to which equalization will be applied.
  948. If input doesn't have that channel the entry is ignored.
  949. @item f
  950. Set central frequency for band.
  951. If input doesn't have that frequency the entry is ignored.
  952. @item w
  953. Set band width in hertz.
  954. @item g
  955. Set band gain in dB.
  956. @item t
  957. Set filter type for band, optional, can be:
  958. @table @samp
  959. @item 0
  960. Butterworth, this is default.
  961. @item 1
  962. Chebyshev type 1.
  963. @item 2
  964. Chebyshev type 2.
  965. @end table
  966. @end table
  967. @item curves
  968. With this option activated frequency response of anequalizer is displayed
  969. in video stream.
  970. @item size
  971. Set video stream size. Only useful if curves option is activated.
  972. @item mgain
  973. Set max gain that will be displayed. Only useful if curves option is activated.
  974. Setting this to a reasonable value makes it possible to display gain which is derived from
  975. neighbour bands which are too close to each other and thus produce higher gain
  976. when both are activated.
  977. @item fscale
  978. Set frequency scale used to draw frequency response in video output.
  979. Can be linear or logarithmic. Default is logarithmic.
  980. @item colors
  981. Set color for each channel curve which is going to be displayed in video stream.
  982. This is list of color names separated by space or by '|'.
  983. Unrecognised or missing colors will be replaced by white color.
  984. @end table
  985. @subsection Examples
  986. @itemize
  987. @item
  988. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  989. for first 2 channels using Chebyshev type 1 filter:
  990. @example
  991. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  992. @end example
  993. @end itemize
  994. @subsection Commands
  995. This filter supports the following commands:
  996. @table @option
  997. @item change
  998. Alter existing filter parameters.
  999. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1000. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1001. error is returned.
  1002. @var{freq} set new frequency parameter.
  1003. @var{width} set new width parameter in herz.
  1004. @var{gain} set new gain parameter in dB.
  1005. Full filter invocation with asendcmd may look like this:
  1006. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1007. @end table
  1008. @section anull
  1009. Pass the audio source unchanged to the output.
  1010. @section apad
  1011. Pad the end of an audio stream with silence.
  1012. This can be used together with @command{ffmpeg} @option{-shortest} to
  1013. extend audio streams to the same length as the video stream.
  1014. A description of the accepted options follows.
  1015. @table @option
  1016. @item packet_size
  1017. Set silence packet size. Default value is 4096.
  1018. @item pad_len
  1019. Set the number of samples of silence to add to the end. After the
  1020. value is reached, the stream is terminated. This option is mutually
  1021. exclusive with @option{whole_len}.
  1022. @item whole_len
  1023. Set the minimum total number of samples in the output audio stream. If
  1024. the value is longer than the input audio length, silence is added to
  1025. the end, until the value is reached. This option is mutually exclusive
  1026. with @option{pad_len}.
  1027. @end table
  1028. If neither the @option{pad_len} nor the @option{whole_len} option is
  1029. set, the filter will add silence to the end of the input stream
  1030. indefinitely.
  1031. @subsection Examples
  1032. @itemize
  1033. @item
  1034. Add 1024 samples of silence to the end of the input:
  1035. @example
  1036. apad=pad_len=1024
  1037. @end example
  1038. @item
  1039. Make sure the audio output will contain at least 10000 samples, pad
  1040. the input with silence if required:
  1041. @example
  1042. apad=whole_len=10000
  1043. @end example
  1044. @item
  1045. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1046. video stream will always result the shortest and will be converted
  1047. until the end in the output file when using the @option{shortest}
  1048. option:
  1049. @example
  1050. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1051. @end example
  1052. @end itemize
  1053. @section aphaser
  1054. Add a phasing effect to the input audio.
  1055. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1056. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1057. A description of the accepted parameters follows.
  1058. @table @option
  1059. @item in_gain
  1060. Set input gain. Default is 0.4.
  1061. @item out_gain
  1062. Set output gain. Default is 0.74
  1063. @item delay
  1064. Set delay in milliseconds. Default is 3.0.
  1065. @item decay
  1066. Set decay. Default is 0.4.
  1067. @item speed
  1068. Set modulation speed in Hz. Default is 0.5.
  1069. @item type
  1070. Set modulation type. Default is triangular.
  1071. It accepts the following values:
  1072. @table @samp
  1073. @item triangular, t
  1074. @item sinusoidal, s
  1075. @end table
  1076. @end table
  1077. @section apulsator
  1078. Audio pulsator is something between an autopanner and a tremolo.
  1079. But it can produce funny stereo effects as well. Pulsator changes the volume
  1080. of the left and right channel based on a LFO (low frequency oscillator) with
  1081. different waveforms and shifted phases.
  1082. This filter have the ability to define an offset between left and right
  1083. channel. An offset of 0 means that both LFO shapes match each other.
  1084. The left and right channel are altered equally - a conventional tremolo.
  1085. An offset of 50% means that the shape of the right channel is exactly shifted
  1086. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1087. an autopanner. At 1 both curves match again. Every setting in between moves the
  1088. phase shift gapless between all stages and produces some "bypassing" sounds with
  1089. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1090. the 0.5) the faster the signal passes from the left to the right speaker.
  1091. The filter accepts the following options:
  1092. @table @option
  1093. @item level_in
  1094. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1095. @item level_out
  1096. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1097. @item mode
  1098. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1099. sawup or sawdown. Default is sine.
  1100. @item amount
  1101. Set modulation. Define how much of original signal is affected by the LFO.
  1102. @item offset_l
  1103. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1104. @item offset_r
  1105. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1106. @item width
  1107. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1108. @item timing
  1109. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1110. @item bpm
  1111. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1112. is set to bpm.
  1113. @item ms
  1114. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1115. is set to ms.
  1116. @item hz
  1117. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1118. if timing is set to hz.
  1119. @end table
  1120. @anchor{aresample}
  1121. @section aresample
  1122. Resample the input audio to the specified parameters, using the
  1123. libswresample library. If none are specified then the filter will
  1124. automatically convert between its input and output.
  1125. This filter is also able to stretch/squeeze the audio data to make it match
  1126. the timestamps or to inject silence / cut out audio to make it match the
  1127. timestamps, do a combination of both or do neither.
  1128. The filter accepts the syntax
  1129. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1130. expresses a sample rate and @var{resampler_options} is a list of
  1131. @var{key}=@var{value} pairs, separated by ":". See the
  1132. @ref{Resampler Options,,the "Resampler Options" section in the
  1133. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1134. for the complete list of supported options.
  1135. @subsection Examples
  1136. @itemize
  1137. @item
  1138. Resample the input audio to 44100Hz:
  1139. @example
  1140. aresample=44100
  1141. @end example
  1142. @item
  1143. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1144. samples per second compensation:
  1145. @example
  1146. aresample=async=1000
  1147. @end example
  1148. @end itemize
  1149. @section areverse
  1150. Reverse an audio clip.
  1151. Warning: This filter requires memory to buffer the entire clip, so trimming
  1152. is suggested.
  1153. @subsection Examples
  1154. @itemize
  1155. @item
  1156. Take the first 5 seconds of a clip, and reverse it.
  1157. @example
  1158. atrim=end=5,areverse
  1159. @end example
  1160. @end itemize
  1161. @section asetnsamples
  1162. Set the number of samples per each output audio frame.
  1163. The last output packet may contain a different number of samples, as
  1164. the filter will flush all the remaining samples when the input audio
  1165. signals its end.
  1166. The filter accepts the following options:
  1167. @table @option
  1168. @item nb_out_samples, n
  1169. Set the number of frames per each output audio frame. The number is
  1170. intended as the number of samples @emph{per each channel}.
  1171. Default value is 1024.
  1172. @item pad, p
  1173. If set to 1, the filter will pad the last audio frame with zeroes, so
  1174. that the last frame will contain the same number of samples as the
  1175. previous ones. Default value is 1.
  1176. @end table
  1177. For example, to set the number of per-frame samples to 1234 and
  1178. disable padding for the last frame, use:
  1179. @example
  1180. asetnsamples=n=1234:p=0
  1181. @end example
  1182. @section asetrate
  1183. Set the sample rate without altering the PCM data.
  1184. This will result in a change of speed and pitch.
  1185. The filter accepts the following options:
  1186. @table @option
  1187. @item sample_rate, r
  1188. Set the output sample rate. Default is 44100 Hz.
  1189. @end table
  1190. @section ashowinfo
  1191. Show a line containing various information for each input audio frame.
  1192. The input audio is not modified.
  1193. The shown line contains a sequence of key/value pairs of the form
  1194. @var{key}:@var{value}.
  1195. The following values are shown in the output:
  1196. @table @option
  1197. @item n
  1198. The (sequential) number of the input frame, starting from 0.
  1199. @item pts
  1200. The presentation timestamp of the input frame, in time base units; the time base
  1201. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1202. @item pts_time
  1203. The presentation timestamp of the input frame in seconds.
  1204. @item pos
  1205. position of the frame in the input stream, -1 if this information in
  1206. unavailable and/or meaningless (for example in case of synthetic audio)
  1207. @item fmt
  1208. The sample format.
  1209. @item chlayout
  1210. The channel layout.
  1211. @item rate
  1212. The sample rate for the audio frame.
  1213. @item nb_samples
  1214. The number of samples (per channel) in the frame.
  1215. @item checksum
  1216. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1217. audio, the data is treated as if all the planes were concatenated.
  1218. @item plane_checksums
  1219. A list of Adler-32 checksums for each data plane.
  1220. @end table
  1221. @anchor{astats}
  1222. @section astats
  1223. Display time domain statistical information about the audio channels.
  1224. Statistics are calculated and displayed for each audio channel and,
  1225. where applicable, an overall figure is also given.
  1226. It accepts the following option:
  1227. @table @option
  1228. @item length
  1229. Short window length in seconds, used for peak and trough RMS measurement.
  1230. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.1 - 10]}.
  1231. @item metadata
  1232. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1233. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1234. disabled.
  1235. Available keys for each channel are:
  1236. DC_offset
  1237. Min_level
  1238. Max_level
  1239. Min_difference
  1240. Max_difference
  1241. Mean_difference
  1242. RMS_difference
  1243. Peak_level
  1244. RMS_peak
  1245. RMS_trough
  1246. Crest_factor
  1247. Flat_factor
  1248. Peak_count
  1249. Bit_depth
  1250. Dynamic_range
  1251. and for Overall:
  1252. DC_offset
  1253. Min_level
  1254. Max_level
  1255. Min_difference
  1256. Max_difference
  1257. Mean_difference
  1258. RMS_difference
  1259. Peak_level
  1260. RMS_level
  1261. RMS_peak
  1262. RMS_trough
  1263. Flat_factor
  1264. Peak_count
  1265. Bit_depth
  1266. Number_of_samples
  1267. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1268. this @code{lavfi.astats.Overall.Peak_count}.
  1269. For description what each key means read below.
  1270. @item reset
  1271. Set number of frame after which stats are going to be recalculated.
  1272. Default is disabled.
  1273. @end table
  1274. A description of each shown parameter follows:
  1275. @table @option
  1276. @item DC offset
  1277. Mean amplitude displacement from zero.
  1278. @item Min level
  1279. Minimal sample level.
  1280. @item Max level
  1281. Maximal sample level.
  1282. @item Min difference
  1283. Minimal difference between two consecutive samples.
  1284. @item Max difference
  1285. Maximal difference between two consecutive samples.
  1286. @item Mean difference
  1287. Mean difference between two consecutive samples.
  1288. The average of each difference between two consecutive samples.
  1289. @item RMS difference
  1290. Root Mean Square difference between two consecutive samples.
  1291. @item Peak level dB
  1292. @item RMS level dB
  1293. Standard peak and RMS level measured in dBFS.
  1294. @item RMS peak dB
  1295. @item RMS trough dB
  1296. Peak and trough values for RMS level measured over a short window.
  1297. @item Crest factor
  1298. Standard ratio of peak to RMS level (note: not in dB).
  1299. @item Flat factor
  1300. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1301. (i.e. either @var{Min level} or @var{Max level}).
  1302. @item Peak count
  1303. Number of occasions (not the number of samples) that the signal attained either
  1304. @var{Min level} or @var{Max level}.
  1305. @item Bit depth
  1306. Overall bit depth of audio. Number of bits used for each sample.
  1307. @item Dynamic range
  1308. Measured dynamic range of audio in dB.
  1309. @end table
  1310. @section atempo
  1311. Adjust audio tempo.
  1312. The filter accepts exactly one parameter, the audio tempo. If not
  1313. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1314. be in the [0.5, 2.0] range.
  1315. @subsection Examples
  1316. @itemize
  1317. @item
  1318. Slow down audio to 80% tempo:
  1319. @example
  1320. atempo=0.8
  1321. @end example
  1322. @item
  1323. To speed up audio to 125% tempo:
  1324. @example
  1325. atempo=1.25
  1326. @end example
  1327. @end itemize
  1328. @section atrim
  1329. Trim the input so that the output contains one continuous subpart of the input.
  1330. It accepts the following parameters:
  1331. @table @option
  1332. @item start
  1333. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1334. sample with the timestamp @var{start} will be the first sample in the output.
  1335. @item end
  1336. Specify time of the first audio sample that will be dropped, i.e. the
  1337. audio sample immediately preceding the one with the timestamp @var{end} will be
  1338. the last sample in the output.
  1339. @item start_pts
  1340. Same as @var{start}, except this option sets the start timestamp in samples
  1341. instead of seconds.
  1342. @item end_pts
  1343. Same as @var{end}, except this option sets the end timestamp in samples instead
  1344. of seconds.
  1345. @item duration
  1346. The maximum duration of the output in seconds.
  1347. @item start_sample
  1348. The number of the first sample that should be output.
  1349. @item end_sample
  1350. The number of the first sample that should be dropped.
  1351. @end table
  1352. @option{start}, @option{end}, and @option{duration} are expressed as time
  1353. duration specifications; see
  1354. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1355. Note that the first two sets of the start/end options and the @option{duration}
  1356. option look at the frame timestamp, while the _sample options simply count the
  1357. samples that pass through the filter. So start/end_pts and start/end_sample will
  1358. give different results when the timestamps are wrong, inexact or do not start at
  1359. zero. Also note that this filter does not modify the timestamps. If you wish
  1360. to have the output timestamps start at zero, insert the asetpts filter after the
  1361. atrim filter.
  1362. If multiple start or end options are set, this filter tries to be greedy and
  1363. keep all samples that match at least one of the specified constraints. To keep
  1364. only the part that matches all the constraints at once, chain multiple atrim
  1365. filters.
  1366. The defaults are such that all the input is kept. So it is possible to set e.g.
  1367. just the end values to keep everything before the specified time.
  1368. Examples:
  1369. @itemize
  1370. @item
  1371. Drop everything except the second minute of input:
  1372. @example
  1373. ffmpeg -i INPUT -af atrim=60:120
  1374. @end example
  1375. @item
  1376. Keep only the first 1000 samples:
  1377. @example
  1378. ffmpeg -i INPUT -af atrim=end_sample=1000
  1379. @end example
  1380. @end itemize
  1381. @section bandpass
  1382. Apply a two-pole Butterworth band-pass filter with central
  1383. frequency @var{frequency}, and (3dB-point) band-width width.
  1384. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1385. instead of the default: constant 0dB peak gain.
  1386. The filter roll off at 6dB per octave (20dB per decade).
  1387. The filter accepts the following options:
  1388. @table @option
  1389. @item frequency, f
  1390. Set the filter's central frequency. Default is @code{3000}.
  1391. @item csg
  1392. Constant skirt gain if set to 1. Defaults to 0.
  1393. @item width_type, t
  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. @item channels, c
  1408. Specify which channels to filter, by default all available are filtered.
  1409. @end table
  1410. @section bandreject
  1411. Apply a two-pole Butterworth band-reject filter with central
  1412. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1413. The filter roll off at 6dB per octave (20dB per decade).
  1414. The filter accepts the following options:
  1415. @table @option
  1416. @item frequency, f
  1417. Set the filter's central frequency. Default is @code{3000}.
  1418. @item width_type, t
  1419. Set method to specify band-width of filter.
  1420. @table @option
  1421. @item h
  1422. Hz
  1423. @item q
  1424. Q-Factor
  1425. @item o
  1426. octave
  1427. @item s
  1428. slope
  1429. @end table
  1430. @item width, w
  1431. Specify the band-width of a filter in width_type units.
  1432. @item channels, c
  1433. Specify which channels to filter, by default all available are filtered.
  1434. @end table
  1435. @section bass
  1436. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1437. shelving filter with a response similar to that of a standard
  1438. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1439. The filter accepts the following options:
  1440. @table @option
  1441. @item gain, g
  1442. Give the gain at 0 Hz. Its useful range is about -20
  1443. (for a large cut) to +20 (for a large boost).
  1444. Beware of clipping when using a positive gain.
  1445. @item frequency, f
  1446. Set the filter's central frequency and so can be used
  1447. to extend or reduce the frequency range to be boosted or cut.
  1448. The default value is @code{100} Hz.
  1449. @item width_type, t
  1450. Set method to specify band-width of filter.
  1451. @table @option
  1452. @item h
  1453. Hz
  1454. @item q
  1455. Q-Factor
  1456. @item o
  1457. octave
  1458. @item s
  1459. slope
  1460. @end table
  1461. @item width, w
  1462. Determine how steep is the filter's shelf transition.
  1463. @item channels, c
  1464. Specify which channels to filter, by default all available are filtered.
  1465. @end table
  1466. @section biquad
  1467. Apply a biquad IIR filter with the given coefficients.
  1468. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1469. are the numerator and denominator coefficients respectively.
  1470. and @var{channels}, @var{c} specify which channels to filter, by default all
  1471. available are filtered.
  1472. @section bs2b
  1473. Bauer stereo to binaural transformation, which improves headphone listening of
  1474. stereo audio records.
  1475. To enable compilation of this filter you need to configure FFmpeg with
  1476. @code{--enable-libbs2b}.
  1477. It accepts the following parameters:
  1478. @table @option
  1479. @item profile
  1480. Pre-defined crossfeed level.
  1481. @table @option
  1482. @item default
  1483. Default level (fcut=700, feed=50).
  1484. @item cmoy
  1485. Chu Moy circuit (fcut=700, feed=60).
  1486. @item jmeier
  1487. Jan Meier circuit (fcut=650, feed=95).
  1488. @end table
  1489. @item fcut
  1490. Cut frequency (in Hz).
  1491. @item feed
  1492. Feed level (in Hz).
  1493. @end table
  1494. @section channelmap
  1495. Remap input channels to new locations.
  1496. It accepts the following parameters:
  1497. @table @option
  1498. @item map
  1499. Map channels from input to output. The argument is a '|'-separated list of
  1500. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1501. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1502. channel (e.g. FL for front left) or its index in the input channel layout.
  1503. @var{out_channel} is the name of the output channel or its index in the output
  1504. channel layout. If @var{out_channel} is not given then it is implicitly an
  1505. index, starting with zero and increasing by one for each mapping.
  1506. @item channel_layout
  1507. The channel layout of the output stream.
  1508. @end table
  1509. If no mapping is present, the filter will implicitly map input channels to
  1510. output channels, preserving indices.
  1511. For example, assuming a 5.1+downmix input MOV file,
  1512. @example
  1513. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1514. @end example
  1515. will create an output WAV file tagged as stereo from the downmix channels of
  1516. the input.
  1517. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1518. @example
  1519. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1520. @end example
  1521. @section channelsplit
  1522. Split each channel from an input audio stream into a separate output stream.
  1523. It accepts the following parameters:
  1524. @table @option
  1525. @item channel_layout
  1526. The channel layout of the input stream. The default is "stereo".
  1527. @end table
  1528. For example, assuming a stereo input MP3 file,
  1529. @example
  1530. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1531. @end example
  1532. will create an output Matroska file with two audio streams, one containing only
  1533. the left channel and the other the right channel.
  1534. Split a 5.1 WAV file into per-channel files:
  1535. @example
  1536. ffmpeg -i in.wav -filter_complex
  1537. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1538. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1539. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1540. side_right.wav
  1541. @end example
  1542. @section chorus
  1543. Add a chorus effect to the audio.
  1544. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1545. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1546. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1547. The modulation depth defines the range the modulated delay is played before or after
  1548. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1549. sound tuned around the original one, like in a chorus where some vocals are slightly
  1550. off key.
  1551. It accepts the following parameters:
  1552. @table @option
  1553. @item in_gain
  1554. Set input gain. Default is 0.4.
  1555. @item out_gain
  1556. Set output gain. Default is 0.4.
  1557. @item delays
  1558. Set delays. A typical delay is around 40ms to 60ms.
  1559. @item decays
  1560. Set decays.
  1561. @item speeds
  1562. Set speeds.
  1563. @item depths
  1564. Set depths.
  1565. @end table
  1566. @subsection Examples
  1567. @itemize
  1568. @item
  1569. A single delay:
  1570. @example
  1571. chorus=0.7:0.9:55:0.4:0.25:2
  1572. @end example
  1573. @item
  1574. Two delays:
  1575. @example
  1576. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1577. @end example
  1578. @item
  1579. Fuller sounding chorus with three delays:
  1580. @example
  1581. 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
  1582. @end example
  1583. @end itemize
  1584. @section compand
  1585. Compress or expand the audio's dynamic range.
  1586. It accepts the following parameters:
  1587. @table @option
  1588. @item attacks
  1589. @item decays
  1590. A list of times in seconds for each channel over which the instantaneous level
  1591. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1592. increase of volume and @var{decays} refers to decrease of volume. For most
  1593. situations, the attack time (response to the audio getting louder) should be
  1594. shorter than the decay time, because the human ear is more sensitive to sudden
  1595. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1596. a typical value for decay is 0.8 seconds.
  1597. If specified number of attacks & decays is lower than number of channels, the last
  1598. set attack/decay will be used for all remaining channels.
  1599. @item points
  1600. A list of points for the transfer function, specified in dB relative to the
  1601. maximum possible signal amplitude. Each key points list must be defined using
  1602. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1603. @code{x0/y0 x1/y1 x2/y2 ....}
  1604. The input values must be in strictly increasing order but the transfer function
  1605. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1606. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1607. function are @code{-70/-70|-60/-20|1/0}.
  1608. @item soft-knee
  1609. Set the curve radius in dB for all joints. It defaults to 0.01.
  1610. @item gain
  1611. Set the additional gain in dB to be applied at all points on the transfer
  1612. function. This allows for easy adjustment of the overall gain.
  1613. It defaults to 0.
  1614. @item volume
  1615. Set an initial volume, in dB, to be assumed for each channel when filtering
  1616. starts. This permits the user to supply a nominal level initially, so that, for
  1617. example, a very large gain is not applied to initial signal levels before the
  1618. companding has begun to operate. A typical value for audio which is initially
  1619. quiet is -90 dB. It defaults to 0.
  1620. @item delay
  1621. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1622. delayed before being fed to the volume adjuster. Specifying a delay
  1623. approximately equal to the attack/decay times allows the filter to effectively
  1624. operate in predictive rather than reactive mode. It defaults to 0.
  1625. @end table
  1626. @subsection Examples
  1627. @itemize
  1628. @item
  1629. Make music with both quiet and loud passages suitable for listening to in a
  1630. noisy environment:
  1631. @example
  1632. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1633. @end example
  1634. Another example for audio with whisper and explosion parts:
  1635. @example
  1636. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1637. @end example
  1638. @item
  1639. A noise gate for when the noise is at a lower level than the signal:
  1640. @example
  1641. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1642. @end example
  1643. @item
  1644. Here is another noise gate, this time for when the noise is at a higher level
  1645. than the signal (making it, in some ways, similar to squelch):
  1646. @example
  1647. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1648. @end example
  1649. @item
  1650. 2:1 compression starting at -6dB:
  1651. @example
  1652. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1653. @end example
  1654. @item
  1655. 2:1 compression starting at -9dB:
  1656. @example
  1657. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1658. @end example
  1659. @item
  1660. 2:1 compression starting at -12dB:
  1661. @example
  1662. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1663. @end example
  1664. @item
  1665. 2:1 compression starting at -18dB:
  1666. @example
  1667. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1668. @end example
  1669. @item
  1670. 3:1 compression starting at -15dB:
  1671. @example
  1672. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1673. @end example
  1674. @item
  1675. Compressor/Gate:
  1676. @example
  1677. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1678. @end example
  1679. @item
  1680. Expander:
  1681. @example
  1682. 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
  1683. @end example
  1684. @item
  1685. Hard limiter at -6dB:
  1686. @example
  1687. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1688. @end example
  1689. @item
  1690. Hard limiter at -12dB:
  1691. @example
  1692. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1693. @end example
  1694. @item
  1695. Hard noise gate at -35 dB:
  1696. @example
  1697. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1698. @end example
  1699. @item
  1700. Soft limiter:
  1701. @example
  1702. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  1703. @end example
  1704. @end itemize
  1705. @section compensationdelay
  1706. Compensation Delay Line is a metric based delay to compensate differing
  1707. positions of microphones or speakers.
  1708. For example, you have recorded guitar with two microphones placed in
  1709. different location. Because the front of sound wave has fixed speed in
  1710. normal conditions, the phasing of microphones can vary and depends on
  1711. their location and interposition. The best sound mix can be achieved when
  1712. these microphones are in phase (synchronized). Note that distance of
  1713. ~30 cm between microphones makes one microphone to capture signal in
  1714. antiphase to another microphone. That makes the final mix sounding moody.
  1715. This filter helps to solve phasing problems by adding different delays
  1716. to each microphone track and make them synchronized.
  1717. The best result can be reached when you take one track as base and
  1718. synchronize other tracks one by one with it.
  1719. Remember that synchronization/delay tolerance depends on sample rate, too.
  1720. Higher sample rates will give more tolerance.
  1721. It accepts the following parameters:
  1722. @table @option
  1723. @item mm
  1724. Set millimeters distance. This is compensation distance for fine tuning.
  1725. Default is 0.
  1726. @item cm
  1727. Set cm distance. This is compensation distance for tightening distance setup.
  1728. Default is 0.
  1729. @item m
  1730. Set meters distance. This is compensation distance for hard distance setup.
  1731. Default is 0.
  1732. @item dry
  1733. Set dry amount. Amount of unprocessed (dry) signal.
  1734. Default is 0.
  1735. @item wet
  1736. Set wet amount. Amount of processed (wet) signal.
  1737. Default is 1.
  1738. @item temp
  1739. Set temperature degree in Celsius. This is the temperature of the environment.
  1740. Default is 20.
  1741. @end table
  1742. @section crossfeed
  1743. Apply headphone crossfeed filter.
  1744. Crossfeed is the process of blending the left and right channels of stereo
  1745. audio recording.
  1746. It is mainly used to reduce extreme stereo separation of low frequencies.
  1747. The intent is to produce more speaker like sound to the listener.
  1748. The filter accepts the following options:
  1749. @table @option
  1750. @item strength
  1751. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  1752. This sets gain of low shelf filter for side part of stereo image.
  1753. Default is -6dB. Max allowed is -30db when strength is set to 1.
  1754. @item range
  1755. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  1756. This sets cut off frequency of low shelf filter. Default is cut off near
  1757. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  1758. @item level_in
  1759. Set input gain. Default is 0.9.
  1760. @item level_out
  1761. Set output gain. Default is 1.
  1762. @end table
  1763. @section crystalizer
  1764. Simple algorithm to expand audio dynamic range.
  1765. The filter accepts the following options:
  1766. @table @option
  1767. @item i
  1768. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  1769. (unchanged sound) to 10.0 (maximum effect).
  1770. @item c
  1771. Enable clipping. By default is enabled.
  1772. @end table
  1773. @section dcshift
  1774. Apply a DC shift to the audio.
  1775. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1776. in the recording chain) from the audio. The effect of a DC offset is reduced
  1777. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1778. a signal has a DC offset.
  1779. @table @option
  1780. @item shift
  1781. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1782. the audio.
  1783. @item limitergain
  1784. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1785. used to prevent clipping.
  1786. @end table
  1787. @section dynaudnorm
  1788. Dynamic Audio Normalizer.
  1789. This filter applies a certain amount of gain to the input audio in order
  1790. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  1791. contrast to more "simple" normalization algorithms, the Dynamic Audio
  1792. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  1793. This allows for applying extra gain to the "quiet" sections of the audio
  1794. while avoiding distortions or clipping the "loud" sections. In other words:
  1795. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  1796. sections, in the sense that the volume of each section is brought to the
  1797. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  1798. this goal *without* applying "dynamic range compressing". It will retain 100%
  1799. of the dynamic range *within* each section of the audio file.
  1800. @table @option
  1801. @item f
  1802. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  1803. Default is 500 milliseconds.
  1804. The Dynamic Audio Normalizer processes the input audio in small chunks,
  1805. referred to as frames. This is required, because a peak magnitude has no
  1806. meaning for just a single sample value. Instead, we need to determine the
  1807. peak magnitude for a contiguous sequence of sample values. While a "standard"
  1808. normalizer would simply use the peak magnitude of the complete file, the
  1809. Dynamic Audio Normalizer determines the peak magnitude individually for each
  1810. frame. The length of a frame is specified in milliseconds. By default, the
  1811. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  1812. been found to give good results with most files.
  1813. Note that the exact frame length, in number of samples, will be determined
  1814. automatically, based on the sampling rate of the individual input audio file.
  1815. @item g
  1816. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  1817. number. Default is 31.
  1818. Probably the most important parameter of the Dynamic Audio Normalizer is the
  1819. @code{window size} of the Gaussian smoothing filter. The filter's window size
  1820. is specified in frames, centered around the current frame. For the sake of
  1821. simplicity, this must be an odd number. Consequently, the default value of 31
  1822. takes into account the current frame, as well as the 15 preceding frames and
  1823. the 15 subsequent frames. Using a larger window results in a stronger
  1824. smoothing effect and thus in less gain variation, i.e. slower gain
  1825. adaptation. Conversely, using a smaller window results in a weaker smoothing
  1826. effect and thus in more gain variation, i.e. faster gain adaptation.
  1827. In other words, the more you increase this value, the more the Dynamic Audio
  1828. Normalizer will behave like a "traditional" normalization filter. On the
  1829. contrary, the more you decrease this value, the more the Dynamic Audio
  1830. Normalizer will behave like a dynamic range compressor.
  1831. @item p
  1832. Set the target peak value. This specifies the highest permissible magnitude
  1833. level for the normalized audio input. This filter will try to approach the
  1834. target peak magnitude as closely as possible, but at the same time it also
  1835. makes sure that the normalized signal will never exceed the peak magnitude.
  1836. A frame's maximum local gain factor is imposed directly by the target peak
  1837. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  1838. It is not recommended to go above this value.
  1839. @item m
  1840. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  1841. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  1842. factor for each input frame, i.e. the maximum gain factor that does not
  1843. result in clipping or distortion. The maximum gain factor is determined by
  1844. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  1845. additionally bounds the frame's maximum gain factor by a predetermined
  1846. (global) maximum gain factor. This is done in order to avoid excessive gain
  1847. factors in "silent" or almost silent frames. By default, the maximum gain
  1848. factor is 10.0, For most inputs the default value should be sufficient and
  1849. it usually is not recommended to increase this value. Though, for input
  1850. with an extremely low overall volume level, it may be necessary to allow even
  1851. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  1852. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  1853. Instead, a "sigmoid" threshold function will be applied. This way, the
  1854. gain factors will smoothly approach the threshold value, but never exceed that
  1855. value.
  1856. @item r
  1857. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  1858. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  1859. This means that the maximum local gain factor for each frame is defined
  1860. (only) by the frame's highest magnitude sample. This way, the samples can
  1861. be amplified as much as possible without exceeding the maximum signal
  1862. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  1863. Normalizer can also take into account the frame's root mean square,
  1864. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  1865. determine the power of a time-varying signal. It is therefore considered
  1866. that the RMS is a better approximation of the "perceived loudness" than
  1867. just looking at the signal's peak magnitude. Consequently, by adjusting all
  1868. frames to a constant RMS value, a uniform "perceived loudness" can be
  1869. established. If a target RMS value has been specified, a frame's local gain
  1870. factor is defined as the factor that would result in exactly that RMS value.
  1871. Note, however, that the maximum local gain factor is still restricted by the
  1872. frame's highest magnitude sample, in order to prevent clipping.
  1873. @item n
  1874. Enable channels coupling. By default is enabled.
  1875. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  1876. amount. This means the same gain factor will be applied to all channels, i.e.
  1877. the maximum possible gain factor is determined by the "loudest" channel.
  1878. However, in some recordings, it may happen that the volume of the different
  1879. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  1880. In this case, this option can be used to disable the channel coupling. This way,
  1881. the gain factor will be determined independently for each channel, depending
  1882. only on the individual channel's highest magnitude sample. This allows for
  1883. harmonizing the volume of the different channels.
  1884. @item c
  1885. Enable DC bias correction. By default is disabled.
  1886. An audio signal (in the time domain) is a sequence of sample values.
  1887. In the Dynamic Audio Normalizer these sample values are represented in the
  1888. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  1889. audio signal, or "waveform", should be centered around the zero point.
  1890. That means if we calculate the mean value of all samples in a file, or in a
  1891. single frame, then the result should be 0.0 or at least very close to that
  1892. value. If, however, there is a significant deviation of the mean value from
  1893. 0.0, in either positive or negative direction, this is referred to as a
  1894. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  1895. Audio Normalizer provides optional DC bias correction.
  1896. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  1897. the mean value, or "DC correction" offset, of each input frame and subtract
  1898. that value from all of the frame's sample values which ensures those samples
  1899. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  1900. boundaries, the DC correction offset values will be interpolated smoothly
  1901. between neighbouring frames.
  1902. @item b
  1903. Enable alternative boundary mode. By default is disabled.
  1904. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  1905. around each frame. This includes the preceding frames as well as the
  1906. subsequent frames. However, for the "boundary" frames, located at the very
  1907. beginning and at the very end of the audio file, not all neighbouring
  1908. frames are available. In particular, for the first few frames in the audio
  1909. file, the preceding frames are not known. And, similarly, for the last few
  1910. frames in the audio file, the subsequent frames are not known. Thus, the
  1911. question arises which gain factors should be assumed for the missing frames
  1912. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  1913. to deal with this situation. The default boundary mode assumes a gain factor
  1914. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  1915. "fade out" at the beginning and at the end of the input, respectively.
  1916. @item s
  1917. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  1918. By default, the Dynamic Audio Normalizer does not apply "traditional"
  1919. compression. This means that signal peaks will not be pruned and thus the
  1920. full dynamic range will be retained within each local neighbourhood. However,
  1921. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  1922. normalization algorithm with a more "traditional" compression.
  1923. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  1924. (thresholding) function. If (and only if) the compression feature is enabled,
  1925. all input frames will be processed by a soft knee thresholding function prior
  1926. to the actual normalization process. Put simply, the thresholding function is
  1927. going to prune all samples whose magnitude exceeds a certain threshold value.
  1928. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  1929. value. Instead, the threshold value will be adjusted for each individual
  1930. frame.
  1931. In general, smaller parameters result in stronger compression, and vice versa.
  1932. Values below 3.0 are not recommended, because audible distortion may appear.
  1933. @end table
  1934. @section earwax
  1935. Make audio easier to listen to on headphones.
  1936. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  1937. so that when listened to on headphones the stereo image is moved from
  1938. inside your head (standard for headphones) to outside and in front of
  1939. the listener (standard for speakers).
  1940. Ported from SoX.
  1941. @section equalizer
  1942. Apply a two-pole peaking equalisation (EQ) filter. With this
  1943. filter, the signal-level at and around a selected frequency can
  1944. be increased or decreased, whilst (unlike bandpass and bandreject
  1945. filters) that at all other frequencies is unchanged.
  1946. In order to produce complex equalisation curves, this filter can
  1947. be given several times, each with a different central frequency.
  1948. The filter accepts the following options:
  1949. @table @option
  1950. @item frequency, f
  1951. Set the filter's central frequency in Hz.
  1952. @item width_type, t
  1953. Set method to specify band-width of filter.
  1954. @table @option
  1955. @item h
  1956. Hz
  1957. @item q
  1958. Q-Factor
  1959. @item o
  1960. octave
  1961. @item s
  1962. slope
  1963. @end table
  1964. @item width, w
  1965. Specify the band-width of a filter in width_type units.
  1966. @item gain, g
  1967. Set the required gain or attenuation in dB.
  1968. Beware of clipping when using a positive gain.
  1969. @item channels, c
  1970. Specify which channels to filter, by default all available are filtered.
  1971. @end table
  1972. @subsection Examples
  1973. @itemize
  1974. @item
  1975. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  1976. @example
  1977. equalizer=f=1000:t=h:width=200:g=-10
  1978. @end example
  1979. @item
  1980. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  1981. @example
  1982. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  1983. @end example
  1984. @end itemize
  1985. @section extrastereo
  1986. Linearly increases the difference between left and right channels which
  1987. adds some sort of "live" effect to playback.
  1988. The filter accepts the following options:
  1989. @table @option
  1990. @item m
  1991. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  1992. (average of both channels), with 1.0 sound will be unchanged, with
  1993. -1.0 left and right channels will be swapped.
  1994. @item c
  1995. Enable clipping. By default is enabled.
  1996. @end table
  1997. @section firequalizer
  1998. Apply FIR Equalization using arbitrary frequency response.
  1999. The filter accepts the following option:
  2000. @table @option
  2001. @item gain
  2002. Set gain curve equation (in dB). The expression can contain variables:
  2003. @table @option
  2004. @item f
  2005. the evaluated frequency
  2006. @item sr
  2007. sample rate
  2008. @item ch
  2009. channel number, set to 0 when multichannels evaluation is disabled
  2010. @item chid
  2011. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2012. multichannels evaluation is disabled
  2013. @item chs
  2014. number of channels
  2015. @item chlayout
  2016. channel_layout, see libavutil/channel_layout.h
  2017. @end table
  2018. and functions:
  2019. @table @option
  2020. @item gain_interpolate(f)
  2021. interpolate gain on frequency f based on gain_entry
  2022. @item cubic_interpolate(f)
  2023. same as gain_interpolate, but smoother
  2024. @end table
  2025. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2026. @item gain_entry
  2027. Set gain entry for gain_interpolate function. The expression can
  2028. contain functions:
  2029. @table @option
  2030. @item entry(f, g)
  2031. store gain entry at frequency f with value g
  2032. @end table
  2033. This option is also available as command.
  2034. @item delay
  2035. Set filter delay in seconds. Higher value means more accurate.
  2036. Default is @code{0.01}.
  2037. @item accuracy
  2038. Set filter accuracy in Hz. Lower value means more accurate.
  2039. Default is @code{5}.
  2040. @item wfunc
  2041. Set window function. Acceptable values are:
  2042. @table @option
  2043. @item rectangular
  2044. rectangular window, useful when gain curve is already smooth
  2045. @item hann
  2046. hann window (default)
  2047. @item hamming
  2048. hamming window
  2049. @item blackman
  2050. blackman window
  2051. @item nuttall3
  2052. 3-terms continuous 1st derivative nuttall window
  2053. @item mnuttall3
  2054. minimum 3-terms discontinuous nuttall window
  2055. @item nuttall
  2056. 4-terms continuous 1st derivative nuttall window
  2057. @item bnuttall
  2058. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2059. @item bharris
  2060. blackman-harris window
  2061. @item tukey
  2062. tukey window
  2063. @end table
  2064. @item fixed
  2065. If enabled, use fixed number of audio samples. This improves speed when
  2066. filtering with large delay. Default is disabled.
  2067. @item multi
  2068. Enable multichannels evaluation on gain. Default is disabled.
  2069. @item zero_phase
  2070. Enable zero phase mode by subtracting timestamp to compensate delay.
  2071. Default is disabled.
  2072. @item scale
  2073. Set scale used by gain. Acceptable values are:
  2074. @table @option
  2075. @item linlin
  2076. linear frequency, linear gain
  2077. @item linlog
  2078. linear frequency, logarithmic (in dB) gain (default)
  2079. @item loglin
  2080. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2081. @item loglog
  2082. logarithmic frequency, logarithmic gain
  2083. @end table
  2084. @item dumpfile
  2085. Set file for dumping, suitable for gnuplot.
  2086. @item dumpscale
  2087. Set scale for dumpfile. Acceptable values are same with scale option.
  2088. Default is linlog.
  2089. @item fft2
  2090. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2091. Default is disabled.
  2092. @end table
  2093. @subsection Examples
  2094. @itemize
  2095. @item
  2096. lowpass at 1000 Hz:
  2097. @example
  2098. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2099. @end example
  2100. @item
  2101. lowpass at 1000 Hz with gain_entry:
  2102. @example
  2103. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2104. @end example
  2105. @item
  2106. custom equalization:
  2107. @example
  2108. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2109. @end example
  2110. @item
  2111. higher delay with zero phase to compensate delay:
  2112. @example
  2113. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2114. @end example
  2115. @item
  2116. lowpass on left channel, highpass on right channel:
  2117. @example
  2118. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2119. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2120. @end example
  2121. @end itemize
  2122. @section flanger
  2123. Apply a flanging effect to the audio.
  2124. The filter accepts the following options:
  2125. @table @option
  2126. @item delay
  2127. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2128. @item depth
  2129. Set added swep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2130. @item regen
  2131. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2132. Default value is 0.
  2133. @item width
  2134. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2135. Default value is 71.
  2136. @item speed
  2137. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2138. @item shape
  2139. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2140. Default value is @var{sinusoidal}.
  2141. @item phase
  2142. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2143. Default value is 25.
  2144. @item interp
  2145. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2146. Default is @var{linear}.
  2147. @end table
  2148. @section hdcd
  2149. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2150. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2151. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2152. of HDCD, and detects the Transient Filter flag.
  2153. @example
  2154. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2155. @end example
  2156. When using the filter with wav, note the default encoding for wav is 16-bit,
  2157. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2158. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2159. @example
  2160. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2161. ffmpeg -i HDCD16.wav -af hdcd -acodec pcm_s24le OUT24.wav
  2162. @end example
  2163. The filter accepts the following options:
  2164. @table @option
  2165. @item disable_autoconvert
  2166. Disable any automatic format conversion or resampling in the filter graph.
  2167. @item process_stereo
  2168. Process the stereo channels together. If target_gain does not match between
  2169. channels, consider it invalid and use the last valid target_gain.
  2170. @item cdt_ms
  2171. Set the code detect timer period in ms.
  2172. @item force_pe
  2173. Always extend peaks above -3dBFS even if PE isn't signaled.
  2174. @item analyze_mode
  2175. Replace audio with a solid tone and adjust the amplitude to signal some
  2176. specific aspect of the decoding process. The output file can be loaded in
  2177. an audio editor alongside the original to aid analysis.
  2178. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2179. Modes are:
  2180. @table @samp
  2181. @item 0, off
  2182. Disabled
  2183. @item 1, lle
  2184. Gain adjustment level at each sample
  2185. @item 2, pe
  2186. Samples where peak extend occurs
  2187. @item 3, cdt
  2188. Samples where the code detect timer is active
  2189. @item 4, tgm
  2190. Samples where the target gain does not match between channels
  2191. @end table
  2192. @end table
  2193. @section headphone
  2194. Apply head-related transfer functions (HRTFs) to create virtual
  2195. loudspeakers around the user for binaural listening via headphones.
  2196. The HRIRs are provided via additional streams, for each channel
  2197. one stereo input stream is needed.
  2198. The filter accepts the following options:
  2199. @table @option
  2200. @item map
  2201. Set mapping of input streams for convolution.
  2202. The argument is a '|'-separated list of channel names in order as they
  2203. are given as additional stream inputs for filter.
  2204. This also specify number of input streams. Number of input streams
  2205. must be not less than number of channels in first stream plus one.
  2206. @item gain
  2207. Set gain applied to audio. Value is in dB. Default is 0.
  2208. @item type
  2209. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2210. processing audio in time domain which is slow.
  2211. @var{freq} is processing audio in frequency domain which is fast.
  2212. Default is @var{freq}.
  2213. @item lfe
  2214. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2215. @end table
  2216. @subsection Examples
  2217. @itemize
  2218. @item
  2219. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2220. each amovie filter use stereo file with IR coefficients as input.
  2221. The files give coefficients for each position of virtual loudspeaker:
  2222. @example
  2223. ffmpeg -i input.wav -lavfi-complex "amovie=azi_270_ele_0_DFC.wav[sr],amovie=azi_90_ele_0_DFC.wav[sl],amovie=azi_225_ele_0_DFC.wav[br],amovie=azi_135_ele_0_DFC.wav[bl],amovie=azi_0_ele_0_DFC.wav,asplit[fc][lfe],amovie=azi_35_ele_0_DFC.wav[fl],amovie=azi_325_ele_0_DFC.wav[fr],[a:0][fl][fr][fc][lfe][bl][br][sl][sr]headphone=FL|FR|FC|LFE|BL|BR|SL|SR"
  2224. output.wav
  2225. @end example
  2226. @end itemize
  2227. @section highpass
  2228. Apply a high-pass filter with 3dB point frequency.
  2229. The filter can be either single-pole, or double-pole (the default).
  2230. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2231. The filter accepts the following options:
  2232. @table @option
  2233. @item frequency, f
  2234. Set frequency in Hz. Default is 3000.
  2235. @item poles, p
  2236. Set number of poles. Default is 2.
  2237. @item width_type, t
  2238. Set method to specify band-width of filter.
  2239. @table @option
  2240. @item h
  2241. Hz
  2242. @item q
  2243. Q-Factor
  2244. @item o
  2245. octave
  2246. @item s
  2247. slope
  2248. @end table
  2249. @item width, w
  2250. Specify the band-width of a filter in width_type units.
  2251. Applies only to double-pole filter.
  2252. The default is 0.707q and gives a Butterworth response.
  2253. @item channels, c
  2254. Specify which channels to filter, by default all available are filtered.
  2255. @end table
  2256. @section join
  2257. Join multiple input streams into one multi-channel stream.
  2258. It accepts the following parameters:
  2259. @table @option
  2260. @item inputs
  2261. The number of input streams. It defaults to 2.
  2262. @item channel_layout
  2263. The desired output channel layout. It defaults to stereo.
  2264. @item map
  2265. Map channels from inputs to output. The argument is a '|'-separated list of
  2266. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2267. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2268. can be either the name of the input channel (e.g. FL for front left) or its
  2269. index in the specified input stream. @var{out_channel} is the name of the output
  2270. channel.
  2271. @end table
  2272. The filter will attempt to guess the mappings when they are not specified
  2273. explicitly. It does so by first trying to find an unused matching input channel
  2274. and if that fails it picks the first unused input channel.
  2275. Join 3 inputs (with properly set channel layouts):
  2276. @example
  2277. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2278. @end example
  2279. Build a 5.1 output from 6 single-channel streams:
  2280. @example
  2281. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2282. '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'
  2283. out
  2284. @end example
  2285. @section ladspa
  2286. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2287. To enable compilation of this filter you need to configure FFmpeg with
  2288. @code{--enable-ladspa}.
  2289. @table @option
  2290. @item file, f
  2291. Specifies the name of LADSPA plugin library to load. If the environment
  2292. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2293. each one of the directories specified by the colon separated list in
  2294. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2295. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2296. @file{/usr/lib/ladspa/}.
  2297. @item plugin, p
  2298. Specifies the plugin within the library. Some libraries contain only
  2299. one plugin, but others contain many of them. If this is not set filter
  2300. will list all available plugins within the specified library.
  2301. @item controls, c
  2302. Set the '|' separated list of controls which are zero or more floating point
  2303. values that determine the behavior of the loaded plugin (for example delay,
  2304. threshold or gain).
  2305. Controls need to be defined using the following syntax:
  2306. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2307. @var{valuei} is the value set on the @var{i}-th control.
  2308. Alternatively they can be also defined using the following syntax:
  2309. @var{value0}|@var{value1}|@var{value2}|..., where
  2310. @var{valuei} is the value set on the @var{i}-th control.
  2311. If @option{controls} is set to @code{help}, all available controls and
  2312. their valid ranges are printed.
  2313. @item sample_rate, s
  2314. Specify the sample rate, default to 44100. Only used if plugin have
  2315. zero inputs.
  2316. @item nb_samples, n
  2317. Set the number of samples per channel per each output frame, default
  2318. is 1024. Only used if plugin have zero inputs.
  2319. @item duration, d
  2320. Set the minimum duration of the sourced audio. See
  2321. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2322. for the accepted syntax.
  2323. Note that the resulting duration may be greater than the specified duration,
  2324. as the generated audio is always cut at the end of a complete frame.
  2325. If not specified, or the expressed duration is negative, the audio is
  2326. supposed to be generated forever.
  2327. Only used if plugin have zero inputs.
  2328. @end table
  2329. @subsection Examples
  2330. @itemize
  2331. @item
  2332. List all available plugins within amp (LADSPA example plugin) library:
  2333. @example
  2334. ladspa=file=amp
  2335. @end example
  2336. @item
  2337. List all available controls and their valid ranges for @code{vcf_notch}
  2338. plugin from @code{VCF} library:
  2339. @example
  2340. ladspa=f=vcf:p=vcf_notch:c=help
  2341. @end example
  2342. @item
  2343. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2344. plugin library:
  2345. @example
  2346. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2347. @end example
  2348. @item
  2349. Add reverberation to the audio using TAP-plugins
  2350. (Tom's Audio Processing plugins):
  2351. @example
  2352. ladspa=file=tap_reverb:tap_reverb
  2353. @end example
  2354. @item
  2355. Generate white noise, with 0.2 amplitude:
  2356. @example
  2357. ladspa=file=cmt:noise_source_white:c=c0=.2
  2358. @end example
  2359. @item
  2360. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2361. @code{C* Audio Plugin Suite} (CAPS) library:
  2362. @example
  2363. ladspa=file=caps:Click:c=c1=20'
  2364. @end example
  2365. @item
  2366. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2367. @example
  2368. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2369. @end example
  2370. @item
  2371. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2372. @code{SWH Plugins} collection:
  2373. @example
  2374. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2375. @end example
  2376. @item
  2377. Attenuate low frequencies using Multiband EQ from Steve Harris
  2378. @code{SWH Plugins} collection:
  2379. @example
  2380. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2381. @end example
  2382. @item
  2383. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  2384. (CAPS) library:
  2385. @example
  2386. ladspa=caps:Narrower
  2387. @end example
  2388. @item
  2389. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  2390. @example
  2391. ladspa=caps:White:.2
  2392. @end example
  2393. @item
  2394. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  2395. @example
  2396. ladspa=caps:Fractal:c=c1=1
  2397. @end example
  2398. @item
  2399. Dynamic volume normalization using @code{VLevel} plugin:
  2400. @example
  2401. ladspa=vlevel-ladspa:vlevel_mono
  2402. @end example
  2403. @end itemize
  2404. @subsection Commands
  2405. This filter supports the following commands:
  2406. @table @option
  2407. @item cN
  2408. Modify the @var{N}-th control value.
  2409. If the specified value is not valid, it is ignored and prior one is kept.
  2410. @end table
  2411. @section loudnorm
  2412. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2413. Support for both single pass (livestreams, files) and double pass (files) modes.
  2414. This algorithm can target IL, LRA, and maximum true peak.
  2415. The filter accepts the following options:
  2416. @table @option
  2417. @item I, i
  2418. Set integrated loudness target.
  2419. Range is -70.0 - -5.0. Default value is -24.0.
  2420. @item LRA, lra
  2421. Set loudness range target.
  2422. Range is 1.0 - 20.0. Default value is 7.0.
  2423. @item TP, tp
  2424. Set maximum true peak.
  2425. Range is -9.0 - +0.0. Default value is -2.0.
  2426. @item measured_I, measured_i
  2427. Measured IL of input file.
  2428. Range is -99.0 - +0.0.
  2429. @item measured_LRA, measured_lra
  2430. Measured LRA of input file.
  2431. Range is 0.0 - 99.0.
  2432. @item measured_TP, measured_tp
  2433. Measured true peak of input file.
  2434. Range is -99.0 - +99.0.
  2435. @item measured_thresh
  2436. Measured threshold of input file.
  2437. Range is -99.0 - +0.0.
  2438. @item offset
  2439. Set offset gain. Gain is applied before the true-peak limiter.
  2440. Range is -99.0 - +99.0. Default is +0.0.
  2441. @item linear
  2442. Normalize linearly if possible.
  2443. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2444. to be specified in order to use this mode.
  2445. Options are true or false. Default is true.
  2446. @item dual_mono
  2447. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2448. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2449. If set to @code{true}, this option will compensate for this effect.
  2450. Multi-channel input files are not affected by this option.
  2451. Options are true or false. Default is false.
  2452. @item print_format
  2453. Set print format for stats. Options are summary, json, or none.
  2454. Default value is none.
  2455. @end table
  2456. @section lowpass
  2457. Apply a low-pass filter with 3dB point frequency.
  2458. The filter can be either single-pole or double-pole (the default).
  2459. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2460. The filter accepts the following options:
  2461. @table @option
  2462. @item frequency, f
  2463. Set frequency in Hz. Default is 500.
  2464. @item poles, p
  2465. Set number of poles. Default is 2.
  2466. @item width_type, t
  2467. Set method to specify band-width of filter.
  2468. @table @option
  2469. @item h
  2470. Hz
  2471. @item q
  2472. Q-Factor
  2473. @item o
  2474. octave
  2475. @item s
  2476. slope
  2477. @end table
  2478. @item width, w
  2479. Specify the band-width of a filter in width_type units.
  2480. Applies only to double-pole filter.
  2481. The default is 0.707q and gives a Butterworth response.
  2482. @item channels, c
  2483. Specify which channels to filter, by default all available are filtered.
  2484. @end table
  2485. @subsection Examples
  2486. @itemize
  2487. @item
  2488. Lowpass only LFE channel, it LFE is not present it does nothing:
  2489. @example
  2490. lowpass=c=LFE
  2491. @end example
  2492. @end itemize
  2493. @anchor{pan}
  2494. @section pan
  2495. Mix channels with specific gain levels. The filter accepts the output
  2496. channel layout followed by a set of channels definitions.
  2497. This filter is also designed to efficiently remap the channels of an audio
  2498. stream.
  2499. The filter accepts parameters of the form:
  2500. "@var{l}|@var{outdef}|@var{outdef}|..."
  2501. @table @option
  2502. @item l
  2503. output channel layout or number of channels
  2504. @item outdef
  2505. output channel specification, of the form:
  2506. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  2507. @item out_name
  2508. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2509. number (c0, c1, etc.)
  2510. @item gain
  2511. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2512. @item in_name
  2513. input channel to use, see out_name for details; it is not possible to mix
  2514. named and numbered input channels
  2515. @end table
  2516. If the `=' in a channel specification is replaced by `<', then the gains for
  2517. that specification will be renormalized so that the total is 1, thus
  2518. avoiding clipping noise.
  2519. @subsection Mixing examples
  2520. For example, if you want to down-mix from stereo to mono, but with a bigger
  2521. factor for the left channel:
  2522. @example
  2523. pan=1c|c0=0.9*c0+0.1*c1
  2524. @end example
  2525. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2526. 7-channels surround:
  2527. @example
  2528. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2529. @end example
  2530. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2531. that should be preferred (see "-ac" option) unless you have very specific
  2532. needs.
  2533. @subsection Remapping examples
  2534. The channel remapping will be effective if, and only if:
  2535. @itemize
  2536. @item gain coefficients are zeroes or ones,
  2537. @item only one input per channel output,
  2538. @end itemize
  2539. If all these conditions are satisfied, the filter will notify the user ("Pure
  2540. channel mapping detected"), and use an optimized and lossless method to do the
  2541. remapping.
  2542. For example, if you have a 5.1 source and want a stereo audio stream by
  2543. dropping the extra channels:
  2544. @example
  2545. pan="stereo| c0=FL | c1=FR"
  2546. @end example
  2547. Given the same source, you can also switch front left and front right channels
  2548. and keep the input channel layout:
  2549. @example
  2550. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2551. @end example
  2552. If the input is a stereo audio stream, you can mute the front left channel (and
  2553. still keep the stereo channel layout) with:
  2554. @example
  2555. pan="stereo|c1=c1"
  2556. @end example
  2557. Still with a stereo audio stream input, you can copy the right channel in both
  2558. front left and right:
  2559. @example
  2560. pan="stereo| c0=FR | c1=FR"
  2561. @end example
  2562. @section replaygain
  2563. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2564. outputs it unchanged.
  2565. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2566. @section resample
  2567. Convert the audio sample format, sample rate and channel layout. It is
  2568. not meant to be used directly.
  2569. @section rubberband
  2570. Apply time-stretching and pitch-shifting with librubberband.
  2571. The filter accepts the following options:
  2572. @table @option
  2573. @item tempo
  2574. Set tempo scale factor.
  2575. @item pitch
  2576. Set pitch scale factor.
  2577. @item transients
  2578. Set transients detector.
  2579. Possible values are:
  2580. @table @var
  2581. @item crisp
  2582. @item mixed
  2583. @item smooth
  2584. @end table
  2585. @item detector
  2586. Set detector.
  2587. Possible values are:
  2588. @table @var
  2589. @item compound
  2590. @item percussive
  2591. @item soft
  2592. @end table
  2593. @item phase
  2594. Set phase.
  2595. Possible values are:
  2596. @table @var
  2597. @item laminar
  2598. @item independent
  2599. @end table
  2600. @item window
  2601. Set processing window size.
  2602. Possible values are:
  2603. @table @var
  2604. @item standard
  2605. @item short
  2606. @item long
  2607. @end table
  2608. @item smoothing
  2609. Set smoothing.
  2610. Possible values are:
  2611. @table @var
  2612. @item off
  2613. @item on
  2614. @end table
  2615. @item formant
  2616. Enable formant preservation when shift pitching.
  2617. Possible values are:
  2618. @table @var
  2619. @item shifted
  2620. @item preserved
  2621. @end table
  2622. @item pitchq
  2623. Set pitch quality.
  2624. Possible values are:
  2625. @table @var
  2626. @item quality
  2627. @item speed
  2628. @item consistency
  2629. @end table
  2630. @item channels
  2631. Set channels.
  2632. Possible values are:
  2633. @table @var
  2634. @item apart
  2635. @item together
  2636. @end table
  2637. @end table
  2638. @section sidechaincompress
  2639. This filter acts like normal compressor but has the ability to compress
  2640. detected signal using second input signal.
  2641. It needs two input streams and returns one output stream.
  2642. First input stream will be processed depending on second stream signal.
  2643. The filtered signal then can be filtered with other filters in later stages of
  2644. processing. See @ref{pan} and @ref{amerge} filter.
  2645. The filter accepts the following options:
  2646. @table @option
  2647. @item level_in
  2648. Set input gain. Default is 1. Range is between 0.015625 and 64.
  2649. @item threshold
  2650. If a signal of second stream raises above this level it will affect the gain
  2651. reduction of first stream.
  2652. By default is 0.125. Range is between 0.00097563 and 1.
  2653. @item ratio
  2654. Set a ratio about which the signal is reduced. 1:2 means that if the level
  2655. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  2656. Default is 2. Range is between 1 and 20.
  2657. @item attack
  2658. Amount of milliseconds the signal has to rise above the threshold before gain
  2659. reduction starts. Default is 20. Range is between 0.01 and 2000.
  2660. @item release
  2661. Amount of milliseconds the signal has to fall below the threshold before
  2662. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  2663. @item makeup
  2664. Set the amount by how much signal will be amplified after processing.
  2665. Default is 1. Range is from 1 to 64.
  2666. @item knee
  2667. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2668. Default is 2.82843. Range is between 1 and 8.
  2669. @item link
  2670. Choose if the @code{average} level between all channels of side-chain stream
  2671. or the louder(@code{maximum}) channel of side-chain stream affects the
  2672. reduction. Default is @code{average}.
  2673. @item detection
  2674. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  2675. of @code{rms}. Default is @code{rms} which is mainly smoother.
  2676. @item level_sc
  2677. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  2678. @item mix
  2679. How much to use compressed signal in output. Default is 1.
  2680. Range is between 0 and 1.
  2681. @end table
  2682. @subsection Examples
  2683. @itemize
  2684. @item
  2685. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  2686. depending on the signal of 2nd input and later compressed signal to be
  2687. merged with 2nd input:
  2688. @example
  2689. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  2690. @end example
  2691. @end itemize
  2692. @section sidechaingate
  2693. A sidechain gate acts like a normal (wideband) gate but has the ability to
  2694. filter the detected signal before sending it to the gain reduction stage.
  2695. Normally a gate uses the full range signal to detect a level above the
  2696. threshold.
  2697. For example: If you cut all lower frequencies from your sidechain signal
  2698. the gate will decrease the volume of your track only if not enough highs
  2699. appear. With this technique you are able to reduce the resonation of a
  2700. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  2701. guitar.
  2702. It needs two input streams and returns one output stream.
  2703. First input stream will be processed depending on second stream signal.
  2704. The filter accepts the following options:
  2705. @table @option
  2706. @item level_in
  2707. Set input level before filtering.
  2708. Default is 1. Allowed range is from 0.015625 to 64.
  2709. @item range
  2710. Set the level of gain reduction when the signal is below the threshold.
  2711. Default is 0.06125. Allowed range is from 0 to 1.
  2712. @item threshold
  2713. If a signal rises above this level the gain reduction is released.
  2714. Default is 0.125. Allowed range is from 0 to 1.
  2715. @item ratio
  2716. Set a ratio about which the signal is reduced.
  2717. Default is 2. Allowed range is from 1 to 9000.
  2718. @item attack
  2719. Amount of milliseconds the signal has to rise above the threshold before gain
  2720. reduction stops.
  2721. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  2722. @item release
  2723. Amount of milliseconds the signal has to fall below the threshold before the
  2724. reduction is increased again. Default is 250 milliseconds.
  2725. Allowed range is from 0.01 to 9000.
  2726. @item makeup
  2727. Set amount of amplification of signal after processing.
  2728. Default is 1. Allowed range is from 1 to 64.
  2729. @item knee
  2730. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2731. Default is 2.828427125. Allowed range is from 1 to 8.
  2732. @item detection
  2733. Choose if exact signal should be taken for detection or an RMS like one.
  2734. Default is rms. Can be peak or rms.
  2735. @item link
  2736. Choose if the average level between all channels or the louder channel affects
  2737. the reduction.
  2738. Default is average. Can be average or maximum.
  2739. @item level_sc
  2740. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  2741. @end table
  2742. @section silencedetect
  2743. Detect silence in an audio stream.
  2744. This filter logs a message when it detects that the input audio volume is less
  2745. or equal to a noise tolerance value for a duration greater or equal to the
  2746. minimum detected noise duration.
  2747. The printed times and duration are expressed in seconds.
  2748. The filter accepts the following options:
  2749. @table @option
  2750. @item duration, d
  2751. Set silence duration until notification (default is 2 seconds).
  2752. @item noise, n
  2753. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  2754. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  2755. @end table
  2756. @subsection Examples
  2757. @itemize
  2758. @item
  2759. Detect 5 seconds of silence with -50dB noise tolerance:
  2760. @example
  2761. silencedetect=n=-50dB:d=5
  2762. @end example
  2763. @item
  2764. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  2765. tolerance in @file{silence.mp3}:
  2766. @example
  2767. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  2768. @end example
  2769. @end itemize
  2770. @section silenceremove
  2771. Remove silence from the beginning, middle or end of the audio.
  2772. The filter accepts the following options:
  2773. @table @option
  2774. @item start_periods
  2775. This value is used to indicate if audio should be trimmed at beginning of
  2776. the audio. A value of zero indicates no silence should be trimmed from the
  2777. beginning. When specifying a non-zero value, it trims audio up until it
  2778. finds non-silence. Normally, when trimming silence from beginning of audio
  2779. the @var{start_periods} will be @code{1} but it can be increased to higher
  2780. values to trim all audio up to specific count of non-silence periods.
  2781. Default value is @code{0}.
  2782. @item start_duration
  2783. Specify the amount of time that non-silence must be detected before it stops
  2784. trimming audio. By increasing the duration, bursts of noises can be treated
  2785. as silence and trimmed off. Default value is @code{0}.
  2786. @item start_threshold
  2787. This indicates what sample value should be treated as silence. For digital
  2788. audio, a value of @code{0} may be fine but for audio recorded from analog,
  2789. you may wish to increase the value to account for background noise.
  2790. Can be specified in dB (in case "dB" is appended to the specified value)
  2791. or amplitude ratio. Default value is @code{0}.
  2792. @item stop_periods
  2793. Set the count for trimming silence from the end of audio.
  2794. To remove silence from the middle of a file, specify a @var{stop_periods}
  2795. that is negative. This value is then treated as a positive value and is
  2796. used to indicate the effect should restart processing as specified by
  2797. @var{start_periods}, making it suitable for removing periods of silence
  2798. in the middle of the audio.
  2799. Default value is @code{0}.
  2800. @item stop_duration
  2801. Specify a duration of silence that must exist before audio is not copied any
  2802. more. By specifying a higher duration, silence that is wanted can be left in
  2803. the audio.
  2804. Default value is @code{0}.
  2805. @item stop_threshold
  2806. This is the same as @option{start_threshold} but for trimming silence from
  2807. the end of audio.
  2808. Can be specified in dB (in case "dB" is appended to the specified value)
  2809. or amplitude ratio. Default value is @code{0}.
  2810. @item leave_silence
  2811. This indicates that @var{stop_duration} length of audio should be left intact
  2812. at the beginning of each period of silence.
  2813. For example, if you want to remove long pauses between words but do not want
  2814. to remove the pauses completely. Default value is @code{0}.
  2815. @item detection
  2816. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  2817. and works better with digital silence which is exactly 0.
  2818. Default value is @code{rms}.
  2819. @item window
  2820. Set ratio used to calculate size of window for detecting silence.
  2821. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  2822. @end table
  2823. @subsection Examples
  2824. @itemize
  2825. @item
  2826. The following example shows how this filter can be used to start a recording
  2827. that does not contain the delay at the start which usually occurs between
  2828. pressing the record button and the start of the performance:
  2829. @example
  2830. silenceremove=1:5:0.02
  2831. @end example
  2832. @item
  2833. Trim all silence encountered from beginning to end where there is more than 1
  2834. second of silence in audio:
  2835. @example
  2836. silenceremove=0:0:0:-1:1:-90dB
  2837. @end example
  2838. @end itemize
  2839. @section sofalizer
  2840. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  2841. loudspeakers around the user for binaural listening via headphones (audio
  2842. formats up to 9 channels supported).
  2843. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  2844. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  2845. Austrian Academy of Sciences.
  2846. To enable compilation of this filter you need to configure FFmpeg with
  2847. @code{--enable-libmysofa}.
  2848. The filter accepts the following options:
  2849. @table @option
  2850. @item sofa
  2851. Set the SOFA file used for rendering.
  2852. @item gain
  2853. Set gain applied to audio. Value is in dB. Default is 0.
  2854. @item rotation
  2855. Set rotation of virtual loudspeakers in deg. Default is 0.
  2856. @item elevation
  2857. Set elevation of virtual speakers in deg. Default is 0.
  2858. @item radius
  2859. Set distance in meters between loudspeakers and the listener with near-field
  2860. HRTFs. Default is 1.
  2861. @item type
  2862. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2863. processing audio in time domain which is slow.
  2864. @var{freq} is processing audio in frequency domain which is fast.
  2865. Default is @var{freq}.
  2866. @item speakers
  2867. Set custom positions of virtual loudspeakers. Syntax for this option is:
  2868. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  2869. Each virtual loudspeaker is described with short channel name following with
  2870. azimuth and elevation in degreees.
  2871. Each virtual loudspeaker description is separated by '|'.
  2872. For example to override front left and front right channel positions use:
  2873. 'speakers=FL 45 15|FR 345 15'.
  2874. Descriptions with unrecognised channel names are ignored.
  2875. @item lfegain
  2876. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2877. @end table
  2878. @subsection Examples
  2879. @itemize
  2880. @item
  2881. Using ClubFritz6 sofa file:
  2882. @example
  2883. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  2884. @end example
  2885. @item
  2886. Using ClubFritz12 sofa file and bigger radius with small rotation:
  2887. @example
  2888. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  2889. @end example
  2890. @item
  2891. Similar as above but with custom speaker positions for front left, front right, back left and back right
  2892. and also with custom gain:
  2893. @example
  2894. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  2895. @end example
  2896. @end itemize
  2897. @section stereotools
  2898. This filter has some handy utilities to manage stereo signals, for converting
  2899. M/S stereo recordings to L/R signal while having control over the parameters
  2900. or spreading the stereo image of master track.
  2901. The filter accepts the following options:
  2902. @table @option
  2903. @item level_in
  2904. Set input level before filtering for both channels. Defaults is 1.
  2905. Allowed range is from 0.015625 to 64.
  2906. @item level_out
  2907. Set output level after filtering for both channels. Defaults is 1.
  2908. Allowed range is from 0.015625 to 64.
  2909. @item balance_in
  2910. Set input balance between both channels. Default is 0.
  2911. Allowed range is from -1 to 1.
  2912. @item balance_out
  2913. Set output balance between both channels. Default is 0.
  2914. Allowed range is from -1 to 1.
  2915. @item softclip
  2916. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  2917. clipping. Disabled by default.
  2918. @item mutel
  2919. Mute the left channel. Disabled by default.
  2920. @item muter
  2921. Mute the right channel. Disabled by default.
  2922. @item phasel
  2923. Change the phase of the left channel. Disabled by default.
  2924. @item phaser
  2925. Change the phase of the right channel. Disabled by default.
  2926. @item mode
  2927. Set stereo mode. Available values are:
  2928. @table @samp
  2929. @item lr>lr
  2930. Left/Right to Left/Right, this is default.
  2931. @item lr>ms
  2932. Left/Right to Mid/Side.
  2933. @item ms>lr
  2934. Mid/Side to Left/Right.
  2935. @item lr>ll
  2936. Left/Right to Left/Left.
  2937. @item lr>rr
  2938. Left/Right to Right/Right.
  2939. @item lr>l+r
  2940. Left/Right to Left + Right.
  2941. @item lr>rl
  2942. Left/Right to Right/Left.
  2943. @item ms>ll
  2944. Mid/Side to Left/Left.
  2945. @item ms>rr
  2946. Mid/Side to Right/Right.
  2947. @end table
  2948. @item slev
  2949. Set level of side signal. Default is 1.
  2950. Allowed range is from 0.015625 to 64.
  2951. @item sbal
  2952. Set balance of side signal. Default is 0.
  2953. Allowed range is from -1 to 1.
  2954. @item mlev
  2955. Set level of the middle signal. Default is 1.
  2956. Allowed range is from 0.015625 to 64.
  2957. @item mpan
  2958. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  2959. @item base
  2960. Set stereo base between mono and inversed channels. Default is 0.
  2961. Allowed range is from -1 to 1.
  2962. @item delay
  2963. Set delay in milliseconds how much to delay left from right channel and
  2964. vice versa. Default is 0. Allowed range is from -20 to 20.
  2965. @item sclevel
  2966. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  2967. @item phase
  2968. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  2969. @item bmode_in, bmode_out
  2970. Set balance mode for balance_in/balance_out option.
  2971. Can be one of the following:
  2972. @table @samp
  2973. @item balance
  2974. Classic balance mode. Attenuate one channel at time.
  2975. Gain is raised up to 1.
  2976. @item amplitude
  2977. Similar as classic mode above but gain is raised up to 2.
  2978. @item power
  2979. Equal power distribution, from -6dB to +6dB range.
  2980. @end table
  2981. @end table
  2982. @subsection Examples
  2983. @itemize
  2984. @item
  2985. Apply karaoke like effect:
  2986. @example
  2987. stereotools=mlev=0.015625
  2988. @end example
  2989. @item
  2990. Convert M/S signal to L/R:
  2991. @example
  2992. "stereotools=mode=ms>lr"
  2993. @end example
  2994. @end itemize
  2995. @section stereowiden
  2996. This filter enhance the stereo effect by suppressing signal common to both
  2997. channels and by delaying the signal of left into right and vice versa,
  2998. thereby widening the stereo effect.
  2999. The filter accepts the following options:
  3000. @table @option
  3001. @item delay
  3002. Time in milliseconds of the delay of left signal into right and vice versa.
  3003. Default is 20 milliseconds.
  3004. @item feedback
  3005. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3006. effect of left signal in right output and vice versa which gives widening
  3007. effect. Default is 0.3.
  3008. @item crossfeed
  3009. Cross feed of left into right with inverted phase. This helps in suppressing
  3010. the mono. If the value is 1 it will cancel all the signal common to both
  3011. channels. Default is 0.3.
  3012. @item drymix
  3013. Set level of input signal of original channel. Default is 0.8.
  3014. @end table
  3015. @section superequalizer
  3016. Apply 18 band equalizer.
  3017. The filter accepts the following options:
  3018. @table @option
  3019. @item 1b
  3020. Set 65Hz band gain.
  3021. @item 2b
  3022. Set 92Hz band gain.
  3023. @item 3b
  3024. Set 131Hz band gain.
  3025. @item 4b
  3026. Set 185Hz band gain.
  3027. @item 5b
  3028. Set 262Hz band gain.
  3029. @item 6b
  3030. Set 370Hz band gain.
  3031. @item 7b
  3032. Set 523Hz band gain.
  3033. @item 8b
  3034. Set 740Hz band gain.
  3035. @item 9b
  3036. Set 1047Hz band gain.
  3037. @item 10b
  3038. Set 1480Hz band gain.
  3039. @item 11b
  3040. Set 2093Hz band gain.
  3041. @item 12b
  3042. Set 2960Hz band gain.
  3043. @item 13b
  3044. Set 4186Hz band gain.
  3045. @item 14b
  3046. Set 5920Hz band gain.
  3047. @item 15b
  3048. Set 8372Hz band gain.
  3049. @item 16b
  3050. Set 11840Hz band gain.
  3051. @item 17b
  3052. Set 16744Hz band gain.
  3053. @item 18b
  3054. Set 20000Hz band gain.
  3055. @end table
  3056. @section surround
  3057. Apply audio surround upmix filter.
  3058. This filter allows to produce multichannel output from audio stream.
  3059. The filter accepts the following options:
  3060. @table @option
  3061. @item chl_out
  3062. Set output channel layout. By default, this is @var{5.1}.
  3063. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3064. for the required syntax.
  3065. @item chl_in
  3066. Set input channel layout. By default, this is @var{stereo}.
  3067. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3068. for the required syntax.
  3069. @item level_in
  3070. Set input volume level. By default, this is @var{1}.
  3071. @item level_out
  3072. Set output volume level. By default, this is @var{1}.
  3073. @item lfe
  3074. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3075. @item lfe_low
  3076. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3077. @item lfe_high
  3078. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3079. @end table
  3080. @section treble
  3081. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3082. shelving filter with a response similar to that of a standard
  3083. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3084. The filter accepts the following options:
  3085. @table @option
  3086. @item gain, g
  3087. Give the gain at whichever is the lower of ~22 kHz and the
  3088. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3089. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3090. @item frequency, f
  3091. Set the filter's central frequency and so can be used
  3092. to extend or reduce the frequency range to be boosted or cut.
  3093. The default value is @code{3000} Hz.
  3094. @item width_type, t
  3095. Set method to specify band-width of filter.
  3096. @table @option
  3097. @item h
  3098. Hz
  3099. @item q
  3100. Q-Factor
  3101. @item o
  3102. octave
  3103. @item s
  3104. slope
  3105. @end table
  3106. @item width, w
  3107. Determine how steep is the filter's shelf transition.
  3108. @item channels, c
  3109. Specify which channels to filter, by default all available are filtered.
  3110. @end table
  3111. @section tremolo
  3112. Sinusoidal amplitude modulation.
  3113. The filter accepts the following options:
  3114. @table @option
  3115. @item f
  3116. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3117. (20 Hz or lower) will result in a tremolo effect.
  3118. This filter may also be used as a ring modulator by specifying
  3119. a modulation frequency higher than 20 Hz.
  3120. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3121. @item d
  3122. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3123. Default value is 0.5.
  3124. @end table
  3125. @section vibrato
  3126. Sinusoidal phase modulation.
  3127. The filter accepts the following options:
  3128. @table @option
  3129. @item f
  3130. Modulation frequency in Hertz.
  3131. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3132. @item d
  3133. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3134. Default value is 0.5.
  3135. @end table
  3136. @section volume
  3137. Adjust the input audio volume.
  3138. It accepts the following parameters:
  3139. @table @option
  3140. @item volume
  3141. Set audio volume expression.
  3142. Output values are clipped to the maximum value.
  3143. The output audio volume is given by the relation:
  3144. @example
  3145. @var{output_volume} = @var{volume} * @var{input_volume}
  3146. @end example
  3147. The default value for @var{volume} is "1.0".
  3148. @item precision
  3149. This parameter represents the mathematical precision.
  3150. It determines which input sample formats will be allowed, which affects the
  3151. precision of the volume scaling.
  3152. @table @option
  3153. @item fixed
  3154. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  3155. @item float
  3156. 32-bit floating-point; this limits input sample format to FLT. (default)
  3157. @item double
  3158. 64-bit floating-point; this limits input sample format to DBL.
  3159. @end table
  3160. @item replaygain
  3161. Choose the behaviour on encountering ReplayGain side data in input frames.
  3162. @table @option
  3163. @item drop
  3164. Remove ReplayGain side data, ignoring its contents (the default).
  3165. @item ignore
  3166. Ignore ReplayGain side data, but leave it in the frame.
  3167. @item track
  3168. Prefer the track gain, if present.
  3169. @item album
  3170. Prefer the album gain, if present.
  3171. @end table
  3172. @item replaygain_preamp
  3173. Pre-amplification gain in dB to apply to the selected replaygain gain.
  3174. Default value for @var{replaygain_preamp} is 0.0.
  3175. @item eval
  3176. Set when the volume expression is evaluated.
  3177. It accepts the following values:
  3178. @table @samp
  3179. @item once
  3180. only evaluate expression once during the filter initialization, or
  3181. when the @samp{volume} command is sent
  3182. @item frame
  3183. evaluate expression for each incoming frame
  3184. @end table
  3185. Default value is @samp{once}.
  3186. @end table
  3187. The volume expression can contain the following parameters.
  3188. @table @option
  3189. @item n
  3190. frame number (starting at zero)
  3191. @item nb_channels
  3192. number of channels
  3193. @item nb_consumed_samples
  3194. number of samples consumed by the filter
  3195. @item nb_samples
  3196. number of samples in the current frame
  3197. @item pos
  3198. original frame position in the file
  3199. @item pts
  3200. frame PTS
  3201. @item sample_rate
  3202. sample rate
  3203. @item startpts
  3204. PTS at start of stream
  3205. @item startt
  3206. time at start of stream
  3207. @item t
  3208. frame time
  3209. @item tb
  3210. timestamp timebase
  3211. @item volume
  3212. last set volume value
  3213. @end table
  3214. Note that when @option{eval} is set to @samp{once} only the
  3215. @var{sample_rate} and @var{tb} variables are available, all other
  3216. variables will evaluate to NAN.
  3217. @subsection Commands
  3218. This filter supports the following commands:
  3219. @table @option
  3220. @item volume
  3221. Modify the volume expression.
  3222. The command accepts the same syntax of the corresponding option.
  3223. If the specified expression is not valid, it is kept at its current
  3224. value.
  3225. @item replaygain_noclip
  3226. Prevent clipping by limiting the gain applied.
  3227. Default value for @var{replaygain_noclip} is 1.
  3228. @end table
  3229. @subsection Examples
  3230. @itemize
  3231. @item
  3232. Halve the input audio volume:
  3233. @example
  3234. volume=volume=0.5
  3235. volume=volume=1/2
  3236. volume=volume=-6.0206dB
  3237. @end example
  3238. In all the above example the named key for @option{volume} can be
  3239. omitted, for example like in:
  3240. @example
  3241. volume=0.5
  3242. @end example
  3243. @item
  3244. Increase input audio power by 6 decibels using fixed-point precision:
  3245. @example
  3246. volume=volume=6dB:precision=fixed
  3247. @end example
  3248. @item
  3249. Fade volume after time 10 with an annihilation period of 5 seconds:
  3250. @example
  3251. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3252. @end example
  3253. @end itemize
  3254. @section volumedetect
  3255. Detect the volume of the input video.
  3256. The filter has no parameters. The input is not modified. Statistics about
  3257. the volume will be printed in the log when the input stream end is reached.
  3258. In particular it will show the mean volume (root mean square), maximum
  3259. volume (on a per-sample basis), and the beginning of a histogram of the
  3260. registered volume values (from the maximum value to a cumulated 1/1000 of
  3261. the samples).
  3262. All volumes are in decibels relative to the maximum PCM value.
  3263. @subsection Examples
  3264. Here is an excerpt of the output:
  3265. @example
  3266. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3267. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3268. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3269. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3270. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3271. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3272. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3273. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3274. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3275. @end example
  3276. It means that:
  3277. @itemize
  3278. @item
  3279. The mean square energy is approximately -27 dB, or 10^-2.7.
  3280. @item
  3281. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3282. @item
  3283. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3284. @end itemize
  3285. In other words, raising the volume by +4 dB does not cause any clipping,
  3286. raising it by +5 dB causes clipping for 6 samples, etc.
  3287. @c man end AUDIO FILTERS
  3288. @chapter Audio Sources
  3289. @c man begin AUDIO SOURCES
  3290. Below is a description of the currently available audio sources.
  3291. @section abuffer
  3292. Buffer audio frames, and make them available to the filter chain.
  3293. This source is mainly intended for a programmatic use, in particular
  3294. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3295. It accepts the following parameters:
  3296. @table @option
  3297. @item time_base
  3298. The timebase which will be used for timestamps of submitted frames. It must be
  3299. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3300. @item sample_rate
  3301. The sample rate of the incoming audio buffers.
  3302. @item sample_fmt
  3303. The sample format of the incoming audio buffers.
  3304. Either a sample format name or its corresponding integer representation from
  3305. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3306. @item channel_layout
  3307. The channel layout of the incoming audio buffers.
  3308. Either a channel layout name from channel_layout_map in
  3309. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3310. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3311. @item channels
  3312. The number of channels of the incoming audio buffers.
  3313. If both @var{channels} and @var{channel_layout} are specified, then they
  3314. must be consistent.
  3315. @end table
  3316. @subsection Examples
  3317. @example
  3318. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3319. @end example
  3320. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3321. Since the sample format with name "s16p" corresponds to the number
  3322. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3323. equivalent to:
  3324. @example
  3325. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3326. @end example
  3327. @section aevalsrc
  3328. Generate an audio signal specified by an expression.
  3329. This source accepts in input one or more expressions (one for each
  3330. channel), which are evaluated and used to generate a corresponding
  3331. audio signal.
  3332. This source accepts the following options:
  3333. @table @option
  3334. @item exprs
  3335. Set the '|'-separated expressions list for each separate channel. In case the
  3336. @option{channel_layout} option is not specified, the selected channel layout
  3337. depends on the number of provided expressions. Otherwise the last
  3338. specified expression is applied to the remaining output channels.
  3339. @item channel_layout, c
  3340. Set the channel layout. The number of channels in the specified layout
  3341. must be equal to the number of specified expressions.
  3342. @item duration, d
  3343. Set the minimum duration of the sourced audio. See
  3344. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3345. for the accepted syntax.
  3346. Note that the resulting duration may be greater than the specified
  3347. duration, as the generated audio is always cut at the end of a
  3348. complete frame.
  3349. If not specified, or the expressed duration is negative, the audio is
  3350. supposed to be generated forever.
  3351. @item nb_samples, n
  3352. Set the number of samples per channel per each output frame,
  3353. default to 1024.
  3354. @item sample_rate, s
  3355. Specify the sample rate, default to 44100.
  3356. @end table
  3357. Each expression in @var{exprs} can contain the following constants:
  3358. @table @option
  3359. @item n
  3360. number of the evaluated sample, starting from 0
  3361. @item t
  3362. time of the evaluated sample expressed in seconds, starting from 0
  3363. @item s
  3364. sample rate
  3365. @end table
  3366. @subsection Examples
  3367. @itemize
  3368. @item
  3369. Generate silence:
  3370. @example
  3371. aevalsrc=0
  3372. @end example
  3373. @item
  3374. Generate a sin signal with frequency of 440 Hz, set sample rate to
  3375. 8000 Hz:
  3376. @example
  3377. aevalsrc="sin(440*2*PI*t):s=8000"
  3378. @end example
  3379. @item
  3380. Generate a two channels signal, specify the channel layout (Front
  3381. Center + Back Center) explicitly:
  3382. @example
  3383. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  3384. @end example
  3385. @item
  3386. Generate white noise:
  3387. @example
  3388. aevalsrc="-2+random(0)"
  3389. @end example
  3390. @item
  3391. Generate an amplitude modulated signal:
  3392. @example
  3393. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  3394. @end example
  3395. @item
  3396. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  3397. @example
  3398. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  3399. @end example
  3400. @end itemize
  3401. @section anullsrc
  3402. The null audio source, return unprocessed audio frames. It is mainly useful
  3403. as a template and to be employed in analysis / debugging tools, or as
  3404. the source for filters which ignore the input data (for example the sox
  3405. synth filter).
  3406. This source accepts the following options:
  3407. @table @option
  3408. @item channel_layout, cl
  3409. Specifies the channel layout, and can be either an integer or a string
  3410. representing a channel layout. The default value of @var{channel_layout}
  3411. is "stereo".
  3412. Check the channel_layout_map definition in
  3413. @file{libavutil/channel_layout.c} for the mapping between strings and
  3414. channel layout values.
  3415. @item sample_rate, r
  3416. Specifies the sample rate, and defaults to 44100.
  3417. @item nb_samples, n
  3418. Set the number of samples per requested frames.
  3419. @end table
  3420. @subsection Examples
  3421. @itemize
  3422. @item
  3423. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3424. @example
  3425. anullsrc=r=48000:cl=4
  3426. @end example
  3427. @item
  3428. Do the same operation with a more obvious syntax:
  3429. @example
  3430. anullsrc=r=48000:cl=mono
  3431. @end example
  3432. @end itemize
  3433. All the parameters need to be explicitly defined.
  3434. @section flite
  3435. Synthesize a voice utterance using the libflite library.
  3436. To enable compilation of this filter you need to configure FFmpeg with
  3437. @code{--enable-libflite}.
  3438. Note that the flite library is not thread-safe.
  3439. The filter accepts the following options:
  3440. @table @option
  3441. @item list_voices
  3442. If set to 1, list the names of the available voices and exit
  3443. immediately. Default value is 0.
  3444. @item nb_samples, n
  3445. Set the maximum number of samples per frame. Default value is 512.
  3446. @item textfile
  3447. Set the filename containing the text to speak.
  3448. @item text
  3449. Set the text to speak.
  3450. @item voice, v
  3451. Set the voice to use for the speech synthesis. Default value is
  3452. @code{kal}. See also the @var{list_voices} option.
  3453. @end table
  3454. @subsection Examples
  3455. @itemize
  3456. @item
  3457. Read from file @file{speech.txt}, and synthesize the text using the
  3458. standard flite voice:
  3459. @example
  3460. flite=textfile=speech.txt
  3461. @end example
  3462. @item
  3463. Read the specified text selecting the @code{slt} voice:
  3464. @example
  3465. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3466. @end example
  3467. @item
  3468. Input text to ffmpeg:
  3469. @example
  3470. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3471. @end example
  3472. @item
  3473. Make @file{ffplay} speak the specified text, using @code{flite} and
  3474. the @code{lavfi} device:
  3475. @example
  3476. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3477. @end example
  3478. @end itemize
  3479. For more information about libflite, check:
  3480. @url{http://www.speech.cs.cmu.edu/flite/}
  3481. @section anoisesrc
  3482. Generate a noise audio signal.
  3483. The filter accepts the following options:
  3484. @table @option
  3485. @item sample_rate, r
  3486. Specify the sample rate. Default value is 48000 Hz.
  3487. @item amplitude, a
  3488. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  3489. is 1.0.
  3490. @item duration, d
  3491. Specify the duration of the generated audio stream. Not specifying this option
  3492. results in noise with an infinite length.
  3493. @item color, colour, c
  3494. Specify the color of noise. Available noise colors are white, pink, brown,
  3495. blue and violet. Default color is white.
  3496. @item seed, s
  3497. Specify a value used to seed the PRNG.
  3498. @item nb_samples, n
  3499. Set the number of samples per each output frame, default is 1024.
  3500. @end table
  3501. @subsection Examples
  3502. @itemize
  3503. @item
  3504. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  3505. @example
  3506. anoisesrc=d=60:c=pink:r=44100:a=0.5
  3507. @end example
  3508. @end itemize
  3509. @section sine
  3510. Generate an audio signal made of a sine wave with amplitude 1/8.
  3511. The audio signal is bit-exact.
  3512. The filter accepts the following options:
  3513. @table @option
  3514. @item frequency, f
  3515. Set the carrier frequency. Default is 440 Hz.
  3516. @item beep_factor, b
  3517. Enable a periodic beep every second with frequency @var{beep_factor} times
  3518. the carrier frequency. Default is 0, meaning the beep is disabled.
  3519. @item sample_rate, r
  3520. Specify the sample rate, default is 44100.
  3521. @item duration, d
  3522. Specify the duration of the generated audio stream.
  3523. @item samples_per_frame
  3524. Set the number of samples per output frame.
  3525. The expression can contain the following constants:
  3526. @table @option
  3527. @item n
  3528. The (sequential) number of the output audio frame, starting from 0.
  3529. @item pts
  3530. The PTS (Presentation TimeStamp) of the output audio frame,
  3531. expressed in @var{TB} units.
  3532. @item t
  3533. The PTS of the output audio frame, expressed in seconds.
  3534. @item TB
  3535. The timebase of the output audio frames.
  3536. @end table
  3537. Default is @code{1024}.
  3538. @end table
  3539. @subsection Examples
  3540. @itemize
  3541. @item
  3542. Generate a simple 440 Hz sine wave:
  3543. @example
  3544. sine
  3545. @end example
  3546. @item
  3547. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  3548. @example
  3549. sine=220:4:d=5
  3550. sine=f=220:b=4:d=5
  3551. sine=frequency=220:beep_factor=4:duration=5
  3552. @end example
  3553. @item
  3554. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  3555. pattern:
  3556. @example
  3557. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  3558. @end example
  3559. @end itemize
  3560. @c man end AUDIO SOURCES
  3561. @chapter Audio Sinks
  3562. @c man begin AUDIO SINKS
  3563. Below is a description of the currently available audio sinks.
  3564. @section abuffersink
  3565. Buffer audio frames, and make them available to the end of filter chain.
  3566. This sink is mainly intended for programmatic use, in particular
  3567. through the interface defined in @file{libavfilter/buffersink.h}
  3568. or the options system.
  3569. It accepts a pointer to an AVABufferSinkContext structure, which
  3570. defines the incoming buffers' formats, to be passed as the opaque
  3571. parameter to @code{avfilter_init_filter} for initialization.
  3572. @section anullsink
  3573. Null audio sink; do absolutely nothing with the input audio. It is
  3574. mainly useful as a template and for use in analysis / debugging
  3575. tools.
  3576. @c man end AUDIO SINKS
  3577. @chapter Video Filters
  3578. @c man begin VIDEO FILTERS
  3579. When you configure your FFmpeg build, you can disable any of the
  3580. existing filters using @code{--disable-filters}.
  3581. The configure output will show the video filters included in your
  3582. build.
  3583. Below is a description of the currently available video filters.
  3584. @section alphaextract
  3585. Extract the alpha component from the input as a grayscale video. This
  3586. is especially useful with the @var{alphamerge} filter.
  3587. @section alphamerge
  3588. Add or replace the alpha component of the primary input with the
  3589. grayscale value of a second input. This is intended for use with
  3590. @var{alphaextract} to allow the transmission or storage of frame
  3591. sequences that have alpha in a format that doesn't support an alpha
  3592. channel.
  3593. For example, to reconstruct full frames from a normal YUV-encoded video
  3594. and a separate video created with @var{alphaextract}, you might use:
  3595. @example
  3596. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  3597. @end example
  3598. Since this filter is designed for reconstruction, it operates on frame
  3599. sequences without considering timestamps, and terminates when either
  3600. input reaches end of stream. This will cause problems if your encoding
  3601. pipeline drops frames. If you're trying to apply an image as an
  3602. overlay to a video stream, consider the @var{overlay} filter instead.
  3603. @section ass
  3604. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  3605. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  3606. Substation Alpha) subtitles files.
  3607. This filter accepts the following option in addition to the common options from
  3608. the @ref{subtitles} filter:
  3609. @table @option
  3610. @item shaping
  3611. Set the shaping engine
  3612. Available values are:
  3613. @table @samp
  3614. @item auto
  3615. The default libass shaping engine, which is the best available.
  3616. @item simple
  3617. Fast, font-agnostic shaper that can do only substitutions
  3618. @item complex
  3619. Slower shaper using OpenType for substitutions and positioning
  3620. @end table
  3621. The default is @code{auto}.
  3622. @end table
  3623. @section atadenoise
  3624. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  3625. The filter accepts the following options:
  3626. @table @option
  3627. @item 0a
  3628. Set threshold A for 1st plane. Default is 0.02.
  3629. Valid range is 0 to 0.3.
  3630. @item 0b
  3631. Set threshold B for 1st plane. Default is 0.04.
  3632. Valid range is 0 to 5.
  3633. @item 1a
  3634. Set threshold A for 2nd plane. Default is 0.02.
  3635. Valid range is 0 to 0.3.
  3636. @item 1b
  3637. Set threshold B for 2nd plane. Default is 0.04.
  3638. Valid range is 0 to 5.
  3639. @item 2a
  3640. Set threshold A for 3rd plane. Default is 0.02.
  3641. Valid range is 0 to 0.3.
  3642. @item 2b
  3643. Set threshold B for 3rd plane. Default is 0.04.
  3644. Valid range is 0 to 5.
  3645. Threshold A is designed to react on abrupt changes in the input signal and
  3646. threshold B is designed to react on continuous changes in the input signal.
  3647. @item s
  3648. Set number of frames filter will use for averaging. Default is 33. Must be odd
  3649. number in range [5, 129].
  3650. @item p
  3651. Set what planes of frame filter will use for averaging. Default is all.
  3652. @end table
  3653. @section avgblur
  3654. Apply average blur filter.
  3655. The filter accepts the following options:
  3656. @table @option
  3657. @item sizeX
  3658. Set horizontal kernel size.
  3659. @item planes
  3660. Set which planes to filter. By default all planes are filtered.
  3661. @item sizeY
  3662. Set vertical kernel size, if zero it will be same as @code{sizeX}.
  3663. Default is @code{0}.
  3664. @end table
  3665. @section bbox
  3666. Compute the bounding box for the non-black pixels in the input frame
  3667. luminance plane.
  3668. This filter computes the bounding box containing all the pixels with a
  3669. luminance value greater than the minimum allowed value.
  3670. The parameters describing the bounding box are printed on the filter
  3671. log.
  3672. The filter accepts the following option:
  3673. @table @option
  3674. @item min_val
  3675. Set the minimal luminance value. Default is @code{16}.
  3676. @end table
  3677. @section bitplanenoise
  3678. Show and measure bit plane noise.
  3679. The filter accepts the following options:
  3680. @table @option
  3681. @item bitplane
  3682. Set which plane to analyze. Default is @code{1}.
  3683. @item filter
  3684. Filter out noisy pixels from @code{bitplane} set above.
  3685. Default is disabled.
  3686. @end table
  3687. @section blackdetect
  3688. Detect video intervals that are (almost) completely black. Can be
  3689. useful to detect chapter transitions, commercials, or invalid
  3690. recordings. Output lines contains the time for the start, end and
  3691. duration of the detected black interval expressed in seconds.
  3692. In order to display the output lines, you need to set the loglevel at
  3693. least to the AV_LOG_INFO value.
  3694. The filter accepts the following options:
  3695. @table @option
  3696. @item black_min_duration, d
  3697. Set the minimum detected black duration expressed in seconds. It must
  3698. be a non-negative floating point number.
  3699. Default value is 2.0.
  3700. @item picture_black_ratio_th, pic_th
  3701. Set the threshold for considering a picture "black".
  3702. Express the minimum value for the ratio:
  3703. @example
  3704. @var{nb_black_pixels} / @var{nb_pixels}
  3705. @end example
  3706. for which a picture is considered black.
  3707. Default value is 0.98.
  3708. @item pixel_black_th, pix_th
  3709. Set the threshold for considering a pixel "black".
  3710. The threshold expresses the maximum pixel luminance value for which a
  3711. pixel is considered "black". The provided value is scaled according to
  3712. the following equation:
  3713. @example
  3714. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  3715. @end example
  3716. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  3717. the input video format, the range is [0-255] for YUV full-range
  3718. formats and [16-235] for YUV non full-range formats.
  3719. Default value is 0.10.
  3720. @end table
  3721. The following example sets the maximum pixel threshold to the minimum
  3722. value, and detects only black intervals of 2 or more seconds:
  3723. @example
  3724. blackdetect=d=2:pix_th=0.00
  3725. @end example
  3726. @section blackframe
  3727. Detect frames that are (almost) completely black. Can be useful to
  3728. detect chapter transitions or commercials. Output lines consist of
  3729. the frame number of the detected frame, the percentage of blackness,
  3730. the position in the file if known or -1 and the timestamp in seconds.
  3731. In order to display the output lines, you need to set the loglevel at
  3732. least to the AV_LOG_INFO value.
  3733. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  3734. The value represents the percentage of pixels in the picture that
  3735. are below the threshold value.
  3736. It accepts the following parameters:
  3737. @table @option
  3738. @item amount
  3739. The percentage of the pixels that have to be below the threshold; it defaults to
  3740. @code{98}.
  3741. @item threshold, thresh
  3742. The threshold below which a pixel value is considered black; it defaults to
  3743. @code{32}.
  3744. @end table
  3745. @section blend, tblend
  3746. Blend two video frames into each other.
  3747. The @code{blend} filter takes two input streams and outputs one
  3748. stream, the first input is the "top" layer and second input is
  3749. "bottom" layer. By default, the output terminates when the longest input terminates.
  3750. The @code{tblend} (time blend) filter takes two consecutive frames
  3751. from one single stream, and outputs the result obtained by blending
  3752. the new frame on top of the old frame.
  3753. A description of the accepted options follows.
  3754. @table @option
  3755. @item c0_mode
  3756. @item c1_mode
  3757. @item c2_mode
  3758. @item c3_mode
  3759. @item all_mode
  3760. Set blend mode for specific pixel component or all pixel components in case
  3761. of @var{all_mode}. Default value is @code{normal}.
  3762. Available values for component modes are:
  3763. @table @samp
  3764. @item addition
  3765. @item addition128
  3766. @item and
  3767. @item average
  3768. @item burn
  3769. @item darken
  3770. @item difference
  3771. @item difference128
  3772. @item divide
  3773. @item dodge
  3774. @item freeze
  3775. @item exclusion
  3776. @item extremity
  3777. @item glow
  3778. @item hardlight
  3779. @item hardmix
  3780. @item heat
  3781. @item lighten
  3782. @item linearlight
  3783. @item multiply
  3784. @item multiply128
  3785. @item negation
  3786. @item normal
  3787. @item or
  3788. @item overlay
  3789. @item phoenix
  3790. @item pinlight
  3791. @item reflect
  3792. @item screen
  3793. @item softlight
  3794. @item subtract
  3795. @item vividlight
  3796. @item xor
  3797. @end table
  3798. @item c0_opacity
  3799. @item c1_opacity
  3800. @item c2_opacity
  3801. @item c3_opacity
  3802. @item all_opacity
  3803. Set blend opacity for specific pixel component or all pixel components in case
  3804. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  3805. @item c0_expr
  3806. @item c1_expr
  3807. @item c2_expr
  3808. @item c3_expr
  3809. @item all_expr
  3810. Set blend expression for specific pixel component or all pixel components in case
  3811. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  3812. The expressions can use the following variables:
  3813. @table @option
  3814. @item N
  3815. The sequential number of the filtered frame, starting from @code{0}.
  3816. @item X
  3817. @item Y
  3818. the coordinates of the current sample
  3819. @item W
  3820. @item H
  3821. the width and height of currently filtered plane
  3822. @item SW
  3823. @item SH
  3824. Width and height scale depending on the currently filtered plane. It is the
  3825. ratio between the corresponding luma plane number of pixels and the current
  3826. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  3827. @code{0.5,0.5} for chroma planes.
  3828. @item T
  3829. Time of the current frame, expressed in seconds.
  3830. @item TOP, A
  3831. Value of pixel component at current location for first video frame (top layer).
  3832. @item BOTTOM, B
  3833. Value of pixel component at current location for second video frame (bottom layer).
  3834. @end table
  3835. @item shortest
  3836. Force termination when the shortest input terminates. Default is
  3837. @code{0}. This option is only defined for the @code{blend} filter.
  3838. @item repeatlast
  3839. Continue applying the last bottom frame after the end of the stream. A value of
  3840. @code{0} disable the filter after the last frame of the bottom layer is reached.
  3841. Default is @code{1}. This option is only defined for the @code{blend} filter.
  3842. @end table
  3843. @subsection Examples
  3844. @itemize
  3845. @item
  3846. Apply transition from bottom layer to top layer in first 10 seconds:
  3847. @example
  3848. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  3849. @end example
  3850. @item
  3851. Apply 1x1 checkerboard effect:
  3852. @example
  3853. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  3854. @end example
  3855. @item
  3856. Apply uncover left effect:
  3857. @example
  3858. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  3859. @end example
  3860. @item
  3861. Apply uncover down effect:
  3862. @example
  3863. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  3864. @end example
  3865. @item
  3866. Apply uncover up-left effect:
  3867. @example
  3868. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  3869. @end example
  3870. @item
  3871. Split diagonally video and shows top and bottom layer on each side:
  3872. @example
  3873. blend=all_expr=if(gt(X,Y*(W/H)),A,B)
  3874. @end example
  3875. @item
  3876. Display differences between the current and the previous frame:
  3877. @example
  3878. tblend=all_mode=difference128
  3879. @end example
  3880. @end itemize
  3881. @section boxblur
  3882. Apply a boxblur algorithm to the input video.
  3883. It accepts the following parameters:
  3884. @table @option
  3885. @item luma_radius, lr
  3886. @item luma_power, lp
  3887. @item chroma_radius, cr
  3888. @item chroma_power, cp
  3889. @item alpha_radius, ar
  3890. @item alpha_power, ap
  3891. @end table
  3892. A description of the accepted options follows.
  3893. @table @option
  3894. @item luma_radius, lr
  3895. @item chroma_radius, cr
  3896. @item alpha_radius, ar
  3897. Set an expression for the box radius in pixels used for blurring the
  3898. corresponding input plane.
  3899. The radius value must be a non-negative number, and must not be
  3900. greater than the value of the expression @code{min(w,h)/2} for the
  3901. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  3902. planes.
  3903. Default value for @option{luma_radius} is "2". If not specified,
  3904. @option{chroma_radius} and @option{alpha_radius} default to the
  3905. corresponding value set for @option{luma_radius}.
  3906. The expressions can contain the following constants:
  3907. @table @option
  3908. @item w
  3909. @item h
  3910. The input width and height in pixels.
  3911. @item cw
  3912. @item ch
  3913. The input chroma image width and height in pixels.
  3914. @item hsub
  3915. @item vsub
  3916. The horizontal and vertical chroma subsample values. For example, for the
  3917. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  3918. @end table
  3919. @item luma_power, lp
  3920. @item chroma_power, cp
  3921. @item alpha_power, ap
  3922. Specify how many times the boxblur filter is applied to the
  3923. corresponding plane.
  3924. Default value for @option{luma_power} is 2. If not specified,
  3925. @option{chroma_power} and @option{alpha_power} default to the
  3926. corresponding value set for @option{luma_power}.
  3927. A value of 0 will disable the effect.
  3928. @end table
  3929. @subsection Examples
  3930. @itemize
  3931. @item
  3932. Apply a boxblur filter with the luma, chroma, and alpha radii
  3933. set to 2:
  3934. @example
  3935. boxblur=luma_radius=2:luma_power=1
  3936. boxblur=2:1
  3937. @end example
  3938. @item
  3939. Set the luma radius to 2, and alpha and chroma radius to 0:
  3940. @example
  3941. boxblur=2:1:cr=0:ar=0
  3942. @end example
  3943. @item
  3944. Set the luma and chroma radii to a fraction of the video dimension:
  3945. @example
  3946. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  3947. @end example
  3948. @end itemize
  3949. @section bwdif
  3950. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  3951. Deinterlacing Filter").
  3952. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  3953. interpolation algorithms.
  3954. It accepts the following parameters:
  3955. @table @option
  3956. @item mode
  3957. The interlacing mode to adopt. It accepts one of the following values:
  3958. @table @option
  3959. @item 0, send_frame
  3960. Output one frame for each frame.
  3961. @item 1, send_field
  3962. Output one frame for each field.
  3963. @end table
  3964. The default value is @code{send_field}.
  3965. @item parity
  3966. The picture field parity assumed for the input interlaced video. It accepts one
  3967. of the following values:
  3968. @table @option
  3969. @item 0, tff
  3970. Assume the top field is first.
  3971. @item 1, bff
  3972. Assume the bottom field is first.
  3973. @item -1, auto
  3974. Enable automatic detection of field parity.
  3975. @end table
  3976. The default value is @code{auto}.
  3977. If the interlacing is unknown or the decoder does not export this information,
  3978. top field first will be assumed.
  3979. @item deint
  3980. Specify which frames to deinterlace. Accept one of the following
  3981. values:
  3982. @table @option
  3983. @item 0, all
  3984. Deinterlace all frames.
  3985. @item 1, interlaced
  3986. Only deinterlace frames marked as interlaced.
  3987. @end table
  3988. The default value is @code{all}.
  3989. @end table
  3990. @section chromakey
  3991. YUV colorspace color/chroma keying.
  3992. The filter accepts the following options:
  3993. @table @option
  3994. @item color
  3995. The color which will be replaced with transparency.
  3996. @item similarity
  3997. Similarity percentage with the key color.
  3998. 0.01 matches only the exact key color, while 1.0 matches everything.
  3999. @item blend
  4000. Blend percentage.
  4001. 0.0 makes pixels either fully transparent, or not transparent at all.
  4002. Higher values result in semi-transparent pixels, with a higher transparency
  4003. the more similar the pixels color is to the key color.
  4004. @item yuv
  4005. Signals that the color passed is already in YUV instead of RGB.
  4006. Litteral colors like "green" or "red" don't make sense with this enabled anymore.
  4007. This can be used to pass exact YUV values as hexadecimal numbers.
  4008. @end table
  4009. @subsection Examples
  4010. @itemize
  4011. @item
  4012. Make every green pixel in the input image transparent:
  4013. @example
  4014. ffmpeg -i input.png -vf chromakey=green out.png
  4015. @end example
  4016. @item
  4017. Overlay a greenscreen-video on top of a static black background.
  4018. @example
  4019. 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
  4020. @end example
  4021. @end itemize
  4022. @section ciescope
  4023. Display CIE color diagram with pixels overlaid onto it.
  4024. The filter accepts the following options:
  4025. @table @option
  4026. @item system
  4027. Set color system.
  4028. @table @samp
  4029. @item ntsc, 470m
  4030. @item ebu, 470bg
  4031. @item smpte
  4032. @item 240m
  4033. @item apple
  4034. @item widergb
  4035. @item cie1931
  4036. @item rec709, hdtv
  4037. @item uhdtv, rec2020
  4038. @end table
  4039. @item cie
  4040. Set CIE system.
  4041. @table @samp
  4042. @item xyy
  4043. @item ucs
  4044. @item luv
  4045. @end table
  4046. @item gamuts
  4047. Set what gamuts to draw.
  4048. See @code{system} option for available values.
  4049. @item size, s
  4050. Set ciescope size, by default set to 512.
  4051. @item intensity, i
  4052. Set intensity used to map input pixel values to CIE diagram.
  4053. @item contrast
  4054. Set contrast used to draw tongue colors that are out of active color system gamut.
  4055. @item corrgamma
  4056. Correct gamma displayed on scope, by default enabled.
  4057. @item showwhite
  4058. Show white point on CIE diagram, by default disabled.
  4059. @item gamma
  4060. Set input gamma. Used only with XYZ input color space.
  4061. @end table
  4062. @section codecview
  4063. Visualize information exported by some codecs.
  4064. Some codecs can export information through frames using side-data or other
  4065. means. For example, some MPEG based codecs export motion vectors through the
  4066. @var{export_mvs} flag in the codec @option{flags2} option.
  4067. The filter accepts the following option:
  4068. @table @option
  4069. @item mv
  4070. Set motion vectors to visualize.
  4071. Available flags for @var{mv} are:
  4072. @table @samp
  4073. @item pf
  4074. forward predicted MVs of P-frames
  4075. @item bf
  4076. forward predicted MVs of B-frames
  4077. @item bb
  4078. backward predicted MVs of B-frames
  4079. @end table
  4080. @item qp
  4081. Display quantization parameters using the chroma planes.
  4082. @item mv_type, mvt
  4083. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  4084. Available flags for @var{mv_type} are:
  4085. @table @samp
  4086. @item fp
  4087. forward predicted MVs
  4088. @item bp
  4089. backward predicted MVs
  4090. @end table
  4091. @item frame_type, ft
  4092. Set frame type to visualize motion vectors of.
  4093. Available flags for @var{frame_type} are:
  4094. @table @samp
  4095. @item if
  4096. intra-coded frames (I-frames)
  4097. @item pf
  4098. predicted frames (P-frames)
  4099. @item bf
  4100. bi-directionally predicted frames (B-frames)
  4101. @end table
  4102. @end table
  4103. @subsection Examples
  4104. @itemize
  4105. @item
  4106. Visualize forward predicted MVs of all frames using @command{ffplay}:
  4107. @example
  4108. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  4109. @end example
  4110. @item
  4111. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  4112. @example
  4113. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  4114. @end example
  4115. @end itemize
  4116. @section colorbalance
  4117. Modify intensity of primary colors (red, green and blue) of input frames.
  4118. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  4119. regions for the red-cyan, green-magenta or blue-yellow balance.
  4120. A positive adjustment value shifts the balance towards the primary color, a negative
  4121. value towards the complementary color.
  4122. The filter accepts the following options:
  4123. @table @option
  4124. @item rs
  4125. @item gs
  4126. @item bs
  4127. Adjust red, green and blue shadows (darkest pixels).
  4128. @item rm
  4129. @item gm
  4130. @item bm
  4131. Adjust red, green and blue midtones (medium pixels).
  4132. @item rh
  4133. @item gh
  4134. @item bh
  4135. Adjust red, green and blue highlights (brightest pixels).
  4136. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4137. @end table
  4138. @subsection Examples
  4139. @itemize
  4140. @item
  4141. Add red color cast to shadows:
  4142. @example
  4143. colorbalance=rs=.3
  4144. @end example
  4145. @end itemize
  4146. @section colorkey
  4147. RGB colorspace color keying.
  4148. The filter accepts the following options:
  4149. @table @option
  4150. @item color
  4151. The color which will be replaced with transparency.
  4152. @item similarity
  4153. Similarity percentage with the key color.
  4154. 0.01 matches only the exact key color, while 1.0 matches everything.
  4155. @item blend
  4156. Blend percentage.
  4157. 0.0 makes pixels either fully transparent, or not transparent at all.
  4158. Higher values result in semi-transparent pixels, with a higher transparency
  4159. the more similar the pixels color is to the key color.
  4160. @end table
  4161. @subsection Examples
  4162. @itemize
  4163. @item
  4164. Make every green pixel in the input image transparent:
  4165. @example
  4166. ffmpeg -i input.png -vf colorkey=green out.png
  4167. @end example
  4168. @item
  4169. Overlay a greenscreen-video on top of a static background image.
  4170. @example
  4171. 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
  4172. @end example
  4173. @end itemize
  4174. @section colorlevels
  4175. Adjust video input frames using levels.
  4176. The filter accepts the following options:
  4177. @table @option
  4178. @item rimin
  4179. @item gimin
  4180. @item bimin
  4181. @item aimin
  4182. Adjust red, green, blue and alpha input black point.
  4183. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4184. @item rimax
  4185. @item gimax
  4186. @item bimax
  4187. @item aimax
  4188. Adjust red, green, blue and alpha input white point.
  4189. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  4190. Input levels are used to lighten highlights (bright tones), darken shadows
  4191. (dark tones), change the balance of bright and dark tones.
  4192. @item romin
  4193. @item gomin
  4194. @item bomin
  4195. @item aomin
  4196. Adjust red, green, blue and alpha output black point.
  4197. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  4198. @item romax
  4199. @item gomax
  4200. @item bomax
  4201. @item aomax
  4202. Adjust red, green, blue and alpha output white point.
  4203. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  4204. Output levels allows manual selection of a constrained output level range.
  4205. @end table
  4206. @subsection Examples
  4207. @itemize
  4208. @item
  4209. Make video output darker:
  4210. @example
  4211. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  4212. @end example
  4213. @item
  4214. Increase contrast:
  4215. @example
  4216. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  4217. @end example
  4218. @item
  4219. Make video output lighter:
  4220. @example
  4221. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  4222. @end example
  4223. @item
  4224. Increase brightness:
  4225. @example
  4226. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  4227. @end example
  4228. @end itemize
  4229. @section colorchannelmixer
  4230. Adjust video input frames by re-mixing color channels.
  4231. This filter modifies a color channel by adding the values associated to
  4232. the other channels of the same pixels. For example if the value to
  4233. modify is red, the output value will be:
  4234. @example
  4235. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  4236. @end example
  4237. The filter accepts the following options:
  4238. @table @option
  4239. @item rr
  4240. @item rg
  4241. @item rb
  4242. @item ra
  4243. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  4244. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  4245. @item gr
  4246. @item gg
  4247. @item gb
  4248. @item ga
  4249. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  4250. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  4251. @item br
  4252. @item bg
  4253. @item bb
  4254. @item ba
  4255. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  4256. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  4257. @item ar
  4258. @item ag
  4259. @item ab
  4260. @item aa
  4261. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  4262. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  4263. Allowed ranges for options are @code{[-2.0, 2.0]}.
  4264. @end table
  4265. @subsection Examples
  4266. @itemize
  4267. @item
  4268. Convert source to grayscale:
  4269. @example
  4270. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  4271. @end example
  4272. @item
  4273. Simulate sepia tones:
  4274. @example
  4275. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  4276. @end example
  4277. @end itemize
  4278. @section colormatrix
  4279. Convert color matrix.
  4280. The filter accepts the following options:
  4281. @table @option
  4282. @item src
  4283. @item dst
  4284. Specify the source and destination color matrix. Both values must be
  4285. specified.
  4286. The accepted values are:
  4287. @table @samp
  4288. @item bt709
  4289. BT.709
  4290. @item fcc
  4291. FCC
  4292. @item bt601
  4293. BT.601
  4294. @item bt470
  4295. BT.470
  4296. @item bt470bg
  4297. BT.470BG
  4298. @item smpte170m
  4299. SMPTE-170M
  4300. @item smpte240m
  4301. SMPTE-240M
  4302. @item bt2020
  4303. BT.2020
  4304. @end table
  4305. @end table
  4306. For example to convert from BT.601 to SMPTE-240M, use the command:
  4307. @example
  4308. colormatrix=bt601:smpte240m
  4309. @end example
  4310. @section colorspace
  4311. Convert colorspace, transfer characteristics or color primaries.
  4312. Input video needs to have an even size.
  4313. The filter accepts the following options:
  4314. @table @option
  4315. @anchor{all}
  4316. @item all
  4317. Specify all color properties at once.
  4318. The accepted values are:
  4319. @table @samp
  4320. @item bt470m
  4321. BT.470M
  4322. @item bt470bg
  4323. BT.470BG
  4324. @item bt601-6-525
  4325. BT.601-6 525
  4326. @item bt601-6-625
  4327. BT.601-6 625
  4328. @item bt709
  4329. BT.709
  4330. @item smpte170m
  4331. SMPTE-170M
  4332. @item smpte240m
  4333. SMPTE-240M
  4334. @item bt2020
  4335. BT.2020
  4336. @end table
  4337. @anchor{space}
  4338. @item space
  4339. Specify output colorspace.
  4340. The accepted values are:
  4341. @table @samp
  4342. @item bt709
  4343. BT.709
  4344. @item fcc
  4345. FCC
  4346. @item bt470bg
  4347. BT.470BG or BT.601-6 625
  4348. @item smpte170m
  4349. SMPTE-170M or BT.601-6 525
  4350. @item smpte240m
  4351. SMPTE-240M
  4352. @item ycgco
  4353. YCgCo
  4354. @item bt2020ncl
  4355. BT.2020 with non-constant luminance
  4356. @end table
  4357. @anchor{trc}
  4358. @item trc
  4359. Specify output transfer characteristics.
  4360. The accepted values are:
  4361. @table @samp
  4362. @item bt709
  4363. BT.709
  4364. @item bt470m
  4365. BT.470M
  4366. @item bt470bg
  4367. BT.470BG
  4368. @item gamma22
  4369. Constant gamma of 2.2
  4370. @item gamma28
  4371. Constant gamma of 2.8
  4372. @item smpte170m
  4373. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  4374. @item smpte240m
  4375. SMPTE-240M
  4376. @item srgb
  4377. SRGB
  4378. @item iec61966-2-1
  4379. iec61966-2-1
  4380. @item iec61966-2-4
  4381. iec61966-2-4
  4382. @item xvycc
  4383. xvycc
  4384. @item bt2020-10
  4385. BT.2020 for 10-bits content
  4386. @item bt2020-12
  4387. BT.2020 for 12-bits content
  4388. @end table
  4389. @anchor{primaries}
  4390. @item primaries
  4391. Specify output color primaries.
  4392. The accepted values are:
  4393. @table @samp
  4394. @item bt709
  4395. BT.709
  4396. @item bt470m
  4397. BT.470M
  4398. @item bt470bg
  4399. BT.470BG or BT.601-6 625
  4400. @item smpte170m
  4401. SMPTE-170M or BT.601-6 525
  4402. @item smpte240m
  4403. SMPTE-240M
  4404. @item film
  4405. film
  4406. @item smpte431
  4407. SMPTE-431
  4408. @item smpte432
  4409. SMPTE-432
  4410. @item bt2020
  4411. BT.2020
  4412. @item jedec-p22
  4413. JEDEC P22 phosphors
  4414. @end table
  4415. @anchor{range}
  4416. @item range
  4417. Specify output color range.
  4418. The accepted values are:
  4419. @table @samp
  4420. @item tv
  4421. TV (restricted) range
  4422. @item mpeg
  4423. MPEG (restricted) range
  4424. @item pc
  4425. PC (full) range
  4426. @item jpeg
  4427. JPEG (full) range
  4428. @end table
  4429. @item format
  4430. Specify output color format.
  4431. The accepted values are:
  4432. @table @samp
  4433. @item yuv420p
  4434. YUV 4:2:0 planar 8-bits
  4435. @item yuv420p10
  4436. YUV 4:2:0 planar 10-bits
  4437. @item yuv420p12
  4438. YUV 4:2:0 planar 12-bits
  4439. @item yuv422p
  4440. YUV 4:2:2 planar 8-bits
  4441. @item yuv422p10
  4442. YUV 4:2:2 planar 10-bits
  4443. @item yuv422p12
  4444. YUV 4:2:2 planar 12-bits
  4445. @item yuv444p
  4446. YUV 4:4:4 planar 8-bits
  4447. @item yuv444p10
  4448. YUV 4:4:4 planar 10-bits
  4449. @item yuv444p12
  4450. YUV 4:4:4 planar 12-bits
  4451. @end table
  4452. @item fast
  4453. Do a fast conversion, which skips gamma/primary correction. This will take
  4454. significantly less CPU, but will be mathematically incorrect. To get output
  4455. compatible with that produced by the colormatrix filter, use fast=1.
  4456. @item dither
  4457. Specify dithering mode.
  4458. The accepted values are:
  4459. @table @samp
  4460. @item none
  4461. No dithering
  4462. @item fsb
  4463. Floyd-Steinberg dithering
  4464. @end table
  4465. @item wpadapt
  4466. Whitepoint adaptation mode.
  4467. The accepted values are:
  4468. @table @samp
  4469. @item bradford
  4470. Bradford whitepoint adaptation
  4471. @item vonkries
  4472. von Kries whitepoint adaptation
  4473. @item identity
  4474. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  4475. @end table
  4476. @item iall
  4477. Override all input properties at once. Same accepted values as @ref{all}.
  4478. @item ispace
  4479. Override input colorspace. Same accepted values as @ref{space}.
  4480. @item iprimaries
  4481. Override input color primaries. Same accepted values as @ref{primaries}.
  4482. @item itrc
  4483. Override input transfer characteristics. Same accepted values as @ref{trc}.
  4484. @item irange
  4485. Override input color range. Same accepted values as @ref{range}.
  4486. @end table
  4487. The filter converts the transfer characteristics, color space and color
  4488. primaries to the specified user values. The output value, if not specified,
  4489. is set to a default value based on the "all" property. If that property is
  4490. also not specified, the filter will log an error. The output color range and
  4491. format default to the same value as the input color range and format. The
  4492. input transfer characteristics, color space, color primaries and color range
  4493. should be set on the input data. If any of these are missing, the filter will
  4494. log an error and no conversion will take place.
  4495. For example to convert the input to SMPTE-240M, use the command:
  4496. @example
  4497. colorspace=smpte240m
  4498. @end example
  4499. @section convolution
  4500. Apply convolution 3x3 or 5x5 filter.
  4501. The filter accepts the following options:
  4502. @table @option
  4503. @item 0m
  4504. @item 1m
  4505. @item 2m
  4506. @item 3m
  4507. Set matrix for each plane.
  4508. Matrix is sequence of 9 or 25 signed integers.
  4509. @item 0rdiv
  4510. @item 1rdiv
  4511. @item 2rdiv
  4512. @item 3rdiv
  4513. Set multiplier for calculated value for each plane.
  4514. @item 0bias
  4515. @item 1bias
  4516. @item 2bias
  4517. @item 3bias
  4518. Set bias for each plane. This value is added to the result of the multiplication.
  4519. Useful for making the overall image brighter or darker. Default is 0.0.
  4520. @end table
  4521. @subsection Examples
  4522. @itemize
  4523. @item
  4524. Apply sharpen:
  4525. @example
  4526. 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"
  4527. @end example
  4528. @item
  4529. Apply blur:
  4530. @example
  4531. 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"
  4532. @end example
  4533. @item
  4534. Apply edge enhance:
  4535. @example
  4536. 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"
  4537. @end example
  4538. @item
  4539. Apply edge detect:
  4540. @example
  4541. 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"
  4542. @end example
  4543. @item
  4544. Apply emboss:
  4545. @example
  4546. 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"
  4547. @end example
  4548. @end itemize
  4549. @section copy
  4550. Copy the input video source unchanged to the output. This is mainly useful for
  4551. testing purposes.
  4552. @anchor{coreimage}
  4553. @section coreimage
  4554. Video filtering on GPU using Apple's CoreImage API on OSX.
  4555. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  4556. processed by video hardware. However, software-based OpenGL implementations
  4557. exist which means there is no guarantee for hardware processing. It depends on
  4558. the respective OSX.
  4559. There are many filters and image generators provided by Apple that come with a
  4560. large variety of options. The filter has to be referenced by its name along
  4561. with its options.
  4562. The coreimage filter accepts the following options:
  4563. @table @option
  4564. @item list_filters
  4565. List all available filters and generators along with all their respective
  4566. options as well as possible minimum and maximum values along with the default
  4567. values.
  4568. @example
  4569. list_filters=true
  4570. @end example
  4571. @item filter
  4572. Specify all filters by their respective name and options.
  4573. Use @var{list_filters} to determine all valid filter names and options.
  4574. Numerical options are specified by a float value and are automatically clamped
  4575. to their respective value range. Vector and color options have to be specified
  4576. by a list of space separated float values. Character escaping has to be done.
  4577. A special option name @code{default} is available to use default options for a
  4578. filter.
  4579. It is required to specify either @code{default} or at least one of the filter options.
  4580. All omitted options are used with their default values.
  4581. The syntax of the filter string is as follows:
  4582. @example
  4583. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  4584. @end example
  4585. @item output_rect
  4586. Specify a rectangle where the output of the filter chain is copied into the
  4587. input image. It is given by a list of space separated float values:
  4588. @example
  4589. output_rect=x\ y\ width\ height
  4590. @end example
  4591. If not given, the output rectangle equals the dimensions of the input image.
  4592. The output rectangle is automatically cropped at the borders of the input
  4593. image. Negative values are valid for each component.
  4594. @example
  4595. output_rect=25\ 25\ 100\ 100
  4596. @end example
  4597. @end table
  4598. Several filters can be chained for successive processing without GPU-HOST
  4599. transfers allowing for fast processing of complex filter chains.
  4600. Currently, only filters with zero (generators) or exactly one (filters) input
  4601. image and one output image are supported. Also, transition filters are not yet
  4602. usable as intended.
  4603. Some filters generate output images with additional padding depending on the
  4604. respective filter kernel. The padding is automatically removed to ensure the
  4605. filter output has the same size as the input image.
  4606. For image generators, the size of the output image is determined by the
  4607. previous output image of the filter chain or the input image of the whole
  4608. filterchain, respectively. The generators do not use the pixel information of
  4609. this image to generate their output. However, the generated output is
  4610. blended onto this image, resulting in partial or complete coverage of the
  4611. output image.
  4612. The @ref{coreimagesrc} video source can be used for generating input images
  4613. which are directly fed into the filter chain. By using it, providing input
  4614. images by another video source or an input video is not required.
  4615. @subsection Examples
  4616. @itemize
  4617. @item
  4618. List all filters available:
  4619. @example
  4620. coreimage=list_filters=true
  4621. @end example
  4622. @item
  4623. Use the CIBoxBlur filter with default options to blur an image:
  4624. @example
  4625. coreimage=filter=CIBoxBlur@@default
  4626. @end example
  4627. @item
  4628. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  4629. its center at 100x100 and a radius of 50 pixels:
  4630. @example
  4631. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  4632. @end example
  4633. @item
  4634. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  4635. given as complete and escaped command-line for Apple's standard bash shell:
  4636. @example
  4637. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  4638. @end example
  4639. @end itemize
  4640. @section crop
  4641. Crop the input video to given dimensions.
  4642. It accepts the following parameters:
  4643. @table @option
  4644. @item w, out_w
  4645. The width of the output video. It defaults to @code{iw}.
  4646. This expression is evaluated only once during the filter
  4647. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  4648. @item h, out_h
  4649. The height of the output video. It defaults to @code{ih}.
  4650. This expression is evaluated only once during the filter
  4651. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  4652. @item x
  4653. The horizontal position, in the input video, of the left edge of the output
  4654. video. It defaults to @code{(in_w-out_w)/2}.
  4655. This expression is evaluated per-frame.
  4656. @item y
  4657. The vertical position, in the input video, of the top edge of the output video.
  4658. It defaults to @code{(in_h-out_h)/2}.
  4659. This expression is evaluated per-frame.
  4660. @item keep_aspect
  4661. If set to 1 will force the output display aspect ratio
  4662. to be the same of the input, by changing the output sample aspect
  4663. ratio. It defaults to 0.
  4664. @item exact
  4665. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  4666. width/height/x/y as specified and will not be rounded to nearest smaller value.
  4667. It defaults to 0.
  4668. @end table
  4669. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  4670. expressions containing the following constants:
  4671. @table @option
  4672. @item x
  4673. @item y
  4674. The computed values for @var{x} and @var{y}. They are evaluated for
  4675. each new frame.
  4676. @item in_w
  4677. @item in_h
  4678. The input width and height.
  4679. @item iw
  4680. @item ih
  4681. These are the same as @var{in_w} and @var{in_h}.
  4682. @item out_w
  4683. @item out_h
  4684. The output (cropped) width and height.
  4685. @item ow
  4686. @item oh
  4687. These are the same as @var{out_w} and @var{out_h}.
  4688. @item a
  4689. same as @var{iw} / @var{ih}
  4690. @item sar
  4691. input sample aspect ratio
  4692. @item dar
  4693. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  4694. @item hsub
  4695. @item vsub
  4696. horizontal and vertical chroma subsample values. For example for the
  4697. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4698. @item n
  4699. The number of the input frame, starting from 0.
  4700. @item pos
  4701. the position in the file of the input frame, NAN if unknown
  4702. @item t
  4703. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  4704. @end table
  4705. The expression for @var{out_w} may depend on the value of @var{out_h},
  4706. and the expression for @var{out_h} may depend on @var{out_w}, but they
  4707. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  4708. evaluated after @var{out_w} and @var{out_h}.
  4709. The @var{x} and @var{y} parameters specify the expressions for the
  4710. position of the top-left corner of the output (non-cropped) area. They
  4711. are evaluated for each frame. If the evaluated value is not valid, it
  4712. is approximated to the nearest valid value.
  4713. The expression for @var{x} may depend on @var{y}, and the expression
  4714. for @var{y} may depend on @var{x}.
  4715. @subsection Examples
  4716. @itemize
  4717. @item
  4718. Crop area with size 100x100 at position (12,34).
  4719. @example
  4720. crop=100:100:12:34
  4721. @end example
  4722. Using named options, the example above becomes:
  4723. @example
  4724. crop=w=100:h=100:x=12:y=34
  4725. @end example
  4726. @item
  4727. Crop the central input area with size 100x100:
  4728. @example
  4729. crop=100:100
  4730. @end example
  4731. @item
  4732. Crop the central input area with size 2/3 of the input video:
  4733. @example
  4734. crop=2/3*in_w:2/3*in_h
  4735. @end example
  4736. @item
  4737. Crop the input video central square:
  4738. @example
  4739. crop=out_w=in_h
  4740. crop=in_h
  4741. @end example
  4742. @item
  4743. Delimit the rectangle with the top-left corner placed at position
  4744. 100:100 and the right-bottom corner corresponding to the right-bottom
  4745. corner of the input image.
  4746. @example
  4747. crop=in_w-100:in_h-100:100:100
  4748. @end example
  4749. @item
  4750. Crop 10 pixels from the left and right borders, and 20 pixels from
  4751. the top and bottom borders
  4752. @example
  4753. crop=in_w-2*10:in_h-2*20
  4754. @end example
  4755. @item
  4756. Keep only the bottom right quarter of the input image:
  4757. @example
  4758. crop=in_w/2:in_h/2:in_w/2:in_h/2
  4759. @end example
  4760. @item
  4761. Crop height for getting Greek harmony:
  4762. @example
  4763. crop=in_w:1/PHI*in_w
  4764. @end example
  4765. @item
  4766. Apply trembling effect:
  4767. @example
  4768. 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)
  4769. @end example
  4770. @item
  4771. Apply erratic camera effect depending on timestamp:
  4772. @example
  4773. 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)"
  4774. @end example
  4775. @item
  4776. Set x depending on the value of y:
  4777. @example
  4778. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  4779. @end example
  4780. @end itemize
  4781. @subsection Commands
  4782. This filter supports the following commands:
  4783. @table @option
  4784. @item w, out_w
  4785. @item h, out_h
  4786. @item x
  4787. @item y
  4788. Set width/height of the output video and the horizontal/vertical position
  4789. in the input video.
  4790. The command accepts the same syntax of the corresponding option.
  4791. If the specified expression is not valid, it is kept at its current
  4792. value.
  4793. @end table
  4794. @section cropdetect
  4795. Auto-detect the crop size.
  4796. It calculates the necessary cropping parameters and prints the
  4797. recommended parameters via the logging system. The detected dimensions
  4798. correspond to the non-black area of the input video.
  4799. It accepts the following parameters:
  4800. @table @option
  4801. @item limit
  4802. Set higher black value threshold, which can be optionally specified
  4803. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  4804. value greater to the set value is considered non-black. It defaults to 24.
  4805. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  4806. on the bitdepth of the pixel format.
  4807. @item round
  4808. The value which the width/height should be divisible by. It defaults to
  4809. 16. The offset is automatically adjusted to center the video. Use 2 to
  4810. get only even dimensions (needed for 4:2:2 video). 16 is best when
  4811. encoding to most video codecs.
  4812. @item reset_count, reset
  4813. Set the counter that determines after how many frames cropdetect will
  4814. reset the previously detected largest video area and start over to
  4815. detect the current optimal crop area. Default value is 0.
  4816. This can be useful when channel logos distort the video area. 0
  4817. indicates 'never reset', and returns the largest area encountered during
  4818. playback.
  4819. @end table
  4820. @anchor{curves}
  4821. @section curves
  4822. Apply color adjustments using curves.
  4823. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  4824. component (red, green and blue) has its values defined by @var{N} key points
  4825. tied from each other using a smooth curve. The x-axis represents the pixel
  4826. values from the input frame, and the y-axis the new pixel values to be set for
  4827. the output frame.
  4828. By default, a component curve is defined by the two points @var{(0;0)} and
  4829. @var{(1;1)}. This creates a straight line where each original pixel value is
  4830. "adjusted" to its own value, which means no change to the image.
  4831. The filter allows you to redefine these two points and add some more. A new
  4832. curve (using a natural cubic spline interpolation) will be define to pass
  4833. smoothly through all these new coordinates. The new defined points needs to be
  4834. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  4835. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  4836. the vector spaces, the values will be clipped accordingly.
  4837. The filter accepts the following options:
  4838. @table @option
  4839. @item preset
  4840. Select one of the available color presets. This option can be used in addition
  4841. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  4842. options takes priority on the preset values.
  4843. Available presets are:
  4844. @table @samp
  4845. @item none
  4846. @item color_negative
  4847. @item cross_process
  4848. @item darker
  4849. @item increase_contrast
  4850. @item lighter
  4851. @item linear_contrast
  4852. @item medium_contrast
  4853. @item negative
  4854. @item strong_contrast
  4855. @item vintage
  4856. @end table
  4857. Default is @code{none}.
  4858. @item master, m
  4859. Set the master key points. These points will define a second pass mapping. It
  4860. is sometimes called a "luminance" or "value" mapping. It can be used with
  4861. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  4862. post-processing LUT.
  4863. @item red, r
  4864. Set the key points for the red component.
  4865. @item green, g
  4866. Set the key points for the green component.
  4867. @item blue, b
  4868. Set the key points for the blue component.
  4869. @item all
  4870. Set the key points for all components (not including master).
  4871. Can be used in addition to the other key points component
  4872. options. In this case, the unset component(s) will fallback on this
  4873. @option{all} setting.
  4874. @item psfile
  4875. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  4876. @item plot
  4877. Save Gnuplot script of the curves in specified file.
  4878. @end table
  4879. To avoid some filtergraph syntax conflicts, each key points list need to be
  4880. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  4881. @subsection Examples
  4882. @itemize
  4883. @item
  4884. Increase slightly the middle level of blue:
  4885. @example
  4886. curves=blue='0/0 0.5/0.58 1/1'
  4887. @end example
  4888. @item
  4889. Vintage effect:
  4890. @example
  4891. 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'
  4892. @end example
  4893. Here we obtain the following coordinates for each components:
  4894. @table @var
  4895. @item red
  4896. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  4897. @item green
  4898. @code{(0;0) (0.50;0.48) (1;1)}
  4899. @item blue
  4900. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  4901. @end table
  4902. @item
  4903. The previous example can also be achieved with the associated built-in preset:
  4904. @example
  4905. curves=preset=vintage
  4906. @end example
  4907. @item
  4908. Or simply:
  4909. @example
  4910. curves=vintage
  4911. @end example
  4912. @item
  4913. Use a Photoshop preset and redefine the points of the green component:
  4914. @example
  4915. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  4916. @end example
  4917. @item
  4918. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  4919. and @command{gnuplot}:
  4920. @example
  4921. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  4922. gnuplot -p /tmp/curves.plt
  4923. @end example
  4924. @end itemize
  4925. @section datascope
  4926. Video data analysis filter.
  4927. This filter shows hexadecimal pixel values of part of video.
  4928. The filter accepts the following options:
  4929. @table @option
  4930. @item size, s
  4931. Set output video size.
  4932. @item x
  4933. Set x offset from where to pick pixels.
  4934. @item y
  4935. Set y offset from where to pick pixels.
  4936. @item mode
  4937. Set scope mode, can be one of the following:
  4938. @table @samp
  4939. @item mono
  4940. Draw hexadecimal pixel values with white color on black background.
  4941. @item color
  4942. Draw hexadecimal pixel values with input video pixel color on black
  4943. background.
  4944. @item color2
  4945. Draw hexadecimal pixel values on color background picked from input video,
  4946. the text color is picked in such way so its always visible.
  4947. @end table
  4948. @item axis
  4949. Draw rows and columns numbers on left and top of video.
  4950. @item opacity
  4951. Set background opacity.
  4952. @end table
  4953. @section dctdnoiz
  4954. Denoise frames using 2D DCT (frequency domain filtering).
  4955. This filter is not designed for real time.
  4956. The filter accepts the following options:
  4957. @table @option
  4958. @item sigma, s
  4959. Set the noise sigma constant.
  4960. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  4961. coefficient (absolute value) below this threshold with be dropped.
  4962. If you need a more advanced filtering, see @option{expr}.
  4963. Default is @code{0}.
  4964. @item overlap
  4965. Set number overlapping pixels for each block. Since the filter can be slow, you
  4966. may want to reduce this value, at the cost of a less effective filter and the
  4967. risk of various artefacts.
  4968. If the overlapping value doesn't permit processing the whole input width or
  4969. height, a warning will be displayed and according borders won't be denoised.
  4970. Default value is @var{blocksize}-1, which is the best possible setting.
  4971. @item expr, e
  4972. Set the coefficient factor expression.
  4973. For each coefficient of a DCT block, this expression will be evaluated as a
  4974. multiplier value for the coefficient.
  4975. If this is option is set, the @option{sigma} option will be ignored.
  4976. The absolute value of the coefficient can be accessed through the @var{c}
  4977. variable.
  4978. @item n
  4979. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  4980. @var{blocksize}, which is the width and height of the processed blocks.
  4981. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  4982. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  4983. on the speed processing. Also, a larger block size does not necessarily means a
  4984. better de-noising.
  4985. @end table
  4986. @subsection Examples
  4987. Apply a denoise with a @option{sigma} of @code{4.5}:
  4988. @example
  4989. dctdnoiz=4.5
  4990. @end example
  4991. The same operation can be achieved using the expression system:
  4992. @example
  4993. dctdnoiz=e='gte(c, 4.5*3)'
  4994. @end example
  4995. Violent denoise using a block size of @code{16x16}:
  4996. @example
  4997. dctdnoiz=15:n=4
  4998. @end example
  4999. @section deband
  5000. Remove banding artifacts from input video.
  5001. It works by replacing banded pixels with average value of referenced pixels.
  5002. The filter accepts the following options:
  5003. @table @option
  5004. @item 1thr
  5005. @item 2thr
  5006. @item 3thr
  5007. @item 4thr
  5008. Set banding detection threshold for each plane. Default is 0.02.
  5009. Valid range is 0.00003 to 0.5.
  5010. If difference between current pixel and reference pixel is less than threshold,
  5011. it will be considered as banded.
  5012. @item range, r
  5013. Banding detection range in pixels. Default is 16. If positive, random number
  5014. in range 0 to set value will be used. If negative, exact absolute value
  5015. will be used.
  5016. The range defines square of four pixels around current pixel.
  5017. @item direction, d
  5018. Set direction in radians from which four pixel will be compared. If positive,
  5019. random direction from 0 to set direction will be picked. If negative, exact of
  5020. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  5021. will pick only pixels on same row and -PI/2 will pick only pixels on same
  5022. column.
  5023. @item blur, b
  5024. If enabled, current pixel is compared with average value of all four
  5025. surrounding pixels. The default is enabled. If disabled current pixel is
  5026. compared with all four surrounding pixels. The pixel is considered banded
  5027. if only all four differences with surrounding pixels are less than threshold.
  5028. @item coupling, c
  5029. If enabled, current pixel is changed if and only if all pixel components are banded,
  5030. e.g. banding detection threshold is triggered for all color components.
  5031. The default is disabled.
  5032. @end table
  5033. @anchor{decimate}
  5034. @section decimate
  5035. Drop duplicated frames at regular intervals.
  5036. The filter accepts the following options:
  5037. @table @option
  5038. @item cycle
  5039. Set the number of frames from which one will be dropped. Setting this to
  5040. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  5041. Default is @code{5}.
  5042. @item dupthresh
  5043. Set the threshold for duplicate detection. If the difference metric for a frame
  5044. is less than or equal to this value, then it is declared as duplicate. Default
  5045. is @code{1.1}
  5046. @item scthresh
  5047. Set scene change threshold. Default is @code{15}.
  5048. @item blockx
  5049. @item blocky
  5050. Set the size of the x and y-axis blocks used during metric calculations.
  5051. Larger blocks give better noise suppression, but also give worse detection of
  5052. small movements. Must be a power of two. Default is @code{32}.
  5053. @item ppsrc
  5054. Mark main input as a pre-processed input and activate clean source input
  5055. stream. This allows the input to be pre-processed with various filters to help
  5056. the metrics calculation while keeping the frame selection lossless. When set to
  5057. @code{1}, the first stream is for the pre-processed input, and the second
  5058. stream is the clean source from where the kept frames are chosen. Default is
  5059. @code{0}.
  5060. @item chroma
  5061. Set whether or not chroma is considered in the metric calculations. Default is
  5062. @code{1}.
  5063. @end table
  5064. @section deflate
  5065. Apply deflate effect to the video.
  5066. This filter replaces the pixel by the local(3x3) average by taking into account
  5067. only values lower than the pixel.
  5068. It accepts the following options:
  5069. @table @option
  5070. @item threshold0
  5071. @item threshold1
  5072. @item threshold2
  5073. @item threshold3
  5074. Limit the maximum change for each plane, default is 65535.
  5075. If 0, plane will remain unchanged.
  5076. @end table
  5077. @section deflicker
  5078. Remove temporal frame luminance variations.
  5079. It accepts the following options:
  5080. @table @option
  5081. @item size, s
  5082. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  5083. @item mode, m
  5084. Set averaging mode to smooth temporal luminance variations.
  5085. Available values are:
  5086. @table @samp
  5087. @item am
  5088. Arithmetic mean
  5089. @item gm
  5090. Geometric mean
  5091. @item hm
  5092. Harmonic mean
  5093. @item qm
  5094. Quadratic mean
  5095. @item cm
  5096. Cubic mean
  5097. @item pm
  5098. Power mean
  5099. @item median
  5100. Median
  5101. @end table
  5102. @item bypass
  5103. Do not actually modify frame. Useful when one only wants metadata.
  5104. @end table
  5105. @section dejudder
  5106. Remove judder produced by partially interlaced telecined content.
  5107. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  5108. source was partially telecined content then the output of @code{pullup,dejudder}
  5109. will have a variable frame rate. May change the recorded frame rate of the
  5110. container. Aside from that change, this filter will not affect constant frame
  5111. rate video.
  5112. The option available in this filter is:
  5113. @table @option
  5114. @item cycle
  5115. Specify the length of the window over which the judder repeats.
  5116. Accepts any integer greater than 1. Useful values are:
  5117. @table @samp
  5118. @item 4
  5119. If the original was telecined from 24 to 30 fps (Film to NTSC).
  5120. @item 5
  5121. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  5122. @item 20
  5123. If a mixture of the two.
  5124. @end table
  5125. The default is @samp{4}.
  5126. @end table
  5127. @section delogo
  5128. Suppress a TV station logo by a simple interpolation of the surrounding
  5129. pixels. Just set a rectangle covering the logo and watch it disappear
  5130. (and sometimes something even uglier appear - your mileage may vary).
  5131. It accepts the following parameters:
  5132. @table @option
  5133. @item x
  5134. @item y
  5135. Specify the top left corner coordinates of the logo. They must be
  5136. specified.
  5137. @item w
  5138. @item h
  5139. Specify the width and height of the logo to clear. They must be
  5140. specified.
  5141. @item band, t
  5142. Specify the thickness of the fuzzy edge of the rectangle (added to
  5143. @var{w} and @var{h}). The default value is 1. This option is
  5144. deprecated, setting higher values should no longer be necessary and
  5145. is not recommended.
  5146. @item show
  5147. When set to 1, a green rectangle is drawn on the screen to simplify
  5148. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  5149. The default value is 0.
  5150. The rectangle is drawn on the outermost pixels which will be (partly)
  5151. replaced with interpolated values. The values of the next pixels
  5152. immediately outside this rectangle in each direction will be used to
  5153. compute the interpolated pixel values inside the rectangle.
  5154. @end table
  5155. @subsection Examples
  5156. @itemize
  5157. @item
  5158. Set a rectangle covering the area with top left corner coordinates 0,0
  5159. and size 100x77, and a band of size 10:
  5160. @example
  5161. delogo=x=0:y=0:w=100:h=77:band=10
  5162. @end example
  5163. @end itemize
  5164. @section deshake
  5165. Attempt to fix small changes in horizontal and/or vertical shift. This
  5166. filter helps remove camera shake from hand-holding a camera, bumping a
  5167. tripod, moving on a vehicle, etc.
  5168. The filter accepts the following options:
  5169. @table @option
  5170. @item x
  5171. @item y
  5172. @item w
  5173. @item h
  5174. Specify a rectangular area where to limit the search for motion
  5175. vectors.
  5176. If desired the search for motion vectors can be limited to a
  5177. rectangular area of the frame defined by its top left corner, width
  5178. and height. These parameters have the same meaning as the drawbox
  5179. filter which can be used to visualise the position of the bounding
  5180. box.
  5181. This is useful when simultaneous movement of subjects within the frame
  5182. might be confused for camera motion by the motion vector search.
  5183. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  5184. then the full frame is used. This allows later options to be set
  5185. without specifying the bounding box for the motion vector search.
  5186. Default - search the whole frame.
  5187. @item rx
  5188. @item ry
  5189. Specify the maximum extent of movement in x and y directions in the
  5190. range 0-64 pixels. Default 16.
  5191. @item edge
  5192. Specify how to generate pixels to fill blanks at the edge of the
  5193. frame. Available values are:
  5194. @table @samp
  5195. @item blank, 0
  5196. Fill zeroes at blank locations
  5197. @item original, 1
  5198. Original image at blank locations
  5199. @item clamp, 2
  5200. Extruded edge value at blank locations
  5201. @item mirror, 3
  5202. Mirrored edge at blank locations
  5203. @end table
  5204. Default value is @samp{mirror}.
  5205. @item blocksize
  5206. Specify the blocksize to use for motion search. Range 4-128 pixels,
  5207. default 8.
  5208. @item contrast
  5209. Specify the contrast threshold for blocks. Only blocks with more than
  5210. the specified contrast (difference between darkest and lightest
  5211. pixels) will be considered. Range 1-255, default 125.
  5212. @item search
  5213. Specify the search strategy. Available values are:
  5214. @table @samp
  5215. @item exhaustive, 0
  5216. Set exhaustive search
  5217. @item less, 1
  5218. Set less exhaustive search.
  5219. @end table
  5220. Default value is @samp{exhaustive}.
  5221. @item filename
  5222. If set then a detailed log of the motion search is written to the
  5223. specified file.
  5224. @item opencl
  5225. If set to 1, specify using OpenCL capabilities, only available if
  5226. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  5227. @end table
  5228. @section detelecine
  5229. Apply an exact inverse of the telecine operation. It requires a predefined
  5230. pattern specified using the pattern option which must be the same as that passed
  5231. to the telecine filter.
  5232. This filter accepts the following options:
  5233. @table @option
  5234. @item first_field
  5235. @table @samp
  5236. @item top, t
  5237. top field first
  5238. @item bottom, b
  5239. bottom field first
  5240. The default value is @code{top}.
  5241. @end table
  5242. @item pattern
  5243. A string of numbers representing the pulldown pattern you wish to apply.
  5244. The default value is @code{23}.
  5245. @item start_frame
  5246. A number representing position of the first frame with respect to the telecine
  5247. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  5248. @end table
  5249. @section dilation
  5250. Apply dilation effect to the video.
  5251. This filter replaces the pixel by the local(3x3) maximum.
  5252. It accepts the following options:
  5253. @table @option
  5254. @item threshold0
  5255. @item threshold1
  5256. @item threshold2
  5257. @item threshold3
  5258. Limit the maximum change for each plane, default is 65535.
  5259. If 0, plane will remain unchanged.
  5260. @item coordinates
  5261. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5262. pixels are used.
  5263. Flags to local 3x3 coordinates maps like this:
  5264. 1 2 3
  5265. 4 5
  5266. 6 7 8
  5267. @end table
  5268. @section displace
  5269. Displace pixels as indicated by second and third input stream.
  5270. It takes three input streams and outputs one stream, the first input is the
  5271. source, and second and third input are displacement maps.
  5272. The second input specifies how much to displace pixels along the
  5273. x-axis, while the third input specifies how much to displace pixels
  5274. along the y-axis.
  5275. If one of displacement map streams terminates, last frame from that
  5276. displacement map will be used.
  5277. Note that once generated, displacements maps can be reused over and over again.
  5278. A description of the accepted options follows.
  5279. @table @option
  5280. @item edge
  5281. Set displace behavior for pixels that are out of range.
  5282. Available values are:
  5283. @table @samp
  5284. @item blank
  5285. Missing pixels are replaced by black pixels.
  5286. @item smear
  5287. Adjacent pixels will spread out to replace missing pixels.
  5288. @item wrap
  5289. Out of range pixels are wrapped so they point to pixels of other side.
  5290. @end table
  5291. Default is @samp{smear}.
  5292. @end table
  5293. @subsection Examples
  5294. @itemize
  5295. @item
  5296. Add ripple effect to rgb input of video size hd720:
  5297. @example
  5298. 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
  5299. @end example
  5300. @item
  5301. Add wave effect to rgb input of video size hd720:
  5302. @example
  5303. 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
  5304. @end example
  5305. @end itemize
  5306. @section drawbox
  5307. Draw a colored box on the input image.
  5308. It accepts the following parameters:
  5309. @table @option
  5310. @item x
  5311. @item y
  5312. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  5313. @item width, w
  5314. @item height, h
  5315. The expressions which specify the width and height of the box; if 0 they are interpreted as
  5316. the input width and height. It defaults to 0.
  5317. @item color, c
  5318. Specify the color of the box to write. For the general syntax of this option,
  5319. check the "Color" section in the ffmpeg-utils manual. If the special
  5320. value @code{invert} is used, the box edge color is the same as the
  5321. video with inverted luma.
  5322. @item thickness, t
  5323. The expression which sets the thickness of the box edge. Default value is @code{3}.
  5324. See below for the list of accepted constants.
  5325. @end table
  5326. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5327. following constants:
  5328. @table @option
  5329. @item dar
  5330. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5331. @item hsub
  5332. @item vsub
  5333. horizontal and vertical chroma subsample values. For example for the
  5334. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5335. @item in_h, ih
  5336. @item in_w, iw
  5337. The input width and height.
  5338. @item sar
  5339. The input sample aspect ratio.
  5340. @item x
  5341. @item y
  5342. The x and y offset coordinates where the box is drawn.
  5343. @item w
  5344. @item h
  5345. The width and height of the drawn box.
  5346. @item t
  5347. The thickness of the drawn box.
  5348. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5349. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5350. @end table
  5351. @subsection Examples
  5352. @itemize
  5353. @item
  5354. Draw a black box around the edge of the input image:
  5355. @example
  5356. drawbox
  5357. @end example
  5358. @item
  5359. Draw a box with color red and an opacity of 50%:
  5360. @example
  5361. drawbox=10:20:200:60:red@@0.5
  5362. @end example
  5363. The previous example can be specified as:
  5364. @example
  5365. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  5366. @end example
  5367. @item
  5368. Fill the box with pink color:
  5369. @example
  5370. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
  5371. @end example
  5372. @item
  5373. Draw a 2-pixel red 2.40:1 mask:
  5374. @example
  5375. 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
  5376. @end example
  5377. @end itemize
  5378. @section drawgrid
  5379. Draw a grid on the input image.
  5380. It accepts the following parameters:
  5381. @table @option
  5382. @item x
  5383. @item y
  5384. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  5385. @item width, w
  5386. @item height, h
  5387. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  5388. input width and height, respectively, minus @code{thickness}, so image gets
  5389. framed. Default to 0.
  5390. @item color, c
  5391. Specify the color of the grid. For the general syntax of this option,
  5392. check the "Color" section in the ffmpeg-utils manual. If the special
  5393. value @code{invert} is used, the grid color is the same as the
  5394. video with inverted luma.
  5395. @item thickness, t
  5396. The expression which sets the thickness of the grid line. Default value is @code{1}.
  5397. See below for the list of accepted constants.
  5398. @end table
  5399. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5400. following constants:
  5401. @table @option
  5402. @item dar
  5403. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5404. @item hsub
  5405. @item vsub
  5406. horizontal and vertical chroma subsample values. For example for the
  5407. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5408. @item in_h, ih
  5409. @item in_w, iw
  5410. The input grid cell width and height.
  5411. @item sar
  5412. The input sample aspect ratio.
  5413. @item x
  5414. @item y
  5415. The x and y coordinates of some point of grid intersection (meant to configure offset).
  5416. @item w
  5417. @item h
  5418. The width and height of the drawn cell.
  5419. @item t
  5420. The thickness of the drawn cell.
  5421. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5422. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5423. @end table
  5424. @subsection Examples
  5425. @itemize
  5426. @item
  5427. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  5428. @example
  5429. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  5430. @end example
  5431. @item
  5432. Draw a white 3x3 grid with an opacity of 50%:
  5433. @example
  5434. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  5435. @end example
  5436. @end itemize
  5437. @anchor{drawtext}
  5438. @section drawtext
  5439. Draw a text string or text from a specified file on top of a video, using the
  5440. libfreetype library.
  5441. To enable compilation of this filter, you need to configure FFmpeg with
  5442. @code{--enable-libfreetype}.
  5443. To enable default font fallback and the @var{font} option you need to
  5444. configure FFmpeg with @code{--enable-libfontconfig}.
  5445. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  5446. @code{--enable-libfribidi}.
  5447. @subsection Syntax
  5448. It accepts the following parameters:
  5449. @table @option
  5450. @item box
  5451. Used to draw a box around text using the background color.
  5452. The value must be either 1 (enable) or 0 (disable).
  5453. The default value of @var{box} is 0.
  5454. @item boxborderw
  5455. Set the width of the border to be drawn around the box using @var{boxcolor}.
  5456. The default value of @var{boxborderw} is 0.
  5457. @item boxcolor
  5458. The color to be used for drawing box around text. For the syntax of this
  5459. option, check the "Color" section in the ffmpeg-utils manual.
  5460. The default value of @var{boxcolor} is "white".
  5461. @item line_spacing
  5462. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  5463. The default value of @var{line_spacing} is 0.
  5464. @item borderw
  5465. Set the width of the border to be drawn around the text using @var{bordercolor}.
  5466. The default value of @var{borderw} is 0.
  5467. @item bordercolor
  5468. Set the color to be used for drawing border around text. For the syntax of this
  5469. option, check the "Color" section in the ffmpeg-utils manual.
  5470. The default value of @var{bordercolor} is "black".
  5471. @item expansion
  5472. Select how the @var{text} is expanded. Can be either @code{none},
  5473. @code{strftime} (deprecated) or
  5474. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  5475. below for details.
  5476. @item basetime
  5477. Set a start time for the count. Value is in microseconds. Only applied
  5478. in the deprecated strftime expansion mode. To emulate in normal expansion
  5479. mode use the @code{pts} function, supplying the start time (in seconds)
  5480. as the second argument.
  5481. @item fix_bounds
  5482. If true, check and fix text coords to avoid clipping.
  5483. @item fontcolor
  5484. The color to be used for drawing fonts. For the syntax of this option, check
  5485. the "Color" section in the ffmpeg-utils manual.
  5486. The default value of @var{fontcolor} is "black".
  5487. @item fontcolor_expr
  5488. String which is expanded the same way as @var{text} to obtain dynamic
  5489. @var{fontcolor} value. By default this option has empty value and is not
  5490. processed. When this option is set, it overrides @var{fontcolor} option.
  5491. @item font
  5492. The font family to be used for drawing text. By default Sans.
  5493. @item fontfile
  5494. The font file to be used for drawing text. The path must be included.
  5495. This parameter is mandatory if the fontconfig support is disabled.
  5496. @item alpha
  5497. Draw the text applying alpha blending. The value can
  5498. be a number between 0.0 and 1.0.
  5499. The expression accepts the same variables @var{x, y} as well.
  5500. The default value is 1.
  5501. Please see @var{fontcolor_expr}.
  5502. @item fontsize
  5503. The font size to be used for drawing text.
  5504. The default value of @var{fontsize} is 16.
  5505. @item text_shaping
  5506. If set to 1, attempt to shape the text (for example, reverse the order of
  5507. right-to-left text and join Arabic characters) before drawing it.
  5508. Otherwise, just draw the text exactly as given.
  5509. By default 1 (if supported).
  5510. @item ft_load_flags
  5511. The flags to be used for loading the fonts.
  5512. The flags map the corresponding flags supported by libfreetype, and are
  5513. a combination of the following values:
  5514. @table @var
  5515. @item default
  5516. @item no_scale
  5517. @item no_hinting
  5518. @item render
  5519. @item no_bitmap
  5520. @item vertical_layout
  5521. @item force_autohint
  5522. @item crop_bitmap
  5523. @item pedantic
  5524. @item ignore_global_advance_width
  5525. @item no_recurse
  5526. @item ignore_transform
  5527. @item monochrome
  5528. @item linear_design
  5529. @item no_autohint
  5530. @end table
  5531. Default value is "default".
  5532. For more information consult the documentation for the FT_LOAD_*
  5533. libfreetype flags.
  5534. @item shadowcolor
  5535. The color to be used for drawing a shadow behind the drawn text. For the
  5536. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  5537. The default value of @var{shadowcolor} is "black".
  5538. @item shadowx
  5539. @item shadowy
  5540. The x and y offsets for the text shadow position with respect to the
  5541. position of the text. They can be either positive or negative
  5542. values. The default value for both is "0".
  5543. @item start_number
  5544. The starting frame number for the n/frame_num variable. The default value
  5545. is "0".
  5546. @item tabsize
  5547. The size in number of spaces to use for rendering the tab.
  5548. Default value is 4.
  5549. @item timecode
  5550. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  5551. format. It can be used with or without text parameter. @var{timecode_rate}
  5552. option must be specified.
  5553. @item timecode_rate, rate, r
  5554. Set the timecode frame rate (timecode only).
  5555. @item tc24hmax
  5556. If set to 1, the output of the timecode option will wrap around at 24 hours.
  5557. Default is 0 (disabled).
  5558. @item text
  5559. The text string to be drawn. The text must be a sequence of UTF-8
  5560. encoded characters.
  5561. This parameter is mandatory if no file is specified with the parameter
  5562. @var{textfile}.
  5563. @item textfile
  5564. A text file containing text to be drawn. The text must be a sequence
  5565. of UTF-8 encoded characters.
  5566. This parameter is mandatory if no text string is specified with the
  5567. parameter @var{text}.
  5568. If both @var{text} and @var{textfile} are specified, an error is thrown.
  5569. @item reload
  5570. If set to 1, the @var{textfile} will be reloaded before each frame.
  5571. Be sure to update it atomically, or it may be read partially, or even fail.
  5572. @item x
  5573. @item y
  5574. The expressions which specify the offsets where text will be drawn
  5575. within the video frame. They are relative to the top/left border of the
  5576. output image.
  5577. The default value of @var{x} and @var{y} is "0".
  5578. See below for the list of accepted constants and functions.
  5579. @end table
  5580. The parameters for @var{x} and @var{y} are expressions containing the
  5581. following constants and functions:
  5582. @table @option
  5583. @item dar
  5584. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  5585. @item hsub
  5586. @item vsub
  5587. horizontal and vertical chroma subsample values. For example for the
  5588. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5589. @item line_h, lh
  5590. the height of each text line
  5591. @item main_h, h, H
  5592. the input height
  5593. @item main_w, w, W
  5594. the input width
  5595. @item max_glyph_a, ascent
  5596. the maximum distance from the baseline to the highest/upper grid
  5597. coordinate used to place a glyph outline point, for all the rendered
  5598. glyphs.
  5599. It is a positive value, due to the grid's orientation with the Y axis
  5600. upwards.
  5601. @item max_glyph_d, descent
  5602. the maximum distance from the baseline to the lowest grid coordinate
  5603. used to place a glyph outline point, for all the rendered glyphs.
  5604. This is a negative value, due to the grid's orientation, with the Y axis
  5605. upwards.
  5606. @item max_glyph_h
  5607. maximum glyph height, that is the maximum height for all the glyphs
  5608. contained in the rendered text, it is equivalent to @var{ascent} -
  5609. @var{descent}.
  5610. @item max_glyph_w
  5611. maximum glyph width, that is the maximum width for all the glyphs
  5612. contained in the rendered text
  5613. @item n
  5614. the number of input frame, starting from 0
  5615. @item rand(min, max)
  5616. return a random number included between @var{min} and @var{max}
  5617. @item sar
  5618. The input sample aspect ratio.
  5619. @item t
  5620. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5621. @item text_h, th
  5622. the height of the rendered text
  5623. @item text_w, tw
  5624. the width of the rendered text
  5625. @item x
  5626. @item y
  5627. the x and y offset coordinates where the text is drawn.
  5628. These parameters allow the @var{x} and @var{y} expressions to refer
  5629. each other, so you can for example specify @code{y=x/dar}.
  5630. @end table
  5631. @anchor{drawtext_expansion}
  5632. @subsection Text expansion
  5633. If @option{expansion} is set to @code{strftime},
  5634. the filter recognizes strftime() sequences in the provided text and
  5635. expands them accordingly. Check the documentation of strftime(). This
  5636. feature is deprecated.
  5637. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  5638. If @option{expansion} is set to @code{normal} (which is the default),
  5639. the following expansion mechanism is used.
  5640. The backslash character @samp{\}, followed by any character, always expands to
  5641. the second character.
  5642. Sequences of the form @code{%@{...@}} are expanded. The text between the
  5643. braces is a function name, possibly followed by arguments separated by ':'.
  5644. If the arguments contain special characters or delimiters (':' or '@}'),
  5645. they should be escaped.
  5646. Note that they probably must also be escaped as the value for the
  5647. @option{text} option in the filter argument string and as the filter
  5648. argument in the filtergraph description, and possibly also for the shell,
  5649. that makes up to four levels of escaping; using a text file avoids these
  5650. problems.
  5651. The following functions are available:
  5652. @table @command
  5653. @item expr, e
  5654. The expression evaluation result.
  5655. It must take one argument specifying the expression to be evaluated,
  5656. which accepts the same constants and functions as the @var{x} and
  5657. @var{y} values. Note that not all constants should be used, for
  5658. example the text size is not known when evaluating the expression, so
  5659. the constants @var{text_w} and @var{text_h} will have an undefined
  5660. value.
  5661. @item expr_int_format, eif
  5662. Evaluate the expression's value and output as formatted integer.
  5663. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  5664. The second argument specifies the output format. Allowed values are @samp{x},
  5665. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  5666. @code{printf} function.
  5667. The third parameter is optional and sets the number of positions taken by the output.
  5668. It can be used to add padding with zeros from the left.
  5669. @item gmtime
  5670. The time at which the filter is running, expressed in UTC.
  5671. It can accept an argument: a strftime() format string.
  5672. @item localtime
  5673. The time at which the filter is running, expressed in the local time zone.
  5674. It can accept an argument: a strftime() format string.
  5675. @item metadata
  5676. Frame metadata. Takes one or two arguments.
  5677. The first argument is mandatory and specifies the metadata key.
  5678. The second argument is optional and specifies a default value, used when the
  5679. metadata key is not found or empty.
  5680. @item n, frame_num
  5681. The frame number, starting from 0.
  5682. @item pict_type
  5683. A 1 character description of the current picture type.
  5684. @item pts
  5685. The timestamp of the current frame.
  5686. It can take up to three arguments.
  5687. The first argument is the format of the timestamp; it defaults to @code{flt}
  5688. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  5689. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  5690. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  5691. @code{localtime} stands for the timestamp of the frame formatted as
  5692. local time zone time.
  5693. The second argument is an offset added to the timestamp.
  5694. If the format is set to @code{localtime} or @code{gmtime},
  5695. a third argument may be supplied: a strftime() format string.
  5696. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  5697. @end table
  5698. @subsection Examples
  5699. @itemize
  5700. @item
  5701. Draw "Test Text" with font FreeSerif, using the default values for the
  5702. optional parameters.
  5703. @example
  5704. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  5705. @end example
  5706. @item
  5707. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  5708. and y=50 (counting from the top-left corner of the screen), text is
  5709. yellow with a red box around it. Both the text and the box have an
  5710. opacity of 20%.
  5711. @example
  5712. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  5713. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  5714. @end example
  5715. Note that the double quotes are not necessary if spaces are not used
  5716. within the parameter list.
  5717. @item
  5718. Show the text at the center of the video frame:
  5719. @example
  5720. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  5721. @end example
  5722. @item
  5723. Show the text at a random position, switching to a new position every 30 seconds:
  5724. @example
  5725. 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)"
  5726. @end example
  5727. @item
  5728. Show a text line sliding from right to left in the last row of the video
  5729. frame. The file @file{LONG_LINE} is assumed to contain a single line
  5730. with no newlines.
  5731. @example
  5732. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  5733. @end example
  5734. @item
  5735. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  5736. @example
  5737. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  5738. @end example
  5739. @item
  5740. Draw a single green letter "g", at the center of the input video.
  5741. The glyph baseline is placed at half screen height.
  5742. @example
  5743. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  5744. @end example
  5745. @item
  5746. Show text for 1 second every 3 seconds:
  5747. @example
  5748. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  5749. @end example
  5750. @item
  5751. Use fontconfig to set the font. Note that the colons need to be escaped.
  5752. @example
  5753. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  5754. @end example
  5755. @item
  5756. Print the date of a real-time encoding (see strftime(3)):
  5757. @example
  5758. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  5759. @end example
  5760. @item
  5761. Show text fading in and out (appearing/disappearing):
  5762. @example
  5763. #!/bin/sh
  5764. DS=1.0 # display start
  5765. DE=10.0 # display end
  5766. FID=1.5 # fade in duration
  5767. FOD=5 # fade out duration
  5768. 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 @}"
  5769. @end example
  5770. @item
  5771. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  5772. and the @option{fontsize} value are included in the @option{y} offset.
  5773. @example
  5774. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  5775. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  5776. @end example
  5777. @end itemize
  5778. For more information about libfreetype, check:
  5779. @url{http://www.freetype.org/}.
  5780. For more information about fontconfig, check:
  5781. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  5782. For more information about libfribidi, check:
  5783. @url{http://fribidi.org/}.
  5784. @section edgedetect
  5785. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  5786. The filter accepts the following options:
  5787. @table @option
  5788. @item low
  5789. @item high
  5790. Set low and high threshold values used by the Canny thresholding
  5791. algorithm.
  5792. The high threshold selects the "strong" edge pixels, which are then
  5793. connected through 8-connectivity with the "weak" edge pixels selected
  5794. by the low threshold.
  5795. @var{low} and @var{high} threshold values must be chosen in the range
  5796. [0,1], and @var{low} should be lesser or equal to @var{high}.
  5797. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  5798. is @code{50/255}.
  5799. @item mode
  5800. Define the drawing mode.
  5801. @table @samp
  5802. @item wires
  5803. Draw white/gray wires on black background.
  5804. @item colormix
  5805. Mix the colors to create a paint/cartoon effect.
  5806. @end table
  5807. Default value is @var{wires}.
  5808. @end table
  5809. @subsection Examples
  5810. @itemize
  5811. @item
  5812. Standard edge detection with custom values for the hysteresis thresholding:
  5813. @example
  5814. edgedetect=low=0.1:high=0.4
  5815. @end example
  5816. @item
  5817. Painting effect without thresholding:
  5818. @example
  5819. edgedetect=mode=colormix:high=0
  5820. @end example
  5821. @end itemize
  5822. @section eq
  5823. Set brightness, contrast, saturation and approximate gamma adjustment.
  5824. The filter accepts the following options:
  5825. @table @option
  5826. @item contrast
  5827. Set the contrast expression. The value must be a float value in range
  5828. @code{-2.0} to @code{2.0}. The default value is "1".
  5829. @item brightness
  5830. Set the brightness expression. The value must be a float value in
  5831. range @code{-1.0} to @code{1.0}. The default value is "0".
  5832. @item saturation
  5833. Set the saturation expression. The value must be a float in
  5834. range @code{0.0} to @code{3.0}. The default value is "1".
  5835. @item gamma
  5836. Set the gamma expression. The value must be a float in range
  5837. @code{0.1} to @code{10.0}. The default value is "1".
  5838. @item gamma_r
  5839. Set the gamma expression for red. The value must be a float in
  5840. range @code{0.1} to @code{10.0}. The default value is "1".
  5841. @item gamma_g
  5842. Set the gamma expression for green. The value must be a float in range
  5843. @code{0.1} to @code{10.0}. The default value is "1".
  5844. @item gamma_b
  5845. Set the gamma expression for blue. The value must be a float in range
  5846. @code{0.1} to @code{10.0}. The default value is "1".
  5847. @item gamma_weight
  5848. Set the gamma weight expression. It can be used to reduce the effect
  5849. of a high gamma value on bright image areas, e.g. keep them from
  5850. getting overamplified and just plain white. The value must be a float
  5851. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  5852. gamma correction all the way down while @code{1.0} leaves it at its
  5853. full strength. Default is "1".
  5854. @item eval
  5855. Set when the expressions for brightness, contrast, saturation and
  5856. gamma expressions are evaluated.
  5857. It accepts the following values:
  5858. @table @samp
  5859. @item init
  5860. only evaluate expressions once during the filter initialization or
  5861. when a command is processed
  5862. @item frame
  5863. evaluate expressions for each incoming frame
  5864. @end table
  5865. Default value is @samp{init}.
  5866. @end table
  5867. The expressions accept the following parameters:
  5868. @table @option
  5869. @item n
  5870. frame count of the input frame starting from 0
  5871. @item pos
  5872. byte position of the corresponding packet in the input file, NAN if
  5873. unspecified
  5874. @item r
  5875. frame rate of the input video, NAN if the input frame rate is unknown
  5876. @item t
  5877. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5878. @end table
  5879. @subsection Commands
  5880. The filter supports the following commands:
  5881. @table @option
  5882. @item contrast
  5883. Set the contrast expression.
  5884. @item brightness
  5885. Set the brightness expression.
  5886. @item saturation
  5887. Set the saturation expression.
  5888. @item gamma
  5889. Set the gamma expression.
  5890. @item gamma_r
  5891. Set the gamma_r expression.
  5892. @item gamma_g
  5893. Set gamma_g expression.
  5894. @item gamma_b
  5895. Set gamma_b expression.
  5896. @item gamma_weight
  5897. Set gamma_weight expression.
  5898. The command accepts the same syntax of the corresponding option.
  5899. If the specified expression is not valid, it is kept at its current
  5900. value.
  5901. @end table
  5902. @section erosion
  5903. Apply erosion effect to the video.
  5904. This filter replaces the pixel by the local(3x3) minimum.
  5905. It accepts the following options:
  5906. @table @option
  5907. @item threshold0
  5908. @item threshold1
  5909. @item threshold2
  5910. @item threshold3
  5911. Limit the maximum change for each plane, default is 65535.
  5912. If 0, plane will remain unchanged.
  5913. @item coordinates
  5914. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5915. pixels are used.
  5916. Flags to local 3x3 coordinates maps like this:
  5917. 1 2 3
  5918. 4 5
  5919. 6 7 8
  5920. @end table
  5921. @section extractplanes
  5922. Extract color channel components from input video stream into
  5923. separate grayscale video streams.
  5924. The filter accepts the following option:
  5925. @table @option
  5926. @item planes
  5927. Set plane(s) to extract.
  5928. Available values for planes are:
  5929. @table @samp
  5930. @item y
  5931. @item u
  5932. @item v
  5933. @item a
  5934. @item r
  5935. @item g
  5936. @item b
  5937. @end table
  5938. Choosing planes not available in the input will result in an error.
  5939. That means you cannot select @code{r}, @code{g}, @code{b} planes
  5940. with @code{y}, @code{u}, @code{v} planes at same time.
  5941. @end table
  5942. @subsection Examples
  5943. @itemize
  5944. @item
  5945. Extract luma, u and v color channel component from input video frame
  5946. into 3 grayscale outputs:
  5947. @example
  5948. 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
  5949. @end example
  5950. @end itemize
  5951. @section elbg
  5952. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  5953. For each input image, the filter will compute the optimal mapping from
  5954. the input to the output given the codebook length, that is the number
  5955. of distinct output colors.
  5956. This filter accepts the following options.
  5957. @table @option
  5958. @item codebook_length, l
  5959. Set codebook length. The value must be a positive integer, and
  5960. represents the number of distinct output colors. Default value is 256.
  5961. @item nb_steps, n
  5962. Set the maximum number of iterations to apply for computing the optimal
  5963. mapping. The higher the value the better the result and the higher the
  5964. computation time. Default value is 1.
  5965. @item seed, s
  5966. Set a random seed, must be an integer included between 0 and
  5967. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  5968. will try to use a good random seed on a best effort basis.
  5969. @item pal8
  5970. Set pal8 output pixel format. This option does not work with codebook
  5971. length greater than 256.
  5972. @end table
  5973. @section fade
  5974. Apply a fade-in/out effect to the input video.
  5975. It accepts the following parameters:
  5976. @table @option
  5977. @item type, t
  5978. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  5979. effect.
  5980. Default is @code{in}.
  5981. @item start_frame, s
  5982. Specify the number of the frame to start applying the fade
  5983. effect at. Default is 0.
  5984. @item nb_frames, n
  5985. The number of frames that the fade effect lasts. At the end of the
  5986. fade-in effect, the output video will have the same intensity as the input video.
  5987. At the end of the fade-out transition, the output video will be filled with the
  5988. selected @option{color}.
  5989. Default is 25.
  5990. @item alpha
  5991. If set to 1, fade only alpha channel, if one exists on the input.
  5992. Default value is 0.
  5993. @item start_time, st
  5994. Specify the timestamp (in seconds) of the frame to start to apply the fade
  5995. effect. If both start_frame and start_time are specified, the fade will start at
  5996. whichever comes last. Default is 0.
  5997. @item duration, d
  5998. The number of seconds for which the fade effect has to last. At the end of the
  5999. fade-in effect the output video will have the same intensity as the input video,
  6000. at the end of the fade-out transition the output video will be filled with the
  6001. selected @option{color}.
  6002. If both duration and nb_frames are specified, duration is used. Default is 0
  6003. (nb_frames is used by default).
  6004. @item color, c
  6005. Specify the color of the fade. Default is "black".
  6006. @end table
  6007. @subsection Examples
  6008. @itemize
  6009. @item
  6010. Fade in the first 30 frames of video:
  6011. @example
  6012. fade=in:0:30
  6013. @end example
  6014. The command above is equivalent to:
  6015. @example
  6016. fade=t=in:s=0:n=30
  6017. @end example
  6018. @item
  6019. Fade out the last 45 frames of a 200-frame video:
  6020. @example
  6021. fade=out:155:45
  6022. fade=type=out:start_frame=155:nb_frames=45
  6023. @end example
  6024. @item
  6025. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  6026. @example
  6027. fade=in:0:25, fade=out:975:25
  6028. @end example
  6029. @item
  6030. Make the first 5 frames yellow, then fade in from frame 5-24:
  6031. @example
  6032. fade=in:5:20:color=yellow
  6033. @end example
  6034. @item
  6035. Fade in alpha over first 25 frames of video:
  6036. @example
  6037. fade=in:0:25:alpha=1
  6038. @end example
  6039. @item
  6040. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  6041. @example
  6042. fade=t=in:st=5.5:d=0.5
  6043. @end example
  6044. @end itemize
  6045. @section fftfilt
  6046. Apply arbitrary expressions to samples in frequency domain
  6047. @table @option
  6048. @item dc_Y
  6049. Adjust the dc value (gain) of the luma plane of the image. The filter
  6050. accepts an integer value in range @code{0} to @code{1000}. The default
  6051. value is set to @code{0}.
  6052. @item dc_U
  6053. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  6054. filter accepts an integer value in range @code{0} to @code{1000}. The
  6055. default value is set to @code{0}.
  6056. @item dc_V
  6057. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  6058. filter accepts an integer value in range @code{0} to @code{1000}. The
  6059. default value is set to @code{0}.
  6060. @item weight_Y
  6061. Set the frequency domain weight expression for the luma plane.
  6062. @item weight_U
  6063. Set the frequency domain weight expression for the 1st chroma plane.
  6064. @item weight_V
  6065. Set the frequency domain weight expression for the 2nd chroma plane.
  6066. The filter accepts the following variables:
  6067. @item X
  6068. @item Y
  6069. The coordinates of the current sample.
  6070. @item W
  6071. @item H
  6072. The width and height of the image.
  6073. @end table
  6074. @subsection Examples
  6075. @itemize
  6076. @item
  6077. High-pass:
  6078. @example
  6079. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  6080. @end example
  6081. @item
  6082. Low-pass:
  6083. @example
  6084. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  6085. @end example
  6086. @item
  6087. Sharpen:
  6088. @example
  6089. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  6090. @end example
  6091. @item
  6092. Blur:
  6093. @example
  6094. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  6095. @end example
  6096. @end itemize
  6097. @section field
  6098. Extract a single field from an interlaced image using stride
  6099. arithmetic to avoid wasting CPU time. The output frames are marked as
  6100. non-interlaced.
  6101. The filter accepts the following options:
  6102. @table @option
  6103. @item type
  6104. Specify whether to extract the top (if the value is @code{0} or
  6105. @code{top}) or the bottom field (if the value is @code{1} or
  6106. @code{bottom}).
  6107. @end table
  6108. @section fieldhint
  6109. Create new frames by copying the top and bottom fields from surrounding frames
  6110. supplied as numbers by the hint file.
  6111. @table @option
  6112. @item hint
  6113. Set file containing hints: absolute/relative frame numbers.
  6114. There must be one line for each frame in a clip. Each line must contain two
  6115. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  6116. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  6117. is current frame number for @code{absolute} mode or out of [-1, 1] range
  6118. for @code{relative} mode. First number tells from which frame to pick up top
  6119. field and second number tells from which frame to pick up bottom field.
  6120. If optionally followed by @code{+} output frame will be marked as interlaced,
  6121. else if followed by @code{-} output frame will be marked as progressive, else
  6122. it will be marked same as input frame.
  6123. If line starts with @code{#} or @code{;} that line is skipped.
  6124. @item mode
  6125. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  6126. @end table
  6127. Example of first several lines of @code{hint} file for @code{relative} mode:
  6128. @example
  6129. 0,0 - # first frame
  6130. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  6131. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  6132. 1,0 -
  6133. 0,0 -
  6134. 0,0 -
  6135. 1,0 -
  6136. 1,0 -
  6137. 1,0 -
  6138. 0,0 -
  6139. 0,0 -
  6140. 1,0 -
  6141. 1,0 -
  6142. 1,0 -
  6143. 0,0 -
  6144. @end example
  6145. @section fieldmatch
  6146. Field matching filter for inverse telecine. It is meant to reconstruct the
  6147. progressive frames from a telecined stream. The filter does not drop duplicated
  6148. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  6149. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  6150. The separation of the field matching and the decimation is notably motivated by
  6151. the possibility of inserting a de-interlacing filter fallback between the two.
  6152. If the source has mixed telecined and real interlaced content,
  6153. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  6154. But these remaining combed frames will be marked as interlaced, and thus can be
  6155. de-interlaced by a later filter such as @ref{yadif} before decimation.
  6156. In addition to the various configuration options, @code{fieldmatch} can take an
  6157. optional second stream, activated through the @option{ppsrc} option. If
  6158. enabled, the frames reconstruction will be based on the fields and frames from
  6159. this second stream. This allows the first input to be pre-processed in order to
  6160. help the various algorithms of the filter, while keeping the output lossless
  6161. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  6162. or brightness/contrast adjustments can help.
  6163. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  6164. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  6165. which @code{fieldmatch} is based on. While the semantic and usage are very
  6166. close, some behaviour and options names can differ.
  6167. The @ref{decimate} filter currently only works for constant frame rate input.
  6168. If your input has mixed telecined (30fps) and progressive content with a lower
  6169. framerate like 24fps use the following filterchain to produce the necessary cfr
  6170. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  6171. The filter accepts the following options:
  6172. @table @option
  6173. @item order
  6174. Specify the assumed field order of the input stream. Available values are:
  6175. @table @samp
  6176. @item auto
  6177. Auto detect parity (use FFmpeg's internal parity value).
  6178. @item bff
  6179. Assume bottom field first.
  6180. @item tff
  6181. Assume top field first.
  6182. @end table
  6183. Note that it is sometimes recommended not to trust the parity announced by the
  6184. stream.
  6185. Default value is @var{auto}.
  6186. @item mode
  6187. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  6188. sense that it won't risk creating jerkiness due to duplicate frames when
  6189. possible, but if there are bad edits or blended fields it will end up
  6190. outputting combed frames when a good match might actually exist. On the other
  6191. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  6192. but will almost always find a good frame if there is one. The other values are
  6193. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  6194. jerkiness and creating duplicate frames versus finding good matches in sections
  6195. with bad edits, orphaned fields, blended fields, etc.
  6196. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  6197. Available values are:
  6198. @table @samp
  6199. @item pc
  6200. 2-way matching (p/c)
  6201. @item pc_n
  6202. 2-way matching, and trying 3rd match if still combed (p/c + n)
  6203. @item pc_u
  6204. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  6205. @item pc_n_ub
  6206. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  6207. still combed (p/c + n + u/b)
  6208. @item pcn
  6209. 3-way matching (p/c/n)
  6210. @item pcn_ub
  6211. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  6212. detected as combed (p/c/n + u/b)
  6213. @end table
  6214. The parenthesis at the end indicate the matches that would be used for that
  6215. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  6216. @var{top}).
  6217. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  6218. the slowest.
  6219. Default value is @var{pc_n}.
  6220. @item ppsrc
  6221. Mark the main input stream as a pre-processed input, and enable the secondary
  6222. input stream as the clean source to pick the fields from. See the filter
  6223. introduction for more details. It is similar to the @option{clip2} feature from
  6224. VFM/TFM.
  6225. Default value is @code{0} (disabled).
  6226. @item field
  6227. Set the field to match from. It is recommended to set this to the same value as
  6228. @option{order} unless you experience matching failures with that setting. In
  6229. certain circumstances changing the field that is used to match from can have a
  6230. large impact on matching performance. Available values are:
  6231. @table @samp
  6232. @item auto
  6233. Automatic (same value as @option{order}).
  6234. @item bottom
  6235. Match from the bottom field.
  6236. @item top
  6237. Match from the top field.
  6238. @end table
  6239. Default value is @var{auto}.
  6240. @item mchroma
  6241. Set whether or not chroma is included during the match comparisons. In most
  6242. cases it is recommended to leave this enabled. You should set this to @code{0}
  6243. only if your clip has bad chroma problems such as heavy rainbowing or other
  6244. artifacts. Setting this to @code{0} could also be used to speed things up at
  6245. the cost of some accuracy.
  6246. Default value is @code{1}.
  6247. @item y0
  6248. @item y1
  6249. These define an exclusion band which excludes the lines between @option{y0} and
  6250. @option{y1} from being included in the field matching decision. An exclusion
  6251. band can be used to ignore subtitles, a logo, or other things that may
  6252. interfere with the matching. @option{y0} sets the starting scan line and
  6253. @option{y1} sets the ending line; all lines in between @option{y0} and
  6254. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  6255. @option{y0} and @option{y1} to the same value will disable the feature.
  6256. @option{y0} and @option{y1} defaults to @code{0}.
  6257. @item scthresh
  6258. Set the scene change detection threshold as a percentage of maximum change on
  6259. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  6260. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  6261. @option{scthresh} is @code{[0.0, 100.0]}.
  6262. Default value is @code{12.0}.
  6263. @item combmatch
  6264. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  6265. account the combed scores of matches when deciding what match to use as the
  6266. final match. Available values are:
  6267. @table @samp
  6268. @item none
  6269. No final matching based on combed scores.
  6270. @item sc
  6271. Combed scores are only used when a scene change is detected.
  6272. @item full
  6273. Use combed scores all the time.
  6274. @end table
  6275. Default is @var{sc}.
  6276. @item combdbg
  6277. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  6278. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  6279. Available values are:
  6280. @table @samp
  6281. @item none
  6282. No forced calculation.
  6283. @item pcn
  6284. Force p/c/n calculations.
  6285. @item pcnub
  6286. Force p/c/n/u/b calculations.
  6287. @end table
  6288. Default value is @var{none}.
  6289. @item cthresh
  6290. This is the area combing threshold used for combed frame detection. This
  6291. essentially controls how "strong" or "visible" combing must be to be detected.
  6292. Larger values mean combing must be more visible and smaller values mean combing
  6293. can be less visible or strong and still be detected. Valid settings are from
  6294. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  6295. be detected as combed). This is basically a pixel difference value. A good
  6296. range is @code{[8, 12]}.
  6297. Default value is @code{9}.
  6298. @item chroma
  6299. Sets whether or not chroma is considered in the combed frame decision. Only
  6300. disable this if your source has chroma problems (rainbowing, etc.) that are
  6301. causing problems for the combed frame detection with chroma enabled. Actually,
  6302. using @option{chroma}=@var{0} is usually more reliable, except for the case
  6303. where there is chroma only combing in the source.
  6304. Default value is @code{0}.
  6305. @item blockx
  6306. @item blocky
  6307. Respectively set the x-axis and y-axis size of the window used during combed
  6308. frame detection. This has to do with the size of the area in which
  6309. @option{combpel} pixels are required to be detected as combed for a frame to be
  6310. declared combed. See the @option{combpel} parameter description for more info.
  6311. Possible values are any number that is a power of 2 starting at 4 and going up
  6312. to 512.
  6313. Default value is @code{16}.
  6314. @item combpel
  6315. The number of combed pixels inside any of the @option{blocky} by
  6316. @option{blockx} size blocks on the frame for the frame to be detected as
  6317. combed. While @option{cthresh} controls how "visible" the combing must be, this
  6318. setting controls "how much" combing there must be in any localized area (a
  6319. window defined by the @option{blockx} and @option{blocky} settings) on the
  6320. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  6321. which point no frames will ever be detected as combed). This setting is known
  6322. as @option{MI} in TFM/VFM vocabulary.
  6323. Default value is @code{80}.
  6324. @end table
  6325. @anchor{p/c/n/u/b meaning}
  6326. @subsection p/c/n/u/b meaning
  6327. @subsubsection p/c/n
  6328. We assume the following telecined stream:
  6329. @example
  6330. Top fields: 1 2 2 3 4
  6331. Bottom fields: 1 2 3 4 4
  6332. @end example
  6333. The numbers correspond to the progressive frame the fields relate to. Here, the
  6334. first two frames are progressive, the 3rd and 4th are combed, and so on.
  6335. When @code{fieldmatch} is configured to run a matching from bottom
  6336. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  6337. @example
  6338. Input stream:
  6339. T 1 2 2 3 4
  6340. B 1 2 3 4 4 <-- matching reference
  6341. Matches: c c n n c
  6342. Output stream:
  6343. T 1 2 3 4 4
  6344. B 1 2 3 4 4
  6345. @end example
  6346. As a result of the field matching, we can see that some frames get duplicated.
  6347. To perform a complete inverse telecine, you need to rely on a decimation filter
  6348. after this operation. See for instance the @ref{decimate} filter.
  6349. The same operation now matching from top fields (@option{field}=@var{top})
  6350. looks like this:
  6351. @example
  6352. Input stream:
  6353. T 1 2 2 3 4 <-- matching reference
  6354. B 1 2 3 4 4
  6355. Matches: c c p p c
  6356. Output stream:
  6357. T 1 2 2 3 4
  6358. B 1 2 2 3 4
  6359. @end example
  6360. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  6361. basically, they refer to the frame and field of the opposite parity:
  6362. @itemize
  6363. @item @var{p} matches the field of the opposite parity in the previous frame
  6364. @item @var{c} matches the field of the opposite parity in the current frame
  6365. @item @var{n} matches the field of the opposite parity in the next frame
  6366. @end itemize
  6367. @subsubsection u/b
  6368. The @var{u} and @var{b} matching are a bit special in the sense that they match
  6369. from the opposite parity flag. In the following examples, we assume that we are
  6370. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  6371. 'x' is placed above and below each matched fields.
  6372. With bottom matching (@option{field}=@var{bottom}):
  6373. @example
  6374. Match: c p n b u
  6375. x x x x x
  6376. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6377. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6378. x x x x x
  6379. Output frames:
  6380. 2 1 2 2 2
  6381. 2 2 2 1 3
  6382. @end example
  6383. With top matching (@option{field}=@var{top}):
  6384. @example
  6385. Match: c p n b u
  6386. x x x x x
  6387. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6388. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6389. x x x x x
  6390. Output frames:
  6391. 2 2 2 1 2
  6392. 2 1 3 2 2
  6393. @end example
  6394. @subsection Examples
  6395. Simple IVTC of a top field first telecined stream:
  6396. @example
  6397. fieldmatch=order=tff:combmatch=none, decimate
  6398. @end example
  6399. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  6400. @example
  6401. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  6402. @end example
  6403. @section fieldorder
  6404. Transform the field order of the input video.
  6405. It accepts the following parameters:
  6406. @table @option
  6407. @item order
  6408. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  6409. for bottom field first.
  6410. @end table
  6411. The default value is @samp{tff}.
  6412. The transformation is done by shifting the picture content up or down
  6413. by one line, and filling the remaining line with appropriate picture content.
  6414. This method is consistent with most broadcast field order converters.
  6415. If the input video is not flagged as being interlaced, or it is already
  6416. flagged as being of the required output field order, then this filter does
  6417. not alter the incoming video.
  6418. It is very useful when converting to or from PAL DV material,
  6419. which is bottom field first.
  6420. For example:
  6421. @example
  6422. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  6423. @end example
  6424. @section fifo, afifo
  6425. Buffer input images and send them when they are requested.
  6426. It is mainly useful when auto-inserted by the libavfilter
  6427. framework.
  6428. It does not take parameters.
  6429. @section find_rect
  6430. Find a rectangular object
  6431. It accepts the following options:
  6432. @table @option
  6433. @item object
  6434. Filepath of the object image, needs to be in gray8.
  6435. @item threshold
  6436. Detection threshold, default is 0.5.
  6437. @item mipmaps
  6438. Number of mipmaps, default is 3.
  6439. @item xmin, ymin, xmax, ymax
  6440. Specifies the rectangle in which to search.
  6441. @end table
  6442. @subsection Examples
  6443. @itemize
  6444. @item
  6445. Generate a representative palette of a given video using @command{ffmpeg}:
  6446. @example
  6447. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6448. @end example
  6449. @end itemize
  6450. @section cover_rect
  6451. Cover a rectangular object
  6452. It accepts the following options:
  6453. @table @option
  6454. @item cover
  6455. Filepath of the optional cover image, needs to be in yuv420.
  6456. @item mode
  6457. Set covering mode.
  6458. It accepts the following values:
  6459. @table @samp
  6460. @item cover
  6461. cover it by the supplied image
  6462. @item blur
  6463. cover it by interpolating the surrounding pixels
  6464. @end table
  6465. Default value is @var{blur}.
  6466. @end table
  6467. @subsection Examples
  6468. @itemize
  6469. @item
  6470. Generate a representative palette of a given video using @command{ffmpeg}:
  6471. @example
  6472. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6473. @end example
  6474. @end itemize
  6475. @anchor{format}
  6476. @section format
  6477. Convert the input video to one of the specified pixel formats.
  6478. Libavfilter will try to pick one that is suitable as input to
  6479. the next filter.
  6480. It accepts the following parameters:
  6481. @table @option
  6482. @item pix_fmts
  6483. A '|'-separated list of pixel format names, such as
  6484. "pix_fmts=yuv420p|monow|rgb24".
  6485. @end table
  6486. @subsection Examples
  6487. @itemize
  6488. @item
  6489. Convert the input video to the @var{yuv420p} format
  6490. @example
  6491. format=pix_fmts=yuv420p
  6492. @end example
  6493. Convert the input video to any of the formats in the list
  6494. @example
  6495. format=pix_fmts=yuv420p|yuv444p|yuv410p
  6496. @end example
  6497. @end itemize
  6498. @anchor{fps}
  6499. @section fps
  6500. Convert the video to specified constant frame rate by duplicating or dropping
  6501. frames as necessary.
  6502. It accepts the following parameters:
  6503. @table @option
  6504. @item fps
  6505. The desired output frame rate. The default is @code{25}.
  6506. @item round
  6507. Rounding method.
  6508. Possible values are:
  6509. @table @option
  6510. @item zero
  6511. zero round towards 0
  6512. @item inf
  6513. round away from 0
  6514. @item down
  6515. round towards -infinity
  6516. @item up
  6517. round towards +infinity
  6518. @item near
  6519. round to nearest
  6520. @end table
  6521. The default is @code{near}.
  6522. @item start_time
  6523. Assume the first PTS should be the given value, in seconds. This allows for
  6524. padding/trimming at the start of stream. By default, no assumption is made
  6525. about the first frame's expected PTS, so no padding or trimming is done.
  6526. For example, this could be set to 0 to pad the beginning with duplicates of
  6527. the first frame if a video stream starts after the audio stream or to trim any
  6528. frames with a negative PTS.
  6529. @end table
  6530. Alternatively, the options can be specified as a flat string:
  6531. @var{fps}[:@var{round}].
  6532. See also the @ref{setpts} filter.
  6533. @subsection Examples
  6534. @itemize
  6535. @item
  6536. A typical usage in order to set the fps to 25:
  6537. @example
  6538. fps=fps=25
  6539. @end example
  6540. @item
  6541. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  6542. @example
  6543. fps=fps=film:round=near
  6544. @end example
  6545. @end itemize
  6546. @section framepack
  6547. Pack two different video streams into a stereoscopic video, setting proper
  6548. metadata on supported codecs. The two views should have the same size and
  6549. framerate and processing will stop when the shorter video ends. Please note
  6550. that you may conveniently adjust view properties with the @ref{scale} and
  6551. @ref{fps} filters.
  6552. It accepts the following parameters:
  6553. @table @option
  6554. @item format
  6555. The desired packing format. Supported values are:
  6556. @table @option
  6557. @item sbs
  6558. The views are next to each other (default).
  6559. @item tab
  6560. The views are on top of each other.
  6561. @item lines
  6562. The views are packed by line.
  6563. @item columns
  6564. The views are packed by column.
  6565. @item frameseq
  6566. The views are temporally interleaved.
  6567. @end table
  6568. @end table
  6569. Some examples:
  6570. @example
  6571. # Convert left and right views into a frame-sequential video
  6572. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  6573. # Convert views into a side-by-side video with the same output resolution as the input
  6574. 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
  6575. @end example
  6576. @section framerate
  6577. Change the frame rate by interpolating new video output frames from the source
  6578. frames.
  6579. This filter is not designed to function correctly with interlaced media. If
  6580. you wish to change the frame rate of interlaced media then you are required
  6581. to deinterlace before this filter and re-interlace after this filter.
  6582. A description of the accepted options follows.
  6583. @table @option
  6584. @item fps
  6585. Specify the output frames per second. This option can also be specified
  6586. as a value alone. The default is @code{50}.
  6587. @item interp_start
  6588. Specify the start of a range where the output frame will be created as a
  6589. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6590. the default is @code{15}.
  6591. @item interp_end
  6592. Specify the end of a range where the output frame will be created as a
  6593. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6594. the default is @code{240}.
  6595. @item scene
  6596. Specify the level at which a scene change is detected as a value between
  6597. 0 and 100 to indicate a new scene; a low value reflects a low
  6598. probability for the current frame to introduce a new scene, while a higher
  6599. value means the current frame is more likely to be one.
  6600. The default is @code{7}.
  6601. @item flags
  6602. Specify flags influencing the filter process.
  6603. Available value for @var{flags} is:
  6604. @table @option
  6605. @item scene_change_detect, scd
  6606. Enable scene change detection using the value of the option @var{scene}.
  6607. This flag is enabled by default.
  6608. @end table
  6609. @end table
  6610. @section framestep
  6611. Select one frame every N-th frame.
  6612. This filter accepts the following option:
  6613. @table @option
  6614. @item step
  6615. Select frame after every @code{step} frames.
  6616. Allowed values are positive integers higher than 0. Default value is @code{1}.
  6617. @end table
  6618. @anchor{frei0r}
  6619. @section frei0r
  6620. Apply a frei0r effect to the input video.
  6621. To enable the compilation of this filter, you need to install the frei0r
  6622. header and configure FFmpeg with @code{--enable-frei0r}.
  6623. It accepts the following parameters:
  6624. @table @option
  6625. @item filter_name
  6626. The name of the frei0r effect to load. If the environment variable
  6627. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  6628. directories specified by the colon-separated list in @env{FREIOR_PATH}.
  6629. Otherwise, the standard frei0r paths are searched, in this order:
  6630. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  6631. @file{/usr/lib/frei0r-1/}.
  6632. @item filter_params
  6633. A '|'-separated list of parameters to pass to the frei0r effect.
  6634. @end table
  6635. A frei0r effect parameter can be a boolean (its value is either
  6636. "y" or "n"), a double, a color (specified as
  6637. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  6638. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  6639. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  6640. @var{X} and @var{Y} are floating point numbers) and/or a string.
  6641. The number and types of parameters depend on the loaded effect. If an
  6642. effect parameter is not specified, the default value is set.
  6643. @subsection Examples
  6644. @itemize
  6645. @item
  6646. Apply the distort0r effect, setting the first two double parameters:
  6647. @example
  6648. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  6649. @end example
  6650. @item
  6651. Apply the colordistance effect, taking a color as the first parameter:
  6652. @example
  6653. frei0r=colordistance:0.2/0.3/0.4
  6654. frei0r=colordistance:violet
  6655. frei0r=colordistance:0x112233
  6656. @end example
  6657. @item
  6658. Apply the perspective effect, specifying the top left and top right image
  6659. positions:
  6660. @example
  6661. frei0r=perspective:0.2/0.2|0.8/0.2
  6662. @end example
  6663. @end itemize
  6664. For more information, see
  6665. @url{http://frei0r.dyne.org}
  6666. @section fspp
  6667. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  6668. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  6669. processing filter, one of them is performed once per block, not per pixel.
  6670. This allows for much higher speed.
  6671. The filter accepts the following options:
  6672. @table @option
  6673. @item quality
  6674. Set quality. This option defines the number of levels for averaging. It accepts
  6675. an integer in the range 4-5. Default value is @code{4}.
  6676. @item qp
  6677. Force a constant quantization parameter. It accepts an integer in range 0-63.
  6678. If not set, the filter will use the QP from the video stream (if available).
  6679. @item strength
  6680. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  6681. more details but also more artifacts, while higher values make the image smoother
  6682. but also blurrier. Default value is @code{0} − PSNR optimal.
  6683. @item use_bframe_qp
  6684. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  6685. option may cause flicker since the B-Frames have often larger QP. Default is
  6686. @code{0} (not enabled).
  6687. @end table
  6688. @section gblur
  6689. Apply Gaussian blur filter.
  6690. The filter accepts the following options:
  6691. @table @option
  6692. @item sigma
  6693. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  6694. @item steps
  6695. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  6696. @item planes
  6697. Set which planes to filter. By default all planes are filtered.
  6698. @item sigmaV
  6699. Set vertical sigma, if negative it will be same as @code{sigma}.
  6700. Default is @code{-1}.
  6701. @end table
  6702. @section geq
  6703. The filter accepts the following options:
  6704. @table @option
  6705. @item lum_expr, lum
  6706. Set the luminance expression.
  6707. @item cb_expr, cb
  6708. Set the chrominance blue expression.
  6709. @item cr_expr, cr
  6710. Set the chrominance red expression.
  6711. @item alpha_expr, a
  6712. Set the alpha expression.
  6713. @item red_expr, r
  6714. Set the red expression.
  6715. @item green_expr, g
  6716. Set the green expression.
  6717. @item blue_expr, b
  6718. Set the blue expression.
  6719. @end table
  6720. The colorspace is selected according to the specified options. If one
  6721. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  6722. options is specified, the filter will automatically select a YCbCr
  6723. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  6724. @option{blue_expr} options is specified, it will select an RGB
  6725. colorspace.
  6726. If one of the chrominance expression is not defined, it falls back on the other
  6727. one. If no alpha expression is specified it will evaluate to opaque value.
  6728. If none of chrominance expressions are specified, they will evaluate
  6729. to the luminance expression.
  6730. The expressions can use the following variables and functions:
  6731. @table @option
  6732. @item N
  6733. The sequential number of the filtered frame, starting from @code{0}.
  6734. @item X
  6735. @item Y
  6736. The coordinates of the current sample.
  6737. @item W
  6738. @item H
  6739. The width and height of the image.
  6740. @item SW
  6741. @item SH
  6742. Width and height scale depending on the currently filtered plane. It is the
  6743. ratio between the corresponding luma plane number of pixels and the current
  6744. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  6745. @code{0.5,0.5} for chroma planes.
  6746. @item T
  6747. Time of the current frame, expressed in seconds.
  6748. @item p(x, y)
  6749. Return the value of the pixel at location (@var{x},@var{y}) of the current
  6750. plane.
  6751. @item lum(x, y)
  6752. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  6753. plane.
  6754. @item cb(x, y)
  6755. Return the value of the pixel at location (@var{x},@var{y}) of the
  6756. blue-difference chroma plane. Return 0 if there is no such plane.
  6757. @item cr(x, y)
  6758. Return the value of the pixel at location (@var{x},@var{y}) of the
  6759. red-difference chroma plane. Return 0 if there is no such plane.
  6760. @item r(x, y)
  6761. @item g(x, y)
  6762. @item b(x, y)
  6763. Return the value of the pixel at location (@var{x},@var{y}) of the
  6764. red/green/blue component. Return 0 if there is no such component.
  6765. @item alpha(x, y)
  6766. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  6767. plane. Return 0 if there is no such plane.
  6768. @end table
  6769. For functions, if @var{x} and @var{y} are outside the area, the value will be
  6770. automatically clipped to the closer edge.
  6771. @subsection Examples
  6772. @itemize
  6773. @item
  6774. Flip the image horizontally:
  6775. @example
  6776. geq=p(W-X\,Y)
  6777. @end example
  6778. @item
  6779. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  6780. wavelength of 100 pixels:
  6781. @example
  6782. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  6783. @end example
  6784. @item
  6785. Generate a fancy enigmatic moving light:
  6786. @example
  6787. 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
  6788. @end example
  6789. @item
  6790. Generate a quick emboss effect:
  6791. @example
  6792. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  6793. @end example
  6794. @item
  6795. Modify RGB components depending on pixel position:
  6796. @example
  6797. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  6798. @end example
  6799. @item
  6800. Create a radial gradient that is the same size as the input (also see
  6801. the @ref{vignette} filter):
  6802. @example
  6803. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  6804. @end example
  6805. @end itemize
  6806. @section gradfun
  6807. Fix the banding artifacts that are sometimes introduced into nearly flat
  6808. regions by truncation to 8-bit color depth.
  6809. Interpolate the gradients that should go where the bands are, and
  6810. dither them.
  6811. It is designed for playback only. Do not use it prior to
  6812. lossy compression, because compression tends to lose the dither and
  6813. bring back the bands.
  6814. It accepts the following parameters:
  6815. @table @option
  6816. @item strength
  6817. The maximum amount by which the filter will change any one pixel. This is also
  6818. the threshold for detecting nearly flat regions. Acceptable values range from
  6819. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  6820. valid range.
  6821. @item radius
  6822. The neighborhood to fit the gradient to. A larger radius makes for smoother
  6823. gradients, but also prevents the filter from modifying the pixels near detailed
  6824. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  6825. values will be clipped to the valid range.
  6826. @end table
  6827. Alternatively, the options can be specified as a flat string:
  6828. @var{strength}[:@var{radius}]
  6829. @subsection Examples
  6830. @itemize
  6831. @item
  6832. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  6833. @example
  6834. gradfun=3.5:8
  6835. @end example
  6836. @item
  6837. Specify radius, omitting the strength (which will fall-back to the default
  6838. value):
  6839. @example
  6840. gradfun=radius=8
  6841. @end example
  6842. @end itemize
  6843. @anchor{haldclut}
  6844. @section haldclut
  6845. Apply a Hald CLUT to a video stream.
  6846. First input is the video stream to process, and second one is the Hald CLUT.
  6847. The Hald CLUT input can be a simple picture or a complete video stream.
  6848. The filter accepts the following options:
  6849. @table @option
  6850. @item shortest
  6851. Force termination when the shortest input terminates. Default is @code{0}.
  6852. @item repeatlast
  6853. Continue applying the last CLUT after the end of the stream. A value of
  6854. @code{0} disable the filter after the last frame of the CLUT is reached.
  6855. Default is @code{1}.
  6856. @end table
  6857. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  6858. filters share the same internals).
  6859. More information about the Hald CLUT can be found on Eskil Steenberg's website
  6860. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  6861. @subsection Workflow examples
  6862. @subsubsection Hald CLUT video stream
  6863. Generate an identity Hald CLUT stream altered with various effects:
  6864. @example
  6865. 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
  6866. @end example
  6867. Note: make sure you use a lossless codec.
  6868. Then use it with @code{haldclut} to apply it on some random stream:
  6869. @example
  6870. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  6871. @end example
  6872. The Hald CLUT will be applied to the 10 first seconds (duration of
  6873. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  6874. to the remaining frames of the @code{mandelbrot} stream.
  6875. @subsubsection Hald CLUT with preview
  6876. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  6877. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  6878. biggest possible square starting at the top left of the picture. The remaining
  6879. padding pixels (bottom or right) will be ignored. This area can be used to add
  6880. a preview of the Hald CLUT.
  6881. Typically, the following generated Hald CLUT will be supported by the
  6882. @code{haldclut} filter:
  6883. @example
  6884. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  6885. pad=iw+320 [padded_clut];
  6886. smptebars=s=320x256, split [a][b];
  6887. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  6888. [main][b] overlay=W-320" -frames:v 1 clut.png
  6889. @end example
  6890. It contains the original and a preview of the effect of the CLUT: SMPTE color
  6891. bars are displayed on the right-top, and below the same color bars processed by
  6892. the color changes.
  6893. Then, the effect of this Hald CLUT can be visualized with:
  6894. @example
  6895. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  6896. @end example
  6897. @section hflip
  6898. Flip the input video horizontally.
  6899. For example, to horizontally flip the input video with @command{ffmpeg}:
  6900. @example
  6901. ffmpeg -i in.avi -vf "hflip" out.avi
  6902. @end example
  6903. @section histeq
  6904. This filter applies a global color histogram equalization on a
  6905. per-frame basis.
  6906. It can be used to correct video that has a compressed range of pixel
  6907. intensities. The filter redistributes the pixel intensities to
  6908. equalize their distribution across the intensity range. It may be
  6909. viewed as an "automatically adjusting contrast filter". This filter is
  6910. useful only for correcting degraded or poorly captured source
  6911. video.
  6912. The filter accepts the following options:
  6913. @table @option
  6914. @item strength
  6915. Determine the amount of equalization to be applied. As the strength
  6916. is reduced, the distribution of pixel intensities more-and-more
  6917. approaches that of the input frame. The value must be a float number
  6918. in the range [0,1] and defaults to 0.200.
  6919. @item intensity
  6920. Set the maximum intensity that can generated and scale the output
  6921. values appropriately. The strength should be set as desired and then
  6922. the intensity can be limited if needed to avoid washing-out. The value
  6923. must be a float number in the range [0,1] and defaults to 0.210.
  6924. @item antibanding
  6925. Set the antibanding level. If enabled the filter will randomly vary
  6926. the luminance of output pixels by a small amount to avoid banding of
  6927. the histogram. Possible values are @code{none}, @code{weak} or
  6928. @code{strong}. It defaults to @code{none}.
  6929. @end table
  6930. @section histogram
  6931. Compute and draw a color distribution histogram for the input video.
  6932. The computed histogram is a representation of the color component
  6933. distribution in an image.
  6934. Standard histogram displays the color components distribution in an image.
  6935. Displays color graph for each color component. Shows distribution of
  6936. the Y, U, V, A or R, G, B components, depending on input format, in the
  6937. current frame. Below each graph a color component scale meter is shown.
  6938. The filter accepts the following options:
  6939. @table @option
  6940. @item level_height
  6941. Set height of level. Default value is @code{200}.
  6942. Allowed range is [50, 2048].
  6943. @item scale_height
  6944. Set height of color scale. Default value is @code{12}.
  6945. Allowed range is [0, 40].
  6946. @item display_mode
  6947. Set display mode.
  6948. It accepts the following values:
  6949. @table @samp
  6950. @item stack
  6951. Per color component graphs are placed below each other.
  6952. @item parade
  6953. Per color component graphs are placed side by side.
  6954. @item overlay
  6955. Presents information identical to that in the @code{parade}, except
  6956. that the graphs representing color components are superimposed directly
  6957. over one another.
  6958. @end table
  6959. Default is @code{stack}.
  6960. @item levels_mode
  6961. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  6962. Default is @code{linear}.
  6963. @item components
  6964. Set what color components to display.
  6965. Default is @code{7}.
  6966. @item fgopacity
  6967. Set foreground opacity. Default is @code{0.7}.
  6968. @item bgopacity
  6969. Set background opacity. Default is @code{0.5}.
  6970. @end table
  6971. @subsection Examples
  6972. @itemize
  6973. @item
  6974. Calculate and draw histogram:
  6975. @example
  6976. ffplay -i input -vf histogram
  6977. @end example
  6978. @end itemize
  6979. @anchor{hqdn3d}
  6980. @section hqdn3d
  6981. This is a high precision/quality 3d denoise filter. It aims to reduce
  6982. image noise, producing smooth images and making still images really
  6983. still. It should enhance compressibility.
  6984. It accepts the following optional parameters:
  6985. @table @option
  6986. @item luma_spatial
  6987. A non-negative floating point number which specifies spatial luma strength.
  6988. It defaults to 4.0.
  6989. @item chroma_spatial
  6990. A non-negative floating point number which specifies spatial chroma strength.
  6991. It defaults to 3.0*@var{luma_spatial}/4.0.
  6992. @item luma_tmp
  6993. A floating point number which specifies luma temporal strength. It defaults to
  6994. 6.0*@var{luma_spatial}/4.0.
  6995. @item chroma_tmp
  6996. A floating point number which specifies chroma temporal strength. It defaults to
  6997. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  6998. @end table
  6999. @section hwdownload
  7000. Download hardware frames to system memory.
  7001. The input must be in hardware frames, and the output a non-hardware format.
  7002. Not all formats will be supported on the output - it may be necessary to insert
  7003. an additional @option{format} filter immediately following in the graph to get
  7004. the output in a supported format.
  7005. @section hwmap
  7006. Map hardware frames to system memory or to another device.
  7007. This filter has several different modes of operation; which one is used depends
  7008. on the input and output formats:
  7009. @itemize
  7010. @item
  7011. Hardware frame input, normal frame output
  7012. Map the input frames to system memory and pass them to the output. If the
  7013. original hardware frame is later required (for example, after overlaying
  7014. something else on part of it), the @option{hwmap} filter can be used again
  7015. in the next mode to retrieve it.
  7016. @item
  7017. Normal frame input, hardware frame output
  7018. If the input is actually a software-mapped hardware frame, then unmap it -
  7019. that is, return the original hardware frame.
  7020. Otherwise, a device must be provided. Create new hardware surfaces on that
  7021. device for the output, then map them back to the software format at the input
  7022. and give those frames to the preceding filter. This will then act like the
  7023. @option{hwupload} filter, but may be able to avoid an additional copy when
  7024. the input is already in a compatible format.
  7025. @item
  7026. Hardware frame input and output
  7027. A device must be supplied for the output, either directly or with the
  7028. @option{derive_device} option. The input and output devices must be of
  7029. different types and compatible - the exact meaning of this is
  7030. system-dependent, but typically it means that they must refer to the same
  7031. underlying hardware context (for example, refer to the same graphics card).
  7032. If the input frames were originally created on the output device, then unmap
  7033. to retrieve the original frames.
  7034. Otherwise, map the frames to the output device - create new hardware frames
  7035. on the output corresponding to the frames on the input.
  7036. @end itemize
  7037. The following additional parameters are accepted:
  7038. @table @option
  7039. @item mode
  7040. Set the frame mapping mode. Some combination of:
  7041. @table @var
  7042. @item read
  7043. The mapped frame should be readable.
  7044. @item write
  7045. The mapped frame should be writeable.
  7046. @item overwrite
  7047. The mapping will always overwrite the entire frame.
  7048. This may improve performance in some cases, as the original contents of the
  7049. frame need not be loaded.
  7050. @item direct
  7051. The mapping must not involve any copying.
  7052. Indirect mappings to copies of frames are created in some cases where either
  7053. direct mapping is not possible or it would have unexpected properties.
  7054. Setting this flag ensures that the mapping is direct and will fail if that is
  7055. not possible.
  7056. @end table
  7057. Defaults to @var{read+write} if not specified.
  7058. @item derive_device @var{type}
  7059. Rather than using the device supplied at initialisation, instead derive a new
  7060. device of type @var{type} from the device the input frames exist on.
  7061. @item reverse
  7062. In a hardware to hardware mapping, map in reverse - create frames in the sink
  7063. and map them back to the source. This may be necessary in some cases where
  7064. a mapping in one direction is required but only the opposite direction is
  7065. supported by the devices being used.
  7066. This option is dangerous - it may break the preceding filter in undefined
  7067. ways if there are any additional constraints on that filter's output.
  7068. Do not use it without fully understanding the implications of its use.
  7069. @end table
  7070. @section hwupload
  7071. Upload system memory frames to hardware surfaces.
  7072. The device to upload to must be supplied when the filter is initialised. If
  7073. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  7074. option.
  7075. @anchor{hwupload_cuda}
  7076. @section hwupload_cuda
  7077. Upload system memory frames to a CUDA device.
  7078. It accepts the following optional parameters:
  7079. @table @option
  7080. @item device
  7081. The number of the CUDA device to use
  7082. @end table
  7083. @section hqx
  7084. Apply a high-quality magnification filter designed for pixel art. This filter
  7085. was originally created by Maxim Stepin.
  7086. It accepts the following option:
  7087. @table @option
  7088. @item n
  7089. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  7090. @code{hq3x} and @code{4} for @code{hq4x}.
  7091. Default is @code{3}.
  7092. @end table
  7093. @section hstack
  7094. Stack input videos horizontally.
  7095. All streams must be of same pixel format and of same height.
  7096. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  7097. to create same output.
  7098. The filter accept the following option:
  7099. @table @option
  7100. @item inputs
  7101. Set number of input streams. Default is 2.
  7102. @item shortest
  7103. If set to 1, force the output to terminate when the shortest input
  7104. terminates. Default value is 0.
  7105. @end table
  7106. @section hue
  7107. Modify the hue and/or the saturation of the input.
  7108. It accepts the following parameters:
  7109. @table @option
  7110. @item h
  7111. Specify the hue angle as a number of degrees. It accepts an expression,
  7112. and defaults to "0".
  7113. @item s
  7114. Specify the saturation in the [-10,10] range. It accepts an expression and
  7115. defaults to "1".
  7116. @item H
  7117. Specify the hue angle as a number of radians. It accepts an
  7118. expression, and defaults to "0".
  7119. @item b
  7120. Specify the brightness in the [-10,10] range. It accepts an expression and
  7121. defaults to "0".
  7122. @end table
  7123. @option{h} and @option{H} are mutually exclusive, and can't be
  7124. specified at the same time.
  7125. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  7126. expressions containing the following constants:
  7127. @table @option
  7128. @item n
  7129. frame count of the input frame starting from 0
  7130. @item pts
  7131. presentation timestamp of the input frame expressed in time base units
  7132. @item r
  7133. frame rate of the input video, NAN if the input frame rate is unknown
  7134. @item t
  7135. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7136. @item tb
  7137. time base of the input video
  7138. @end table
  7139. @subsection Examples
  7140. @itemize
  7141. @item
  7142. Set the hue to 90 degrees and the saturation to 1.0:
  7143. @example
  7144. hue=h=90:s=1
  7145. @end example
  7146. @item
  7147. Same command but expressing the hue in radians:
  7148. @example
  7149. hue=H=PI/2:s=1
  7150. @end example
  7151. @item
  7152. Rotate hue and make the saturation swing between 0
  7153. and 2 over a period of 1 second:
  7154. @example
  7155. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  7156. @end example
  7157. @item
  7158. Apply a 3 seconds saturation fade-in effect starting at 0:
  7159. @example
  7160. hue="s=min(t/3\,1)"
  7161. @end example
  7162. The general fade-in expression can be written as:
  7163. @example
  7164. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  7165. @end example
  7166. @item
  7167. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  7168. @example
  7169. hue="s=max(0\, min(1\, (8-t)/3))"
  7170. @end example
  7171. The general fade-out expression can be written as:
  7172. @example
  7173. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  7174. @end example
  7175. @end itemize
  7176. @subsection Commands
  7177. This filter supports the following commands:
  7178. @table @option
  7179. @item b
  7180. @item s
  7181. @item h
  7182. @item H
  7183. Modify the hue and/or the saturation and/or brightness of the input video.
  7184. The command accepts the same syntax of the corresponding option.
  7185. If the specified expression is not valid, it is kept at its current
  7186. value.
  7187. @end table
  7188. @section hysteresis
  7189. Grow first stream into second stream by connecting components.
  7190. This makes it possible to build more robust edge masks.
  7191. This filter accepts the following options:
  7192. @table @option
  7193. @item planes
  7194. Set which planes will be processed as bitmap, unprocessed planes will be
  7195. copied from first stream.
  7196. By default value 0xf, all planes will be processed.
  7197. @item threshold
  7198. Set threshold which is used in filtering. If pixel component value is higher than
  7199. this value filter algorithm for connecting components is activated.
  7200. By default value is 0.
  7201. @end table
  7202. @section idet
  7203. Detect video interlacing type.
  7204. This filter tries to detect if the input frames are interlaced, progressive,
  7205. top or bottom field first. It will also try to detect fields that are
  7206. repeated between adjacent frames (a sign of telecine).
  7207. Single frame detection considers only immediately adjacent frames when classifying each frame.
  7208. Multiple frame detection incorporates the classification history of previous frames.
  7209. The filter will log these metadata values:
  7210. @table @option
  7211. @item single.current_frame
  7212. Detected type of current frame using single-frame detection. One of:
  7213. ``tff'' (top field first), ``bff'' (bottom field first),
  7214. ``progressive'', or ``undetermined''
  7215. @item single.tff
  7216. Cumulative number of frames detected as top field first using single-frame detection.
  7217. @item multiple.tff
  7218. Cumulative number of frames detected as top field first using multiple-frame detection.
  7219. @item single.bff
  7220. Cumulative number of frames detected as bottom field first using single-frame detection.
  7221. @item multiple.current_frame
  7222. Detected type of current frame using multiple-frame detection. One of:
  7223. ``tff'' (top field first), ``bff'' (bottom field first),
  7224. ``progressive'', or ``undetermined''
  7225. @item multiple.bff
  7226. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  7227. @item single.progressive
  7228. Cumulative number of frames detected as progressive using single-frame detection.
  7229. @item multiple.progressive
  7230. Cumulative number of frames detected as progressive using multiple-frame detection.
  7231. @item single.undetermined
  7232. Cumulative number of frames that could not be classified using single-frame detection.
  7233. @item multiple.undetermined
  7234. Cumulative number of frames that could not be classified using multiple-frame detection.
  7235. @item repeated.current_frame
  7236. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  7237. @item repeated.neither
  7238. Cumulative number of frames with no repeated field.
  7239. @item repeated.top
  7240. Cumulative number of frames with the top field repeated from the previous frame's top field.
  7241. @item repeated.bottom
  7242. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  7243. @end table
  7244. The filter accepts the following options:
  7245. @table @option
  7246. @item intl_thres
  7247. Set interlacing threshold.
  7248. @item prog_thres
  7249. Set progressive threshold.
  7250. @item rep_thres
  7251. Threshold for repeated field detection.
  7252. @item half_life
  7253. Number of frames after which a given frame's contribution to the
  7254. statistics is halved (i.e., it contributes only 0.5 to its
  7255. classification). The default of 0 means that all frames seen are given
  7256. full weight of 1.0 forever.
  7257. @item analyze_interlaced_flag
  7258. When this is not 0 then idet will use the specified number of frames to determine
  7259. if the interlaced flag is accurate, it will not count undetermined frames.
  7260. If the flag is found to be accurate it will be used without any further
  7261. computations, if it is found to be inaccurate it will be cleared without any
  7262. further computations. This allows inserting the idet filter as a low computational
  7263. method to clean up the interlaced flag
  7264. @end table
  7265. @section il
  7266. Deinterleave or interleave fields.
  7267. This filter allows one to process interlaced images fields without
  7268. deinterlacing them. Deinterleaving splits the input frame into 2
  7269. fields (so called half pictures). Odd lines are moved to the top
  7270. half of the output image, even lines to the bottom half.
  7271. You can process (filter) them independently and then re-interleave them.
  7272. The filter accepts the following options:
  7273. @table @option
  7274. @item luma_mode, l
  7275. @item chroma_mode, c
  7276. @item alpha_mode, a
  7277. Available values for @var{luma_mode}, @var{chroma_mode} and
  7278. @var{alpha_mode} are:
  7279. @table @samp
  7280. @item none
  7281. Do nothing.
  7282. @item deinterleave, d
  7283. Deinterleave fields, placing one above the other.
  7284. @item interleave, i
  7285. Interleave fields. Reverse the effect of deinterleaving.
  7286. @end table
  7287. Default value is @code{none}.
  7288. @item luma_swap, ls
  7289. @item chroma_swap, cs
  7290. @item alpha_swap, as
  7291. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  7292. @end table
  7293. @section inflate
  7294. Apply inflate effect to the video.
  7295. This filter replaces the pixel by the local(3x3) average by taking into account
  7296. only values higher than the pixel.
  7297. It accepts the following options:
  7298. @table @option
  7299. @item threshold0
  7300. @item threshold1
  7301. @item threshold2
  7302. @item threshold3
  7303. Limit the maximum change for each plane, default is 65535.
  7304. If 0, plane will remain unchanged.
  7305. @end table
  7306. @section interlace
  7307. Simple interlacing filter from progressive contents. This interleaves upper (or
  7308. lower) lines from odd frames with lower (or upper) lines from even frames,
  7309. halving the frame rate and preserving image height.
  7310. @example
  7311. Original Original New Frame
  7312. Frame 'j' Frame 'j+1' (tff)
  7313. ========== =========== ==================
  7314. Line 0 --------------------> Frame 'j' Line 0
  7315. Line 1 Line 1 ----> Frame 'j+1' Line 1
  7316. Line 2 ---------------------> Frame 'j' Line 2
  7317. Line 3 Line 3 ----> Frame 'j+1' Line 3
  7318. ... ... ...
  7319. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  7320. @end example
  7321. It accepts the following optional parameters:
  7322. @table @option
  7323. @item scan
  7324. This determines whether the interlaced frame is taken from the even
  7325. (tff - default) or odd (bff) lines of the progressive frame.
  7326. @item lowpass
  7327. Vertical lowpass filter to avoid twitter interlacing and
  7328. reduce moire patterns.
  7329. @table @samp
  7330. @item 0, off
  7331. Disable vertical lowpass filter
  7332. @item 1, linear
  7333. Enable linear filter (default)
  7334. @item 2, complex
  7335. Enable complex filter. This will slightly less reduce twitter and moire
  7336. but better retain detail and subjective sharpness impression.
  7337. @end table
  7338. @end table
  7339. @section kerndeint
  7340. Deinterlace input video by applying Donald Graft's adaptive kernel
  7341. deinterling. Work on interlaced parts of a video to produce
  7342. progressive frames.
  7343. The description of the accepted parameters follows.
  7344. @table @option
  7345. @item thresh
  7346. Set the threshold which affects the filter's tolerance when
  7347. determining if a pixel line must be processed. It must be an integer
  7348. in the range [0,255] and defaults to 10. A value of 0 will result in
  7349. applying the process on every pixels.
  7350. @item map
  7351. Paint pixels exceeding the threshold value to white if set to 1.
  7352. Default is 0.
  7353. @item order
  7354. Set the fields order. Swap fields if set to 1, leave fields alone if
  7355. 0. Default is 0.
  7356. @item sharp
  7357. Enable additional sharpening if set to 1. Default is 0.
  7358. @item twoway
  7359. Enable twoway sharpening if set to 1. Default is 0.
  7360. @end table
  7361. @subsection Examples
  7362. @itemize
  7363. @item
  7364. Apply default values:
  7365. @example
  7366. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  7367. @end example
  7368. @item
  7369. Enable additional sharpening:
  7370. @example
  7371. kerndeint=sharp=1
  7372. @end example
  7373. @item
  7374. Paint processed pixels in white:
  7375. @example
  7376. kerndeint=map=1
  7377. @end example
  7378. @end itemize
  7379. @section lenscorrection
  7380. Correct radial lens distortion
  7381. This filter can be used to correct for radial distortion as can result from the use
  7382. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  7383. one can use tools available for example as part of opencv or simply trial-and-error.
  7384. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  7385. and extract the k1 and k2 coefficients from the resulting matrix.
  7386. Note that effectively the same filter is available in the open-source tools Krita and
  7387. Digikam from the KDE project.
  7388. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  7389. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  7390. brightness distribution, so you may want to use both filters together in certain
  7391. cases, though you will have to take care of ordering, i.e. whether vignetting should
  7392. be applied before or after lens correction.
  7393. @subsection Options
  7394. The filter accepts the following options:
  7395. @table @option
  7396. @item cx
  7397. Relative x-coordinate of the focal point of the image, and thereby the center of the
  7398. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7399. width.
  7400. @item cy
  7401. Relative y-coordinate of the focal point of the image, and thereby the center of the
  7402. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7403. height.
  7404. @item k1
  7405. Coefficient of the quadratic correction term. 0.5 means no correction.
  7406. @item k2
  7407. Coefficient of the double quadratic correction term. 0.5 means no correction.
  7408. @end table
  7409. The formula that generates the correction is:
  7410. @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)
  7411. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  7412. distances from the focal point in the source and target images, respectively.
  7413. @section libvmaf
  7414. Obtain the average VMAF (Video Multi-Method Assessment Fusion)
  7415. score between two input videos.
  7416. This filter takes two input videos.
  7417. Both video inputs must have the same resolution and pixel format for
  7418. this filter to work correctly. Also it assumes that both inputs
  7419. have the same number of frames, which are compared one by one.
  7420. The obtained average VMAF score is printed through the logging system.
  7421. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  7422. After installing the library it can be enabled using:
  7423. @code{./configure --enable-libvmaf}.
  7424. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  7425. On the below examples the input file @file{main.mpg} being processed is
  7426. compared with the reference file @file{ref.mpg}.
  7427. The filter has following options:
  7428. @table @option
  7429. @item model_path
  7430. Set the model path which is to be used for SVM.
  7431. Default value: @code{"vmaf_v0.6.1.pkl"}
  7432. @item log_path
  7433. Set the file path to be used to store logs.
  7434. @item log_fmt
  7435. Set the format of the log file (xml or json).
  7436. @item enable_transform
  7437. Enables transform for computing vmaf.
  7438. @item phone_model
  7439. Invokes the phone model which will generate VMAF scores higher than in the
  7440. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  7441. @item psnr
  7442. Enables computing psnr along with vmaf.
  7443. @item ssim
  7444. Enables computing ssim along with vmaf.
  7445. @item ms_ssim
  7446. Enables computing ms_ssim along with vmaf.
  7447. @item pool
  7448. Set the pool method to be used for computing vmaf.
  7449. @end table
  7450. For example:
  7451. @example
  7452. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  7453. @end example
  7454. Example with options:
  7455. @example
  7456. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:enable-transform=1" -f null -
  7457. @end example
  7458. @section limiter
  7459. Limits the pixel components values to the specified range [min, max].
  7460. The filter accepts the following options:
  7461. @table @option
  7462. @item min
  7463. Lower bound. Defaults to the lowest allowed value for the input.
  7464. @item max
  7465. Upper bound. Defaults to the highest allowed value for the input.
  7466. @item planes
  7467. Specify which planes will be processed. Defaults to all available.
  7468. @end table
  7469. @section loop
  7470. Loop video frames.
  7471. The filter accepts the following options:
  7472. @table @option
  7473. @item loop
  7474. Set the number of loops.
  7475. @item size
  7476. Set maximal size in number of frames.
  7477. @item start
  7478. Set first frame of loop.
  7479. @end table
  7480. @anchor{lut3d}
  7481. @section lut3d
  7482. Apply a 3D LUT to an input video.
  7483. The filter accepts the following options:
  7484. @table @option
  7485. @item file
  7486. Set the 3D LUT file name.
  7487. Currently supported formats:
  7488. @table @samp
  7489. @item 3dl
  7490. AfterEffects
  7491. @item cube
  7492. Iridas
  7493. @item dat
  7494. DaVinci
  7495. @item m3d
  7496. Pandora
  7497. @end table
  7498. @item interp
  7499. Select interpolation mode.
  7500. Available values are:
  7501. @table @samp
  7502. @item nearest
  7503. Use values from the nearest defined point.
  7504. @item trilinear
  7505. Interpolate values using the 8 points defining a cube.
  7506. @item tetrahedral
  7507. Interpolate values using a tetrahedron.
  7508. @end table
  7509. @end table
  7510. @section lumakey
  7511. Turn certain luma values into transparency.
  7512. The filter accepts the following options:
  7513. @table @option
  7514. @item threshold
  7515. Set the luma which will be used as base for transparency.
  7516. Default value is @code{0}.
  7517. @item tolerance
  7518. Set the range of luma values to be keyed out.
  7519. Default value is @code{0}.
  7520. @item softness
  7521. Set the range of softness. Default value is @code{0}.
  7522. Use this to control gradual transition from zero to full transparency.
  7523. @end table
  7524. @section lut, lutrgb, lutyuv
  7525. Compute a look-up table for binding each pixel component input value
  7526. to an output value, and apply it to the input video.
  7527. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  7528. to an RGB input video.
  7529. These filters accept the following parameters:
  7530. @table @option
  7531. @item c0
  7532. set first pixel component expression
  7533. @item c1
  7534. set second pixel component expression
  7535. @item c2
  7536. set third pixel component expression
  7537. @item c3
  7538. set fourth pixel component expression, corresponds to the alpha component
  7539. @item r
  7540. set red component expression
  7541. @item g
  7542. set green component expression
  7543. @item b
  7544. set blue component expression
  7545. @item a
  7546. alpha component expression
  7547. @item y
  7548. set Y/luminance component expression
  7549. @item u
  7550. set U/Cb component expression
  7551. @item v
  7552. set V/Cr component expression
  7553. @end table
  7554. Each of them specifies the expression to use for computing the lookup table for
  7555. the corresponding pixel component values.
  7556. The exact component associated to each of the @var{c*} options depends on the
  7557. format in input.
  7558. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  7559. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  7560. The expressions can contain the following constants and functions:
  7561. @table @option
  7562. @item w
  7563. @item h
  7564. The input width and height.
  7565. @item val
  7566. The input value for the pixel component.
  7567. @item clipval
  7568. The input value, clipped to the @var{minval}-@var{maxval} range.
  7569. @item maxval
  7570. The maximum value for the pixel component.
  7571. @item minval
  7572. The minimum value for the pixel component.
  7573. @item negval
  7574. The negated value for the pixel component value, clipped to the
  7575. @var{minval}-@var{maxval} range; it corresponds to the expression
  7576. "maxval-clipval+minval".
  7577. @item clip(val)
  7578. The computed value in @var{val}, clipped to the
  7579. @var{minval}-@var{maxval} range.
  7580. @item gammaval(gamma)
  7581. The computed gamma correction value of the pixel component value,
  7582. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  7583. expression
  7584. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  7585. @end table
  7586. All expressions default to "val".
  7587. @subsection Examples
  7588. @itemize
  7589. @item
  7590. Negate input video:
  7591. @example
  7592. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  7593. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  7594. @end example
  7595. The above is the same as:
  7596. @example
  7597. lutrgb="r=negval:g=negval:b=negval"
  7598. lutyuv="y=negval:u=negval:v=negval"
  7599. @end example
  7600. @item
  7601. Negate luminance:
  7602. @example
  7603. lutyuv=y=negval
  7604. @end example
  7605. @item
  7606. Remove chroma components, turning the video into a graytone image:
  7607. @example
  7608. lutyuv="u=128:v=128"
  7609. @end example
  7610. @item
  7611. Apply a luma burning effect:
  7612. @example
  7613. lutyuv="y=2*val"
  7614. @end example
  7615. @item
  7616. Remove green and blue components:
  7617. @example
  7618. lutrgb="g=0:b=0"
  7619. @end example
  7620. @item
  7621. Set a constant alpha channel value on input:
  7622. @example
  7623. format=rgba,lutrgb=a="maxval-minval/2"
  7624. @end example
  7625. @item
  7626. Correct luminance gamma by a factor of 0.5:
  7627. @example
  7628. lutyuv=y=gammaval(0.5)
  7629. @end example
  7630. @item
  7631. Discard least significant bits of luma:
  7632. @example
  7633. lutyuv=y='bitand(val, 128+64+32)'
  7634. @end example
  7635. @item
  7636. Technicolor like effect:
  7637. @example
  7638. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  7639. @end example
  7640. @end itemize
  7641. @section lut2
  7642. Compute and apply a lookup table from two video inputs.
  7643. This filter accepts the following parameters:
  7644. @table @option
  7645. @item c0
  7646. set first pixel component expression
  7647. @item c1
  7648. set second pixel component expression
  7649. @item c2
  7650. set third pixel component expression
  7651. @item c3
  7652. set fourth pixel component expression, corresponds to the alpha component
  7653. @end table
  7654. Each of them specifies the expression to use for computing the lookup table for
  7655. the corresponding pixel component values.
  7656. The exact component associated to each of the @var{c*} options depends on the
  7657. format in inputs.
  7658. The expressions can contain the following constants:
  7659. @table @option
  7660. @item w
  7661. @item h
  7662. The input width and height.
  7663. @item x
  7664. The first input value for the pixel component.
  7665. @item y
  7666. The second input value for the pixel component.
  7667. @item bdx
  7668. The first input video bit depth.
  7669. @item bdy
  7670. The second input video bit depth.
  7671. @end table
  7672. All expressions default to "x".
  7673. @subsection Examples
  7674. @itemize
  7675. @item
  7676. Highlight differences between two RGB video streams:
  7677. @example
  7678. 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)'
  7679. @end example
  7680. @item
  7681. Highlight differences between two YUV video streams:
  7682. @example
  7683. 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)'
  7684. @end example
  7685. @end itemize
  7686. @section maskedclamp
  7687. Clamp the first input stream with the second input and third input stream.
  7688. Returns the value of first stream to be between second input
  7689. stream - @code{undershoot} and third input stream + @code{overshoot}.
  7690. This filter accepts the following options:
  7691. @table @option
  7692. @item undershoot
  7693. Default value is @code{0}.
  7694. @item overshoot
  7695. Default value is @code{0}.
  7696. @item planes
  7697. Set which planes will be processed as bitmap, unprocessed planes will be
  7698. copied from first stream.
  7699. By default value 0xf, all planes will be processed.
  7700. @end table
  7701. @section maskedmerge
  7702. Merge the first input stream with the second input stream using per pixel
  7703. weights in the third input stream.
  7704. A value of 0 in the third stream pixel component means that pixel component
  7705. from first stream is returned unchanged, while maximum value (eg. 255 for
  7706. 8-bit videos) means that pixel component from second stream is returned
  7707. unchanged. Intermediate values define the amount of merging between both
  7708. input stream's pixel components.
  7709. This filter accepts the following options:
  7710. @table @option
  7711. @item planes
  7712. Set which planes will be processed as bitmap, unprocessed planes will be
  7713. copied from first stream.
  7714. By default value 0xf, all planes will be processed.
  7715. @end table
  7716. @section mcdeint
  7717. Apply motion-compensation deinterlacing.
  7718. It needs one field per frame as input and must thus be used together
  7719. with yadif=1/3 or equivalent.
  7720. This filter accepts the following options:
  7721. @table @option
  7722. @item mode
  7723. Set the deinterlacing mode.
  7724. It accepts one of the following values:
  7725. @table @samp
  7726. @item fast
  7727. @item medium
  7728. @item slow
  7729. use iterative motion estimation
  7730. @item extra_slow
  7731. like @samp{slow}, but use multiple reference frames.
  7732. @end table
  7733. Default value is @samp{fast}.
  7734. @item parity
  7735. Set the picture field parity assumed for the input video. It must be
  7736. one of the following values:
  7737. @table @samp
  7738. @item 0, tff
  7739. assume top field first
  7740. @item 1, bff
  7741. assume bottom field first
  7742. @end table
  7743. Default value is @samp{bff}.
  7744. @item qp
  7745. Set per-block quantization parameter (QP) used by the internal
  7746. encoder.
  7747. Higher values should result in a smoother motion vector field but less
  7748. optimal individual vectors. Default value is 1.
  7749. @end table
  7750. @section mergeplanes
  7751. Merge color channel components from several video streams.
  7752. The filter accepts up to 4 input streams, and merge selected input
  7753. planes to the output video.
  7754. This filter accepts the following options:
  7755. @table @option
  7756. @item mapping
  7757. Set input to output plane mapping. Default is @code{0}.
  7758. The mappings is specified as a bitmap. It should be specified as a
  7759. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  7760. mapping for the first plane of the output stream. 'A' sets the number of
  7761. the input stream to use (from 0 to 3), and 'a' the plane number of the
  7762. corresponding input to use (from 0 to 3). The rest of the mappings is
  7763. similar, 'Bb' describes the mapping for the output stream second
  7764. plane, 'Cc' describes the mapping for the output stream third plane and
  7765. 'Dd' describes the mapping for the output stream fourth plane.
  7766. @item format
  7767. Set output pixel format. Default is @code{yuva444p}.
  7768. @end table
  7769. @subsection Examples
  7770. @itemize
  7771. @item
  7772. Merge three gray video streams of same width and height into single video stream:
  7773. @example
  7774. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  7775. @end example
  7776. @item
  7777. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  7778. @example
  7779. [a0][a1]mergeplanes=0x00010210:yuva444p
  7780. @end example
  7781. @item
  7782. Swap Y and A plane in yuva444p stream:
  7783. @example
  7784. format=yuva444p,mergeplanes=0x03010200:yuva444p
  7785. @end example
  7786. @item
  7787. Swap U and V plane in yuv420p stream:
  7788. @example
  7789. format=yuv420p,mergeplanes=0x000201:yuv420p
  7790. @end example
  7791. @item
  7792. Cast a rgb24 clip to yuv444p:
  7793. @example
  7794. format=rgb24,mergeplanes=0x000102:yuv444p
  7795. @end example
  7796. @end itemize
  7797. @section mestimate
  7798. Estimate and export motion vectors using block matching algorithms.
  7799. Motion vectors are stored in frame side data to be used by other filters.
  7800. This filter accepts the following options:
  7801. @table @option
  7802. @item method
  7803. Specify the motion estimation method. Accepts one of the following values:
  7804. @table @samp
  7805. @item esa
  7806. Exhaustive search algorithm.
  7807. @item tss
  7808. Three step search algorithm.
  7809. @item tdls
  7810. Two dimensional logarithmic search algorithm.
  7811. @item ntss
  7812. New three step search algorithm.
  7813. @item fss
  7814. Four step search algorithm.
  7815. @item ds
  7816. Diamond search algorithm.
  7817. @item hexbs
  7818. Hexagon-based search algorithm.
  7819. @item epzs
  7820. Enhanced predictive zonal search algorithm.
  7821. @item umh
  7822. Uneven multi-hexagon search algorithm.
  7823. @end table
  7824. Default value is @samp{esa}.
  7825. @item mb_size
  7826. Macroblock size. Default @code{16}.
  7827. @item search_param
  7828. Search parameter. Default @code{7}.
  7829. @end table
  7830. @section midequalizer
  7831. Apply Midway Image Equalization effect using two video streams.
  7832. Midway Image Equalization adjusts a pair of images to have the same
  7833. histogram, while maintaining their dynamics as much as possible. It's
  7834. useful for e.g. matching exposures from a pair of stereo cameras.
  7835. This filter has two inputs and one output, which must be of same pixel format, but
  7836. may be of different sizes. The output of filter is first input adjusted with
  7837. midway histogram of both inputs.
  7838. This filter accepts the following option:
  7839. @table @option
  7840. @item planes
  7841. Set which planes to process. Default is @code{15}, which is all available planes.
  7842. @end table
  7843. @section minterpolate
  7844. Convert the video to specified frame rate using motion interpolation.
  7845. This filter accepts the following options:
  7846. @table @option
  7847. @item fps
  7848. 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}.
  7849. @item mi_mode
  7850. Motion interpolation mode. Following values are accepted:
  7851. @table @samp
  7852. @item dup
  7853. Duplicate previous or next frame for interpolating new ones.
  7854. @item blend
  7855. Blend source frames. Interpolated frame is mean of previous and next frames.
  7856. @item mci
  7857. Motion compensated interpolation. Following options are effective when this mode is selected:
  7858. @table @samp
  7859. @item mc_mode
  7860. Motion compensation mode. Following values are accepted:
  7861. @table @samp
  7862. @item obmc
  7863. Overlapped block motion compensation.
  7864. @item aobmc
  7865. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  7866. @end table
  7867. Default mode is @samp{obmc}.
  7868. @item me_mode
  7869. Motion estimation mode. Following values are accepted:
  7870. @table @samp
  7871. @item bidir
  7872. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  7873. @item bilat
  7874. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  7875. @end table
  7876. Default mode is @samp{bilat}.
  7877. @item me
  7878. The algorithm to be used for motion estimation. Following values are accepted:
  7879. @table @samp
  7880. @item esa
  7881. Exhaustive search algorithm.
  7882. @item tss
  7883. Three step search algorithm.
  7884. @item tdls
  7885. Two dimensional logarithmic search algorithm.
  7886. @item ntss
  7887. New three step search algorithm.
  7888. @item fss
  7889. Four step search algorithm.
  7890. @item ds
  7891. Diamond search algorithm.
  7892. @item hexbs
  7893. Hexagon-based search algorithm.
  7894. @item epzs
  7895. Enhanced predictive zonal search algorithm.
  7896. @item umh
  7897. Uneven multi-hexagon search algorithm.
  7898. @end table
  7899. Default algorithm is @samp{epzs}.
  7900. @item mb_size
  7901. Macroblock size. Default @code{16}.
  7902. @item search_param
  7903. Motion estimation search parameter. Default @code{32}.
  7904. @item vsbmc
  7905. 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).
  7906. @end table
  7907. @end table
  7908. @item scd
  7909. 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:
  7910. @table @samp
  7911. @item none
  7912. Disable scene change detection.
  7913. @item fdiff
  7914. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  7915. @end table
  7916. Default method is @samp{fdiff}.
  7917. @item scd_threshold
  7918. Scene change detection threshold. Default is @code{5.0}.
  7919. @end table
  7920. @section mpdecimate
  7921. Drop frames that do not differ greatly from the previous frame in
  7922. order to reduce frame rate.
  7923. The main use of this filter is for very-low-bitrate encoding
  7924. (e.g. streaming over dialup modem), but it could in theory be used for
  7925. fixing movies that were inverse-telecined incorrectly.
  7926. A description of the accepted options follows.
  7927. @table @option
  7928. @item max
  7929. Set the maximum number of consecutive frames which can be dropped (if
  7930. positive), or the minimum interval between dropped frames (if
  7931. negative). If the value is 0, the frame is dropped unregarding the
  7932. number of previous sequentially dropped frames.
  7933. Default value is 0.
  7934. @item hi
  7935. @item lo
  7936. @item frac
  7937. Set the dropping threshold values.
  7938. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  7939. represent actual pixel value differences, so a threshold of 64
  7940. corresponds to 1 unit of difference for each pixel, or the same spread
  7941. out differently over the block.
  7942. A frame is a candidate for dropping if no 8x8 blocks differ by more
  7943. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  7944. meaning the whole image) differ by more than a threshold of @option{lo}.
  7945. Default value for @option{hi} is 64*12, default value for @option{lo} is
  7946. 64*5, and default value for @option{frac} is 0.33.
  7947. @end table
  7948. @section negate
  7949. Negate input video.
  7950. It accepts an integer in input; if non-zero it negates the
  7951. alpha component (if available). The default value in input is 0.
  7952. @section nlmeans
  7953. Denoise frames using Non-Local Means algorithm.
  7954. Each pixel is adjusted by looking for other pixels with similar contexts. This
  7955. context similarity is defined by comparing their surrounding patches of size
  7956. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  7957. around the pixel.
  7958. Note that the research area defines centers for patches, which means some
  7959. patches will be made of pixels outside that research area.
  7960. The filter accepts the following options.
  7961. @table @option
  7962. @item s
  7963. Set denoising strength.
  7964. @item p
  7965. Set patch size.
  7966. @item pc
  7967. Same as @option{p} but for chroma planes.
  7968. The default value is @var{0} and means automatic.
  7969. @item r
  7970. Set research size.
  7971. @item rc
  7972. Same as @option{r} but for chroma planes.
  7973. The default value is @var{0} and means automatic.
  7974. @end table
  7975. @section nnedi
  7976. Deinterlace video using neural network edge directed interpolation.
  7977. This filter accepts the following options:
  7978. @table @option
  7979. @item weights
  7980. Mandatory option, without binary file filter can not work.
  7981. Currently file can be found here:
  7982. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  7983. @item deint
  7984. Set which frames to deinterlace, by default it is @code{all}.
  7985. Can be @code{all} or @code{interlaced}.
  7986. @item field
  7987. Set mode of operation.
  7988. Can be one of the following:
  7989. @table @samp
  7990. @item af
  7991. Use frame flags, both fields.
  7992. @item a
  7993. Use frame flags, single field.
  7994. @item t
  7995. Use top field only.
  7996. @item b
  7997. Use bottom field only.
  7998. @item tf
  7999. Use both fields, top first.
  8000. @item bf
  8001. Use both fields, bottom first.
  8002. @end table
  8003. @item planes
  8004. Set which planes to process, by default filter process all frames.
  8005. @item nsize
  8006. Set size of local neighborhood around each pixel, used by the predictor neural
  8007. network.
  8008. Can be one of the following:
  8009. @table @samp
  8010. @item s8x6
  8011. @item s16x6
  8012. @item s32x6
  8013. @item s48x6
  8014. @item s8x4
  8015. @item s16x4
  8016. @item s32x4
  8017. @end table
  8018. @item nns
  8019. Set the number of neurons in predicctor neural network.
  8020. Can be one of the following:
  8021. @table @samp
  8022. @item n16
  8023. @item n32
  8024. @item n64
  8025. @item n128
  8026. @item n256
  8027. @end table
  8028. @item qual
  8029. Controls the number of different neural network predictions that are blended
  8030. together to compute the final output value. Can be @code{fast}, default or
  8031. @code{slow}.
  8032. @item etype
  8033. Set which set of weights to use in the predictor.
  8034. Can be one of the following:
  8035. @table @samp
  8036. @item a
  8037. weights trained to minimize absolute error
  8038. @item s
  8039. weights trained to minimize squared error
  8040. @end table
  8041. @item pscrn
  8042. Controls whether or not the prescreener neural network is used to decide
  8043. which pixels should be processed by the predictor neural network and which
  8044. can be handled by simple cubic interpolation.
  8045. The prescreener is trained to know whether cubic interpolation will be
  8046. sufficient for a pixel or whether it should be predicted by the predictor nn.
  8047. The computational complexity of the prescreener nn is much less than that of
  8048. the predictor nn. Since most pixels can be handled by cubic interpolation,
  8049. using the prescreener generally results in much faster processing.
  8050. The prescreener is pretty accurate, so the difference between using it and not
  8051. using it is almost always unnoticeable.
  8052. Can be one of the following:
  8053. @table @samp
  8054. @item none
  8055. @item original
  8056. @item new
  8057. @end table
  8058. Default is @code{new}.
  8059. @item fapprox
  8060. Set various debugging flags.
  8061. @end table
  8062. @section noformat
  8063. Force libavfilter not to use any of the specified pixel formats for the
  8064. input to the next filter.
  8065. It accepts the following parameters:
  8066. @table @option
  8067. @item pix_fmts
  8068. A '|'-separated list of pixel format names, such as
  8069. apix_fmts=yuv420p|monow|rgb24".
  8070. @end table
  8071. @subsection Examples
  8072. @itemize
  8073. @item
  8074. Force libavfilter to use a format different from @var{yuv420p} for the
  8075. input to the vflip filter:
  8076. @example
  8077. noformat=pix_fmts=yuv420p,vflip
  8078. @end example
  8079. @item
  8080. Convert the input video to any of the formats not contained in the list:
  8081. @example
  8082. noformat=yuv420p|yuv444p|yuv410p
  8083. @end example
  8084. @end itemize
  8085. @section noise
  8086. Add noise on video input frame.
  8087. The filter accepts the following options:
  8088. @table @option
  8089. @item all_seed
  8090. @item c0_seed
  8091. @item c1_seed
  8092. @item c2_seed
  8093. @item c3_seed
  8094. Set noise seed for specific pixel component or all pixel components in case
  8095. of @var{all_seed}. Default value is @code{123457}.
  8096. @item all_strength, alls
  8097. @item c0_strength, c0s
  8098. @item c1_strength, c1s
  8099. @item c2_strength, c2s
  8100. @item c3_strength, c3s
  8101. Set noise strength for specific pixel component or all pixel components in case
  8102. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  8103. @item all_flags, allf
  8104. @item c0_flags, c0f
  8105. @item c1_flags, c1f
  8106. @item c2_flags, c2f
  8107. @item c3_flags, c3f
  8108. Set pixel component flags or set flags for all components if @var{all_flags}.
  8109. Available values for component flags are:
  8110. @table @samp
  8111. @item a
  8112. averaged temporal noise (smoother)
  8113. @item p
  8114. mix random noise with a (semi)regular pattern
  8115. @item t
  8116. temporal noise (noise pattern changes between frames)
  8117. @item u
  8118. uniform noise (gaussian otherwise)
  8119. @end table
  8120. @end table
  8121. @subsection Examples
  8122. Add temporal and uniform noise to input video:
  8123. @example
  8124. noise=alls=20:allf=t+u
  8125. @end example
  8126. @section null
  8127. Pass the video source unchanged to the output.
  8128. @section ocr
  8129. Optical Character Recognition
  8130. This filter uses Tesseract for optical character recognition.
  8131. It accepts the following options:
  8132. @table @option
  8133. @item datapath
  8134. Set datapath to tesseract data. Default is to use whatever was
  8135. set at installation.
  8136. @item language
  8137. Set language, default is "eng".
  8138. @item whitelist
  8139. Set character whitelist.
  8140. @item blacklist
  8141. Set character blacklist.
  8142. @end table
  8143. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  8144. @section ocv
  8145. Apply a video transform using libopencv.
  8146. To enable this filter, install the libopencv library and headers and
  8147. configure FFmpeg with @code{--enable-libopencv}.
  8148. It accepts the following parameters:
  8149. @table @option
  8150. @item filter_name
  8151. The name of the libopencv filter to apply.
  8152. @item filter_params
  8153. The parameters to pass to the libopencv filter. If not specified, the default
  8154. values are assumed.
  8155. @end table
  8156. Refer to the official libopencv documentation for more precise
  8157. information:
  8158. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  8159. Several libopencv filters are supported; see the following subsections.
  8160. @anchor{dilate}
  8161. @subsection dilate
  8162. Dilate an image by using a specific structuring element.
  8163. It corresponds to the libopencv function @code{cvDilate}.
  8164. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  8165. @var{struct_el} represents a structuring element, and has the syntax:
  8166. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  8167. @var{cols} and @var{rows} represent the number of columns and rows of
  8168. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  8169. point, and @var{shape} the shape for the structuring element. @var{shape}
  8170. must be "rect", "cross", "ellipse", or "custom".
  8171. If the value for @var{shape} is "custom", it must be followed by a
  8172. string of the form "=@var{filename}". The file with name
  8173. @var{filename} is assumed to represent a binary image, with each
  8174. printable character corresponding to a bright pixel. When a custom
  8175. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  8176. or columns and rows of the read file are assumed instead.
  8177. The default value for @var{struct_el} is "3x3+0x0/rect".
  8178. @var{nb_iterations} specifies the number of times the transform is
  8179. applied to the image, and defaults to 1.
  8180. Some examples:
  8181. @example
  8182. # Use the default values
  8183. ocv=dilate
  8184. # Dilate using a structuring element with a 5x5 cross, iterating two times
  8185. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  8186. # Read the shape from the file diamond.shape, iterating two times.
  8187. # The file diamond.shape may contain a pattern of characters like this
  8188. # *
  8189. # ***
  8190. # *****
  8191. # ***
  8192. # *
  8193. # The specified columns and rows are ignored
  8194. # but the anchor point coordinates are not
  8195. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  8196. @end example
  8197. @subsection erode
  8198. Erode an image by using a specific structuring element.
  8199. It corresponds to the libopencv function @code{cvErode}.
  8200. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  8201. with the same syntax and semantics as the @ref{dilate} filter.
  8202. @subsection smooth
  8203. Smooth the input video.
  8204. The filter takes the following parameters:
  8205. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  8206. @var{type} is the type of smooth filter to apply, and must be one of
  8207. the following values: "blur", "blur_no_scale", "median", "gaussian",
  8208. or "bilateral". The default value is "gaussian".
  8209. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  8210. depend on the smooth type. @var{param1} and
  8211. @var{param2} accept integer positive values or 0. @var{param3} and
  8212. @var{param4} accept floating point values.
  8213. The default value for @var{param1} is 3. The default value for the
  8214. other parameters is 0.
  8215. These parameters correspond to the parameters assigned to the
  8216. libopencv function @code{cvSmooth}.
  8217. @section oscilloscope
  8218. 2D Video Oscilloscope.
  8219. Useful to measure spatial impulse, step responses, chroma delays, etc.
  8220. It accepts the following parameters:
  8221. @table @option
  8222. @item x
  8223. Set scope center x position.
  8224. @item y
  8225. Set scope center y position.
  8226. @item s
  8227. Set scope size, relative to frame diagonal.
  8228. @item t
  8229. Set scope tilt/rotation.
  8230. @item o
  8231. Set trace opacity.
  8232. @item tx
  8233. Set trace center x position.
  8234. @item ty
  8235. Set trace center y position.
  8236. @item tw
  8237. Set trace width, relative to width of frame.
  8238. @item th
  8239. Set trace height, relative to height of frame.
  8240. @item c
  8241. Set which components to trace. By default it traces first three components.
  8242. @item g
  8243. Draw trace grid. By default is enabled.
  8244. @item st
  8245. Draw some statistics. By default is enabled.
  8246. @item sc
  8247. Draw scope. By default is enabled.
  8248. @end table
  8249. @subsection Examples
  8250. @itemize
  8251. @item
  8252. Inspect full first row of video frame.
  8253. @example
  8254. oscilloscope=x=0.5:y=0:s=1
  8255. @end example
  8256. @item
  8257. Inspect full last row of video frame.
  8258. @example
  8259. oscilloscope=x=0.5:y=1:s=1
  8260. @end example
  8261. @item
  8262. Inspect full 5th line of video frame of height 1080.
  8263. @example
  8264. oscilloscope=x=0.5:y=5/1080:s=1
  8265. @end example
  8266. @item
  8267. Inspect full last column of video frame.
  8268. @example
  8269. oscilloscope=x=1:y=0.5:s=1:t=1
  8270. @end example
  8271. @end itemize
  8272. @anchor{overlay}
  8273. @section overlay
  8274. Overlay one video on top of another.
  8275. It takes two inputs and has one output. The first input is the "main"
  8276. video on which the second input is overlaid.
  8277. It accepts the following parameters:
  8278. A description of the accepted options follows.
  8279. @table @option
  8280. @item x
  8281. @item y
  8282. Set the expression for the x and y coordinates of the overlaid video
  8283. on the main video. Default value is "0" for both expressions. In case
  8284. the expression is invalid, it is set to a huge value (meaning that the
  8285. overlay will not be displayed within the output visible area).
  8286. @item eof_action
  8287. The action to take when EOF is encountered on the secondary input; it accepts
  8288. one of the following values:
  8289. @table @option
  8290. @item repeat
  8291. Repeat the last frame (the default).
  8292. @item endall
  8293. End both streams.
  8294. @item pass
  8295. Pass the main input through.
  8296. @end table
  8297. @item eval
  8298. Set when the expressions for @option{x}, and @option{y} are evaluated.
  8299. It accepts the following values:
  8300. @table @samp
  8301. @item init
  8302. only evaluate expressions once during the filter initialization or
  8303. when a command is processed
  8304. @item frame
  8305. evaluate expressions for each incoming frame
  8306. @end table
  8307. Default value is @samp{frame}.
  8308. @item shortest
  8309. If set to 1, force the output to terminate when the shortest input
  8310. terminates. Default value is 0.
  8311. @item format
  8312. Set the format for the output video.
  8313. It accepts the following values:
  8314. @table @samp
  8315. @item yuv420
  8316. force YUV420 output
  8317. @item yuv422
  8318. force YUV422 output
  8319. @item yuv444
  8320. force YUV444 output
  8321. @item rgb
  8322. force packed RGB output
  8323. @item gbrp
  8324. force planar RGB output
  8325. @item auto
  8326. automatically pick format
  8327. @end table
  8328. Default value is @samp{yuv420}.
  8329. @item repeatlast
  8330. If set to 1, force the filter to draw the last overlay frame over the
  8331. main input until the end of the stream. A value of 0 disables this
  8332. behavior. Default value is 1.
  8333. @end table
  8334. The @option{x}, and @option{y} expressions can contain the following
  8335. parameters.
  8336. @table @option
  8337. @item main_w, W
  8338. @item main_h, H
  8339. The main input width and height.
  8340. @item overlay_w, w
  8341. @item overlay_h, h
  8342. The overlay input width and height.
  8343. @item x
  8344. @item y
  8345. The computed values for @var{x} and @var{y}. They are evaluated for
  8346. each new frame.
  8347. @item hsub
  8348. @item vsub
  8349. horizontal and vertical chroma subsample values of the output
  8350. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  8351. @var{vsub} is 1.
  8352. @item n
  8353. the number of input frame, starting from 0
  8354. @item pos
  8355. the position in the file of the input frame, NAN if unknown
  8356. @item t
  8357. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  8358. @end table
  8359. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  8360. when evaluation is done @emph{per frame}, and will evaluate to NAN
  8361. when @option{eval} is set to @samp{init}.
  8362. Be aware that frames are taken from each input video in timestamp
  8363. order, hence, if their initial timestamps differ, it is a good idea
  8364. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  8365. have them begin in the same zero timestamp, as the example for
  8366. the @var{movie} filter does.
  8367. You can chain together more overlays but you should test the
  8368. efficiency of such approach.
  8369. @subsection Commands
  8370. This filter supports the following commands:
  8371. @table @option
  8372. @item x
  8373. @item y
  8374. Modify the x and y of the overlay input.
  8375. The command accepts the same syntax of the corresponding option.
  8376. If the specified expression is not valid, it is kept at its current
  8377. value.
  8378. @end table
  8379. @subsection Examples
  8380. @itemize
  8381. @item
  8382. Draw the overlay at 10 pixels from the bottom right corner of the main
  8383. video:
  8384. @example
  8385. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  8386. @end example
  8387. Using named options the example above becomes:
  8388. @example
  8389. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  8390. @end example
  8391. @item
  8392. Insert a transparent PNG logo in the bottom left corner of the input,
  8393. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  8394. @example
  8395. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  8396. @end example
  8397. @item
  8398. Insert 2 different transparent PNG logos (second logo on bottom
  8399. right corner) using the @command{ffmpeg} tool:
  8400. @example
  8401. 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
  8402. @end example
  8403. @item
  8404. Add a transparent color layer on top of the main video; @code{WxH}
  8405. must specify the size of the main input to the overlay filter:
  8406. @example
  8407. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  8408. @end example
  8409. @item
  8410. Play an original video and a filtered version (here with the deshake
  8411. filter) side by side using the @command{ffplay} tool:
  8412. @example
  8413. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  8414. @end example
  8415. The above command is the same as:
  8416. @example
  8417. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  8418. @end example
  8419. @item
  8420. Make a sliding overlay appearing from the left to the right top part of the
  8421. screen starting since time 2:
  8422. @example
  8423. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  8424. @end example
  8425. @item
  8426. Compose output by putting two input videos side to side:
  8427. @example
  8428. ffmpeg -i left.avi -i right.avi -filter_complex "
  8429. nullsrc=size=200x100 [background];
  8430. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  8431. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  8432. [background][left] overlay=shortest=1 [background+left];
  8433. [background+left][right] overlay=shortest=1:x=100 [left+right]
  8434. "
  8435. @end example
  8436. @item
  8437. Mask 10-20 seconds of a video by applying the delogo filter to a section
  8438. @example
  8439. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  8440. -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]'
  8441. masked.avi
  8442. @end example
  8443. @item
  8444. Chain several overlays in cascade:
  8445. @example
  8446. nullsrc=s=200x200 [bg];
  8447. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  8448. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  8449. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  8450. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  8451. [in3] null, [mid2] overlay=100:100 [out0]
  8452. @end example
  8453. @end itemize
  8454. @section owdenoise
  8455. Apply Overcomplete Wavelet denoiser.
  8456. The filter accepts the following options:
  8457. @table @option
  8458. @item depth
  8459. Set depth.
  8460. Larger depth values will denoise lower frequency components more, but
  8461. slow down filtering.
  8462. Must be an int in the range 8-16, default is @code{8}.
  8463. @item luma_strength, ls
  8464. Set luma strength.
  8465. Must be a double value in the range 0-1000, default is @code{1.0}.
  8466. @item chroma_strength, cs
  8467. Set chroma strength.
  8468. Must be a double value in the range 0-1000, default is @code{1.0}.
  8469. @end table
  8470. @anchor{pad}
  8471. @section pad
  8472. Add paddings to the input image, and place the original input at the
  8473. provided @var{x}, @var{y} coordinates.
  8474. It accepts the following parameters:
  8475. @table @option
  8476. @item width, w
  8477. @item height, h
  8478. Specify an expression for the size of the output image with the
  8479. paddings added. If the value for @var{width} or @var{height} is 0, the
  8480. corresponding input size is used for the output.
  8481. The @var{width} expression can reference the value set by the
  8482. @var{height} expression, and vice versa.
  8483. The default value of @var{width} and @var{height} is 0.
  8484. @item x
  8485. @item y
  8486. Specify the offsets to place the input image at within the padded area,
  8487. with respect to the top/left border of the output image.
  8488. The @var{x} expression can reference the value set by the @var{y}
  8489. expression, and vice versa.
  8490. The default value of @var{x} and @var{y} is 0.
  8491. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  8492. so the input image is centered on the padded area.
  8493. @item color
  8494. Specify the color of the padded area. For the syntax of this option,
  8495. check the "Color" section in the ffmpeg-utils manual.
  8496. The default value of @var{color} is "black".
  8497. @item eval
  8498. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  8499. It accepts the following values:
  8500. @table @samp
  8501. @item init
  8502. Only evaluate expressions once during the filter initialization or when
  8503. a command is processed.
  8504. @item frame
  8505. Evaluate expressions for each incoming frame.
  8506. @end table
  8507. Default value is @samp{init}.
  8508. @item aspect
  8509. Pad to aspect instead to a resolution.
  8510. @end table
  8511. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  8512. options are expressions containing the following constants:
  8513. @table @option
  8514. @item in_w
  8515. @item in_h
  8516. The input video width and height.
  8517. @item iw
  8518. @item ih
  8519. These are the same as @var{in_w} and @var{in_h}.
  8520. @item out_w
  8521. @item out_h
  8522. The output width and height (the size of the padded area), as
  8523. specified by the @var{width} and @var{height} expressions.
  8524. @item ow
  8525. @item oh
  8526. These are the same as @var{out_w} and @var{out_h}.
  8527. @item x
  8528. @item y
  8529. The x and y offsets as specified by the @var{x} and @var{y}
  8530. expressions, or NAN if not yet specified.
  8531. @item a
  8532. same as @var{iw} / @var{ih}
  8533. @item sar
  8534. input sample aspect ratio
  8535. @item dar
  8536. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  8537. @item hsub
  8538. @item vsub
  8539. The horizontal and vertical chroma subsample values. For example for the
  8540. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8541. @end table
  8542. @subsection Examples
  8543. @itemize
  8544. @item
  8545. Add paddings with the color "violet" to the input video. The output video
  8546. size is 640x480, and the top-left corner of the input video is placed at
  8547. column 0, row 40
  8548. @example
  8549. pad=640:480:0:40:violet
  8550. @end example
  8551. The example above is equivalent to the following command:
  8552. @example
  8553. pad=width=640:height=480:x=0:y=40:color=violet
  8554. @end example
  8555. @item
  8556. Pad the input to get an output with dimensions increased by 3/2,
  8557. and put the input video at the center of the padded area:
  8558. @example
  8559. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  8560. @end example
  8561. @item
  8562. Pad the input to get a squared output with size equal to the maximum
  8563. value between the input width and height, and put the input video at
  8564. the center of the padded area:
  8565. @example
  8566. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  8567. @end example
  8568. @item
  8569. Pad the input to get a final w/h ratio of 16:9:
  8570. @example
  8571. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  8572. @end example
  8573. @item
  8574. In case of anamorphic video, in order to set the output display aspect
  8575. correctly, it is necessary to use @var{sar} in the expression,
  8576. according to the relation:
  8577. @example
  8578. (ih * X / ih) * sar = output_dar
  8579. X = output_dar / sar
  8580. @end example
  8581. Thus the previous example needs to be modified to:
  8582. @example
  8583. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  8584. @end example
  8585. @item
  8586. Double the output size and put the input video in the bottom-right
  8587. corner of the output padded area:
  8588. @example
  8589. pad="2*iw:2*ih:ow-iw:oh-ih"
  8590. @end example
  8591. @end itemize
  8592. @anchor{palettegen}
  8593. @section palettegen
  8594. Generate one palette for a whole video stream.
  8595. It accepts the following options:
  8596. @table @option
  8597. @item max_colors
  8598. Set the maximum number of colors to quantize in the palette.
  8599. Note: the palette will still contain 256 colors; the unused palette entries
  8600. will be black.
  8601. @item reserve_transparent
  8602. Create a palette of 255 colors maximum and reserve the last one for
  8603. transparency. Reserving the transparency color is useful for GIF optimization.
  8604. If not set, the maximum of colors in the palette will be 256. You probably want
  8605. to disable this option for a standalone image.
  8606. Set by default.
  8607. @item stats_mode
  8608. Set statistics mode.
  8609. It accepts the following values:
  8610. @table @samp
  8611. @item full
  8612. Compute full frame histograms.
  8613. @item diff
  8614. Compute histograms only for the part that differs from previous frame. This
  8615. might be relevant to give more importance to the moving part of your input if
  8616. the background is static.
  8617. @item single
  8618. Compute new histogram for each frame.
  8619. @end table
  8620. Default value is @var{full}.
  8621. @end table
  8622. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  8623. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  8624. color quantization of the palette. This information is also visible at
  8625. @var{info} logging level.
  8626. @subsection Examples
  8627. @itemize
  8628. @item
  8629. Generate a representative palette of a given video using @command{ffmpeg}:
  8630. @example
  8631. ffmpeg -i input.mkv -vf palettegen palette.png
  8632. @end example
  8633. @end itemize
  8634. @section paletteuse
  8635. Use a palette to downsample an input video stream.
  8636. The filter takes two inputs: one video stream and a palette. The palette must
  8637. be a 256 pixels image.
  8638. It accepts the following options:
  8639. @table @option
  8640. @item dither
  8641. Select dithering mode. Available algorithms are:
  8642. @table @samp
  8643. @item bayer
  8644. Ordered 8x8 bayer dithering (deterministic)
  8645. @item heckbert
  8646. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  8647. Note: this dithering is sometimes considered "wrong" and is included as a
  8648. reference.
  8649. @item floyd_steinberg
  8650. Floyd and Steingberg dithering (error diffusion)
  8651. @item sierra2
  8652. Frankie Sierra dithering v2 (error diffusion)
  8653. @item sierra2_4a
  8654. Frankie Sierra dithering v2 "Lite" (error diffusion)
  8655. @end table
  8656. Default is @var{sierra2_4a}.
  8657. @item bayer_scale
  8658. When @var{bayer} dithering is selected, this option defines the scale of the
  8659. pattern (how much the crosshatch pattern is visible). A low value means more
  8660. visible pattern for less banding, and higher value means less visible pattern
  8661. at the cost of more banding.
  8662. The option must be an integer value in the range [0,5]. Default is @var{2}.
  8663. @item diff_mode
  8664. If set, define the zone to process
  8665. @table @samp
  8666. @item rectangle
  8667. Only the changing rectangle will be reprocessed. This is similar to GIF
  8668. cropping/offsetting compression mechanism. This option can be useful for speed
  8669. if only a part of the image is changing, and has use cases such as limiting the
  8670. scope of the error diffusal @option{dither} to the rectangle that bounds the
  8671. moving scene (it leads to more deterministic output if the scene doesn't change
  8672. much, and as a result less moving noise and better GIF compression).
  8673. @end table
  8674. Default is @var{none}.
  8675. @item new
  8676. Take new palette for each output frame.
  8677. @end table
  8678. @subsection Examples
  8679. @itemize
  8680. @item
  8681. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  8682. using @command{ffmpeg}:
  8683. @example
  8684. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  8685. @end example
  8686. @end itemize
  8687. @section perspective
  8688. Correct perspective of video not recorded perpendicular to the screen.
  8689. A description of the accepted parameters follows.
  8690. @table @option
  8691. @item x0
  8692. @item y0
  8693. @item x1
  8694. @item y1
  8695. @item x2
  8696. @item y2
  8697. @item x3
  8698. @item y3
  8699. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  8700. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  8701. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  8702. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  8703. then the corners of the source will be sent to the specified coordinates.
  8704. The expressions can use the following variables:
  8705. @table @option
  8706. @item W
  8707. @item H
  8708. the width and height of video frame.
  8709. @item in
  8710. Input frame count.
  8711. @item on
  8712. Output frame count.
  8713. @end table
  8714. @item interpolation
  8715. Set interpolation for perspective correction.
  8716. It accepts the following values:
  8717. @table @samp
  8718. @item linear
  8719. @item cubic
  8720. @end table
  8721. Default value is @samp{linear}.
  8722. @item sense
  8723. Set interpretation of coordinate options.
  8724. It accepts the following values:
  8725. @table @samp
  8726. @item 0, source
  8727. Send point in the source specified by the given coordinates to
  8728. the corners of the destination.
  8729. @item 1, destination
  8730. Send the corners of the source to the point in the destination specified
  8731. by the given coordinates.
  8732. Default value is @samp{source}.
  8733. @end table
  8734. @item eval
  8735. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  8736. It accepts the following values:
  8737. @table @samp
  8738. @item init
  8739. only evaluate expressions once during the filter initialization or
  8740. when a command is processed
  8741. @item frame
  8742. evaluate expressions for each incoming frame
  8743. @end table
  8744. Default value is @samp{init}.
  8745. @end table
  8746. @section phase
  8747. Delay interlaced video by one field time so that the field order changes.
  8748. The intended use is to fix PAL movies that have been captured with the
  8749. opposite field order to the film-to-video transfer.
  8750. A description of the accepted parameters follows.
  8751. @table @option
  8752. @item mode
  8753. Set phase mode.
  8754. It accepts the following values:
  8755. @table @samp
  8756. @item t
  8757. Capture field order top-first, transfer bottom-first.
  8758. Filter will delay the bottom field.
  8759. @item b
  8760. Capture field order bottom-first, transfer top-first.
  8761. Filter will delay the top field.
  8762. @item p
  8763. Capture and transfer with the same field order. This mode only exists
  8764. for the documentation of the other options to refer to, but if you
  8765. actually select it, the filter will faithfully do nothing.
  8766. @item a
  8767. Capture field order determined automatically by field flags, transfer
  8768. opposite.
  8769. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  8770. basis using field flags. If no field information is available,
  8771. then this works just like @samp{u}.
  8772. @item u
  8773. Capture unknown or varying, transfer opposite.
  8774. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  8775. analyzing the images and selecting the alternative that produces best
  8776. match between the fields.
  8777. @item T
  8778. Capture top-first, transfer unknown or varying.
  8779. Filter selects among @samp{t} and @samp{p} using image analysis.
  8780. @item B
  8781. Capture bottom-first, transfer unknown or varying.
  8782. Filter selects among @samp{b} and @samp{p} using image analysis.
  8783. @item A
  8784. Capture determined by field flags, transfer unknown or varying.
  8785. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  8786. image analysis. If no field information is available, then this works just
  8787. like @samp{U}. This is the default mode.
  8788. @item U
  8789. Both capture and transfer unknown or varying.
  8790. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  8791. @end table
  8792. @end table
  8793. @section pixdesctest
  8794. Pixel format descriptor test filter, mainly useful for internal
  8795. testing. The output video should be equal to the input video.
  8796. For example:
  8797. @example
  8798. format=monow, pixdesctest
  8799. @end example
  8800. can be used to test the monowhite pixel format descriptor definition.
  8801. @section pixscope
  8802. Display sample values of color channels. Mainly useful for checking color and levels.
  8803. The filters accept the following options:
  8804. @table @option
  8805. @item x
  8806. Set scope X position, offset on X axis.
  8807. @item y
  8808. Set scope Y position, offset on Y axis.
  8809. @item w
  8810. Set scope width.
  8811. @item h
  8812. Set scope height.
  8813. @item o
  8814. Set window opacity. This window also holds statistics about pixel area.
  8815. @end table
  8816. @section pp
  8817. Enable the specified chain of postprocessing subfilters using libpostproc. This
  8818. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  8819. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  8820. Each subfilter and some options have a short and a long name that can be used
  8821. interchangeably, i.e. dr/dering are the same.
  8822. The filters accept the following options:
  8823. @table @option
  8824. @item subfilters
  8825. Set postprocessing subfilters string.
  8826. @end table
  8827. All subfilters share common options to determine their scope:
  8828. @table @option
  8829. @item a/autoq
  8830. Honor the quality commands for this subfilter.
  8831. @item c/chrom
  8832. Do chrominance filtering, too (default).
  8833. @item y/nochrom
  8834. Do luminance filtering only (no chrominance).
  8835. @item n/noluma
  8836. Do chrominance filtering only (no luminance).
  8837. @end table
  8838. These options can be appended after the subfilter name, separated by a '|'.
  8839. Available subfilters are:
  8840. @table @option
  8841. @item hb/hdeblock[|difference[|flatness]]
  8842. Horizontal deblocking filter
  8843. @table @option
  8844. @item difference
  8845. Difference factor where higher values mean more deblocking (default: @code{32}).
  8846. @item flatness
  8847. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8848. @end table
  8849. @item vb/vdeblock[|difference[|flatness]]
  8850. Vertical deblocking filter
  8851. @table @option
  8852. @item difference
  8853. Difference factor where higher values mean more deblocking (default: @code{32}).
  8854. @item flatness
  8855. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8856. @end table
  8857. @item ha/hadeblock[|difference[|flatness]]
  8858. Accurate horizontal deblocking filter
  8859. @table @option
  8860. @item difference
  8861. Difference factor where higher values mean more deblocking (default: @code{32}).
  8862. @item flatness
  8863. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8864. @end table
  8865. @item va/vadeblock[|difference[|flatness]]
  8866. Accurate vertical deblocking filter
  8867. @table @option
  8868. @item difference
  8869. Difference factor where higher values mean more deblocking (default: @code{32}).
  8870. @item flatness
  8871. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8872. @end table
  8873. @end table
  8874. The horizontal and vertical deblocking filters share the difference and
  8875. flatness values so you cannot set different horizontal and vertical
  8876. thresholds.
  8877. @table @option
  8878. @item h1/x1hdeblock
  8879. Experimental horizontal deblocking filter
  8880. @item v1/x1vdeblock
  8881. Experimental vertical deblocking filter
  8882. @item dr/dering
  8883. Deringing filter
  8884. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  8885. @table @option
  8886. @item threshold1
  8887. larger -> stronger filtering
  8888. @item threshold2
  8889. larger -> stronger filtering
  8890. @item threshold3
  8891. larger -> stronger filtering
  8892. @end table
  8893. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  8894. @table @option
  8895. @item f/fullyrange
  8896. Stretch luminance to @code{0-255}.
  8897. @end table
  8898. @item lb/linblenddeint
  8899. Linear blend deinterlacing filter that deinterlaces the given block by
  8900. filtering all lines with a @code{(1 2 1)} filter.
  8901. @item li/linipoldeint
  8902. Linear interpolating deinterlacing filter that deinterlaces the given block by
  8903. linearly interpolating every second line.
  8904. @item ci/cubicipoldeint
  8905. Cubic interpolating deinterlacing filter deinterlaces the given block by
  8906. cubically interpolating every second line.
  8907. @item md/mediandeint
  8908. Median deinterlacing filter that deinterlaces the given block by applying a
  8909. median filter to every second line.
  8910. @item fd/ffmpegdeint
  8911. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  8912. second line with a @code{(-1 4 2 4 -1)} filter.
  8913. @item l5/lowpass5
  8914. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  8915. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  8916. @item fq/forceQuant[|quantizer]
  8917. Overrides the quantizer table from the input with the constant quantizer you
  8918. specify.
  8919. @table @option
  8920. @item quantizer
  8921. Quantizer to use
  8922. @end table
  8923. @item de/default
  8924. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  8925. @item fa/fast
  8926. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  8927. @item ac
  8928. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  8929. @end table
  8930. @subsection Examples
  8931. @itemize
  8932. @item
  8933. Apply horizontal and vertical deblocking, deringing and automatic
  8934. brightness/contrast:
  8935. @example
  8936. pp=hb/vb/dr/al
  8937. @end example
  8938. @item
  8939. Apply default filters without brightness/contrast correction:
  8940. @example
  8941. pp=de/-al
  8942. @end example
  8943. @item
  8944. Apply default filters and temporal denoiser:
  8945. @example
  8946. pp=default/tmpnoise|1|2|3
  8947. @end example
  8948. @item
  8949. Apply deblocking on luminance only, and switch vertical deblocking on or off
  8950. automatically depending on available CPU time:
  8951. @example
  8952. pp=hb|y/vb|a
  8953. @end example
  8954. @end itemize
  8955. @section pp7
  8956. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  8957. similar to spp = 6 with 7 point DCT, where only the center sample is
  8958. used after IDCT.
  8959. The filter accepts the following options:
  8960. @table @option
  8961. @item qp
  8962. Force a constant quantization parameter. It accepts an integer in range
  8963. 0 to 63. If not set, the filter will use the QP from the video stream
  8964. (if available).
  8965. @item mode
  8966. Set thresholding mode. Available modes are:
  8967. @table @samp
  8968. @item hard
  8969. Set hard thresholding.
  8970. @item soft
  8971. Set soft thresholding (better de-ringing effect, but likely blurrier).
  8972. @item medium
  8973. Set medium thresholding (good results, default).
  8974. @end table
  8975. @end table
  8976. @section premultiply
  8977. Apply alpha premultiply effect to input video stream using first plane
  8978. of second stream as alpha.
  8979. Both streams must have same dimensions and same pixel format.
  8980. The filter accepts the following option:
  8981. @table @option
  8982. @item planes
  8983. Set which planes will be processed, unprocessed planes will be copied.
  8984. By default value 0xf, all planes will be processed.
  8985. @end table
  8986. @section prewitt
  8987. Apply prewitt operator to input video stream.
  8988. The filter accepts the following option:
  8989. @table @option
  8990. @item planes
  8991. Set which planes will be processed, unprocessed planes will be copied.
  8992. By default value 0xf, all planes will be processed.
  8993. @item scale
  8994. Set value which will be multiplied with filtered result.
  8995. @item delta
  8996. Set value which will be added to filtered result.
  8997. @end table
  8998. @section psnr
  8999. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  9000. Ratio) between two input videos.
  9001. This filter takes in input two input videos, the first input is
  9002. considered the "main" source and is passed unchanged to the
  9003. output. The second input is used as a "reference" video for computing
  9004. the PSNR.
  9005. Both video inputs must have the same resolution and pixel format for
  9006. this filter to work correctly. Also it assumes that both inputs
  9007. have the same number of frames, which are compared one by one.
  9008. The obtained average PSNR is printed through the logging system.
  9009. The filter stores the accumulated MSE (mean squared error) of each
  9010. frame, and at the end of the processing it is averaged across all frames
  9011. equally, and the following formula is applied to obtain the PSNR:
  9012. @example
  9013. PSNR = 10*log10(MAX^2/MSE)
  9014. @end example
  9015. Where MAX is the average of the maximum values of each component of the
  9016. image.
  9017. The description of the accepted parameters follows.
  9018. @table @option
  9019. @item stats_file, f
  9020. If specified the filter will use the named file to save the PSNR of
  9021. each individual frame. When filename equals "-" the data is sent to
  9022. standard output.
  9023. @item stats_version
  9024. Specifies which version of the stats file format to use. Details of
  9025. each format are written below.
  9026. Default value is 1.
  9027. @item stats_add_max
  9028. Determines whether the max value is output to the stats log.
  9029. Default value is 0.
  9030. Requires stats_version >= 2. If this is set and stats_version < 2,
  9031. the filter will return an error.
  9032. @end table
  9033. The file printed if @var{stats_file} is selected, contains a sequence of
  9034. key/value pairs of the form @var{key}:@var{value} for each compared
  9035. couple of frames.
  9036. If a @var{stats_version} greater than 1 is specified, a header line precedes
  9037. the list of per-frame-pair stats, with key value pairs following the frame
  9038. format with the following parameters:
  9039. @table @option
  9040. @item psnr_log_version
  9041. The version of the log file format. Will match @var{stats_version}.
  9042. @item fields
  9043. A comma separated list of the per-frame-pair parameters included in
  9044. the log.
  9045. @end table
  9046. A description of each shown per-frame-pair parameter follows:
  9047. @table @option
  9048. @item n
  9049. sequential number of the input frame, starting from 1
  9050. @item mse_avg
  9051. Mean Square Error pixel-by-pixel average difference of the compared
  9052. frames, averaged over all the image components.
  9053. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  9054. Mean Square Error pixel-by-pixel average difference of the compared
  9055. frames for the component specified by the suffix.
  9056. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  9057. Peak Signal to Noise ratio of the compared frames for the component
  9058. specified by the suffix.
  9059. @item max_avg, max_y, max_u, max_v
  9060. Maximum allowed value for each channel, and average over all
  9061. channels.
  9062. @end table
  9063. For example:
  9064. @example
  9065. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  9066. [main][ref] psnr="stats_file=stats.log" [out]
  9067. @end example
  9068. On this example the input file being processed is compared with the
  9069. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  9070. is stored in @file{stats.log}.
  9071. @anchor{pullup}
  9072. @section pullup
  9073. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  9074. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  9075. content.
  9076. The pullup filter is designed to take advantage of future context in making
  9077. its decisions. This filter is stateless in the sense that it does not lock
  9078. onto a pattern to follow, but it instead looks forward to the following
  9079. fields in order to identify matches and rebuild progressive frames.
  9080. To produce content with an even framerate, insert the fps filter after
  9081. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  9082. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  9083. The filter accepts the following options:
  9084. @table @option
  9085. @item jl
  9086. @item jr
  9087. @item jt
  9088. @item jb
  9089. These options set the amount of "junk" to ignore at the left, right, top, and
  9090. bottom of the image, respectively. Left and right are in units of 8 pixels,
  9091. while top and bottom are in units of 2 lines.
  9092. The default is 8 pixels on each side.
  9093. @item sb
  9094. Set the strict breaks. Setting this option to 1 will reduce the chances of
  9095. filter generating an occasional mismatched frame, but it may also cause an
  9096. excessive number of frames to be dropped during high motion sequences.
  9097. Conversely, setting it to -1 will make filter match fields more easily.
  9098. This may help processing of video where there is slight blurring between
  9099. the fields, but may also cause there to be interlaced frames in the output.
  9100. Default value is @code{0}.
  9101. @item mp
  9102. Set the metric plane to use. It accepts the following values:
  9103. @table @samp
  9104. @item l
  9105. Use luma plane.
  9106. @item u
  9107. Use chroma blue plane.
  9108. @item v
  9109. Use chroma red plane.
  9110. @end table
  9111. This option may be set to use chroma plane instead of the default luma plane
  9112. for doing filter's computations. This may improve accuracy on very clean
  9113. source material, but more likely will decrease accuracy, especially if there
  9114. is chroma noise (rainbow effect) or any grayscale video.
  9115. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  9116. load and make pullup usable in realtime on slow machines.
  9117. @end table
  9118. For best results (without duplicated frames in the output file) it is
  9119. necessary to change the output frame rate. For example, to inverse
  9120. telecine NTSC input:
  9121. @example
  9122. ffmpeg -i input -vf pullup -r 24000/1001 ...
  9123. @end example
  9124. @section qp
  9125. Change video quantization parameters (QP).
  9126. The filter accepts the following option:
  9127. @table @option
  9128. @item qp
  9129. Set expression for quantization parameter.
  9130. @end table
  9131. The expression is evaluated through the eval API and can contain, among others,
  9132. the following constants:
  9133. @table @var
  9134. @item known
  9135. 1 if index is not 129, 0 otherwise.
  9136. @item qp
  9137. Sequentional index starting from -129 to 128.
  9138. @end table
  9139. @subsection Examples
  9140. @itemize
  9141. @item
  9142. Some equation like:
  9143. @example
  9144. qp=2+2*sin(PI*qp)
  9145. @end example
  9146. @end itemize
  9147. @section random
  9148. Flush video frames from internal cache of frames into a random order.
  9149. No frame is discarded.
  9150. Inspired by @ref{frei0r} nervous filter.
  9151. @table @option
  9152. @item frames
  9153. Set size in number of frames of internal cache, in range from @code{2} to
  9154. @code{512}. Default is @code{30}.
  9155. @item seed
  9156. Set seed for random number generator, must be an integer included between
  9157. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  9158. less than @code{0}, the filter will try to use a good random seed on a
  9159. best effort basis.
  9160. @end table
  9161. @section readeia608
  9162. Read closed captioning (EIA-608) information from the top lines of a video frame.
  9163. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  9164. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  9165. with EIA-608 data (starting from 0). A description of each metadata value follows:
  9166. @table @option
  9167. @item lavfi.readeia608.X.cc
  9168. The two bytes stored as EIA-608 data (printed in hexadecimal).
  9169. @item lavfi.readeia608.X.line
  9170. The number of the line on which the EIA-608 data was identified and read.
  9171. @end table
  9172. This filter accepts the following options:
  9173. @table @option
  9174. @item scan_min
  9175. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  9176. @item scan_max
  9177. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  9178. @item mac
  9179. Set minimal acceptable amplitude change for sync codes detection.
  9180. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  9181. @item spw
  9182. Set the ratio of width reserved for sync code detection.
  9183. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  9184. @item mhd
  9185. Set the max peaks height difference for sync code detection.
  9186. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9187. @item mpd
  9188. Set max peaks period difference for sync code detection.
  9189. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9190. @item msd
  9191. Set the first two max start code bits differences.
  9192. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  9193. @item bhd
  9194. Set the minimum ratio of bits height compared to 3rd start code bit.
  9195. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  9196. @item th_w
  9197. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  9198. @item th_b
  9199. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  9200. @item chp
  9201. Enable checking the parity bit. In the event of a parity error, the filter will output
  9202. @code{0x00} for that character. Default is false.
  9203. @end table
  9204. @subsection Examples
  9205. @itemize
  9206. @item
  9207. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  9208. @example
  9209. ffprobe -f lavfi -i movie=captioned_video.mov,readeia608 -show_entries frame=pkt_pts_time:frame_tags=lavfi.readeia608.0.cc,lavfi.readeia608.1.cc -of csv
  9210. @end example
  9211. @end itemize
  9212. @section readvitc
  9213. Read vertical interval timecode (VITC) information from the top lines of a
  9214. video frame.
  9215. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  9216. timecode value, if a valid timecode has been detected. Further metadata key
  9217. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  9218. timecode data has been found or not.
  9219. This filter accepts the following options:
  9220. @table @option
  9221. @item scan_max
  9222. Set the maximum number of lines to scan for VITC data. If the value is set to
  9223. @code{-1} the full video frame is scanned. Default is @code{45}.
  9224. @item thr_b
  9225. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  9226. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  9227. @item thr_w
  9228. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  9229. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  9230. @end table
  9231. @subsection Examples
  9232. @itemize
  9233. @item
  9234. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  9235. draw @code{--:--:--:--} as a placeholder:
  9236. @example
  9237. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  9238. @end example
  9239. @end itemize
  9240. @section remap
  9241. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  9242. Destination pixel at position (X, Y) will be picked from source (x, y) position
  9243. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  9244. value for pixel will be used for destination pixel.
  9245. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  9246. will have Xmap/Ymap video stream dimensions.
  9247. Xmap and Ymap input video streams are 16bit depth, single channel.
  9248. @section removegrain
  9249. The removegrain filter is a spatial denoiser for progressive video.
  9250. @table @option
  9251. @item m0
  9252. Set mode for the first plane.
  9253. @item m1
  9254. Set mode for the second plane.
  9255. @item m2
  9256. Set mode for the third plane.
  9257. @item m3
  9258. Set mode for the fourth plane.
  9259. @end table
  9260. Range of mode is from 0 to 24. Description of each mode follows:
  9261. @table @var
  9262. @item 0
  9263. Leave input plane unchanged. Default.
  9264. @item 1
  9265. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  9266. @item 2
  9267. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  9268. @item 3
  9269. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  9270. @item 4
  9271. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  9272. This is equivalent to a median filter.
  9273. @item 5
  9274. Line-sensitive clipping giving the minimal change.
  9275. @item 6
  9276. Line-sensitive clipping, intermediate.
  9277. @item 7
  9278. Line-sensitive clipping, intermediate.
  9279. @item 8
  9280. Line-sensitive clipping, intermediate.
  9281. @item 9
  9282. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  9283. @item 10
  9284. Replaces the target pixel with the closest neighbour.
  9285. @item 11
  9286. [1 2 1] horizontal and vertical kernel blur.
  9287. @item 12
  9288. Same as mode 11.
  9289. @item 13
  9290. Bob mode, interpolates top field from the line where the neighbours
  9291. pixels are the closest.
  9292. @item 14
  9293. Bob mode, interpolates bottom field from the line where the neighbours
  9294. pixels are the closest.
  9295. @item 15
  9296. Bob mode, interpolates top field. Same as 13 but with a more complicated
  9297. interpolation formula.
  9298. @item 16
  9299. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  9300. interpolation formula.
  9301. @item 17
  9302. Clips the pixel with the minimum and maximum of respectively the maximum and
  9303. minimum of each pair of opposite neighbour pixels.
  9304. @item 18
  9305. Line-sensitive clipping using opposite neighbours whose greatest distance from
  9306. the current pixel is minimal.
  9307. @item 19
  9308. Replaces the pixel with the average of its 8 neighbours.
  9309. @item 20
  9310. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  9311. @item 21
  9312. Clips pixels using the averages of opposite neighbour.
  9313. @item 22
  9314. Same as mode 21 but simpler and faster.
  9315. @item 23
  9316. Small edge and halo removal, but reputed useless.
  9317. @item 24
  9318. Similar as 23.
  9319. @end table
  9320. @section removelogo
  9321. Suppress a TV station logo, using an image file to determine which
  9322. pixels comprise the logo. It works by filling in the pixels that
  9323. comprise the logo with neighboring pixels.
  9324. The filter accepts the following options:
  9325. @table @option
  9326. @item filename, f
  9327. Set the filter bitmap file, which can be any image format supported by
  9328. libavformat. The width and height of the image file must match those of the
  9329. video stream being processed.
  9330. @end table
  9331. Pixels in the provided bitmap image with a value of zero are not
  9332. considered part of the logo, non-zero pixels are considered part of
  9333. the logo. If you use white (255) for the logo and black (0) for the
  9334. rest, you will be safe. For making the filter bitmap, it is
  9335. recommended to take a screen capture of a black frame with the logo
  9336. visible, and then using a threshold filter followed by the erode
  9337. filter once or twice.
  9338. If needed, little splotches can be fixed manually. Remember that if
  9339. logo pixels are not covered, the filter quality will be much
  9340. reduced. Marking too many pixels as part of the logo does not hurt as
  9341. much, but it will increase the amount of blurring needed to cover over
  9342. the image and will destroy more information than necessary, and extra
  9343. pixels will slow things down on a large logo.
  9344. @section repeatfields
  9345. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  9346. fields based on its value.
  9347. @section reverse
  9348. Reverse a video clip.
  9349. Warning: This filter requires memory to buffer the entire clip, so trimming
  9350. is suggested.
  9351. @subsection Examples
  9352. @itemize
  9353. @item
  9354. Take the first 5 seconds of a clip, and reverse it.
  9355. @example
  9356. trim=end=5,reverse
  9357. @end example
  9358. @end itemize
  9359. @section roberts
  9360. Apply roberts cross operator to input video stream.
  9361. The filter accepts the following option:
  9362. @table @option
  9363. @item planes
  9364. Set which planes will be processed, unprocessed planes will be copied.
  9365. By default value 0xf, all planes will be processed.
  9366. @item scale
  9367. Set value which will be multiplied with filtered result.
  9368. @item delta
  9369. Set value which will be added to filtered result.
  9370. @end table
  9371. @section rotate
  9372. Rotate video by an arbitrary angle expressed in radians.
  9373. The filter accepts the following options:
  9374. A description of the optional parameters follows.
  9375. @table @option
  9376. @item angle, a
  9377. Set an expression for the angle by which to rotate the input video
  9378. clockwise, expressed as a number of radians. A negative value will
  9379. result in a counter-clockwise rotation. By default it is set to "0".
  9380. This expression is evaluated for each frame.
  9381. @item out_w, ow
  9382. Set the output width expression, default value is "iw".
  9383. This expression is evaluated just once during configuration.
  9384. @item out_h, oh
  9385. Set the output height expression, default value is "ih".
  9386. This expression is evaluated just once during configuration.
  9387. @item bilinear
  9388. Enable bilinear interpolation if set to 1, a value of 0 disables
  9389. it. Default value is 1.
  9390. @item fillcolor, c
  9391. Set the color used to fill the output area not covered by the rotated
  9392. image. For the general syntax of this option, check the "Color" section in the
  9393. ffmpeg-utils manual. If the special value "none" is selected then no
  9394. background is printed (useful for example if the background is never shown).
  9395. Default value is "black".
  9396. @end table
  9397. The expressions for the angle and the output size can contain the
  9398. following constants and functions:
  9399. @table @option
  9400. @item n
  9401. sequential number of the input frame, starting from 0. It is always NAN
  9402. before the first frame is filtered.
  9403. @item t
  9404. time in seconds of the input frame, it is set to 0 when the filter is
  9405. configured. It is always NAN before the first frame is filtered.
  9406. @item hsub
  9407. @item vsub
  9408. horizontal and vertical chroma subsample values. For example for the
  9409. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9410. @item in_w, iw
  9411. @item in_h, ih
  9412. the input video width and height
  9413. @item out_w, ow
  9414. @item out_h, oh
  9415. the output width and height, that is the size of the padded area as
  9416. specified by the @var{width} and @var{height} expressions
  9417. @item rotw(a)
  9418. @item roth(a)
  9419. the minimal width/height required for completely containing the input
  9420. video rotated by @var{a} radians.
  9421. These are only available when computing the @option{out_w} and
  9422. @option{out_h} expressions.
  9423. @end table
  9424. @subsection Examples
  9425. @itemize
  9426. @item
  9427. Rotate the input by PI/6 radians clockwise:
  9428. @example
  9429. rotate=PI/6
  9430. @end example
  9431. @item
  9432. Rotate the input by PI/6 radians counter-clockwise:
  9433. @example
  9434. rotate=-PI/6
  9435. @end example
  9436. @item
  9437. Rotate the input by 45 degrees clockwise:
  9438. @example
  9439. rotate=45*PI/180
  9440. @end example
  9441. @item
  9442. Apply a constant rotation with period T, starting from an angle of PI/3:
  9443. @example
  9444. rotate=PI/3+2*PI*t/T
  9445. @end example
  9446. @item
  9447. Make the input video rotation oscillating with a period of T
  9448. seconds and an amplitude of A radians:
  9449. @example
  9450. rotate=A*sin(2*PI/T*t)
  9451. @end example
  9452. @item
  9453. Rotate the video, output size is chosen so that the whole rotating
  9454. input video is always completely contained in the output:
  9455. @example
  9456. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  9457. @end example
  9458. @item
  9459. Rotate the video, reduce the output size so that no background is ever
  9460. shown:
  9461. @example
  9462. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  9463. @end example
  9464. @end itemize
  9465. @subsection Commands
  9466. The filter supports the following commands:
  9467. @table @option
  9468. @item a, angle
  9469. Set the angle expression.
  9470. The command accepts the same syntax of the corresponding option.
  9471. If the specified expression is not valid, it is kept at its current
  9472. value.
  9473. @end table
  9474. @section sab
  9475. Apply Shape Adaptive Blur.
  9476. The filter accepts the following options:
  9477. @table @option
  9478. @item luma_radius, lr
  9479. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  9480. value is 1.0. A greater value will result in a more blurred image, and
  9481. in slower processing.
  9482. @item luma_pre_filter_radius, lpfr
  9483. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  9484. value is 1.0.
  9485. @item luma_strength, ls
  9486. Set luma maximum difference between pixels to still be considered, must
  9487. be a value in the 0.1-100.0 range, default value is 1.0.
  9488. @item chroma_radius, cr
  9489. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  9490. greater value will result in a more blurred image, and in slower
  9491. processing.
  9492. @item chroma_pre_filter_radius, cpfr
  9493. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  9494. @item chroma_strength, cs
  9495. Set chroma maximum difference between pixels to still be considered,
  9496. must be a value in the -0.9-100.0 range.
  9497. @end table
  9498. Each chroma option value, if not explicitly specified, is set to the
  9499. corresponding luma option value.
  9500. @anchor{scale}
  9501. @section scale
  9502. Scale (resize) the input video, using the libswscale library.
  9503. The scale filter forces the output display aspect ratio to be the same
  9504. of the input, by changing the output sample aspect ratio.
  9505. If the input image format is different from the format requested by
  9506. the next filter, the scale filter will convert the input to the
  9507. requested format.
  9508. @subsection Options
  9509. The filter accepts the following options, or any of the options
  9510. supported by the libswscale scaler.
  9511. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  9512. the complete list of scaler options.
  9513. @table @option
  9514. @item width, w
  9515. @item height, h
  9516. Set the output video dimension expression. Default value is the input
  9517. dimension.
  9518. If the @var{width} or @var{w} value is 0, the input width is used for
  9519. the output. If the @var{height} or @var{h} value is 0, the input height
  9520. is used for the output.
  9521. If one and only one of the values is -n with n >= 1, the scale filter
  9522. will use a value that maintains the aspect ratio of the input image,
  9523. calculated from the other specified dimension. After that it will,
  9524. however, make sure that the calculated dimension is divisible by n and
  9525. adjust the value if necessary.
  9526. If both values are -n with n >= 1, the behavior will be identical to
  9527. both values being set to 0 as previously detailed.
  9528. See below for the list of accepted constants for use in the dimension
  9529. expression.
  9530. @item eval
  9531. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  9532. @table @samp
  9533. @item init
  9534. Only evaluate expressions once during the filter initialization or when a command is processed.
  9535. @item frame
  9536. Evaluate expressions for each incoming frame.
  9537. @end table
  9538. Default value is @samp{init}.
  9539. @item interl
  9540. Set the interlacing mode. It accepts the following values:
  9541. @table @samp
  9542. @item 1
  9543. Force interlaced aware scaling.
  9544. @item 0
  9545. Do not apply interlaced scaling.
  9546. @item -1
  9547. Select interlaced aware scaling depending on whether the source frames
  9548. are flagged as interlaced or not.
  9549. @end table
  9550. Default value is @samp{0}.
  9551. @item flags
  9552. Set libswscale scaling flags. See
  9553. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  9554. complete list of values. If not explicitly specified the filter applies
  9555. the default flags.
  9556. @item param0, param1
  9557. Set libswscale input parameters for scaling algorithms that need them. See
  9558. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  9559. complete documentation. If not explicitly specified the filter applies
  9560. empty parameters.
  9561. @item size, s
  9562. Set the video size. For the syntax of this option, check the
  9563. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9564. @item in_color_matrix
  9565. @item out_color_matrix
  9566. Set in/output YCbCr color space type.
  9567. This allows the autodetected value to be overridden as well as allows forcing
  9568. a specific value used for the output and encoder.
  9569. If not specified, the color space type depends on the pixel format.
  9570. Possible values:
  9571. @table @samp
  9572. @item auto
  9573. Choose automatically.
  9574. @item bt709
  9575. Format conforming to International Telecommunication Union (ITU)
  9576. Recommendation BT.709.
  9577. @item fcc
  9578. Set color space conforming to the United States Federal Communications
  9579. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  9580. @item bt601
  9581. Set color space conforming to:
  9582. @itemize
  9583. @item
  9584. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  9585. @item
  9586. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  9587. @item
  9588. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  9589. @end itemize
  9590. @item smpte240m
  9591. Set color space conforming to SMPTE ST 240:1999.
  9592. @end table
  9593. @item in_range
  9594. @item out_range
  9595. Set in/output YCbCr sample range.
  9596. This allows the autodetected value to be overridden as well as allows forcing
  9597. a specific value used for the output and encoder. If not specified, the
  9598. range depends on the pixel format. Possible values:
  9599. @table @samp
  9600. @item auto
  9601. Choose automatically.
  9602. @item jpeg/full/pc
  9603. Set full range (0-255 in case of 8-bit luma).
  9604. @item mpeg/tv
  9605. Set "MPEG" range (16-235 in case of 8-bit luma).
  9606. @end table
  9607. @item force_original_aspect_ratio
  9608. Enable decreasing or increasing output video width or height if necessary to
  9609. keep the original aspect ratio. Possible values:
  9610. @table @samp
  9611. @item disable
  9612. Scale the video as specified and disable this feature.
  9613. @item decrease
  9614. The output video dimensions will automatically be decreased if needed.
  9615. @item increase
  9616. The output video dimensions will automatically be increased if needed.
  9617. @end table
  9618. One useful instance of this option is that when you know a specific device's
  9619. maximum allowed resolution, you can use this to limit the output video to
  9620. that, while retaining the aspect ratio. For example, device A allows
  9621. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  9622. decrease) and specifying 1280x720 to the command line makes the output
  9623. 1280x533.
  9624. Please note that this is a different thing than specifying -1 for @option{w}
  9625. or @option{h}, you still need to specify the output resolution for this option
  9626. to work.
  9627. @end table
  9628. The values of the @option{w} and @option{h} options are expressions
  9629. containing the following constants:
  9630. @table @var
  9631. @item in_w
  9632. @item in_h
  9633. The input width and height
  9634. @item iw
  9635. @item ih
  9636. These are the same as @var{in_w} and @var{in_h}.
  9637. @item out_w
  9638. @item out_h
  9639. The output (scaled) width and height
  9640. @item ow
  9641. @item oh
  9642. These are the same as @var{out_w} and @var{out_h}
  9643. @item a
  9644. The same as @var{iw} / @var{ih}
  9645. @item sar
  9646. input sample aspect ratio
  9647. @item dar
  9648. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  9649. @item hsub
  9650. @item vsub
  9651. horizontal and vertical input chroma subsample values. For example for the
  9652. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9653. @item ohsub
  9654. @item ovsub
  9655. horizontal and vertical output chroma subsample values. For example for the
  9656. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9657. @end table
  9658. @subsection Examples
  9659. @itemize
  9660. @item
  9661. Scale the input video to a size of 200x100
  9662. @example
  9663. scale=w=200:h=100
  9664. @end example
  9665. This is equivalent to:
  9666. @example
  9667. scale=200:100
  9668. @end example
  9669. or:
  9670. @example
  9671. scale=200x100
  9672. @end example
  9673. @item
  9674. Specify a size abbreviation for the output size:
  9675. @example
  9676. scale=qcif
  9677. @end example
  9678. which can also be written as:
  9679. @example
  9680. scale=size=qcif
  9681. @end example
  9682. @item
  9683. Scale the input to 2x:
  9684. @example
  9685. scale=w=2*iw:h=2*ih
  9686. @end example
  9687. @item
  9688. The above is the same as:
  9689. @example
  9690. scale=2*in_w:2*in_h
  9691. @end example
  9692. @item
  9693. Scale the input to 2x with forced interlaced scaling:
  9694. @example
  9695. scale=2*iw:2*ih:interl=1
  9696. @end example
  9697. @item
  9698. Scale the input to half size:
  9699. @example
  9700. scale=w=iw/2:h=ih/2
  9701. @end example
  9702. @item
  9703. Increase the width, and set the height to the same size:
  9704. @example
  9705. scale=3/2*iw:ow
  9706. @end example
  9707. @item
  9708. Seek Greek harmony:
  9709. @example
  9710. scale=iw:1/PHI*iw
  9711. scale=ih*PHI:ih
  9712. @end example
  9713. @item
  9714. Increase the height, and set the width to 3/2 of the height:
  9715. @example
  9716. scale=w=3/2*oh:h=3/5*ih
  9717. @end example
  9718. @item
  9719. Increase the size, making the size a multiple of the chroma
  9720. subsample values:
  9721. @example
  9722. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  9723. @end example
  9724. @item
  9725. Increase the width to a maximum of 500 pixels,
  9726. keeping the same aspect ratio as the input:
  9727. @example
  9728. scale=w='min(500\, iw*3/2):h=-1'
  9729. @end example
  9730. @end itemize
  9731. @subsection Commands
  9732. This filter supports the following commands:
  9733. @table @option
  9734. @item width, w
  9735. @item height, h
  9736. Set the output video dimension expression.
  9737. The command accepts the same syntax of the corresponding option.
  9738. If the specified expression is not valid, it is kept at its current
  9739. value.
  9740. @end table
  9741. @section scale_npp
  9742. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  9743. format conversion on CUDA video frames. Setting the output width and height
  9744. works in the same way as for the @var{scale} filter.
  9745. The following additional options are accepted:
  9746. @table @option
  9747. @item format
  9748. The pixel format of the output CUDA frames. If set to the string "same" (the
  9749. default), the input format will be kept. Note that automatic format negotiation
  9750. and conversion is not yet supported for hardware frames
  9751. @item interp_algo
  9752. The interpolation algorithm used for resizing. One of the following:
  9753. @table @option
  9754. @item nn
  9755. Nearest neighbour.
  9756. @item linear
  9757. @item cubic
  9758. @item cubic2p_bspline
  9759. 2-parameter cubic (B=1, C=0)
  9760. @item cubic2p_catmullrom
  9761. 2-parameter cubic (B=0, C=1/2)
  9762. @item cubic2p_b05c03
  9763. 2-parameter cubic (B=1/2, C=3/10)
  9764. @item super
  9765. Supersampling
  9766. @item lanczos
  9767. @end table
  9768. @end table
  9769. @section scale2ref
  9770. Scale (resize) the input video, based on a reference video.
  9771. See the scale filter for available options, scale2ref supports the same but
  9772. uses the reference video instead of the main input as basis. scale2ref also
  9773. supports the following additional constants for the @option{w} and
  9774. @option{h} options:
  9775. @table @var
  9776. @item main_w
  9777. @item main_h
  9778. The main input video's width and height
  9779. @item main_a
  9780. The same as @var{main_w} / @var{main_h}
  9781. @item main_sar
  9782. The main input video's sample aspect ratio
  9783. @item main_dar, mdar
  9784. The main input video's display aspect ratio. Calculated from
  9785. @code{(main_w / main_h) * main_sar}.
  9786. @item main_hsub
  9787. @item main_vsub
  9788. The main input video's horizontal and vertical chroma subsample values.
  9789. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  9790. is 1.
  9791. @end table
  9792. @subsection Examples
  9793. @itemize
  9794. @item
  9795. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  9796. @example
  9797. 'scale2ref[b][a];[a][b]overlay'
  9798. @end example
  9799. @end itemize
  9800. @anchor{selectivecolor}
  9801. @section selectivecolor
  9802. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  9803. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  9804. by the "purity" of the color (that is, how saturated it already is).
  9805. This filter is similar to the Adobe Photoshop Selective Color tool.
  9806. The filter accepts the following options:
  9807. @table @option
  9808. @item correction_method
  9809. Select color correction method.
  9810. Available values are:
  9811. @table @samp
  9812. @item absolute
  9813. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  9814. component value).
  9815. @item relative
  9816. Specified adjustments are relative to the original component value.
  9817. @end table
  9818. Default is @code{absolute}.
  9819. @item reds
  9820. Adjustments for red pixels (pixels where the red component is the maximum)
  9821. @item yellows
  9822. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  9823. @item greens
  9824. Adjustments for green pixels (pixels where the green component is the maximum)
  9825. @item cyans
  9826. Adjustments for cyan pixels (pixels where the red component is the minimum)
  9827. @item blues
  9828. Adjustments for blue pixels (pixels where the blue component is the maximum)
  9829. @item magentas
  9830. Adjustments for magenta pixels (pixels where the green component is the minimum)
  9831. @item whites
  9832. Adjustments for white pixels (pixels where all components are greater than 128)
  9833. @item neutrals
  9834. Adjustments for all pixels except pure black and pure white
  9835. @item blacks
  9836. Adjustments for black pixels (pixels where all components are lesser than 128)
  9837. @item psfile
  9838. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  9839. @end table
  9840. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  9841. 4 space separated floating point adjustment values in the [-1,1] range,
  9842. respectively to adjust the amount of cyan, magenta, yellow and black for the
  9843. pixels of its range.
  9844. @subsection Examples
  9845. @itemize
  9846. @item
  9847. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  9848. increase magenta by 27% in blue areas:
  9849. @example
  9850. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  9851. @end example
  9852. @item
  9853. Use a Photoshop selective color preset:
  9854. @example
  9855. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  9856. @end example
  9857. @end itemize
  9858. @anchor{separatefields}
  9859. @section separatefields
  9860. The @code{separatefields} takes a frame-based video input and splits
  9861. each frame into its components fields, producing a new half height clip
  9862. with twice the frame rate and twice the frame count.
  9863. This filter use field-dominance information in frame to decide which
  9864. of each pair of fields to place first in the output.
  9865. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  9866. @section setdar, setsar
  9867. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  9868. output video.
  9869. This is done by changing the specified Sample (aka Pixel) Aspect
  9870. Ratio, according to the following equation:
  9871. @example
  9872. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  9873. @end example
  9874. Keep in mind that the @code{setdar} filter does not modify the pixel
  9875. dimensions of the video frame. Also, the display aspect ratio set by
  9876. this filter may be changed by later filters in the filterchain,
  9877. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  9878. applied.
  9879. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  9880. the filter output video.
  9881. Note that as a consequence of the application of this filter, the
  9882. output display aspect ratio will change according to the equation
  9883. above.
  9884. Keep in mind that the sample aspect ratio set by the @code{setsar}
  9885. filter may be changed by later filters in the filterchain, e.g. if
  9886. another "setsar" or a "setdar" filter is applied.
  9887. It accepts the following parameters:
  9888. @table @option
  9889. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  9890. Set the aspect ratio used by the filter.
  9891. The parameter can be a floating point number string, an expression, or
  9892. a string of the form @var{num}:@var{den}, where @var{num} and
  9893. @var{den} are the numerator and denominator of the aspect ratio. If
  9894. the parameter is not specified, it is assumed the value "0".
  9895. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  9896. should be escaped.
  9897. @item max
  9898. Set the maximum integer value to use for expressing numerator and
  9899. denominator when reducing the expressed aspect ratio to a rational.
  9900. Default value is @code{100}.
  9901. @end table
  9902. The parameter @var{sar} is an expression containing
  9903. the following constants:
  9904. @table @option
  9905. @item E, PI, PHI
  9906. These are approximated values for the mathematical constants e
  9907. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  9908. @item w, h
  9909. The input width and height.
  9910. @item a
  9911. These are the same as @var{w} / @var{h}.
  9912. @item sar
  9913. The input sample aspect ratio.
  9914. @item dar
  9915. The input display aspect ratio. It is the same as
  9916. (@var{w} / @var{h}) * @var{sar}.
  9917. @item hsub, vsub
  9918. Horizontal and vertical chroma subsample values. For example, for the
  9919. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9920. @end table
  9921. @subsection Examples
  9922. @itemize
  9923. @item
  9924. To change the display aspect ratio to 16:9, specify one of the following:
  9925. @example
  9926. setdar=dar=1.77777
  9927. setdar=dar=16/9
  9928. @end example
  9929. @item
  9930. To change the sample aspect ratio to 10:11, specify:
  9931. @example
  9932. setsar=sar=10/11
  9933. @end example
  9934. @item
  9935. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  9936. 1000 in the aspect ratio reduction, use the command:
  9937. @example
  9938. setdar=ratio=16/9:max=1000
  9939. @end example
  9940. @end itemize
  9941. @anchor{setfield}
  9942. @section setfield
  9943. Force field for the output video frame.
  9944. The @code{setfield} filter marks the interlace type field for the
  9945. output frames. It does not change the input frame, but only sets the
  9946. corresponding property, which affects how the frame is treated by
  9947. following filters (e.g. @code{fieldorder} or @code{yadif}).
  9948. The filter accepts the following options:
  9949. @table @option
  9950. @item mode
  9951. Available values are:
  9952. @table @samp
  9953. @item auto
  9954. Keep the same field property.
  9955. @item bff
  9956. Mark the frame as bottom-field-first.
  9957. @item tff
  9958. Mark the frame as top-field-first.
  9959. @item prog
  9960. Mark the frame as progressive.
  9961. @end table
  9962. @end table
  9963. @section showinfo
  9964. Show a line containing various information for each input video frame.
  9965. The input video is not modified.
  9966. The shown line contains a sequence of key/value pairs of the form
  9967. @var{key}:@var{value}.
  9968. The following values are shown in the output:
  9969. @table @option
  9970. @item n
  9971. The (sequential) number of the input frame, starting from 0.
  9972. @item pts
  9973. The Presentation TimeStamp of the input frame, expressed as a number of
  9974. time base units. The time base unit depends on the filter input pad.
  9975. @item pts_time
  9976. The Presentation TimeStamp of the input frame, expressed as a number of
  9977. seconds.
  9978. @item pos
  9979. The position of the frame in the input stream, or -1 if this information is
  9980. unavailable and/or meaningless (for example in case of synthetic video).
  9981. @item fmt
  9982. The pixel format name.
  9983. @item sar
  9984. The sample aspect ratio of the input frame, expressed in the form
  9985. @var{num}/@var{den}.
  9986. @item s
  9987. The size of the input frame. For the syntax of this option, check the
  9988. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9989. @item i
  9990. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  9991. for bottom field first).
  9992. @item iskey
  9993. This is 1 if the frame is a key frame, 0 otherwise.
  9994. @item type
  9995. The picture type of the input frame ("I" for an I-frame, "P" for a
  9996. P-frame, "B" for a B-frame, or "?" for an unknown type).
  9997. Also refer to the documentation of the @code{AVPictureType} enum and of
  9998. the @code{av_get_picture_type_char} function defined in
  9999. @file{libavutil/avutil.h}.
  10000. @item checksum
  10001. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  10002. @item plane_checksum
  10003. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  10004. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  10005. @end table
  10006. @section showpalette
  10007. Displays the 256 colors palette of each frame. This filter is only relevant for
  10008. @var{pal8} pixel format frames.
  10009. It accepts the following option:
  10010. @table @option
  10011. @item s
  10012. Set the size of the box used to represent one palette color entry. Default is
  10013. @code{30} (for a @code{30x30} pixel box).
  10014. @end table
  10015. @section shuffleframes
  10016. Reorder and/or duplicate and/or drop video frames.
  10017. It accepts the following parameters:
  10018. @table @option
  10019. @item mapping
  10020. Set the destination indexes of input frames.
  10021. This is space or '|' separated list of indexes that maps input frames to output
  10022. frames. Number of indexes also sets maximal value that each index may have.
  10023. '-1' index have special meaning and that is to drop frame.
  10024. @end table
  10025. The first frame has the index 0. The default is to keep the input unchanged.
  10026. @subsection Examples
  10027. @itemize
  10028. @item
  10029. Swap second and third frame of every three frames of the input:
  10030. @example
  10031. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  10032. @end example
  10033. @item
  10034. Swap 10th and 1st frame of every ten frames of the input:
  10035. @example
  10036. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  10037. @end example
  10038. @end itemize
  10039. @section shuffleplanes
  10040. Reorder and/or duplicate video planes.
  10041. It accepts the following parameters:
  10042. @table @option
  10043. @item map0
  10044. The index of the input plane to be used as the first output plane.
  10045. @item map1
  10046. The index of the input plane to be used as the second output plane.
  10047. @item map2
  10048. The index of the input plane to be used as the third output plane.
  10049. @item map3
  10050. The index of the input plane to be used as the fourth output plane.
  10051. @end table
  10052. The first plane has the index 0. The default is to keep the input unchanged.
  10053. @subsection Examples
  10054. @itemize
  10055. @item
  10056. Swap the second and third planes of the input:
  10057. @example
  10058. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  10059. @end example
  10060. @end itemize
  10061. @anchor{signalstats}
  10062. @section signalstats
  10063. Evaluate various visual metrics that assist in determining issues associated
  10064. with the digitization of analog video media.
  10065. By default the filter will log these metadata values:
  10066. @table @option
  10067. @item YMIN
  10068. Display the minimal Y value contained within the input frame. Expressed in
  10069. range of [0-255].
  10070. @item YLOW
  10071. Display the Y value at the 10% percentile within the input frame. Expressed in
  10072. range of [0-255].
  10073. @item YAVG
  10074. Display the average Y value within the input frame. Expressed in range of
  10075. [0-255].
  10076. @item YHIGH
  10077. Display the Y value at the 90% percentile within the input frame. Expressed in
  10078. range of [0-255].
  10079. @item YMAX
  10080. Display the maximum Y value contained within the input frame. Expressed in
  10081. range of [0-255].
  10082. @item UMIN
  10083. Display the minimal U value contained within the input frame. Expressed in
  10084. range of [0-255].
  10085. @item ULOW
  10086. Display the U value at the 10% percentile within the input frame. Expressed in
  10087. range of [0-255].
  10088. @item UAVG
  10089. Display the average U value within the input frame. Expressed in range of
  10090. [0-255].
  10091. @item UHIGH
  10092. Display the U value at the 90% percentile within the input frame. Expressed in
  10093. range of [0-255].
  10094. @item UMAX
  10095. Display the maximum U value contained within the input frame. Expressed in
  10096. range of [0-255].
  10097. @item VMIN
  10098. Display the minimal V value contained within the input frame. Expressed in
  10099. range of [0-255].
  10100. @item VLOW
  10101. Display the V value at the 10% percentile within the input frame. Expressed in
  10102. range of [0-255].
  10103. @item VAVG
  10104. Display the average V value within the input frame. Expressed in range of
  10105. [0-255].
  10106. @item VHIGH
  10107. Display the V value at the 90% percentile within the input frame. Expressed in
  10108. range of [0-255].
  10109. @item VMAX
  10110. Display the maximum V value contained within the input frame. Expressed in
  10111. range of [0-255].
  10112. @item SATMIN
  10113. Display the minimal saturation value contained within the input frame.
  10114. Expressed in range of [0-~181.02].
  10115. @item SATLOW
  10116. Display the saturation value at the 10% percentile within the input frame.
  10117. Expressed in range of [0-~181.02].
  10118. @item SATAVG
  10119. Display the average saturation value within the input frame. Expressed in range
  10120. of [0-~181.02].
  10121. @item SATHIGH
  10122. Display the saturation value at the 90% percentile within the input frame.
  10123. Expressed in range of [0-~181.02].
  10124. @item SATMAX
  10125. Display the maximum saturation value contained within the input frame.
  10126. Expressed in range of [0-~181.02].
  10127. @item HUEMED
  10128. Display the median value for hue within the input frame. Expressed in range of
  10129. [0-360].
  10130. @item HUEAVG
  10131. Display the average value for hue within the input frame. Expressed in range of
  10132. [0-360].
  10133. @item YDIF
  10134. Display the average of sample value difference between all values of the Y
  10135. plane in the current frame and corresponding values of the previous input frame.
  10136. Expressed in range of [0-255].
  10137. @item UDIF
  10138. Display the average of sample value difference between all values of the U
  10139. plane in the current frame and corresponding values of the previous input frame.
  10140. Expressed in range of [0-255].
  10141. @item VDIF
  10142. Display the average of sample value difference between all values of the V
  10143. plane in the current frame and corresponding values of the previous input frame.
  10144. Expressed in range of [0-255].
  10145. @item YBITDEPTH
  10146. Display bit depth of Y plane in current frame.
  10147. Expressed in range of [0-16].
  10148. @item UBITDEPTH
  10149. Display bit depth of U plane in current frame.
  10150. Expressed in range of [0-16].
  10151. @item VBITDEPTH
  10152. Display bit depth of V plane in current frame.
  10153. Expressed in range of [0-16].
  10154. @end table
  10155. The filter accepts the following options:
  10156. @table @option
  10157. @item stat
  10158. @item out
  10159. @option{stat} specify an additional form of image analysis.
  10160. @option{out} output video with the specified type of pixel highlighted.
  10161. Both options accept the following values:
  10162. @table @samp
  10163. @item tout
  10164. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  10165. unlike the neighboring pixels of the same field. Examples of temporal outliers
  10166. include the results of video dropouts, head clogs, or tape tracking issues.
  10167. @item vrep
  10168. Identify @var{vertical line repetition}. Vertical line repetition includes
  10169. similar rows of pixels within a frame. In born-digital video vertical line
  10170. repetition is common, but this pattern is uncommon in video digitized from an
  10171. analog source. When it occurs in video that results from the digitization of an
  10172. analog source it can indicate concealment from a dropout compensator.
  10173. @item brng
  10174. Identify pixels that fall outside of legal broadcast range.
  10175. @end table
  10176. @item color, c
  10177. Set the highlight color for the @option{out} option. The default color is
  10178. yellow.
  10179. @end table
  10180. @subsection Examples
  10181. @itemize
  10182. @item
  10183. Output data of various video metrics:
  10184. @example
  10185. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  10186. @end example
  10187. @item
  10188. Output specific data about the minimum and maximum values of the Y plane per frame:
  10189. @example
  10190. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  10191. @end example
  10192. @item
  10193. Playback video while highlighting pixels that are outside of broadcast range in red.
  10194. @example
  10195. ffplay example.mov -vf signalstats="out=brng:color=red"
  10196. @end example
  10197. @item
  10198. Playback video with signalstats metadata drawn over the frame.
  10199. @example
  10200. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  10201. @end example
  10202. The contents of signalstat_drawtext.txt used in the command are:
  10203. @example
  10204. time %@{pts:hms@}
  10205. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  10206. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  10207. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  10208. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  10209. @end example
  10210. @end itemize
  10211. @anchor{signature}
  10212. @section signature
  10213. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  10214. input. In this case the matching between the inputs can be calculated additionally.
  10215. The filter always passes through the first input. The signature of each stream can
  10216. be written into a file.
  10217. It accepts the following options:
  10218. @table @option
  10219. @item detectmode
  10220. Enable or disable the matching process.
  10221. Available values are:
  10222. @table @samp
  10223. @item off
  10224. Disable the calculation of a matching (default).
  10225. @item full
  10226. Calculate the matching for the whole video and output whether the whole video
  10227. matches or only parts.
  10228. @item fast
  10229. Calculate only until a matching is found or the video ends. Should be faster in
  10230. some cases.
  10231. @end table
  10232. @item nb_inputs
  10233. Set the number of inputs. The option value must be a non negative integer.
  10234. Default value is 1.
  10235. @item filename
  10236. Set the path to which the output is written. If there is more than one input,
  10237. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  10238. integer), that will be replaced with the input number. If no filename is
  10239. specified, no output will be written. This is the default.
  10240. @item format
  10241. Choose the output format.
  10242. Available values are:
  10243. @table @samp
  10244. @item binary
  10245. Use the specified binary representation (default).
  10246. @item xml
  10247. Use the specified xml representation.
  10248. @end table
  10249. @item th_d
  10250. Set threshold to detect one word as similar. The option value must be an integer
  10251. greater than zero. The default value is 9000.
  10252. @item th_dc
  10253. Set threshold to detect all words as similar. The option value must be an integer
  10254. greater than zero. The default value is 60000.
  10255. @item th_xh
  10256. Set threshold to detect frames as similar. The option value must be an integer
  10257. greater than zero. The default value is 116.
  10258. @item th_di
  10259. Set the minimum length of a sequence in frames to recognize it as matching
  10260. sequence. The option value must be a non negative integer value.
  10261. The default value is 0.
  10262. @item th_it
  10263. Set the minimum relation, that matching frames to all frames must have.
  10264. The option value must be a double value between 0 and 1. The default value is 0.5.
  10265. @end table
  10266. @subsection Examples
  10267. @itemize
  10268. @item
  10269. To calculate the signature of an input video and store it in signature.bin:
  10270. @example
  10271. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  10272. @end example
  10273. @item
  10274. To detect whether two videos match and store the signatures in XML format in
  10275. signature0.xml and signature1.xml:
  10276. @example
  10277. ffmpeg -i input1.mkv -i input2.mkv -filter_complex "[0:v][1:v] signature=nb_inputs=2:detectmode=full:format=xml:filename=signature%d.xml" -map :v -f null -
  10278. @end example
  10279. @end itemize
  10280. @anchor{smartblur}
  10281. @section smartblur
  10282. Blur the input video without impacting the outlines.
  10283. It accepts the following options:
  10284. @table @option
  10285. @item luma_radius, lr
  10286. Set the luma radius. The option value must be a float number in
  10287. the range [0.1,5.0] that specifies the variance of the gaussian filter
  10288. used to blur the image (slower if larger). Default value is 1.0.
  10289. @item luma_strength, ls
  10290. Set the luma strength. The option value must be a float number
  10291. in the range [-1.0,1.0] that configures the blurring. A value included
  10292. in [0.0,1.0] will blur the image whereas a value included in
  10293. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  10294. @item luma_threshold, lt
  10295. Set the luma threshold used as a coefficient to determine
  10296. whether a pixel should be blurred or not. The option value must be an
  10297. integer in the range [-30,30]. A value of 0 will filter all the image,
  10298. a value included in [0,30] will filter flat areas and a value included
  10299. in [-30,0] will filter edges. Default value is 0.
  10300. @item chroma_radius, cr
  10301. Set the chroma radius. The option value must be a float number in
  10302. the range [0.1,5.0] that specifies the variance of the gaussian filter
  10303. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  10304. @item chroma_strength, cs
  10305. Set the chroma strength. The option value must be a float number
  10306. in the range [-1.0,1.0] that configures the blurring. A value included
  10307. in [0.0,1.0] will blur the image whereas a value included in
  10308. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  10309. @item chroma_threshold, ct
  10310. Set the chroma threshold used as a coefficient to determine
  10311. whether a pixel should be blurred or not. The option value must be an
  10312. integer in the range [-30,30]. A value of 0 will filter all the image,
  10313. a value included in [0,30] will filter flat areas and a value included
  10314. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  10315. @end table
  10316. If a chroma option is not explicitly set, the corresponding luma value
  10317. is set.
  10318. @section ssim
  10319. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  10320. This filter takes in input two input videos, the first input is
  10321. considered the "main" source and is passed unchanged to the
  10322. output. The second input is used as a "reference" video for computing
  10323. the SSIM.
  10324. Both video inputs must have the same resolution and pixel format for
  10325. this filter to work correctly. Also it assumes that both inputs
  10326. have the same number of frames, which are compared one by one.
  10327. The filter stores the calculated SSIM of each frame.
  10328. The description of the accepted parameters follows.
  10329. @table @option
  10330. @item stats_file, f
  10331. If specified the filter will use the named file to save the SSIM of
  10332. each individual frame. When filename equals "-" the data is sent to
  10333. standard output.
  10334. @end table
  10335. The file printed if @var{stats_file} is selected, contains a sequence of
  10336. key/value pairs of the form @var{key}:@var{value} for each compared
  10337. couple of frames.
  10338. A description of each shown parameter follows:
  10339. @table @option
  10340. @item n
  10341. sequential number of the input frame, starting from 1
  10342. @item Y, U, V, R, G, B
  10343. SSIM of the compared frames for the component specified by the suffix.
  10344. @item All
  10345. SSIM of the compared frames for the whole frame.
  10346. @item dB
  10347. Same as above but in dB representation.
  10348. @end table
  10349. For example:
  10350. @example
  10351. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  10352. [main][ref] ssim="stats_file=stats.log" [out]
  10353. @end example
  10354. On this example the input file being processed is compared with the
  10355. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  10356. is stored in @file{stats.log}.
  10357. Another example with both psnr and ssim at same time:
  10358. @example
  10359. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  10360. @end example
  10361. @section stereo3d
  10362. Convert between different stereoscopic image formats.
  10363. The filters accept the following options:
  10364. @table @option
  10365. @item in
  10366. Set stereoscopic image format of input.
  10367. Available values for input image formats are:
  10368. @table @samp
  10369. @item sbsl
  10370. side by side parallel (left eye left, right eye right)
  10371. @item sbsr
  10372. side by side crosseye (right eye left, left eye right)
  10373. @item sbs2l
  10374. side by side parallel with half width resolution
  10375. (left eye left, right eye right)
  10376. @item sbs2r
  10377. side by side crosseye with half width resolution
  10378. (right eye left, left eye right)
  10379. @item abl
  10380. above-below (left eye above, right eye below)
  10381. @item abr
  10382. above-below (right eye above, left eye below)
  10383. @item ab2l
  10384. above-below with half height resolution
  10385. (left eye above, right eye below)
  10386. @item ab2r
  10387. above-below with half height resolution
  10388. (right eye above, left eye below)
  10389. @item al
  10390. alternating frames (left eye first, right eye second)
  10391. @item ar
  10392. alternating frames (right eye first, left eye second)
  10393. @item irl
  10394. interleaved rows (left eye has top row, right eye starts on next row)
  10395. @item irr
  10396. interleaved rows (right eye has top row, left eye starts on next row)
  10397. @item icl
  10398. interleaved columns, left eye first
  10399. @item icr
  10400. interleaved columns, right eye first
  10401. Default value is @samp{sbsl}.
  10402. @end table
  10403. @item out
  10404. Set stereoscopic image format of output.
  10405. @table @samp
  10406. @item sbsl
  10407. side by side parallel (left eye left, right eye right)
  10408. @item sbsr
  10409. side by side crosseye (right eye left, left eye right)
  10410. @item sbs2l
  10411. side by side parallel with half width resolution
  10412. (left eye left, right eye right)
  10413. @item sbs2r
  10414. side by side crosseye with half width resolution
  10415. (right eye left, left eye right)
  10416. @item abl
  10417. above-below (left eye above, right eye below)
  10418. @item abr
  10419. above-below (right eye above, left eye below)
  10420. @item ab2l
  10421. above-below with half height resolution
  10422. (left eye above, right eye below)
  10423. @item ab2r
  10424. above-below with half height resolution
  10425. (right eye above, left eye below)
  10426. @item al
  10427. alternating frames (left eye first, right eye second)
  10428. @item ar
  10429. alternating frames (right eye first, left eye second)
  10430. @item irl
  10431. interleaved rows (left eye has top row, right eye starts on next row)
  10432. @item irr
  10433. interleaved rows (right eye has top row, left eye starts on next row)
  10434. @item arbg
  10435. anaglyph red/blue gray
  10436. (red filter on left eye, blue filter on right eye)
  10437. @item argg
  10438. anaglyph red/green gray
  10439. (red filter on left eye, green filter on right eye)
  10440. @item arcg
  10441. anaglyph red/cyan gray
  10442. (red filter on left eye, cyan filter on right eye)
  10443. @item arch
  10444. anaglyph red/cyan half colored
  10445. (red filter on left eye, cyan filter on right eye)
  10446. @item arcc
  10447. anaglyph red/cyan color
  10448. (red filter on left eye, cyan filter on right eye)
  10449. @item arcd
  10450. anaglyph red/cyan color optimized with the least squares projection of dubois
  10451. (red filter on left eye, cyan filter on right eye)
  10452. @item agmg
  10453. anaglyph green/magenta gray
  10454. (green filter on left eye, magenta filter on right eye)
  10455. @item agmh
  10456. anaglyph green/magenta half colored
  10457. (green filter on left eye, magenta filter on right eye)
  10458. @item agmc
  10459. anaglyph green/magenta colored
  10460. (green filter on left eye, magenta filter on right eye)
  10461. @item agmd
  10462. anaglyph green/magenta color optimized with the least squares projection of dubois
  10463. (green filter on left eye, magenta filter on right eye)
  10464. @item aybg
  10465. anaglyph yellow/blue gray
  10466. (yellow filter on left eye, blue filter on right eye)
  10467. @item aybh
  10468. anaglyph yellow/blue half colored
  10469. (yellow filter on left eye, blue filter on right eye)
  10470. @item aybc
  10471. anaglyph yellow/blue colored
  10472. (yellow filter on left eye, blue filter on right eye)
  10473. @item aybd
  10474. anaglyph yellow/blue color optimized with the least squares projection of dubois
  10475. (yellow filter on left eye, blue filter on right eye)
  10476. @item ml
  10477. mono output (left eye only)
  10478. @item mr
  10479. mono output (right eye only)
  10480. @item chl
  10481. checkerboard, left eye first
  10482. @item chr
  10483. checkerboard, right eye first
  10484. @item icl
  10485. interleaved columns, left eye first
  10486. @item icr
  10487. interleaved columns, right eye first
  10488. @item hdmi
  10489. HDMI frame pack
  10490. @end table
  10491. Default value is @samp{arcd}.
  10492. @end table
  10493. @subsection Examples
  10494. @itemize
  10495. @item
  10496. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  10497. @example
  10498. stereo3d=sbsl:aybd
  10499. @end example
  10500. @item
  10501. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  10502. @example
  10503. stereo3d=abl:sbsr
  10504. @end example
  10505. @end itemize
  10506. @section streamselect, astreamselect
  10507. Select video or audio streams.
  10508. The filter accepts the following options:
  10509. @table @option
  10510. @item inputs
  10511. Set number of inputs. Default is 2.
  10512. @item map
  10513. Set input indexes to remap to outputs.
  10514. @end table
  10515. @subsection Commands
  10516. The @code{streamselect} and @code{astreamselect} filter supports the following
  10517. commands:
  10518. @table @option
  10519. @item map
  10520. Set input indexes to remap to outputs.
  10521. @end table
  10522. @subsection Examples
  10523. @itemize
  10524. @item
  10525. Select first 5 seconds 1st stream and rest of time 2nd stream:
  10526. @example
  10527. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  10528. @end example
  10529. @item
  10530. Same as above, but for audio:
  10531. @example
  10532. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  10533. @end example
  10534. @end itemize
  10535. @section sobel
  10536. Apply sobel operator to input video stream.
  10537. The filter accepts the following option:
  10538. @table @option
  10539. @item planes
  10540. Set which planes will be processed, unprocessed planes will be copied.
  10541. By default value 0xf, all planes will be processed.
  10542. @item scale
  10543. Set value which will be multiplied with filtered result.
  10544. @item delta
  10545. Set value which will be added to filtered result.
  10546. @end table
  10547. @anchor{spp}
  10548. @section spp
  10549. Apply a simple postprocessing filter that compresses and decompresses the image
  10550. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  10551. and average the results.
  10552. The filter accepts the following options:
  10553. @table @option
  10554. @item quality
  10555. Set quality. This option defines the number of levels for averaging. It accepts
  10556. an integer in the range 0-6. If set to @code{0}, the filter will have no
  10557. effect. A value of @code{6} means the higher quality. For each increment of
  10558. that value the speed drops by a factor of approximately 2. Default value is
  10559. @code{3}.
  10560. @item qp
  10561. Force a constant quantization parameter. If not set, the filter will use the QP
  10562. from the video stream (if available).
  10563. @item mode
  10564. Set thresholding mode. Available modes are:
  10565. @table @samp
  10566. @item hard
  10567. Set hard thresholding (default).
  10568. @item soft
  10569. Set soft thresholding (better de-ringing effect, but likely blurrier).
  10570. @end table
  10571. @item use_bframe_qp
  10572. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  10573. option may cause flicker since the B-Frames have often larger QP. Default is
  10574. @code{0} (not enabled).
  10575. @end table
  10576. @anchor{subtitles}
  10577. @section subtitles
  10578. Draw subtitles on top of input video using the libass library.
  10579. To enable compilation of this filter you need to configure FFmpeg with
  10580. @code{--enable-libass}. This filter also requires a build with libavcodec and
  10581. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  10582. Alpha) subtitles format.
  10583. The filter accepts the following options:
  10584. @table @option
  10585. @item filename, f
  10586. Set the filename of the subtitle file to read. It must be specified.
  10587. @item original_size
  10588. Specify the size of the original video, the video for which the ASS file
  10589. was composed. For the syntax of this option, check the
  10590. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10591. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  10592. correctly scale the fonts if the aspect ratio has been changed.
  10593. @item fontsdir
  10594. Set a directory path containing fonts that can be used by the filter.
  10595. These fonts will be used in addition to whatever the font provider uses.
  10596. @item charenc
  10597. Set subtitles input character encoding. @code{subtitles} filter only. Only
  10598. useful if not UTF-8.
  10599. @item stream_index, si
  10600. Set subtitles stream index. @code{subtitles} filter only.
  10601. @item force_style
  10602. Override default style or script info parameters of the subtitles. It accepts a
  10603. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  10604. @end table
  10605. If the first key is not specified, it is assumed that the first value
  10606. specifies the @option{filename}.
  10607. For example, to render the file @file{sub.srt} on top of the input
  10608. video, use the command:
  10609. @example
  10610. subtitles=sub.srt
  10611. @end example
  10612. which is equivalent to:
  10613. @example
  10614. subtitles=filename=sub.srt
  10615. @end example
  10616. To render the default subtitles stream from file @file{video.mkv}, use:
  10617. @example
  10618. subtitles=video.mkv
  10619. @end example
  10620. To render the second subtitles stream from that file, use:
  10621. @example
  10622. subtitles=video.mkv:si=1
  10623. @end example
  10624. To make the subtitles stream from @file{sub.srt} appear in transparent green
  10625. @code{DejaVu Serif}, use:
  10626. @example
  10627. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  10628. @end example
  10629. @section super2xsai
  10630. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  10631. Interpolate) pixel art scaling algorithm.
  10632. Useful for enlarging pixel art images without reducing sharpness.
  10633. @section swaprect
  10634. Swap two rectangular objects in video.
  10635. This filter accepts the following options:
  10636. @table @option
  10637. @item w
  10638. Set object width.
  10639. @item h
  10640. Set object height.
  10641. @item x1
  10642. Set 1st rect x coordinate.
  10643. @item y1
  10644. Set 1st rect y coordinate.
  10645. @item x2
  10646. Set 2nd rect x coordinate.
  10647. @item y2
  10648. Set 2nd rect y coordinate.
  10649. All expressions are evaluated once for each frame.
  10650. @end table
  10651. The all options are expressions containing the following constants:
  10652. @table @option
  10653. @item w
  10654. @item h
  10655. The input width and height.
  10656. @item a
  10657. same as @var{w} / @var{h}
  10658. @item sar
  10659. input sample aspect ratio
  10660. @item dar
  10661. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  10662. @item n
  10663. The number of the input frame, starting from 0.
  10664. @item t
  10665. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  10666. @item pos
  10667. the position in the file of the input frame, NAN if unknown
  10668. @end table
  10669. @section swapuv
  10670. Swap U & V plane.
  10671. @section telecine
  10672. Apply telecine process to the video.
  10673. This filter accepts the following options:
  10674. @table @option
  10675. @item first_field
  10676. @table @samp
  10677. @item top, t
  10678. top field first
  10679. @item bottom, b
  10680. bottom field first
  10681. The default value is @code{top}.
  10682. @end table
  10683. @item pattern
  10684. A string of numbers representing the pulldown pattern you wish to apply.
  10685. The default value is @code{23}.
  10686. @end table
  10687. @example
  10688. Some typical patterns:
  10689. NTSC output (30i):
  10690. 27.5p: 32222
  10691. 24p: 23 (classic)
  10692. 24p: 2332 (preferred)
  10693. 20p: 33
  10694. 18p: 334
  10695. 16p: 3444
  10696. PAL output (25i):
  10697. 27.5p: 12222
  10698. 24p: 222222222223 ("Euro pulldown")
  10699. 16.67p: 33
  10700. 16p: 33333334
  10701. @end example
  10702. @section threshold
  10703. Apply threshold effect to video stream.
  10704. This filter needs four video streams to perform thresholding.
  10705. First stream is stream we are filtering.
  10706. Second stream is holding threshold values, third stream is holding min values,
  10707. and last, fourth stream is holding max values.
  10708. The filter accepts the following option:
  10709. @table @option
  10710. @item planes
  10711. Set which planes will be processed, unprocessed planes will be copied.
  10712. By default value 0xf, all planes will be processed.
  10713. @end table
  10714. For example if first stream pixel's component value is less then threshold value
  10715. of pixel component from 2nd threshold stream, third stream value will picked,
  10716. otherwise fourth stream pixel component value will be picked.
  10717. Using color source filter one can perform various types of thresholding:
  10718. @subsection Examples
  10719. @itemize
  10720. @item
  10721. Binary threshold, using gray color as threshold:
  10722. @example
  10723. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  10724. @end example
  10725. @item
  10726. Inverted binary threshold, using gray color as threshold:
  10727. @example
  10728. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  10729. @end example
  10730. @item
  10731. Truncate binary threshold, using gray color as threshold:
  10732. @example
  10733. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  10734. @end example
  10735. @item
  10736. Threshold to zero, using gray color as threshold:
  10737. @example
  10738. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  10739. @end example
  10740. @item
  10741. Inverted threshold to zero, using gray color as threshold:
  10742. @example
  10743. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  10744. @end example
  10745. @end itemize
  10746. @section thumbnail
  10747. Select the most representative frame in a given sequence of consecutive frames.
  10748. The filter accepts the following options:
  10749. @table @option
  10750. @item n
  10751. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  10752. will pick one of them, and then handle the next batch of @var{n} frames until
  10753. the end. Default is @code{100}.
  10754. @end table
  10755. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  10756. value will result in a higher memory usage, so a high value is not recommended.
  10757. @subsection Examples
  10758. @itemize
  10759. @item
  10760. Extract one picture each 50 frames:
  10761. @example
  10762. thumbnail=50
  10763. @end example
  10764. @item
  10765. Complete example of a thumbnail creation with @command{ffmpeg}:
  10766. @example
  10767. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  10768. @end example
  10769. @end itemize
  10770. @section tile
  10771. Tile several successive frames together.
  10772. The filter accepts the following options:
  10773. @table @option
  10774. @item layout
  10775. Set the grid size (i.e. the number of lines and columns). For the syntax of
  10776. this option, check the
  10777. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10778. @item nb_frames
  10779. Set the maximum number of frames to render in the given area. It must be less
  10780. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  10781. the area will be used.
  10782. @item margin
  10783. Set the outer border margin in pixels.
  10784. @item padding
  10785. Set the inner border thickness (i.e. the number of pixels between frames). For
  10786. more advanced padding options (such as having different values for the edges),
  10787. refer to the pad video filter.
  10788. @item color
  10789. Specify the color of the unused area. For the syntax of this option, check the
  10790. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  10791. is "black".
  10792. @end table
  10793. @subsection Examples
  10794. @itemize
  10795. @item
  10796. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  10797. @example
  10798. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  10799. @end example
  10800. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  10801. duplicating each output frame to accommodate the originally detected frame
  10802. rate.
  10803. @item
  10804. Display @code{5} pictures in an area of @code{3x2} frames,
  10805. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  10806. mixed flat and named options:
  10807. @example
  10808. tile=3x2:nb_frames=5:padding=7:margin=2
  10809. @end example
  10810. @end itemize
  10811. @section tinterlace
  10812. Perform various types of temporal field interlacing.
  10813. Frames are counted starting from 1, so the first input frame is
  10814. considered odd.
  10815. The filter accepts the following options:
  10816. @table @option
  10817. @item mode
  10818. Specify the mode of the interlacing. This option can also be specified
  10819. as a value alone. See below for a list of values for this option.
  10820. Available values are:
  10821. @table @samp
  10822. @item merge, 0
  10823. Move odd frames into the upper field, even into the lower field,
  10824. generating a double height frame at half frame rate.
  10825. @example
  10826. ------> time
  10827. Input:
  10828. Frame 1 Frame 2 Frame 3 Frame 4
  10829. 11111 22222 33333 44444
  10830. 11111 22222 33333 44444
  10831. 11111 22222 33333 44444
  10832. 11111 22222 33333 44444
  10833. Output:
  10834. 11111 33333
  10835. 22222 44444
  10836. 11111 33333
  10837. 22222 44444
  10838. 11111 33333
  10839. 22222 44444
  10840. 11111 33333
  10841. 22222 44444
  10842. @end example
  10843. @item drop_even, 1
  10844. Only output odd frames, even frames are dropped, generating a frame with
  10845. unchanged height at half frame rate.
  10846. @example
  10847. ------> time
  10848. Input:
  10849. Frame 1 Frame 2 Frame 3 Frame 4
  10850. 11111 22222 33333 44444
  10851. 11111 22222 33333 44444
  10852. 11111 22222 33333 44444
  10853. 11111 22222 33333 44444
  10854. Output:
  10855. 11111 33333
  10856. 11111 33333
  10857. 11111 33333
  10858. 11111 33333
  10859. @end example
  10860. @item drop_odd, 2
  10861. Only output even frames, odd frames are dropped, generating a frame with
  10862. unchanged height at half frame rate.
  10863. @example
  10864. ------> time
  10865. Input:
  10866. Frame 1 Frame 2 Frame 3 Frame 4
  10867. 11111 22222 33333 44444
  10868. 11111 22222 33333 44444
  10869. 11111 22222 33333 44444
  10870. 11111 22222 33333 44444
  10871. Output:
  10872. 22222 44444
  10873. 22222 44444
  10874. 22222 44444
  10875. 22222 44444
  10876. @end example
  10877. @item pad, 3
  10878. Expand each frame to full height, but pad alternate lines with black,
  10879. generating a frame with double height at the same input frame rate.
  10880. @example
  10881. ------> time
  10882. Input:
  10883. Frame 1 Frame 2 Frame 3 Frame 4
  10884. 11111 22222 33333 44444
  10885. 11111 22222 33333 44444
  10886. 11111 22222 33333 44444
  10887. 11111 22222 33333 44444
  10888. Output:
  10889. 11111 ..... 33333 .....
  10890. ..... 22222 ..... 44444
  10891. 11111 ..... 33333 .....
  10892. ..... 22222 ..... 44444
  10893. 11111 ..... 33333 .....
  10894. ..... 22222 ..... 44444
  10895. 11111 ..... 33333 .....
  10896. ..... 22222 ..... 44444
  10897. @end example
  10898. @item interleave_top, 4
  10899. Interleave the upper field from odd frames with the lower field from
  10900. even frames, generating a frame with unchanged height at half frame rate.
  10901. @example
  10902. ------> time
  10903. Input:
  10904. Frame 1 Frame 2 Frame 3 Frame 4
  10905. 11111<- 22222 33333<- 44444
  10906. 11111 22222<- 33333 44444<-
  10907. 11111<- 22222 33333<- 44444
  10908. 11111 22222<- 33333 44444<-
  10909. Output:
  10910. 11111 33333
  10911. 22222 44444
  10912. 11111 33333
  10913. 22222 44444
  10914. @end example
  10915. @item interleave_bottom, 5
  10916. Interleave the lower field from odd frames with the upper field from
  10917. even frames, generating a frame with unchanged height at half frame rate.
  10918. @example
  10919. ------> time
  10920. Input:
  10921. Frame 1 Frame 2 Frame 3 Frame 4
  10922. 11111 22222<- 33333 44444<-
  10923. 11111<- 22222 33333<- 44444
  10924. 11111 22222<- 33333 44444<-
  10925. 11111<- 22222 33333<- 44444
  10926. Output:
  10927. 22222 44444
  10928. 11111 33333
  10929. 22222 44444
  10930. 11111 33333
  10931. @end example
  10932. @item interlacex2, 6
  10933. Double frame rate with unchanged height. Frames are inserted each
  10934. containing the second temporal field from the previous input frame and
  10935. the first temporal field from the next input frame. This mode relies on
  10936. the top_field_first flag. Useful for interlaced video displays with no
  10937. field synchronisation.
  10938. @example
  10939. ------> time
  10940. Input:
  10941. Frame 1 Frame 2 Frame 3 Frame 4
  10942. 11111 22222 33333 44444
  10943. 11111 22222 33333 44444
  10944. 11111 22222 33333 44444
  10945. 11111 22222 33333 44444
  10946. Output:
  10947. 11111 22222 22222 33333 33333 44444 44444
  10948. 11111 11111 22222 22222 33333 33333 44444
  10949. 11111 22222 22222 33333 33333 44444 44444
  10950. 11111 11111 22222 22222 33333 33333 44444
  10951. @end example
  10952. @item mergex2, 7
  10953. Move odd frames into the upper field, even into the lower field,
  10954. generating a double height frame at same frame rate.
  10955. @example
  10956. ------> time
  10957. Input:
  10958. Frame 1 Frame 2 Frame 3 Frame 4
  10959. 11111 22222 33333 44444
  10960. 11111 22222 33333 44444
  10961. 11111 22222 33333 44444
  10962. 11111 22222 33333 44444
  10963. Output:
  10964. 11111 33333 33333 55555
  10965. 22222 22222 44444 44444
  10966. 11111 33333 33333 55555
  10967. 22222 22222 44444 44444
  10968. 11111 33333 33333 55555
  10969. 22222 22222 44444 44444
  10970. 11111 33333 33333 55555
  10971. 22222 22222 44444 44444
  10972. @end example
  10973. @end table
  10974. Numeric values are deprecated but are accepted for backward
  10975. compatibility reasons.
  10976. Default mode is @code{merge}.
  10977. @item flags
  10978. Specify flags influencing the filter process.
  10979. Available value for @var{flags} is:
  10980. @table @option
  10981. @item low_pass_filter, vlfp
  10982. Enable linear vertical low-pass filtering in the filter.
  10983. Vertical low-pass filtering is required when creating an interlaced
  10984. destination from a progressive source which contains high-frequency
  10985. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  10986. patterning.
  10987. @item complex_filter, cvlfp
  10988. Enable complex vertical low-pass filtering.
  10989. This will slightly less reduce interlace 'twitter' and Moire
  10990. patterning but better retain detail and subjective sharpness impression.
  10991. @end table
  10992. Vertical low-pass filtering can only be enabled for @option{mode}
  10993. @var{interleave_top} and @var{interleave_bottom}.
  10994. @end table
  10995. @section transpose
  10996. Transpose rows with columns in the input video and optionally flip it.
  10997. It accepts the following parameters:
  10998. @table @option
  10999. @item dir
  11000. Specify the transposition direction.
  11001. Can assume the following values:
  11002. @table @samp
  11003. @item 0, 4, cclock_flip
  11004. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  11005. @example
  11006. L.R L.l
  11007. . . -> . .
  11008. l.r R.r
  11009. @end example
  11010. @item 1, 5, clock
  11011. Rotate by 90 degrees clockwise, that is:
  11012. @example
  11013. L.R l.L
  11014. . . -> . .
  11015. l.r r.R
  11016. @end example
  11017. @item 2, 6, cclock
  11018. Rotate by 90 degrees counterclockwise, that is:
  11019. @example
  11020. L.R R.r
  11021. . . -> . .
  11022. l.r L.l
  11023. @end example
  11024. @item 3, 7, clock_flip
  11025. Rotate by 90 degrees clockwise and vertically flip, that is:
  11026. @example
  11027. L.R r.R
  11028. . . -> . .
  11029. l.r l.L
  11030. @end example
  11031. @end table
  11032. For values between 4-7, the transposition is only done if the input
  11033. video geometry is portrait and not landscape. These values are
  11034. deprecated, the @code{passthrough} option should be used instead.
  11035. Numerical values are deprecated, and should be dropped in favor of
  11036. symbolic constants.
  11037. @item passthrough
  11038. Do not apply the transposition if the input geometry matches the one
  11039. specified by the specified value. It accepts the following values:
  11040. @table @samp
  11041. @item none
  11042. Always apply transposition.
  11043. @item portrait
  11044. Preserve portrait geometry (when @var{height} >= @var{width}).
  11045. @item landscape
  11046. Preserve landscape geometry (when @var{width} >= @var{height}).
  11047. @end table
  11048. Default value is @code{none}.
  11049. @end table
  11050. For example to rotate by 90 degrees clockwise and preserve portrait
  11051. layout:
  11052. @example
  11053. transpose=dir=1:passthrough=portrait
  11054. @end example
  11055. The command above can also be specified as:
  11056. @example
  11057. transpose=1:portrait
  11058. @end example
  11059. @section trim
  11060. Trim the input so that the output contains one continuous subpart of the input.
  11061. It accepts the following parameters:
  11062. @table @option
  11063. @item start
  11064. Specify the time of the start of the kept section, i.e. the frame with the
  11065. timestamp @var{start} will be the first frame in the output.
  11066. @item end
  11067. Specify the time of the first frame that will be dropped, i.e. the frame
  11068. immediately preceding the one with the timestamp @var{end} will be the last
  11069. frame in the output.
  11070. @item start_pts
  11071. This is the same as @var{start}, except this option sets the start timestamp
  11072. in timebase units instead of seconds.
  11073. @item end_pts
  11074. This is the same as @var{end}, except this option sets the end timestamp
  11075. in timebase units instead of seconds.
  11076. @item duration
  11077. The maximum duration of the output in seconds.
  11078. @item start_frame
  11079. The number of the first frame that should be passed to the output.
  11080. @item end_frame
  11081. The number of the first frame that should be dropped.
  11082. @end table
  11083. @option{start}, @option{end}, and @option{duration} are expressed as time
  11084. duration specifications; see
  11085. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11086. for the accepted syntax.
  11087. Note that the first two sets of the start/end options and the @option{duration}
  11088. option look at the frame timestamp, while the _frame variants simply count the
  11089. frames that pass through the filter. Also note that this filter does not modify
  11090. the timestamps. If you wish for the output timestamps to start at zero, insert a
  11091. setpts filter after the trim filter.
  11092. If multiple start or end options are set, this filter tries to be greedy and
  11093. keep all the frames that match at least one of the specified constraints. To keep
  11094. only the part that matches all the constraints at once, chain multiple trim
  11095. filters.
  11096. The defaults are such that all the input is kept. So it is possible to set e.g.
  11097. just the end values to keep everything before the specified time.
  11098. Examples:
  11099. @itemize
  11100. @item
  11101. Drop everything except the second minute of input:
  11102. @example
  11103. ffmpeg -i INPUT -vf trim=60:120
  11104. @end example
  11105. @item
  11106. Keep only the first second:
  11107. @example
  11108. ffmpeg -i INPUT -vf trim=duration=1
  11109. @end example
  11110. @end itemize
  11111. @anchor{unsharp}
  11112. @section unsharp
  11113. Sharpen or blur the input video.
  11114. It accepts the following parameters:
  11115. @table @option
  11116. @item luma_msize_x, lx
  11117. Set the luma matrix horizontal size. It must be an odd integer between
  11118. 3 and 23. The default value is 5.
  11119. @item luma_msize_y, ly
  11120. Set the luma matrix vertical size. It must be an odd integer between 3
  11121. and 23. The default value is 5.
  11122. @item luma_amount, la
  11123. Set the luma effect strength. It must be a floating point number, reasonable
  11124. values lay between -1.5 and 1.5.
  11125. Negative values will blur the input video, while positive values will
  11126. sharpen it, a value of zero will disable the effect.
  11127. Default value is 1.0.
  11128. @item chroma_msize_x, cx
  11129. Set the chroma matrix horizontal size. It must be an odd integer
  11130. between 3 and 23. The default value is 5.
  11131. @item chroma_msize_y, cy
  11132. Set the chroma matrix vertical size. It must be an odd integer
  11133. between 3 and 23. The default value is 5.
  11134. @item chroma_amount, ca
  11135. Set the chroma effect strength. It must be a floating point number, reasonable
  11136. values lay between -1.5 and 1.5.
  11137. Negative values will blur the input video, while positive values will
  11138. sharpen it, a value of zero will disable the effect.
  11139. Default value is 0.0.
  11140. @item opencl
  11141. If set to 1, specify using OpenCL capabilities, only available if
  11142. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  11143. @end table
  11144. All parameters are optional and default to the equivalent of the
  11145. string '5:5:1.0:5:5:0.0'.
  11146. @subsection Examples
  11147. @itemize
  11148. @item
  11149. Apply strong luma sharpen effect:
  11150. @example
  11151. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  11152. @end example
  11153. @item
  11154. Apply a strong blur of both luma and chroma parameters:
  11155. @example
  11156. unsharp=7:7:-2:7:7:-2
  11157. @end example
  11158. @end itemize
  11159. @section uspp
  11160. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  11161. the image at several (or - in the case of @option{quality} level @code{8} - all)
  11162. shifts and average the results.
  11163. The way this differs from the behavior of spp is that uspp actually encodes &
  11164. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  11165. DCT similar to MJPEG.
  11166. The filter accepts the following options:
  11167. @table @option
  11168. @item quality
  11169. Set quality. This option defines the number of levels for averaging. It accepts
  11170. an integer in the range 0-8. If set to @code{0}, the filter will have no
  11171. effect. A value of @code{8} means the higher quality. For each increment of
  11172. that value the speed drops by a factor of approximately 2. Default value is
  11173. @code{3}.
  11174. @item qp
  11175. Force a constant quantization parameter. If not set, the filter will use the QP
  11176. from the video stream (if available).
  11177. @end table
  11178. @section vaguedenoiser
  11179. Apply a wavelet based denoiser.
  11180. It transforms each frame from the video input into the wavelet domain,
  11181. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  11182. the obtained coefficients. It does an inverse wavelet transform after.
  11183. Due to wavelet properties, it should give a nice smoothed result, and
  11184. reduced noise, without blurring picture features.
  11185. This filter accepts the following options:
  11186. @table @option
  11187. @item threshold
  11188. The filtering strength. The higher, the more filtered the video will be.
  11189. Hard thresholding can use a higher threshold than soft thresholding
  11190. before the video looks overfiltered.
  11191. @item method
  11192. The filtering method the filter will use.
  11193. It accepts the following values:
  11194. @table @samp
  11195. @item hard
  11196. All values under the threshold will be zeroed.
  11197. @item soft
  11198. All values under the threshold will be zeroed. All values above will be
  11199. reduced by the threshold.
  11200. @item garrote
  11201. Scales or nullifies coefficients - intermediary between (more) soft and
  11202. (less) hard thresholding.
  11203. @end table
  11204. @item nsteps
  11205. Number of times, the wavelet will decompose the picture. Picture can't
  11206. be decomposed beyond a particular point (typically, 8 for a 640x480
  11207. frame - as 2^9 = 512 > 480)
  11208. @item percent
  11209. Partial of full denoising (limited coefficients shrinking), from 0 to 100.
  11210. @item planes
  11211. A list of the planes to process. By default all planes are processed.
  11212. @end table
  11213. @section vectorscope
  11214. Display 2 color component values in the two dimensional graph (which is called
  11215. a vectorscope).
  11216. This filter accepts the following options:
  11217. @table @option
  11218. @item mode, m
  11219. Set vectorscope mode.
  11220. It accepts the following values:
  11221. @table @samp
  11222. @item gray
  11223. Gray values are displayed on graph, higher brightness means more pixels have
  11224. same component color value on location in graph. This is the default mode.
  11225. @item color
  11226. Gray values are displayed on graph. Surrounding pixels values which are not
  11227. present in video frame are drawn in gradient of 2 color components which are
  11228. set by option @code{x} and @code{y}. The 3rd color component is static.
  11229. @item color2
  11230. Actual color components values present in video frame are displayed on graph.
  11231. @item color3
  11232. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  11233. on graph increases value of another color component, which is luminance by
  11234. default values of @code{x} and @code{y}.
  11235. @item color4
  11236. Actual colors present in video frame are displayed on graph. If two different
  11237. colors map to same position on graph then color with higher value of component
  11238. not present in graph is picked.
  11239. @item color5
  11240. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  11241. component picked from radial gradient.
  11242. @end table
  11243. @item x
  11244. Set which color component will be represented on X-axis. Default is @code{1}.
  11245. @item y
  11246. Set which color component will be represented on Y-axis. Default is @code{2}.
  11247. @item intensity, i
  11248. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  11249. of color component which represents frequency of (X, Y) location in graph.
  11250. @item envelope, e
  11251. @table @samp
  11252. @item none
  11253. No envelope, this is default.
  11254. @item instant
  11255. Instant envelope, even darkest single pixel will be clearly highlighted.
  11256. @item peak
  11257. Hold maximum and minimum values presented in graph over time. This way you
  11258. can still spot out of range values without constantly looking at vectorscope.
  11259. @item peak+instant
  11260. Peak and instant envelope combined together.
  11261. @end table
  11262. @item graticule, g
  11263. Set what kind of graticule to draw.
  11264. @table @samp
  11265. @item none
  11266. @item green
  11267. @item color
  11268. @end table
  11269. @item opacity, o
  11270. Set graticule opacity.
  11271. @item flags, f
  11272. Set graticule flags.
  11273. @table @samp
  11274. @item white
  11275. Draw graticule for white point.
  11276. @item black
  11277. Draw graticule for black point.
  11278. @item name
  11279. Draw color points short names.
  11280. @end table
  11281. @item bgopacity, b
  11282. Set background opacity.
  11283. @item lthreshold, l
  11284. Set low threshold for color component not represented on X or Y axis.
  11285. Values lower than this value will be ignored. Default is 0.
  11286. Note this value is multiplied with actual max possible value one pixel component
  11287. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  11288. is 0.1 * 255 = 25.
  11289. @item hthreshold, h
  11290. Set high threshold for color component not represented on X or Y axis.
  11291. Values higher than this value will be ignored. Default is 1.
  11292. Note this value is multiplied with actual max possible value one pixel component
  11293. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  11294. is 0.9 * 255 = 230.
  11295. @item colorspace, c
  11296. Set what kind of colorspace to use when drawing graticule.
  11297. @table @samp
  11298. @item auto
  11299. @item 601
  11300. @item 709
  11301. @end table
  11302. Default is auto.
  11303. @end table
  11304. @anchor{vidstabdetect}
  11305. @section vidstabdetect
  11306. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  11307. @ref{vidstabtransform} for pass 2.
  11308. This filter generates a file with relative translation and rotation
  11309. transform information about subsequent frames, which is then used by
  11310. the @ref{vidstabtransform} filter.
  11311. To enable compilation of this filter you need to configure FFmpeg with
  11312. @code{--enable-libvidstab}.
  11313. This filter accepts the following options:
  11314. @table @option
  11315. @item result
  11316. Set the path to the file used to write the transforms information.
  11317. Default value is @file{transforms.trf}.
  11318. @item shakiness
  11319. Set how shaky the video is and how quick the camera is. It accepts an
  11320. integer in the range 1-10, a value of 1 means little shakiness, a
  11321. value of 10 means strong shakiness. Default value is 5.
  11322. @item accuracy
  11323. Set the accuracy of the detection process. It must be a value in the
  11324. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  11325. accuracy. Default value is 15.
  11326. @item stepsize
  11327. Set stepsize of the search process. The region around minimum is
  11328. scanned with 1 pixel resolution. Default value is 6.
  11329. @item mincontrast
  11330. Set minimum contrast. Below this value a local measurement field is
  11331. discarded. Must be a floating point value in the range 0-1. Default
  11332. value is 0.3.
  11333. @item tripod
  11334. Set reference frame number for tripod mode.
  11335. If enabled, the motion of the frames is compared to a reference frame
  11336. in the filtered stream, identified by the specified number. The idea
  11337. is to compensate all movements in a more-or-less static scene and keep
  11338. the camera view absolutely still.
  11339. If set to 0, it is disabled. The frames are counted starting from 1.
  11340. @item show
  11341. Show fields and transforms in the resulting frames. It accepts an
  11342. integer in the range 0-2. Default value is 0, which disables any
  11343. visualization.
  11344. @end table
  11345. @subsection Examples
  11346. @itemize
  11347. @item
  11348. Use default values:
  11349. @example
  11350. vidstabdetect
  11351. @end example
  11352. @item
  11353. Analyze strongly shaky movie and put the results in file
  11354. @file{mytransforms.trf}:
  11355. @example
  11356. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  11357. @end example
  11358. @item
  11359. Visualize the result of internal transformations in the resulting
  11360. video:
  11361. @example
  11362. vidstabdetect=show=1
  11363. @end example
  11364. @item
  11365. Analyze a video with medium shakiness using @command{ffmpeg}:
  11366. @example
  11367. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  11368. @end example
  11369. @end itemize
  11370. @anchor{vidstabtransform}
  11371. @section vidstabtransform
  11372. Video stabilization/deshaking: pass 2 of 2,
  11373. see @ref{vidstabdetect} for pass 1.
  11374. Read a file with transform information for each frame and
  11375. apply/compensate them. Together with the @ref{vidstabdetect}
  11376. filter this can be used to deshake videos. See also
  11377. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  11378. the @ref{unsharp} filter, see below.
  11379. To enable compilation of this filter you need to configure FFmpeg with
  11380. @code{--enable-libvidstab}.
  11381. @subsection Options
  11382. @table @option
  11383. @item input
  11384. Set path to the file used to read the transforms. Default value is
  11385. @file{transforms.trf}.
  11386. @item smoothing
  11387. Set the number of frames (value*2 + 1) used for lowpass filtering the
  11388. camera movements. Default value is 10.
  11389. For example a number of 10 means that 21 frames are used (10 in the
  11390. past and 10 in the future) to smoothen the motion in the video. A
  11391. larger value leads to a smoother video, but limits the acceleration of
  11392. the camera (pan/tilt movements). 0 is a special case where a static
  11393. camera is simulated.
  11394. @item optalgo
  11395. Set the camera path optimization algorithm.
  11396. Accepted values are:
  11397. @table @samp
  11398. @item gauss
  11399. gaussian kernel low-pass filter on camera motion (default)
  11400. @item avg
  11401. averaging on transformations
  11402. @end table
  11403. @item maxshift
  11404. Set maximal number of pixels to translate frames. Default value is -1,
  11405. meaning no limit.
  11406. @item maxangle
  11407. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  11408. value is -1, meaning no limit.
  11409. @item crop
  11410. Specify how to deal with borders that may be visible due to movement
  11411. compensation.
  11412. Available values are:
  11413. @table @samp
  11414. @item keep
  11415. keep image information from previous frame (default)
  11416. @item black
  11417. fill the border black
  11418. @end table
  11419. @item invert
  11420. Invert transforms if set to 1. Default value is 0.
  11421. @item relative
  11422. Consider transforms as relative to previous frame if set to 1,
  11423. absolute if set to 0. Default value is 0.
  11424. @item zoom
  11425. Set percentage to zoom. A positive value will result in a zoom-in
  11426. effect, a negative value in a zoom-out effect. Default value is 0 (no
  11427. zoom).
  11428. @item optzoom
  11429. Set optimal zooming to avoid borders.
  11430. Accepted values are:
  11431. @table @samp
  11432. @item 0
  11433. disabled
  11434. @item 1
  11435. optimal static zoom value is determined (only very strong movements
  11436. will lead to visible borders) (default)
  11437. @item 2
  11438. optimal adaptive zoom value is determined (no borders will be
  11439. visible), see @option{zoomspeed}
  11440. @end table
  11441. Note that the value given at zoom is added to the one calculated here.
  11442. @item zoomspeed
  11443. Set percent to zoom maximally each frame (enabled when
  11444. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  11445. 0.25.
  11446. @item interpol
  11447. Specify type of interpolation.
  11448. Available values are:
  11449. @table @samp
  11450. @item no
  11451. no interpolation
  11452. @item linear
  11453. linear only horizontal
  11454. @item bilinear
  11455. linear in both directions (default)
  11456. @item bicubic
  11457. cubic in both directions (slow)
  11458. @end table
  11459. @item tripod
  11460. Enable virtual tripod mode if set to 1, which is equivalent to
  11461. @code{relative=0:smoothing=0}. Default value is 0.
  11462. Use also @code{tripod} option of @ref{vidstabdetect}.
  11463. @item debug
  11464. Increase log verbosity if set to 1. Also the detected global motions
  11465. are written to the temporary file @file{global_motions.trf}. Default
  11466. value is 0.
  11467. @end table
  11468. @subsection Examples
  11469. @itemize
  11470. @item
  11471. Use @command{ffmpeg} for a typical stabilization with default values:
  11472. @example
  11473. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  11474. @end example
  11475. Note the use of the @ref{unsharp} filter which is always recommended.
  11476. @item
  11477. Zoom in a bit more and load transform data from a given file:
  11478. @example
  11479. vidstabtransform=zoom=5:input="mytransforms.trf"
  11480. @end example
  11481. @item
  11482. Smoothen the video even more:
  11483. @example
  11484. vidstabtransform=smoothing=30
  11485. @end example
  11486. @end itemize
  11487. @section vflip
  11488. Flip the input video vertically.
  11489. For example, to vertically flip a video with @command{ffmpeg}:
  11490. @example
  11491. ffmpeg -i in.avi -vf "vflip" out.avi
  11492. @end example
  11493. @anchor{vignette}
  11494. @section vignette
  11495. Make or reverse a natural vignetting effect.
  11496. The filter accepts the following options:
  11497. @table @option
  11498. @item angle, a
  11499. Set lens angle expression as a number of radians.
  11500. The value is clipped in the @code{[0,PI/2]} range.
  11501. Default value: @code{"PI/5"}
  11502. @item x0
  11503. @item y0
  11504. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  11505. by default.
  11506. @item mode
  11507. Set forward/backward mode.
  11508. Available modes are:
  11509. @table @samp
  11510. @item forward
  11511. The larger the distance from the central point, the darker the image becomes.
  11512. @item backward
  11513. The larger the distance from the central point, the brighter the image becomes.
  11514. This can be used to reverse a vignette effect, though there is no automatic
  11515. detection to extract the lens @option{angle} and other settings (yet). It can
  11516. also be used to create a burning effect.
  11517. @end table
  11518. Default value is @samp{forward}.
  11519. @item eval
  11520. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  11521. It accepts the following values:
  11522. @table @samp
  11523. @item init
  11524. Evaluate expressions only once during the filter initialization.
  11525. @item frame
  11526. Evaluate expressions for each incoming frame. This is way slower than the
  11527. @samp{init} mode since it requires all the scalers to be re-computed, but it
  11528. allows advanced dynamic expressions.
  11529. @end table
  11530. Default value is @samp{init}.
  11531. @item dither
  11532. Set dithering to reduce the circular banding effects. Default is @code{1}
  11533. (enabled).
  11534. @item aspect
  11535. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  11536. Setting this value to the SAR of the input will make a rectangular vignetting
  11537. following the dimensions of the video.
  11538. Default is @code{1/1}.
  11539. @end table
  11540. @subsection Expressions
  11541. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  11542. following parameters.
  11543. @table @option
  11544. @item w
  11545. @item h
  11546. input width and height
  11547. @item n
  11548. the number of input frame, starting from 0
  11549. @item pts
  11550. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  11551. @var{TB} units, NAN if undefined
  11552. @item r
  11553. frame rate of the input video, NAN if the input frame rate is unknown
  11554. @item t
  11555. the PTS (Presentation TimeStamp) of the filtered video frame,
  11556. expressed in seconds, NAN if undefined
  11557. @item tb
  11558. time base of the input video
  11559. @end table
  11560. @subsection Examples
  11561. @itemize
  11562. @item
  11563. Apply simple strong vignetting effect:
  11564. @example
  11565. vignette=PI/4
  11566. @end example
  11567. @item
  11568. Make a flickering vignetting:
  11569. @example
  11570. vignette='PI/4+random(1)*PI/50':eval=frame
  11571. @end example
  11572. @end itemize
  11573. @section vstack
  11574. Stack input videos vertically.
  11575. All streams must be of same pixel format and of same width.
  11576. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  11577. to create same output.
  11578. The filter accept the following option:
  11579. @table @option
  11580. @item inputs
  11581. Set number of input streams. Default is 2.
  11582. @item shortest
  11583. If set to 1, force the output to terminate when the shortest input
  11584. terminates. Default value is 0.
  11585. @end table
  11586. @section w3fdif
  11587. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  11588. Deinterlacing Filter").
  11589. Based on the process described by Martin Weston for BBC R&D, and
  11590. implemented based on the de-interlace algorithm written by Jim
  11591. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  11592. uses filter coefficients calculated by BBC R&D.
  11593. There are two sets of filter coefficients, so called "simple":
  11594. and "complex". Which set of filter coefficients is used can
  11595. be set by passing an optional parameter:
  11596. @table @option
  11597. @item filter
  11598. Set the interlacing filter coefficients. Accepts one of the following values:
  11599. @table @samp
  11600. @item simple
  11601. Simple filter coefficient set.
  11602. @item complex
  11603. More-complex filter coefficient set.
  11604. @end table
  11605. Default value is @samp{complex}.
  11606. @item deint
  11607. Specify which frames to deinterlace. Accept one of the following values:
  11608. @table @samp
  11609. @item all
  11610. Deinterlace all frames,
  11611. @item interlaced
  11612. Only deinterlace frames marked as interlaced.
  11613. @end table
  11614. Default value is @samp{all}.
  11615. @end table
  11616. @section waveform
  11617. Video waveform monitor.
  11618. The waveform monitor plots color component intensity. By default luminance
  11619. only. Each column of the waveform corresponds to a column of pixels in the
  11620. source video.
  11621. It accepts the following options:
  11622. @table @option
  11623. @item mode, m
  11624. Can be either @code{row}, or @code{column}. Default is @code{column}.
  11625. In row mode, the graph on the left side represents color component value 0 and
  11626. the right side represents value = 255. In column mode, the top side represents
  11627. color component value = 0 and bottom side represents value = 255.
  11628. @item intensity, i
  11629. Set intensity. Smaller values are useful to find out how many values of the same
  11630. luminance are distributed across input rows/columns.
  11631. Default value is @code{0.04}. Allowed range is [0, 1].
  11632. @item mirror, r
  11633. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  11634. In mirrored mode, higher values will be represented on the left
  11635. side for @code{row} mode and at the top for @code{column} mode. Default is
  11636. @code{1} (mirrored).
  11637. @item display, d
  11638. Set display mode.
  11639. It accepts the following values:
  11640. @table @samp
  11641. @item overlay
  11642. Presents information identical to that in the @code{parade}, except
  11643. that the graphs representing color components are superimposed directly
  11644. over one another.
  11645. This display mode makes it easier to spot relative differences or similarities
  11646. in overlapping areas of the color components that are supposed to be identical,
  11647. such as neutral whites, grays, or blacks.
  11648. @item stack
  11649. Display separate graph for the color components side by side in
  11650. @code{row} mode or one below the other in @code{column} mode.
  11651. @item parade
  11652. Display separate graph for the color components side by side in
  11653. @code{column} mode or one below the other in @code{row} mode.
  11654. Using this display mode makes it easy to spot color casts in the highlights
  11655. and shadows of an image, by comparing the contours of the top and the bottom
  11656. graphs of each waveform. Since whites, grays, and blacks are characterized
  11657. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  11658. should display three waveforms of roughly equal width/height. If not, the
  11659. correction is easy to perform by making level adjustments the three waveforms.
  11660. @end table
  11661. Default is @code{stack}.
  11662. @item components, c
  11663. Set which color components to display. Default is 1, which means only luminance
  11664. or red color component if input is in RGB colorspace. If is set for example to
  11665. 7 it will display all 3 (if) available color components.
  11666. @item envelope, e
  11667. @table @samp
  11668. @item none
  11669. No envelope, this is default.
  11670. @item instant
  11671. Instant envelope, minimum and maximum values presented in graph will be easily
  11672. visible even with small @code{step} value.
  11673. @item peak
  11674. Hold minimum and maximum values presented in graph across time. This way you
  11675. can still spot out of range values without constantly looking at waveforms.
  11676. @item peak+instant
  11677. Peak and instant envelope combined together.
  11678. @end table
  11679. @item filter, f
  11680. @table @samp
  11681. @item lowpass
  11682. No filtering, this is default.
  11683. @item flat
  11684. Luma and chroma combined together.
  11685. @item aflat
  11686. Similar as above, but shows difference between blue and red chroma.
  11687. @item chroma
  11688. Displays only chroma.
  11689. @item color
  11690. Displays actual color value on waveform.
  11691. @item acolor
  11692. Similar as above, but with luma showing frequency of chroma values.
  11693. @end table
  11694. @item graticule, g
  11695. Set which graticule to display.
  11696. @table @samp
  11697. @item none
  11698. Do not display graticule.
  11699. @item green
  11700. Display green graticule showing legal broadcast ranges.
  11701. @end table
  11702. @item opacity, o
  11703. Set graticule opacity.
  11704. @item flags, fl
  11705. Set graticule flags.
  11706. @table @samp
  11707. @item numbers
  11708. Draw numbers above lines. By default enabled.
  11709. @item dots
  11710. Draw dots instead of lines.
  11711. @end table
  11712. @item scale, s
  11713. Set scale used for displaying graticule.
  11714. @table @samp
  11715. @item digital
  11716. @item millivolts
  11717. @item ire
  11718. @end table
  11719. Default is digital.
  11720. @item bgopacity, b
  11721. Set background opacity.
  11722. @end table
  11723. @section weave, doubleweave
  11724. The @code{weave} takes a field-based video input and join
  11725. each two sequential fields into single frame, producing a new double
  11726. height clip with half the frame rate and half the frame count.
  11727. The @code{doubleweave} works same as @code{weave} but without
  11728. halving frame rate and frame count.
  11729. It accepts the following option:
  11730. @table @option
  11731. @item first_field
  11732. Set first field. Available values are:
  11733. @table @samp
  11734. @item top, t
  11735. Set the frame as top-field-first.
  11736. @item bottom, b
  11737. Set the frame as bottom-field-first.
  11738. @end table
  11739. @end table
  11740. @subsection Examples
  11741. @itemize
  11742. @item
  11743. Interlace video using @ref{select} and @ref{separatefields} filter:
  11744. @example
  11745. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  11746. @end example
  11747. @end itemize
  11748. @section xbr
  11749. Apply the xBR high-quality magnification filter which is designed for pixel
  11750. art. It follows a set of edge-detection rules, see
  11751. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  11752. It accepts the following option:
  11753. @table @option
  11754. @item n
  11755. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  11756. @code{3xBR} and @code{4} for @code{4xBR}.
  11757. Default is @code{3}.
  11758. @end table
  11759. @anchor{yadif}
  11760. @section yadif
  11761. Deinterlace the input video ("yadif" means "yet another deinterlacing
  11762. filter").
  11763. It accepts the following parameters:
  11764. @table @option
  11765. @item mode
  11766. The interlacing mode to adopt. It accepts one of the following values:
  11767. @table @option
  11768. @item 0, send_frame
  11769. Output one frame for each frame.
  11770. @item 1, send_field
  11771. Output one frame for each field.
  11772. @item 2, send_frame_nospatial
  11773. Like @code{send_frame}, but it skips the spatial interlacing check.
  11774. @item 3, send_field_nospatial
  11775. Like @code{send_field}, but it skips the spatial interlacing check.
  11776. @end table
  11777. The default value is @code{send_frame}.
  11778. @item parity
  11779. The picture field parity assumed for the input interlaced video. It accepts one
  11780. of the following values:
  11781. @table @option
  11782. @item 0, tff
  11783. Assume the top field is first.
  11784. @item 1, bff
  11785. Assume the bottom field is first.
  11786. @item -1, auto
  11787. Enable automatic detection of field parity.
  11788. @end table
  11789. The default value is @code{auto}.
  11790. If the interlacing is unknown or the decoder does not export this information,
  11791. top field first will be assumed.
  11792. @item deint
  11793. Specify which frames to deinterlace. Accept one of the following
  11794. values:
  11795. @table @option
  11796. @item 0, all
  11797. Deinterlace all frames.
  11798. @item 1, interlaced
  11799. Only deinterlace frames marked as interlaced.
  11800. @end table
  11801. The default value is @code{all}.
  11802. @end table
  11803. @section zoompan
  11804. Apply Zoom & Pan effect.
  11805. This filter accepts the following options:
  11806. @table @option
  11807. @item zoom, z
  11808. Set the zoom expression. Default is 1.
  11809. @item x
  11810. @item y
  11811. Set the x and y expression. Default is 0.
  11812. @item d
  11813. Set the duration expression in number of frames.
  11814. This sets for how many number of frames effect will last for
  11815. single input image.
  11816. @item s
  11817. Set the output image size, default is 'hd720'.
  11818. @item fps
  11819. Set the output frame rate, default is '25'.
  11820. @end table
  11821. Each expression can contain the following constants:
  11822. @table @option
  11823. @item in_w, iw
  11824. Input width.
  11825. @item in_h, ih
  11826. Input height.
  11827. @item out_w, ow
  11828. Output width.
  11829. @item out_h, oh
  11830. Output height.
  11831. @item in
  11832. Input frame count.
  11833. @item on
  11834. Output frame count.
  11835. @item x
  11836. @item y
  11837. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  11838. for current input frame.
  11839. @item px
  11840. @item py
  11841. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  11842. not yet such frame (first input frame).
  11843. @item zoom
  11844. Last calculated zoom from 'z' expression for current input frame.
  11845. @item pzoom
  11846. Last calculated zoom of last output frame of previous input frame.
  11847. @item duration
  11848. Number of output frames for current input frame. Calculated from 'd' expression
  11849. for each input frame.
  11850. @item pduration
  11851. number of output frames created for previous input frame
  11852. @item a
  11853. Rational number: input width / input height
  11854. @item sar
  11855. sample aspect ratio
  11856. @item dar
  11857. display aspect ratio
  11858. @end table
  11859. @subsection Examples
  11860. @itemize
  11861. @item
  11862. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  11863. @example
  11864. 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
  11865. @end example
  11866. @item
  11867. Zoom-in up to 1.5 and pan always at center of picture:
  11868. @example
  11869. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  11870. @end example
  11871. @item
  11872. Same as above but without pausing:
  11873. @example
  11874. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  11875. @end example
  11876. @end itemize
  11877. @section zscale
  11878. Scale (resize) the input video, using the z.lib library:
  11879. https://github.com/sekrit-twc/zimg.
  11880. The zscale filter forces the output display aspect ratio to be the same
  11881. as the input, by changing the output sample aspect ratio.
  11882. If the input image format is different from the format requested by
  11883. the next filter, the zscale filter will convert the input to the
  11884. requested format.
  11885. @subsection Options
  11886. The filter accepts the following options.
  11887. @table @option
  11888. @item width, w
  11889. @item height, h
  11890. Set the output video dimension expression. Default value is the input
  11891. dimension.
  11892. If the @var{width} or @var{w} value is 0, the input width is used for
  11893. the output. If the @var{height} or @var{h} value is 0, the input height
  11894. is used for the output.
  11895. If one and only one of the values is -n with n >= 1, the zscale filter
  11896. will use a value that maintains the aspect ratio of the input image,
  11897. calculated from the other specified dimension. After that it will,
  11898. however, make sure that the calculated dimension is divisible by n and
  11899. adjust the value if necessary.
  11900. If both values are -n with n >= 1, the behavior will be identical to
  11901. both values being set to 0 as previously detailed.
  11902. See below for the list of accepted constants for use in the dimension
  11903. expression.
  11904. @item size, s
  11905. Set the video size. For the syntax of this option, check the
  11906. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11907. @item dither, d
  11908. Set the dither type.
  11909. Possible values are:
  11910. @table @var
  11911. @item none
  11912. @item ordered
  11913. @item random
  11914. @item error_diffusion
  11915. @end table
  11916. Default is none.
  11917. @item filter, f
  11918. Set the resize filter type.
  11919. Possible values are:
  11920. @table @var
  11921. @item point
  11922. @item bilinear
  11923. @item bicubic
  11924. @item spline16
  11925. @item spline36
  11926. @item lanczos
  11927. @end table
  11928. Default is bilinear.
  11929. @item range, r
  11930. Set the color range.
  11931. Possible values are:
  11932. @table @var
  11933. @item input
  11934. @item limited
  11935. @item full
  11936. @end table
  11937. Default is same as input.
  11938. @item primaries, p
  11939. Set the color primaries.
  11940. Possible values are:
  11941. @table @var
  11942. @item input
  11943. @item 709
  11944. @item unspecified
  11945. @item 170m
  11946. @item 240m
  11947. @item 2020
  11948. @end table
  11949. Default is same as input.
  11950. @item transfer, t
  11951. Set the transfer characteristics.
  11952. Possible values are:
  11953. @table @var
  11954. @item input
  11955. @item 709
  11956. @item unspecified
  11957. @item 601
  11958. @item linear
  11959. @item 2020_10
  11960. @item 2020_12
  11961. @item smpte2084
  11962. @item iec61966-2-1
  11963. @item arib-std-b67
  11964. @end table
  11965. Default is same as input.
  11966. @item matrix, m
  11967. Set the colorspace matrix.
  11968. Possible value are:
  11969. @table @var
  11970. @item input
  11971. @item 709
  11972. @item unspecified
  11973. @item 470bg
  11974. @item 170m
  11975. @item 2020_ncl
  11976. @item 2020_cl
  11977. @end table
  11978. Default is same as input.
  11979. @item rangein, rin
  11980. Set the input color range.
  11981. Possible values are:
  11982. @table @var
  11983. @item input
  11984. @item limited
  11985. @item full
  11986. @end table
  11987. Default is same as input.
  11988. @item primariesin, pin
  11989. Set the input color primaries.
  11990. Possible values are:
  11991. @table @var
  11992. @item input
  11993. @item 709
  11994. @item unspecified
  11995. @item 170m
  11996. @item 240m
  11997. @item 2020
  11998. @end table
  11999. Default is same as input.
  12000. @item transferin, tin
  12001. Set the input transfer characteristics.
  12002. Possible values are:
  12003. @table @var
  12004. @item input
  12005. @item 709
  12006. @item unspecified
  12007. @item 601
  12008. @item linear
  12009. @item 2020_10
  12010. @item 2020_12
  12011. @end table
  12012. Default is same as input.
  12013. @item matrixin, min
  12014. Set the input colorspace matrix.
  12015. Possible value are:
  12016. @table @var
  12017. @item input
  12018. @item 709
  12019. @item unspecified
  12020. @item 470bg
  12021. @item 170m
  12022. @item 2020_ncl
  12023. @item 2020_cl
  12024. @end table
  12025. @item chromal, c
  12026. Set the output chroma location.
  12027. Possible values are:
  12028. @table @var
  12029. @item input
  12030. @item left
  12031. @item center
  12032. @item topleft
  12033. @item top
  12034. @item bottomleft
  12035. @item bottom
  12036. @end table
  12037. @item chromalin, cin
  12038. Set the input chroma location.
  12039. Possible values are:
  12040. @table @var
  12041. @item input
  12042. @item left
  12043. @item center
  12044. @item topleft
  12045. @item top
  12046. @item bottomleft
  12047. @item bottom
  12048. @end table
  12049. @item npl
  12050. Set the nominal peak luminance.
  12051. @end table
  12052. The values of the @option{w} and @option{h} options are expressions
  12053. containing the following constants:
  12054. @table @var
  12055. @item in_w
  12056. @item in_h
  12057. The input width and height
  12058. @item iw
  12059. @item ih
  12060. These are the same as @var{in_w} and @var{in_h}.
  12061. @item out_w
  12062. @item out_h
  12063. The output (scaled) width and height
  12064. @item ow
  12065. @item oh
  12066. These are the same as @var{out_w} and @var{out_h}
  12067. @item a
  12068. The same as @var{iw} / @var{ih}
  12069. @item sar
  12070. input sample aspect ratio
  12071. @item dar
  12072. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  12073. @item hsub
  12074. @item vsub
  12075. horizontal and vertical input chroma subsample values. For example for the
  12076. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12077. @item ohsub
  12078. @item ovsub
  12079. horizontal and vertical output chroma subsample values. For example for the
  12080. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12081. @end table
  12082. @table @option
  12083. @end table
  12084. @c man end VIDEO FILTERS
  12085. @chapter Video Sources
  12086. @c man begin VIDEO SOURCES
  12087. Below is a description of the currently available video sources.
  12088. @section buffer
  12089. Buffer video frames, and make them available to the filter chain.
  12090. This source is mainly intended for a programmatic use, in particular
  12091. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  12092. It accepts the following parameters:
  12093. @table @option
  12094. @item video_size
  12095. Specify the size (width and height) of the buffered video frames. For the
  12096. syntax of this option, check the
  12097. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12098. @item width
  12099. The input video width.
  12100. @item height
  12101. The input video height.
  12102. @item pix_fmt
  12103. A string representing the pixel format of the buffered video frames.
  12104. It may be a number corresponding to a pixel format, or a pixel format
  12105. name.
  12106. @item time_base
  12107. Specify the timebase assumed by the timestamps of the buffered frames.
  12108. @item frame_rate
  12109. Specify the frame rate expected for the video stream.
  12110. @item pixel_aspect, sar
  12111. The sample (pixel) aspect ratio of the input video.
  12112. @item sws_param
  12113. Specify the optional parameters to be used for the scale filter which
  12114. is automatically inserted when an input change is detected in the
  12115. input size or format.
  12116. @item hw_frames_ctx
  12117. When using a hardware pixel format, this should be a reference to an
  12118. AVHWFramesContext describing input frames.
  12119. @end table
  12120. For example:
  12121. @example
  12122. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  12123. @end example
  12124. will instruct the source to accept video frames with size 320x240 and
  12125. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  12126. square pixels (1:1 sample aspect ratio).
  12127. Since the pixel format with name "yuv410p" corresponds to the number 6
  12128. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  12129. this example corresponds to:
  12130. @example
  12131. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  12132. @end example
  12133. Alternatively, the options can be specified as a flat string, but this
  12134. syntax is deprecated:
  12135. @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}]
  12136. @section cellauto
  12137. Create a pattern generated by an elementary cellular automaton.
  12138. The initial state of the cellular automaton can be defined through the
  12139. @option{filename} and @option{pattern} options. If such options are
  12140. not specified an initial state is created randomly.
  12141. At each new frame a new row in the video is filled with the result of
  12142. the cellular automaton next generation. The behavior when the whole
  12143. frame is filled is defined by the @option{scroll} option.
  12144. This source accepts the following options:
  12145. @table @option
  12146. @item filename, f
  12147. Read the initial cellular automaton state, i.e. the starting row, from
  12148. the specified file.
  12149. In the file, each non-whitespace character is considered an alive
  12150. cell, a newline will terminate the row, and further characters in the
  12151. file will be ignored.
  12152. @item pattern, p
  12153. Read the initial cellular automaton state, i.e. the starting row, from
  12154. the specified string.
  12155. Each non-whitespace character in the string is considered an alive
  12156. cell, a newline will terminate the row, and further characters in the
  12157. string will be ignored.
  12158. @item rate, r
  12159. Set the video rate, that is the number of frames generated per second.
  12160. Default is 25.
  12161. @item random_fill_ratio, ratio
  12162. Set the random fill ratio for the initial cellular automaton row. It
  12163. is a floating point number value ranging from 0 to 1, defaults to
  12164. 1/PHI.
  12165. This option is ignored when a file or a pattern is specified.
  12166. @item random_seed, seed
  12167. Set the seed for filling randomly the initial row, must be an integer
  12168. included between 0 and UINT32_MAX. If not specified, or if explicitly
  12169. set to -1, the filter will try to use a good random seed on a best
  12170. effort basis.
  12171. @item rule
  12172. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  12173. Default value is 110.
  12174. @item size, s
  12175. Set the size of the output video. For the syntax of this option, check the
  12176. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12177. If @option{filename} or @option{pattern} is specified, the size is set
  12178. by default to the width of the specified initial state row, and the
  12179. height is set to @var{width} * PHI.
  12180. If @option{size} is set, it must contain the width of the specified
  12181. pattern string, and the specified pattern will be centered in the
  12182. larger row.
  12183. If a filename or a pattern string is not specified, the size value
  12184. defaults to "320x518" (used for a randomly generated initial state).
  12185. @item scroll
  12186. If set to 1, scroll the output upward when all the rows in the output
  12187. have been already filled. If set to 0, the new generated row will be
  12188. written over the top row just after the bottom row is filled.
  12189. Defaults to 1.
  12190. @item start_full, full
  12191. If set to 1, completely fill the output with generated rows before
  12192. outputting the first frame.
  12193. This is the default behavior, for disabling set the value to 0.
  12194. @item stitch
  12195. If set to 1, stitch the left and right row edges together.
  12196. This is the default behavior, for disabling set the value to 0.
  12197. @end table
  12198. @subsection Examples
  12199. @itemize
  12200. @item
  12201. Read the initial state from @file{pattern}, and specify an output of
  12202. size 200x400.
  12203. @example
  12204. cellauto=f=pattern:s=200x400
  12205. @end example
  12206. @item
  12207. Generate a random initial row with a width of 200 cells, with a fill
  12208. ratio of 2/3:
  12209. @example
  12210. cellauto=ratio=2/3:s=200x200
  12211. @end example
  12212. @item
  12213. Create a pattern generated by rule 18 starting by a single alive cell
  12214. centered on an initial row with width 100:
  12215. @example
  12216. cellauto=p=@@:s=100x400:full=0:rule=18
  12217. @end example
  12218. @item
  12219. Specify a more elaborated initial pattern:
  12220. @example
  12221. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  12222. @end example
  12223. @end itemize
  12224. @anchor{coreimagesrc}
  12225. @section coreimagesrc
  12226. Video source generated on GPU using Apple's CoreImage API on OSX.
  12227. This video source is a specialized version of the @ref{coreimage} video filter.
  12228. Use a core image generator at the beginning of the applied filterchain to
  12229. generate the content.
  12230. The coreimagesrc video source accepts the following options:
  12231. @table @option
  12232. @item list_generators
  12233. List all available generators along with all their respective options as well as
  12234. possible minimum and maximum values along with the default values.
  12235. @example
  12236. list_generators=true
  12237. @end example
  12238. @item size, s
  12239. Specify the size of the sourced video. For the syntax of this option, check the
  12240. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12241. The default value is @code{320x240}.
  12242. @item rate, r
  12243. Specify the frame rate of the sourced video, as the number of frames
  12244. generated per second. It has to be a string in the format
  12245. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12246. number or a valid video frame rate abbreviation. The default value is
  12247. "25".
  12248. @item sar
  12249. Set the sample aspect ratio of the sourced video.
  12250. @item duration, d
  12251. Set the duration of the sourced video. See
  12252. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12253. for the accepted syntax.
  12254. If not specified, or the expressed duration is negative, the video is
  12255. supposed to be generated forever.
  12256. @end table
  12257. Additionally, all options of the @ref{coreimage} video filter are accepted.
  12258. A complete filterchain can be used for further processing of the
  12259. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  12260. and examples for details.
  12261. @subsection Examples
  12262. @itemize
  12263. @item
  12264. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  12265. given as complete and escaped command-line for Apple's standard bash shell:
  12266. @example
  12267. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  12268. @end example
  12269. This example is equivalent to the QRCode example of @ref{coreimage} without the
  12270. need for a nullsrc video source.
  12271. @end itemize
  12272. @section mandelbrot
  12273. Generate a Mandelbrot set fractal, and progressively zoom towards the
  12274. point specified with @var{start_x} and @var{start_y}.
  12275. This source accepts the following options:
  12276. @table @option
  12277. @item end_pts
  12278. Set the terminal pts value. Default value is 400.
  12279. @item end_scale
  12280. Set the terminal scale value.
  12281. Must be a floating point value. Default value is 0.3.
  12282. @item inner
  12283. Set the inner coloring mode, that is the algorithm used to draw the
  12284. Mandelbrot fractal internal region.
  12285. It shall assume one of the following values:
  12286. @table @option
  12287. @item black
  12288. Set black mode.
  12289. @item convergence
  12290. Show time until convergence.
  12291. @item mincol
  12292. Set color based on point closest to the origin of the iterations.
  12293. @item period
  12294. Set period mode.
  12295. @end table
  12296. Default value is @var{mincol}.
  12297. @item bailout
  12298. Set the bailout value. Default value is 10.0.
  12299. @item maxiter
  12300. Set the maximum of iterations performed by the rendering
  12301. algorithm. Default value is 7189.
  12302. @item outer
  12303. Set outer coloring mode.
  12304. It shall assume one of following values:
  12305. @table @option
  12306. @item iteration_count
  12307. Set iteration cound mode.
  12308. @item normalized_iteration_count
  12309. set normalized iteration count mode.
  12310. @end table
  12311. Default value is @var{normalized_iteration_count}.
  12312. @item rate, r
  12313. Set frame rate, expressed as number of frames per second. Default
  12314. value is "25".
  12315. @item size, s
  12316. Set frame size. For the syntax of this option, check the "Video
  12317. size" section in the ffmpeg-utils manual. Default value is "640x480".
  12318. @item start_scale
  12319. Set the initial scale value. Default value is 3.0.
  12320. @item start_x
  12321. Set the initial x position. Must be a floating point value between
  12322. -100 and 100. Default value is -0.743643887037158704752191506114774.
  12323. @item start_y
  12324. Set the initial y position. Must be a floating point value between
  12325. -100 and 100. Default value is -0.131825904205311970493132056385139.
  12326. @end table
  12327. @section mptestsrc
  12328. Generate various test patterns, as generated by the MPlayer test filter.
  12329. The size of the generated video is fixed, and is 256x256.
  12330. This source is useful in particular for testing encoding features.
  12331. This source accepts the following options:
  12332. @table @option
  12333. @item rate, r
  12334. Specify the frame rate of the sourced video, as the number of frames
  12335. generated per second. It has to be a string in the format
  12336. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12337. number or a valid video frame rate abbreviation. The default value is
  12338. "25".
  12339. @item duration, d
  12340. Set the duration of the sourced video. See
  12341. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12342. for the accepted syntax.
  12343. If not specified, or the expressed duration is negative, the video is
  12344. supposed to be generated forever.
  12345. @item test, t
  12346. Set the number or the name of the test to perform. Supported tests are:
  12347. @table @option
  12348. @item dc_luma
  12349. @item dc_chroma
  12350. @item freq_luma
  12351. @item freq_chroma
  12352. @item amp_luma
  12353. @item amp_chroma
  12354. @item cbp
  12355. @item mv
  12356. @item ring1
  12357. @item ring2
  12358. @item all
  12359. @end table
  12360. Default value is "all", which will cycle through the list of all tests.
  12361. @end table
  12362. Some examples:
  12363. @example
  12364. mptestsrc=t=dc_luma
  12365. @end example
  12366. will generate a "dc_luma" test pattern.
  12367. @section frei0r_src
  12368. Provide a frei0r source.
  12369. To enable compilation of this filter you need to install the frei0r
  12370. header and configure FFmpeg with @code{--enable-frei0r}.
  12371. This source accepts the following parameters:
  12372. @table @option
  12373. @item size
  12374. The size of the video to generate. For the syntax of this option, check the
  12375. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12376. @item framerate
  12377. The framerate of the generated video. It may be a string of the form
  12378. @var{num}/@var{den} or a frame rate abbreviation.
  12379. @item filter_name
  12380. The name to the frei0r source to load. For more information regarding frei0r and
  12381. how to set the parameters, read the @ref{frei0r} section in the video filters
  12382. documentation.
  12383. @item filter_params
  12384. A '|'-separated list of parameters to pass to the frei0r source.
  12385. @end table
  12386. For example, to generate a frei0r partik0l source with size 200x200
  12387. and frame rate 10 which is overlaid on the overlay filter main input:
  12388. @example
  12389. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  12390. @end example
  12391. @section life
  12392. Generate a life pattern.
  12393. This source is based on a generalization of John Conway's life game.
  12394. The sourced input represents a life grid, each pixel represents a cell
  12395. which can be in one of two possible states, alive or dead. Every cell
  12396. interacts with its eight neighbours, which are the cells that are
  12397. horizontally, vertically, or diagonally adjacent.
  12398. At each interaction the grid evolves according to the adopted rule,
  12399. which specifies the number of neighbor alive cells which will make a
  12400. cell stay alive or born. The @option{rule} option allows one to specify
  12401. the rule to adopt.
  12402. This source accepts the following options:
  12403. @table @option
  12404. @item filename, f
  12405. Set the file from which to read the initial grid state. In the file,
  12406. each non-whitespace character is considered an alive cell, and newline
  12407. is used to delimit the end of each row.
  12408. If this option is not specified, the initial grid is generated
  12409. randomly.
  12410. @item rate, r
  12411. Set the video rate, that is the number of frames generated per second.
  12412. Default is 25.
  12413. @item random_fill_ratio, ratio
  12414. Set the random fill ratio for the initial random grid. It is a
  12415. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  12416. It is ignored when a file is specified.
  12417. @item random_seed, seed
  12418. Set the seed for filling the initial random grid, must be an integer
  12419. included between 0 and UINT32_MAX. If not specified, or if explicitly
  12420. set to -1, the filter will try to use a good random seed on a best
  12421. effort basis.
  12422. @item rule
  12423. Set the life rule.
  12424. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  12425. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  12426. @var{NS} specifies the number of alive neighbor cells which make a
  12427. live cell stay alive, and @var{NB} the number of alive neighbor cells
  12428. which make a dead cell to become alive (i.e. to "born").
  12429. "s" and "b" can be used in place of "S" and "B", respectively.
  12430. Alternatively a rule can be specified by an 18-bits integer. The 9
  12431. high order bits are used to encode the next cell state if it is alive
  12432. for each number of neighbor alive cells, the low order bits specify
  12433. the rule for "borning" new cells. Higher order bits encode for an
  12434. higher number of neighbor cells.
  12435. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  12436. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  12437. Default value is "S23/B3", which is the original Conway's game of life
  12438. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  12439. cells, and will born a new cell if there are three alive cells around
  12440. a dead cell.
  12441. @item size, s
  12442. Set the size of the output video. For the syntax of this option, check the
  12443. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12444. If @option{filename} is specified, the size is set by default to the
  12445. same size of the input file. If @option{size} is set, it must contain
  12446. the size specified in the input file, and the initial grid defined in
  12447. that file is centered in the larger resulting area.
  12448. If a filename is not specified, the size value defaults to "320x240"
  12449. (used for a randomly generated initial grid).
  12450. @item stitch
  12451. If set to 1, stitch the left and right grid edges together, and the
  12452. top and bottom edges also. Defaults to 1.
  12453. @item mold
  12454. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  12455. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  12456. value from 0 to 255.
  12457. @item life_color
  12458. Set the color of living (or new born) cells.
  12459. @item death_color
  12460. Set the color of dead cells. If @option{mold} is set, this is the first color
  12461. used to represent a dead cell.
  12462. @item mold_color
  12463. Set mold color, for definitely dead and moldy cells.
  12464. For the syntax of these 3 color options, check the "Color" section in the
  12465. ffmpeg-utils manual.
  12466. @end table
  12467. @subsection Examples
  12468. @itemize
  12469. @item
  12470. Read a grid from @file{pattern}, and center it on a grid of size
  12471. 300x300 pixels:
  12472. @example
  12473. life=f=pattern:s=300x300
  12474. @end example
  12475. @item
  12476. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  12477. @example
  12478. life=ratio=2/3:s=200x200
  12479. @end example
  12480. @item
  12481. Specify a custom rule for evolving a randomly generated grid:
  12482. @example
  12483. life=rule=S14/B34
  12484. @end example
  12485. @item
  12486. Full example with slow death effect (mold) using @command{ffplay}:
  12487. @example
  12488. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  12489. @end example
  12490. @end itemize
  12491. @anchor{allrgb}
  12492. @anchor{allyuv}
  12493. @anchor{color}
  12494. @anchor{haldclutsrc}
  12495. @anchor{nullsrc}
  12496. @anchor{rgbtestsrc}
  12497. @anchor{smptebars}
  12498. @anchor{smptehdbars}
  12499. @anchor{testsrc}
  12500. @anchor{testsrc2}
  12501. @anchor{yuvtestsrc}
  12502. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  12503. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  12504. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  12505. The @code{color} source provides an uniformly colored input.
  12506. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  12507. @ref{haldclut} filter.
  12508. The @code{nullsrc} source returns unprocessed video frames. It is
  12509. mainly useful to be employed in analysis / debugging tools, or as the
  12510. source for filters which ignore the input data.
  12511. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  12512. detecting RGB vs BGR issues. You should see a red, green and blue
  12513. stripe from top to bottom.
  12514. The @code{smptebars} source generates a color bars pattern, based on
  12515. the SMPTE Engineering Guideline EG 1-1990.
  12516. The @code{smptehdbars} source generates a color bars pattern, based on
  12517. the SMPTE RP 219-2002.
  12518. The @code{testsrc} source generates a test video pattern, showing a
  12519. color pattern, a scrolling gradient and a timestamp. This is mainly
  12520. intended for testing purposes.
  12521. The @code{testsrc2} source is similar to testsrc, but supports more
  12522. pixel formats instead of just @code{rgb24}. This allows using it as an
  12523. input for other tests without requiring a format conversion.
  12524. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  12525. see a y, cb and cr stripe from top to bottom.
  12526. The sources accept the following parameters:
  12527. @table @option
  12528. @item color, c
  12529. Specify the color of the source, only available in the @code{color}
  12530. source. For the syntax of this option, check the "Color" section in the
  12531. ffmpeg-utils manual.
  12532. @item level
  12533. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  12534. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  12535. pixels to be used as identity matrix for 3D lookup tables. Each component is
  12536. coded on a @code{1/(N*N)} scale.
  12537. @item size, s
  12538. Specify the size of the sourced video. For the syntax of this option, check the
  12539. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12540. The default value is @code{320x240}.
  12541. This option is not available with the @code{haldclutsrc} filter.
  12542. @item rate, r
  12543. Specify the frame rate of the sourced video, as the number of frames
  12544. generated per second. It has to be a string in the format
  12545. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12546. number or a valid video frame rate abbreviation. The default value is
  12547. "25".
  12548. @item sar
  12549. Set the sample aspect ratio of the sourced video.
  12550. @item duration, d
  12551. Set the duration of the sourced video. See
  12552. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12553. for the accepted syntax.
  12554. If not specified, or the expressed duration is negative, the video is
  12555. supposed to be generated forever.
  12556. @item decimals, n
  12557. Set the number of decimals to show in the timestamp, only available in the
  12558. @code{testsrc} source.
  12559. The displayed timestamp value will correspond to the original
  12560. timestamp value multiplied by the power of 10 of the specified
  12561. value. Default value is 0.
  12562. @end table
  12563. For example the following:
  12564. @example
  12565. testsrc=duration=5.3:size=qcif:rate=10
  12566. @end example
  12567. will generate a video with a duration of 5.3 seconds, with size
  12568. 176x144 and a frame rate of 10 frames per second.
  12569. The following graph description will generate a red source
  12570. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  12571. frames per second.
  12572. @example
  12573. color=c=red@@0.2:s=qcif:r=10
  12574. @end example
  12575. If the input content is to be ignored, @code{nullsrc} can be used. The
  12576. following command generates noise in the luminance plane by employing
  12577. the @code{geq} filter:
  12578. @example
  12579. nullsrc=s=256x256, geq=random(1)*255:128:128
  12580. @end example
  12581. @subsection Commands
  12582. The @code{color} source supports the following commands:
  12583. @table @option
  12584. @item c, color
  12585. Set the color of the created image. Accepts the same syntax of the
  12586. corresponding @option{color} option.
  12587. @end table
  12588. @c man end VIDEO SOURCES
  12589. @chapter Video Sinks
  12590. @c man begin VIDEO SINKS
  12591. Below is a description of the currently available video sinks.
  12592. @section buffersink
  12593. Buffer video frames, and make them available to the end of the filter
  12594. graph.
  12595. This sink is mainly intended for programmatic use, in particular
  12596. through the interface defined in @file{libavfilter/buffersink.h}
  12597. or the options system.
  12598. It accepts a pointer to an AVBufferSinkContext structure, which
  12599. defines the incoming buffers' formats, to be passed as the opaque
  12600. parameter to @code{avfilter_init_filter} for initialization.
  12601. @section nullsink
  12602. Null video sink: do absolutely nothing with the input video. It is
  12603. mainly useful as a template and for use in analysis / debugging
  12604. tools.
  12605. @c man end VIDEO SINKS
  12606. @chapter Multimedia Filters
  12607. @c man begin MULTIMEDIA FILTERS
  12608. Below is a description of the currently available multimedia filters.
  12609. @section abitscope
  12610. Convert input audio to a video output, displaying the audio bit scope.
  12611. The filter accepts the following options:
  12612. @table @option
  12613. @item rate, r
  12614. Set frame rate, expressed as number of frames per second. Default
  12615. value is "25".
  12616. @item size, s
  12617. Specify the video size for the output. For the syntax of this option, check the
  12618. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12619. Default value is @code{1024x256}.
  12620. @item colors
  12621. Specify list of colors separated by space or by '|' which will be used to
  12622. draw channels. Unrecognized or missing colors will be replaced
  12623. by white color.
  12624. @end table
  12625. @section ahistogram
  12626. Convert input audio to a video output, displaying the volume histogram.
  12627. The filter accepts the following options:
  12628. @table @option
  12629. @item dmode
  12630. Specify how histogram is calculated.
  12631. It accepts the following values:
  12632. @table @samp
  12633. @item single
  12634. Use single histogram for all channels.
  12635. @item separate
  12636. Use separate histogram for each channel.
  12637. @end table
  12638. Default is @code{single}.
  12639. @item rate, r
  12640. Set frame rate, expressed as number of frames per second. Default
  12641. value is "25".
  12642. @item size, s
  12643. Specify the video size for the output. For the syntax of this option, check the
  12644. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12645. Default value is @code{hd720}.
  12646. @item scale
  12647. Set display scale.
  12648. It accepts the following values:
  12649. @table @samp
  12650. @item log
  12651. logarithmic
  12652. @item sqrt
  12653. square root
  12654. @item cbrt
  12655. cubic root
  12656. @item lin
  12657. linear
  12658. @item rlog
  12659. reverse logarithmic
  12660. @end table
  12661. Default is @code{log}.
  12662. @item ascale
  12663. Set amplitude scale.
  12664. It accepts the following values:
  12665. @table @samp
  12666. @item log
  12667. logarithmic
  12668. @item lin
  12669. linear
  12670. @end table
  12671. Default is @code{log}.
  12672. @item acount
  12673. Set how much frames to accumulate in histogram.
  12674. Defauls is 1. Setting this to -1 accumulates all frames.
  12675. @item rheight
  12676. Set histogram ratio of window height.
  12677. @item slide
  12678. Set sonogram sliding.
  12679. It accepts the following values:
  12680. @table @samp
  12681. @item replace
  12682. replace old rows with new ones.
  12683. @item scroll
  12684. scroll from top to bottom.
  12685. @end table
  12686. Default is @code{replace}.
  12687. @end table
  12688. @section aphasemeter
  12689. Convert input audio to a video output, displaying the audio phase.
  12690. The filter accepts the following options:
  12691. @table @option
  12692. @item rate, r
  12693. Set the output frame rate. Default value is @code{25}.
  12694. @item size, s
  12695. Set the video size for the output. For the syntax of this option, check the
  12696. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12697. Default value is @code{800x400}.
  12698. @item rc
  12699. @item gc
  12700. @item bc
  12701. Specify the red, green, blue contrast. Default values are @code{2},
  12702. @code{7} and @code{1}.
  12703. Allowed range is @code{[0, 255]}.
  12704. @item mpc
  12705. Set color which will be used for drawing median phase. If color is
  12706. @code{none} which is default, no median phase value will be drawn.
  12707. @item video
  12708. Enable video output. Default is enabled.
  12709. @end table
  12710. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  12711. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  12712. The @code{-1} means left and right channels are completely out of phase and
  12713. @code{1} means channels are in phase.
  12714. @section avectorscope
  12715. Convert input audio to a video output, representing the audio vector
  12716. scope.
  12717. The filter is used to measure the difference between channels of stereo
  12718. audio stream. A monoaural signal, consisting of identical left and right
  12719. signal, results in straight vertical line. Any stereo separation is visible
  12720. as a deviation from this line, creating a Lissajous figure.
  12721. If the straight (or deviation from it) but horizontal line appears this
  12722. indicates that the left and right channels are out of phase.
  12723. The filter accepts the following options:
  12724. @table @option
  12725. @item mode, m
  12726. Set the vectorscope mode.
  12727. Available values are:
  12728. @table @samp
  12729. @item lissajous
  12730. Lissajous rotated by 45 degrees.
  12731. @item lissajous_xy
  12732. Same as above but not rotated.
  12733. @item polar
  12734. Shape resembling half of circle.
  12735. @end table
  12736. Default value is @samp{lissajous}.
  12737. @item size, s
  12738. Set the video size for the output. For the syntax of this option, check the
  12739. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12740. Default value is @code{400x400}.
  12741. @item rate, r
  12742. Set the output frame rate. Default value is @code{25}.
  12743. @item rc
  12744. @item gc
  12745. @item bc
  12746. @item ac
  12747. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  12748. @code{160}, @code{80} and @code{255}.
  12749. Allowed range is @code{[0, 255]}.
  12750. @item rf
  12751. @item gf
  12752. @item bf
  12753. @item af
  12754. Specify the red, green, blue and alpha fade. Default values are @code{15},
  12755. @code{10}, @code{5} and @code{5}.
  12756. Allowed range is @code{[0, 255]}.
  12757. @item zoom
  12758. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[1, 10]}.
  12759. @item draw
  12760. Set the vectorscope drawing mode.
  12761. Available values are:
  12762. @table @samp
  12763. @item dot
  12764. Draw dot for each sample.
  12765. @item line
  12766. Draw line between previous and current sample.
  12767. @end table
  12768. Default value is @samp{dot}.
  12769. @item scale
  12770. Specify amplitude scale of audio samples.
  12771. Available values are:
  12772. @table @samp
  12773. @item lin
  12774. Linear.
  12775. @item sqrt
  12776. Square root.
  12777. @item cbrt
  12778. Cubic root.
  12779. @item log
  12780. Logarithmic.
  12781. @end table
  12782. @end table
  12783. @subsection Examples
  12784. @itemize
  12785. @item
  12786. Complete example using @command{ffplay}:
  12787. @example
  12788. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  12789. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  12790. @end example
  12791. @end itemize
  12792. @section bench, abench
  12793. Benchmark part of a filtergraph.
  12794. The filter accepts the following options:
  12795. @table @option
  12796. @item action
  12797. Start or stop a timer.
  12798. Available values are:
  12799. @table @samp
  12800. @item start
  12801. Get the current time, set it as frame metadata (using the key
  12802. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  12803. @item stop
  12804. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  12805. the input frame metadata to get the time difference. Time difference, average,
  12806. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  12807. @code{min}) are then printed. The timestamps are expressed in seconds.
  12808. @end table
  12809. @end table
  12810. @subsection Examples
  12811. @itemize
  12812. @item
  12813. Benchmark @ref{selectivecolor} filter:
  12814. @example
  12815. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  12816. @end example
  12817. @end itemize
  12818. @section concat
  12819. Concatenate audio and video streams, joining them together one after the
  12820. other.
  12821. The filter works on segments of synchronized video and audio streams. All
  12822. segments must have the same number of streams of each type, and that will
  12823. also be the number of streams at output.
  12824. The filter accepts the following options:
  12825. @table @option
  12826. @item n
  12827. Set the number of segments. Default is 2.
  12828. @item v
  12829. Set the number of output video streams, that is also the number of video
  12830. streams in each segment. Default is 1.
  12831. @item a
  12832. Set the number of output audio streams, that is also the number of audio
  12833. streams in each segment. Default is 0.
  12834. @item unsafe
  12835. Activate unsafe mode: do not fail if segments have a different format.
  12836. @end table
  12837. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  12838. @var{a} audio outputs.
  12839. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  12840. segment, in the same order as the outputs, then the inputs for the second
  12841. segment, etc.
  12842. Related streams do not always have exactly the same duration, for various
  12843. reasons including codec frame size or sloppy authoring. For that reason,
  12844. related synchronized streams (e.g. a video and its audio track) should be
  12845. concatenated at once. The concat filter will use the duration of the longest
  12846. stream in each segment (except the last one), and if necessary pad shorter
  12847. audio streams with silence.
  12848. For this filter to work correctly, all segments must start at timestamp 0.
  12849. All corresponding streams must have the same parameters in all segments; the
  12850. filtering system will automatically select a common pixel format for video
  12851. streams, and a common sample format, sample rate and channel layout for
  12852. audio streams, but other settings, such as resolution, must be converted
  12853. explicitly by the user.
  12854. Different frame rates are acceptable but will result in variable frame rate
  12855. at output; be sure to configure the output file to handle it.
  12856. @subsection Examples
  12857. @itemize
  12858. @item
  12859. Concatenate an opening, an episode and an ending, all in bilingual version
  12860. (video in stream 0, audio in streams 1 and 2):
  12861. @example
  12862. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  12863. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  12864. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  12865. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  12866. @end example
  12867. @item
  12868. Concatenate two parts, handling audio and video separately, using the
  12869. (a)movie sources, and adjusting the resolution:
  12870. @example
  12871. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  12872. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  12873. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  12874. @end example
  12875. Note that a desync will happen at the stitch if the audio and video streams
  12876. do not have exactly the same duration in the first file.
  12877. @end itemize
  12878. @section drawgraph, adrawgraph
  12879. Draw a graph using input video or audio metadata.
  12880. It accepts the following parameters:
  12881. @table @option
  12882. @item m1
  12883. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  12884. @item fg1
  12885. Set 1st foreground color expression.
  12886. @item m2
  12887. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  12888. @item fg2
  12889. Set 2nd foreground color expression.
  12890. @item m3
  12891. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  12892. @item fg3
  12893. Set 3rd foreground color expression.
  12894. @item m4
  12895. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  12896. @item fg4
  12897. Set 4th foreground color expression.
  12898. @item min
  12899. Set minimal value of metadata value.
  12900. @item max
  12901. Set maximal value of metadata value.
  12902. @item bg
  12903. Set graph background color. Default is white.
  12904. @item mode
  12905. Set graph mode.
  12906. Available values for mode is:
  12907. @table @samp
  12908. @item bar
  12909. @item dot
  12910. @item line
  12911. @end table
  12912. Default is @code{line}.
  12913. @item slide
  12914. Set slide mode.
  12915. Available values for slide is:
  12916. @table @samp
  12917. @item frame
  12918. Draw new frame when right border is reached.
  12919. @item replace
  12920. Replace old columns with new ones.
  12921. @item scroll
  12922. Scroll from right to left.
  12923. @item rscroll
  12924. Scroll from left to right.
  12925. @item picture
  12926. Draw single picture.
  12927. @end table
  12928. Default is @code{frame}.
  12929. @item size
  12930. Set size of graph video. For the syntax of this option, check the
  12931. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12932. The default value is @code{900x256}.
  12933. The foreground color expressions can use the following variables:
  12934. @table @option
  12935. @item MIN
  12936. Minimal value of metadata value.
  12937. @item MAX
  12938. Maximal value of metadata value.
  12939. @item VAL
  12940. Current metadata key value.
  12941. @end table
  12942. The color is defined as 0xAABBGGRR.
  12943. @end table
  12944. Example using metadata from @ref{signalstats} filter:
  12945. @example
  12946. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  12947. @end example
  12948. Example using metadata from @ref{ebur128} filter:
  12949. @example
  12950. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  12951. @end example
  12952. @anchor{ebur128}
  12953. @section ebur128
  12954. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  12955. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  12956. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  12957. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  12958. The filter also has a video output (see the @var{video} option) with a real
  12959. time graph to observe the loudness evolution. The graphic contains the logged
  12960. message mentioned above, so it is not printed anymore when this option is set,
  12961. unless the verbose logging is set. The main graphing area contains the
  12962. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  12963. the momentary loudness (400 milliseconds).
  12964. More information about the Loudness Recommendation EBU R128 on
  12965. @url{http://tech.ebu.ch/loudness}.
  12966. The filter accepts the following options:
  12967. @table @option
  12968. @item video
  12969. Activate the video output. The audio stream is passed unchanged whether this
  12970. option is set or no. The video stream will be the first output stream if
  12971. activated. Default is @code{0}.
  12972. @item size
  12973. Set the video size. This option is for video only. For the syntax of this
  12974. option, check the
  12975. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12976. Default and minimum resolution is @code{640x480}.
  12977. @item meter
  12978. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  12979. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  12980. other integer value between this range is allowed.
  12981. @item metadata
  12982. Set metadata injection. If set to @code{1}, the audio input will be segmented
  12983. into 100ms output frames, each of them containing various loudness information
  12984. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  12985. Default is @code{0}.
  12986. @item framelog
  12987. Force the frame logging level.
  12988. Available values are:
  12989. @table @samp
  12990. @item info
  12991. information logging level
  12992. @item verbose
  12993. verbose logging level
  12994. @end table
  12995. By default, the logging level is set to @var{info}. If the @option{video} or
  12996. the @option{metadata} options are set, it switches to @var{verbose}.
  12997. @item peak
  12998. Set peak mode(s).
  12999. Available modes can be cumulated (the option is a @code{flag} type). Possible
  13000. values are:
  13001. @table @samp
  13002. @item none
  13003. Disable any peak mode (default).
  13004. @item sample
  13005. Enable sample-peak mode.
  13006. Simple peak mode looking for the higher sample value. It logs a message
  13007. for sample-peak (identified by @code{SPK}).
  13008. @item true
  13009. Enable true-peak mode.
  13010. If enabled, the peak lookup is done on an over-sampled version of the input
  13011. stream for better peak accuracy. It logs a message for true-peak.
  13012. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  13013. This mode requires a build with @code{libswresample}.
  13014. @end table
  13015. @item dualmono
  13016. Treat mono input files as "dual mono". If a mono file is intended for playback
  13017. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  13018. If set to @code{true}, this option will compensate for this effect.
  13019. Multi-channel input files are not affected by this option.
  13020. @item panlaw
  13021. Set a specific pan law to be used for the measurement of dual mono files.
  13022. This parameter is optional, and has a default value of -3.01dB.
  13023. @end table
  13024. @subsection Examples
  13025. @itemize
  13026. @item
  13027. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  13028. @example
  13029. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  13030. @end example
  13031. @item
  13032. Run an analysis with @command{ffmpeg}:
  13033. @example
  13034. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  13035. @end example
  13036. @end itemize
  13037. @section interleave, ainterleave
  13038. Temporally interleave frames from several inputs.
  13039. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  13040. These filters read frames from several inputs and send the oldest
  13041. queued frame to the output.
  13042. Input streams must have well defined, monotonically increasing frame
  13043. timestamp values.
  13044. In order to submit one frame to output, these filters need to enqueue
  13045. at least one frame for each input, so they cannot work in case one
  13046. input is not yet terminated and will not receive incoming frames.
  13047. For example consider the case when one input is a @code{select} filter
  13048. which always drops input frames. The @code{interleave} filter will keep
  13049. reading from that input, but it will never be able to send new frames
  13050. to output until the input sends an end-of-stream signal.
  13051. Also, depending on inputs synchronization, the filters will drop
  13052. frames in case one input receives more frames than the other ones, and
  13053. the queue is already filled.
  13054. These filters accept the following options:
  13055. @table @option
  13056. @item nb_inputs, n
  13057. Set the number of different inputs, it is 2 by default.
  13058. @end table
  13059. @subsection Examples
  13060. @itemize
  13061. @item
  13062. Interleave frames belonging to different streams using @command{ffmpeg}:
  13063. @example
  13064. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  13065. @end example
  13066. @item
  13067. Add flickering blur effect:
  13068. @example
  13069. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  13070. @end example
  13071. @end itemize
  13072. @section metadata, ametadata
  13073. Manipulate frame metadata.
  13074. This filter accepts the following options:
  13075. @table @option
  13076. @item mode
  13077. Set mode of operation of the filter.
  13078. Can be one of the following:
  13079. @table @samp
  13080. @item select
  13081. If both @code{value} and @code{key} is set, select frames
  13082. which have such metadata. If only @code{key} is set, select
  13083. every frame that has such key in metadata.
  13084. @item add
  13085. Add new metadata @code{key} and @code{value}. If key is already available
  13086. do nothing.
  13087. @item modify
  13088. Modify value of already present key.
  13089. @item delete
  13090. If @code{value} is set, delete only keys that have such value.
  13091. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  13092. the frame.
  13093. @item print
  13094. Print key and its value if metadata was found. If @code{key} is not set print all
  13095. metadata values available in frame.
  13096. @end table
  13097. @item key
  13098. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  13099. @item value
  13100. Set metadata value which will be used. This option is mandatory for
  13101. @code{modify} and @code{add} mode.
  13102. @item function
  13103. Which function to use when comparing metadata value and @code{value}.
  13104. Can be one of following:
  13105. @table @samp
  13106. @item same_str
  13107. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  13108. @item starts_with
  13109. Values are interpreted as strings, returns true if metadata value starts with
  13110. the @code{value} option string.
  13111. @item less
  13112. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  13113. @item equal
  13114. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  13115. @item greater
  13116. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  13117. @item expr
  13118. Values are interpreted as floats, returns true if expression from option @code{expr}
  13119. evaluates to true.
  13120. @end table
  13121. @item expr
  13122. Set expression which is used when @code{function} is set to @code{expr}.
  13123. The expression is evaluated through the eval API and can contain the following
  13124. constants:
  13125. @table @option
  13126. @item VALUE1
  13127. Float representation of @code{value} from metadata key.
  13128. @item VALUE2
  13129. Float representation of @code{value} as supplied by user in @code{value} option.
  13130. @end table
  13131. @item file
  13132. If specified in @code{print} mode, output is written to the named file. Instead of
  13133. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  13134. for standard output. If @code{file} option is not set, output is written to the log
  13135. with AV_LOG_INFO loglevel.
  13136. @end table
  13137. @subsection Examples
  13138. @itemize
  13139. @item
  13140. Print all metadata values for frames with key @code{lavfi.singnalstats.YDIF} with values
  13141. between 0 and 1.
  13142. @example
  13143. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  13144. @end example
  13145. @item
  13146. Print silencedetect output to file @file{metadata.txt}.
  13147. @example
  13148. silencedetect,ametadata=mode=print:file=metadata.txt
  13149. @end example
  13150. @item
  13151. Direct all metadata to a pipe with file descriptor 4.
  13152. @example
  13153. metadata=mode=print:file='pipe\:4'
  13154. @end example
  13155. @end itemize
  13156. @section perms, aperms
  13157. Set read/write permissions for the output frames.
  13158. These filters are mainly aimed at developers to test direct path in the
  13159. following filter in the filtergraph.
  13160. The filters accept the following options:
  13161. @table @option
  13162. @item mode
  13163. Select the permissions mode.
  13164. It accepts the following values:
  13165. @table @samp
  13166. @item none
  13167. Do nothing. This is the default.
  13168. @item ro
  13169. Set all the output frames read-only.
  13170. @item rw
  13171. Set all the output frames directly writable.
  13172. @item toggle
  13173. Make the frame read-only if writable, and writable if read-only.
  13174. @item random
  13175. Set each output frame read-only or writable randomly.
  13176. @end table
  13177. @item seed
  13178. Set the seed for the @var{random} mode, must be an integer included between
  13179. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  13180. @code{-1}, the filter will try to use a good random seed on a best effort
  13181. basis.
  13182. @end table
  13183. Note: in case of auto-inserted filter between the permission filter and the
  13184. following one, the permission might not be received as expected in that
  13185. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  13186. perms/aperms filter can avoid this problem.
  13187. @section realtime, arealtime
  13188. Slow down filtering to match real time approximatively.
  13189. These filters will pause the filtering for a variable amount of time to
  13190. match the output rate with the input timestamps.
  13191. They are similar to the @option{re} option to @code{ffmpeg}.
  13192. They accept the following options:
  13193. @table @option
  13194. @item limit
  13195. Time limit for the pauses. Any pause longer than that will be considered
  13196. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  13197. @end table
  13198. @anchor{select}
  13199. @section select, aselect
  13200. Select frames to pass in output.
  13201. This filter accepts the following options:
  13202. @table @option
  13203. @item expr, e
  13204. Set expression, which is evaluated for each input frame.
  13205. If the expression is evaluated to zero, the frame is discarded.
  13206. If the evaluation result is negative or NaN, the frame is sent to the
  13207. first output; otherwise it is sent to the output with index
  13208. @code{ceil(val)-1}, assuming that the input index starts from 0.
  13209. For example a value of @code{1.2} corresponds to the output with index
  13210. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  13211. @item outputs, n
  13212. Set the number of outputs. The output to which to send the selected
  13213. frame is based on the result of the evaluation. Default value is 1.
  13214. @end table
  13215. The expression can contain the following constants:
  13216. @table @option
  13217. @item n
  13218. The (sequential) number of the filtered frame, starting from 0.
  13219. @item selected_n
  13220. The (sequential) number of the selected frame, starting from 0.
  13221. @item prev_selected_n
  13222. The sequential number of the last selected frame. It's NAN if undefined.
  13223. @item TB
  13224. The timebase of the input timestamps.
  13225. @item pts
  13226. The PTS (Presentation TimeStamp) of the filtered video frame,
  13227. expressed in @var{TB} units. It's NAN if undefined.
  13228. @item t
  13229. The PTS of the filtered video frame,
  13230. expressed in seconds. It's NAN if undefined.
  13231. @item prev_pts
  13232. The PTS of the previously filtered video frame. It's NAN if undefined.
  13233. @item prev_selected_pts
  13234. The PTS of the last previously filtered video frame. It's NAN if undefined.
  13235. @item prev_selected_t
  13236. The PTS of the last previously selected video frame. It's NAN if undefined.
  13237. @item start_pts
  13238. The PTS of the first video frame in the video. It's NAN if undefined.
  13239. @item start_t
  13240. The time of the first video frame in the video. It's NAN if undefined.
  13241. @item pict_type @emph{(video only)}
  13242. The type of the filtered frame. It can assume one of the following
  13243. values:
  13244. @table @option
  13245. @item I
  13246. @item P
  13247. @item B
  13248. @item S
  13249. @item SI
  13250. @item SP
  13251. @item BI
  13252. @end table
  13253. @item interlace_type @emph{(video only)}
  13254. The frame interlace type. It can assume one of the following values:
  13255. @table @option
  13256. @item PROGRESSIVE
  13257. The frame is progressive (not interlaced).
  13258. @item TOPFIRST
  13259. The frame is top-field-first.
  13260. @item BOTTOMFIRST
  13261. The frame is bottom-field-first.
  13262. @end table
  13263. @item consumed_sample_n @emph{(audio only)}
  13264. the number of selected samples before the current frame
  13265. @item samples_n @emph{(audio only)}
  13266. the number of samples in the current frame
  13267. @item sample_rate @emph{(audio only)}
  13268. the input sample rate
  13269. @item key
  13270. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  13271. @item pos
  13272. the position in the file of the filtered frame, -1 if the information
  13273. is not available (e.g. for synthetic video)
  13274. @item scene @emph{(video only)}
  13275. value between 0 and 1 to indicate a new scene; a low value reflects a low
  13276. probability for the current frame to introduce a new scene, while a higher
  13277. value means the current frame is more likely to be one (see the example below)
  13278. @item concatdec_select
  13279. The concat demuxer can select only part of a concat input file by setting an
  13280. inpoint and an outpoint, but the output packets may not be entirely contained
  13281. in the selected interval. By using this variable, it is possible to skip frames
  13282. generated by the concat demuxer which are not exactly contained in the selected
  13283. interval.
  13284. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  13285. and the @var{lavf.concat.duration} packet metadata values which are also
  13286. present in the decoded frames.
  13287. The @var{concatdec_select} variable is -1 if the frame pts is at least
  13288. start_time and either the duration metadata is missing or the frame pts is less
  13289. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  13290. missing.
  13291. That basically means that an input frame is selected if its pts is within the
  13292. interval set by the concat demuxer.
  13293. @end table
  13294. The default value of the select expression is "1".
  13295. @subsection Examples
  13296. @itemize
  13297. @item
  13298. Select all frames in input:
  13299. @example
  13300. select
  13301. @end example
  13302. The example above is the same as:
  13303. @example
  13304. select=1
  13305. @end example
  13306. @item
  13307. Skip all frames:
  13308. @example
  13309. select=0
  13310. @end example
  13311. @item
  13312. Select only I-frames:
  13313. @example
  13314. select='eq(pict_type\,I)'
  13315. @end example
  13316. @item
  13317. Select one frame every 100:
  13318. @example
  13319. select='not(mod(n\,100))'
  13320. @end example
  13321. @item
  13322. Select only frames contained in the 10-20 time interval:
  13323. @example
  13324. select=between(t\,10\,20)
  13325. @end example
  13326. @item
  13327. Select only I-frames contained in the 10-20 time interval:
  13328. @example
  13329. select=between(t\,10\,20)*eq(pict_type\,I)
  13330. @end example
  13331. @item
  13332. Select frames with a minimum distance of 10 seconds:
  13333. @example
  13334. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  13335. @end example
  13336. @item
  13337. Use aselect to select only audio frames with samples number > 100:
  13338. @example
  13339. aselect='gt(samples_n\,100)'
  13340. @end example
  13341. @item
  13342. Create a mosaic of the first scenes:
  13343. @example
  13344. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  13345. @end example
  13346. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  13347. choice.
  13348. @item
  13349. Send even and odd frames to separate outputs, and compose them:
  13350. @example
  13351. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  13352. @end example
  13353. @item
  13354. Select useful frames from an ffconcat file which is using inpoints and
  13355. outpoints but where the source files are not intra frame only.
  13356. @example
  13357. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  13358. @end example
  13359. @end itemize
  13360. @section sendcmd, asendcmd
  13361. Send commands to filters in the filtergraph.
  13362. These filters read commands to be sent to other filters in the
  13363. filtergraph.
  13364. @code{sendcmd} must be inserted between two video filters,
  13365. @code{asendcmd} must be inserted between two audio filters, but apart
  13366. from that they act the same way.
  13367. The specification of commands can be provided in the filter arguments
  13368. with the @var{commands} option, or in a file specified by the
  13369. @var{filename} option.
  13370. These filters accept the following options:
  13371. @table @option
  13372. @item commands, c
  13373. Set the commands to be read and sent to the other filters.
  13374. @item filename, f
  13375. Set the filename of the commands to be read and sent to the other
  13376. filters.
  13377. @end table
  13378. @subsection Commands syntax
  13379. A commands description consists of a sequence of interval
  13380. specifications, comprising a list of commands to be executed when a
  13381. particular event related to that interval occurs. The occurring event
  13382. is typically the current frame time entering or leaving a given time
  13383. interval.
  13384. An interval is specified by the following syntax:
  13385. @example
  13386. @var{START}[-@var{END}] @var{COMMANDS};
  13387. @end example
  13388. The time interval is specified by the @var{START} and @var{END} times.
  13389. @var{END} is optional and defaults to the maximum time.
  13390. The current frame time is considered within the specified interval if
  13391. it is included in the interval [@var{START}, @var{END}), that is when
  13392. the time is greater or equal to @var{START} and is lesser than
  13393. @var{END}.
  13394. @var{COMMANDS} consists of a sequence of one or more command
  13395. specifications, separated by ",", relating to that interval. The
  13396. syntax of a command specification is given by:
  13397. @example
  13398. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  13399. @end example
  13400. @var{FLAGS} is optional and specifies the type of events relating to
  13401. the time interval which enable sending the specified command, and must
  13402. be a non-null sequence of identifier flags separated by "+" or "|" and
  13403. enclosed between "[" and "]".
  13404. The following flags are recognized:
  13405. @table @option
  13406. @item enter
  13407. The command is sent when the current frame timestamp enters the
  13408. specified interval. In other words, the command is sent when the
  13409. previous frame timestamp was not in the given interval, and the
  13410. current is.
  13411. @item leave
  13412. The command is sent when the current frame timestamp leaves the
  13413. specified interval. In other words, the command is sent when the
  13414. previous frame timestamp was in the given interval, and the
  13415. current is not.
  13416. @end table
  13417. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  13418. assumed.
  13419. @var{TARGET} specifies the target of the command, usually the name of
  13420. the filter class or a specific filter instance name.
  13421. @var{COMMAND} specifies the name of the command for the target filter.
  13422. @var{ARG} is optional and specifies the optional list of argument for
  13423. the given @var{COMMAND}.
  13424. Between one interval specification and another, whitespaces, or
  13425. sequences of characters starting with @code{#} until the end of line,
  13426. are ignored and can be used to annotate comments.
  13427. A simplified BNF description of the commands specification syntax
  13428. follows:
  13429. @example
  13430. @var{COMMAND_FLAG} ::= "enter" | "leave"
  13431. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  13432. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  13433. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  13434. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  13435. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  13436. @end example
  13437. @subsection Examples
  13438. @itemize
  13439. @item
  13440. Specify audio tempo change at second 4:
  13441. @example
  13442. asendcmd=c='4.0 atempo tempo 1.5',atempo
  13443. @end example
  13444. @item
  13445. Target a specific filter instance:
  13446. @example
  13447. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  13448. @end example
  13449. @item
  13450. Specify a list of drawtext and hue commands in a file.
  13451. @example
  13452. # show text in the interval 5-10
  13453. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  13454. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  13455. # desaturate the image in the interval 15-20
  13456. 15.0-20.0 [enter] hue s 0,
  13457. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  13458. [leave] hue s 1,
  13459. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  13460. # apply an exponential saturation fade-out effect, starting from time 25
  13461. 25 [enter] hue s exp(25-t)
  13462. @end example
  13463. A filtergraph allowing to read and process the above command list
  13464. stored in a file @file{test.cmd}, can be specified with:
  13465. @example
  13466. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  13467. @end example
  13468. @end itemize
  13469. @anchor{setpts}
  13470. @section setpts, asetpts
  13471. Change the PTS (presentation timestamp) of the input frames.
  13472. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  13473. This filter accepts the following options:
  13474. @table @option
  13475. @item expr
  13476. The expression which is evaluated for each frame to construct its timestamp.
  13477. @end table
  13478. The expression is evaluated through the eval API and can contain the following
  13479. constants:
  13480. @table @option
  13481. @item FRAME_RATE
  13482. frame rate, only defined for constant frame-rate video
  13483. @item PTS
  13484. The presentation timestamp in input
  13485. @item N
  13486. The count of the input frame for video or the number of consumed samples,
  13487. not including the current frame for audio, starting from 0.
  13488. @item NB_CONSUMED_SAMPLES
  13489. The number of consumed samples, not including the current frame (only
  13490. audio)
  13491. @item NB_SAMPLES, S
  13492. The number of samples in the current frame (only audio)
  13493. @item SAMPLE_RATE, SR
  13494. The audio sample rate.
  13495. @item STARTPTS
  13496. The PTS of the first frame.
  13497. @item STARTT
  13498. the time in seconds of the first frame
  13499. @item INTERLACED
  13500. State whether the current frame is interlaced.
  13501. @item T
  13502. the time in seconds of the current frame
  13503. @item POS
  13504. original position in the file of the frame, or undefined if undefined
  13505. for the current frame
  13506. @item PREV_INPTS
  13507. The previous input PTS.
  13508. @item PREV_INT
  13509. previous input time in seconds
  13510. @item PREV_OUTPTS
  13511. The previous output PTS.
  13512. @item PREV_OUTT
  13513. previous output time in seconds
  13514. @item RTCTIME
  13515. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  13516. instead.
  13517. @item RTCSTART
  13518. The wallclock (RTC) time at the start of the movie in microseconds.
  13519. @item TB
  13520. The timebase of the input timestamps.
  13521. @end table
  13522. @subsection Examples
  13523. @itemize
  13524. @item
  13525. Start counting PTS from zero
  13526. @example
  13527. setpts=PTS-STARTPTS
  13528. @end example
  13529. @item
  13530. Apply fast motion effect:
  13531. @example
  13532. setpts=0.5*PTS
  13533. @end example
  13534. @item
  13535. Apply slow motion effect:
  13536. @example
  13537. setpts=2.0*PTS
  13538. @end example
  13539. @item
  13540. Set fixed rate of 25 frames per second:
  13541. @example
  13542. setpts=N/(25*TB)
  13543. @end example
  13544. @item
  13545. Set fixed rate 25 fps with some jitter:
  13546. @example
  13547. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  13548. @end example
  13549. @item
  13550. Apply an offset of 10 seconds to the input PTS:
  13551. @example
  13552. setpts=PTS+10/TB
  13553. @end example
  13554. @item
  13555. Generate timestamps from a "live source" and rebase onto the current timebase:
  13556. @example
  13557. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  13558. @end example
  13559. @item
  13560. Generate timestamps by counting samples:
  13561. @example
  13562. asetpts=N/SR/TB
  13563. @end example
  13564. @end itemize
  13565. @section settb, asettb
  13566. Set the timebase to use for the output frames timestamps.
  13567. It is mainly useful for testing timebase configuration.
  13568. It accepts the following parameters:
  13569. @table @option
  13570. @item expr, tb
  13571. The expression which is evaluated into the output timebase.
  13572. @end table
  13573. The value for @option{tb} is an arithmetic expression representing a
  13574. rational. The expression can contain the constants "AVTB" (the default
  13575. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  13576. audio only). Default value is "intb".
  13577. @subsection Examples
  13578. @itemize
  13579. @item
  13580. Set the timebase to 1/25:
  13581. @example
  13582. settb=expr=1/25
  13583. @end example
  13584. @item
  13585. Set the timebase to 1/10:
  13586. @example
  13587. settb=expr=0.1
  13588. @end example
  13589. @item
  13590. Set the timebase to 1001/1000:
  13591. @example
  13592. settb=1+0.001
  13593. @end example
  13594. @item
  13595. Set the timebase to 2*intb:
  13596. @example
  13597. settb=2*intb
  13598. @end example
  13599. @item
  13600. Set the default timebase value:
  13601. @example
  13602. settb=AVTB
  13603. @end example
  13604. @end itemize
  13605. @section showcqt
  13606. Convert input audio to a video output representing frequency spectrum
  13607. logarithmically using Brown-Puckette constant Q transform algorithm with
  13608. direct frequency domain coefficient calculation (but the transform itself
  13609. is not really constant Q, instead the Q factor is actually variable/clamped),
  13610. with musical tone scale, from E0 to D#10.
  13611. The filter accepts the following options:
  13612. @table @option
  13613. @item size, s
  13614. Specify the video size for the output. It must be even. For the syntax of this option,
  13615. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13616. Default value is @code{1920x1080}.
  13617. @item fps, rate, r
  13618. Set the output frame rate. Default value is @code{25}.
  13619. @item bar_h
  13620. Set the bargraph height. It must be even. Default value is @code{-1} which
  13621. computes the bargraph height automatically.
  13622. @item axis_h
  13623. Set the axis height. It must be even. Default value is @code{-1} which computes
  13624. the axis height automatically.
  13625. @item sono_h
  13626. Set the sonogram height. It must be even. Default value is @code{-1} which
  13627. computes the sonogram height automatically.
  13628. @item fullhd
  13629. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  13630. instead. Default value is @code{1}.
  13631. @item sono_v, volume
  13632. Specify the sonogram volume expression. It can contain variables:
  13633. @table @option
  13634. @item bar_v
  13635. the @var{bar_v} evaluated expression
  13636. @item frequency, freq, f
  13637. the frequency where it is evaluated
  13638. @item timeclamp, tc
  13639. the value of @var{timeclamp} option
  13640. @end table
  13641. and functions:
  13642. @table @option
  13643. @item a_weighting(f)
  13644. A-weighting of equal loudness
  13645. @item b_weighting(f)
  13646. B-weighting of equal loudness
  13647. @item c_weighting(f)
  13648. C-weighting of equal loudness.
  13649. @end table
  13650. Default value is @code{16}.
  13651. @item bar_v, volume2
  13652. Specify the bargraph volume expression. It can contain variables:
  13653. @table @option
  13654. @item sono_v
  13655. the @var{sono_v} evaluated expression
  13656. @item frequency, freq, f
  13657. the frequency where it is evaluated
  13658. @item timeclamp, tc
  13659. the value of @var{timeclamp} option
  13660. @end table
  13661. and functions:
  13662. @table @option
  13663. @item a_weighting(f)
  13664. A-weighting of equal loudness
  13665. @item b_weighting(f)
  13666. B-weighting of equal loudness
  13667. @item c_weighting(f)
  13668. C-weighting of equal loudness.
  13669. @end table
  13670. Default value is @code{sono_v}.
  13671. @item sono_g, gamma
  13672. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  13673. higher gamma makes the spectrum having more range. Default value is @code{3}.
  13674. Acceptable range is @code{[1, 7]}.
  13675. @item bar_g, gamma2
  13676. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  13677. @code{[1, 7]}.
  13678. @item bar_t
  13679. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  13680. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  13681. @item timeclamp, tc
  13682. Specify the transform timeclamp. At low frequency, there is trade-off between
  13683. accuracy in time domain and frequency domain. If timeclamp is lower,
  13684. event in time domain is represented more accurately (such as fast bass drum),
  13685. otherwise event in frequency domain is represented more accurately
  13686. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  13687. @item attack
  13688. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  13689. limits future samples by applying asymmetric windowing in time domain, useful
  13690. when low latency is required. Accepted range is @code{[0, 1]}.
  13691. @item basefreq
  13692. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  13693. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  13694. @item endfreq
  13695. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  13696. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  13697. @item coeffclamp
  13698. This option is deprecated and ignored.
  13699. @item tlength
  13700. Specify the transform length in time domain. Use this option to control accuracy
  13701. trade-off between time domain and frequency domain at every frequency sample.
  13702. It can contain variables:
  13703. @table @option
  13704. @item frequency, freq, f
  13705. the frequency where it is evaluated
  13706. @item timeclamp, tc
  13707. the value of @var{timeclamp} option.
  13708. @end table
  13709. Default value is @code{384*tc/(384+tc*f)}.
  13710. @item count
  13711. Specify the transform count for every video frame. Default value is @code{6}.
  13712. Acceptable range is @code{[1, 30]}.
  13713. @item fcount
  13714. Specify the transform count for every single pixel. Default value is @code{0},
  13715. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  13716. @item fontfile
  13717. Specify font file for use with freetype to draw the axis. If not specified,
  13718. use embedded font. Note that drawing with font file or embedded font is not
  13719. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  13720. option instead.
  13721. @item font
  13722. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  13723. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  13724. @item fontcolor
  13725. Specify font color expression. This is arithmetic expression that should return
  13726. integer value 0xRRGGBB. It can contain variables:
  13727. @table @option
  13728. @item frequency, freq, f
  13729. the frequency where it is evaluated
  13730. @item timeclamp, tc
  13731. the value of @var{timeclamp} option
  13732. @end table
  13733. and functions:
  13734. @table @option
  13735. @item midi(f)
  13736. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  13737. @item r(x), g(x), b(x)
  13738. red, green, and blue value of intensity x.
  13739. @end table
  13740. Default value is @code{st(0, (midi(f)-59.5)/12);
  13741. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  13742. r(1-ld(1)) + b(ld(1))}.
  13743. @item axisfile
  13744. Specify image file to draw the axis. This option override @var{fontfile} and
  13745. @var{fontcolor} option.
  13746. @item axis, text
  13747. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  13748. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  13749. Default value is @code{1}.
  13750. @item csp
  13751. Set colorspace. The accepted values are:
  13752. @table @samp
  13753. @item unspecified
  13754. Unspecified (default)
  13755. @item bt709
  13756. BT.709
  13757. @item fcc
  13758. FCC
  13759. @item bt470bg
  13760. BT.470BG or BT.601-6 625
  13761. @item smpte170m
  13762. SMPTE-170M or BT.601-6 525
  13763. @item smpte240m
  13764. SMPTE-240M
  13765. @item bt2020ncl
  13766. BT.2020 with non-constant luminance
  13767. @end table
  13768. @item cscheme
  13769. Set spectrogram color scheme. This is list of floating point values with format
  13770. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  13771. The default is @code{1|0.5|0|0|0.5|1}.
  13772. @end table
  13773. @subsection Examples
  13774. @itemize
  13775. @item
  13776. Playing audio while showing the spectrum:
  13777. @example
  13778. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  13779. @end example
  13780. @item
  13781. Same as above, but with frame rate 30 fps:
  13782. @example
  13783. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  13784. @end example
  13785. @item
  13786. Playing at 1280x720:
  13787. @example
  13788. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  13789. @end example
  13790. @item
  13791. Disable sonogram display:
  13792. @example
  13793. sono_h=0
  13794. @end example
  13795. @item
  13796. A1 and its harmonics: A1, A2, (near)E3, A3:
  13797. @example
  13798. 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),
  13799. asplit[a][out1]; [a] showcqt [out0]'
  13800. @end example
  13801. @item
  13802. Same as above, but with more accuracy in frequency domain:
  13803. @example
  13804. 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),
  13805. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  13806. @end example
  13807. @item
  13808. Custom volume:
  13809. @example
  13810. bar_v=10:sono_v=bar_v*a_weighting(f)
  13811. @end example
  13812. @item
  13813. Custom gamma, now spectrum is linear to the amplitude.
  13814. @example
  13815. bar_g=2:sono_g=2
  13816. @end example
  13817. @item
  13818. Custom tlength equation:
  13819. @example
  13820. 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)))'
  13821. @end example
  13822. @item
  13823. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  13824. @example
  13825. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  13826. @end example
  13827. @item
  13828. Custom font using fontconfig:
  13829. @example
  13830. font='Courier New,Monospace,mono|bold'
  13831. @end example
  13832. @item
  13833. Custom frequency range with custom axis using image file:
  13834. @example
  13835. axisfile=myaxis.png:basefreq=40:endfreq=10000
  13836. @end example
  13837. @end itemize
  13838. @section showfreqs
  13839. Convert input audio to video output representing the audio power spectrum.
  13840. Audio amplitude is on Y-axis while frequency is on X-axis.
  13841. The filter accepts the following options:
  13842. @table @option
  13843. @item size, s
  13844. Specify size of video. For the syntax of this option, check the
  13845. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13846. Default is @code{1024x512}.
  13847. @item mode
  13848. Set display mode.
  13849. This set how each frequency bin will be represented.
  13850. It accepts the following values:
  13851. @table @samp
  13852. @item line
  13853. @item bar
  13854. @item dot
  13855. @end table
  13856. Default is @code{bar}.
  13857. @item ascale
  13858. Set amplitude scale.
  13859. It accepts the following values:
  13860. @table @samp
  13861. @item lin
  13862. Linear scale.
  13863. @item sqrt
  13864. Square root scale.
  13865. @item cbrt
  13866. Cubic root scale.
  13867. @item log
  13868. Logarithmic scale.
  13869. @end table
  13870. Default is @code{log}.
  13871. @item fscale
  13872. Set frequency scale.
  13873. It accepts the following values:
  13874. @table @samp
  13875. @item lin
  13876. Linear scale.
  13877. @item log
  13878. Logarithmic scale.
  13879. @item rlog
  13880. Reverse logarithmic scale.
  13881. @end table
  13882. Default is @code{lin}.
  13883. @item win_size
  13884. Set window size.
  13885. It accepts the following values:
  13886. @table @samp
  13887. @item w16
  13888. @item w32
  13889. @item w64
  13890. @item w128
  13891. @item w256
  13892. @item w512
  13893. @item w1024
  13894. @item w2048
  13895. @item w4096
  13896. @item w8192
  13897. @item w16384
  13898. @item w32768
  13899. @item w65536
  13900. @end table
  13901. Default is @code{w2048}
  13902. @item win_func
  13903. Set windowing function.
  13904. It accepts the following values:
  13905. @table @samp
  13906. @item rect
  13907. @item bartlett
  13908. @item hanning
  13909. @item hamming
  13910. @item blackman
  13911. @item welch
  13912. @item flattop
  13913. @item bharris
  13914. @item bnuttall
  13915. @item bhann
  13916. @item sine
  13917. @item nuttall
  13918. @item lanczos
  13919. @item gauss
  13920. @item tukey
  13921. @item dolph
  13922. @item cauchy
  13923. @item parzen
  13924. @item poisson
  13925. @end table
  13926. Default is @code{hanning}.
  13927. @item overlap
  13928. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  13929. which means optimal overlap for selected window function will be picked.
  13930. @item averaging
  13931. Set time averaging. Setting this to 0 will display current maximal peaks.
  13932. Default is @code{1}, which means time averaging is disabled.
  13933. @item colors
  13934. Specify list of colors separated by space or by '|' which will be used to
  13935. draw channel frequencies. Unrecognized or missing colors will be replaced
  13936. by white color.
  13937. @item cmode
  13938. Set channel display mode.
  13939. It accepts the following values:
  13940. @table @samp
  13941. @item combined
  13942. @item separate
  13943. @end table
  13944. Default is @code{combined}.
  13945. @item minamp
  13946. Set minimum amplitude used in @code{log} amplitude scaler.
  13947. @end table
  13948. @anchor{showspectrum}
  13949. @section showspectrum
  13950. Convert input audio to a video output, representing the audio frequency
  13951. spectrum.
  13952. The filter accepts the following options:
  13953. @table @option
  13954. @item size, s
  13955. Specify the video size for the output. For the syntax of this option, check the
  13956. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13957. Default value is @code{640x512}.
  13958. @item slide
  13959. Specify how the spectrum should slide along the window.
  13960. It accepts the following values:
  13961. @table @samp
  13962. @item replace
  13963. the samples start again on the left when they reach the right
  13964. @item scroll
  13965. the samples scroll from right to left
  13966. @item fullframe
  13967. frames are only produced when the samples reach the right
  13968. @item rscroll
  13969. the samples scroll from left to right
  13970. @end table
  13971. Default value is @code{replace}.
  13972. @item mode
  13973. Specify display mode.
  13974. It accepts the following values:
  13975. @table @samp
  13976. @item combined
  13977. all channels are displayed in the same row
  13978. @item separate
  13979. all channels are displayed in separate rows
  13980. @end table
  13981. Default value is @samp{combined}.
  13982. @item color
  13983. Specify display color mode.
  13984. It accepts the following values:
  13985. @table @samp
  13986. @item channel
  13987. each channel is displayed in a separate color
  13988. @item intensity
  13989. each channel is displayed using the same color scheme
  13990. @item rainbow
  13991. each channel is displayed using the rainbow color scheme
  13992. @item moreland
  13993. each channel is displayed using the moreland color scheme
  13994. @item nebulae
  13995. each channel is displayed using the nebulae color scheme
  13996. @item fire
  13997. each channel is displayed using the fire color scheme
  13998. @item fiery
  13999. each channel is displayed using the fiery color scheme
  14000. @item fruit
  14001. each channel is displayed using the fruit color scheme
  14002. @item cool
  14003. each channel is displayed using the cool color scheme
  14004. @end table
  14005. Default value is @samp{channel}.
  14006. @item scale
  14007. Specify scale used for calculating intensity color values.
  14008. It accepts the following values:
  14009. @table @samp
  14010. @item lin
  14011. linear
  14012. @item sqrt
  14013. square root, default
  14014. @item cbrt
  14015. cubic root
  14016. @item log
  14017. logarithmic
  14018. @item 4thrt
  14019. 4th root
  14020. @item 5thrt
  14021. 5th root
  14022. @end table
  14023. Default value is @samp{sqrt}.
  14024. @item saturation
  14025. Set saturation modifier for displayed colors. Negative values provide
  14026. alternative color scheme. @code{0} is no saturation at all.
  14027. Saturation must be in [-10.0, 10.0] range.
  14028. Default value is @code{1}.
  14029. @item win_func
  14030. Set window function.
  14031. It accepts the following values:
  14032. @table @samp
  14033. @item rect
  14034. @item bartlett
  14035. @item hann
  14036. @item hanning
  14037. @item hamming
  14038. @item blackman
  14039. @item welch
  14040. @item flattop
  14041. @item bharris
  14042. @item bnuttall
  14043. @item bhann
  14044. @item sine
  14045. @item nuttall
  14046. @item lanczos
  14047. @item gauss
  14048. @item tukey
  14049. @item dolph
  14050. @item cauchy
  14051. @item parzen
  14052. @item poisson
  14053. @end table
  14054. Default value is @code{hann}.
  14055. @item orientation
  14056. Set orientation of time vs frequency axis. Can be @code{vertical} or
  14057. @code{horizontal}. Default is @code{vertical}.
  14058. @item overlap
  14059. Set ratio of overlap window. Default value is @code{0}.
  14060. When value is @code{1} overlap is set to recommended size for specific
  14061. window function currently used.
  14062. @item gain
  14063. Set scale gain for calculating intensity color values.
  14064. Default value is @code{1}.
  14065. @item data
  14066. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  14067. @item rotation
  14068. Set color rotation, must be in [-1.0, 1.0] range.
  14069. Default value is @code{0}.
  14070. @end table
  14071. The usage is very similar to the showwaves filter; see the examples in that
  14072. section.
  14073. @subsection Examples
  14074. @itemize
  14075. @item
  14076. Large window with logarithmic color scaling:
  14077. @example
  14078. showspectrum=s=1280x480:scale=log
  14079. @end example
  14080. @item
  14081. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  14082. @example
  14083. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  14084. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  14085. @end example
  14086. @end itemize
  14087. @section showspectrumpic
  14088. Convert input audio to a single video frame, representing the audio frequency
  14089. spectrum.
  14090. The filter accepts the following options:
  14091. @table @option
  14092. @item size, s
  14093. Specify the video size for the output. For the syntax of this option, check the
  14094. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14095. Default value is @code{4096x2048}.
  14096. @item mode
  14097. Specify display mode.
  14098. It accepts the following values:
  14099. @table @samp
  14100. @item combined
  14101. all channels are displayed in the same row
  14102. @item separate
  14103. all channels are displayed in separate rows
  14104. @end table
  14105. Default value is @samp{combined}.
  14106. @item color
  14107. Specify display color mode.
  14108. It accepts the following values:
  14109. @table @samp
  14110. @item channel
  14111. each channel is displayed in a separate color
  14112. @item intensity
  14113. each channel is displayed using the same color scheme
  14114. @item rainbow
  14115. each channel is displayed using the rainbow color scheme
  14116. @item moreland
  14117. each channel is displayed using the moreland color scheme
  14118. @item nebulae
  14119. each channel is displayed using the nebulae color scheme
  14120. @item fire
  14121. each channel is displayed using the fire color scheme
  14122. @item fiery
  14123. each channel is displayed using the fiery color scheme
  14124. @item fruit
  14125. each channel is displayed using the fruit color scheme
  14126. @item cool
  14127. each channel is displayed using the cool color scheme
  14128. @end table
  14129. Default value is @samp{intensity}.
  14130. @item scale
  14131. Specify scale used for calculating intensity color values.
  14132. It accepts the following values:
  14133. @table @samp
  14134. @item lin
  14135. linear
  14136. @item sqrt
  14137. square root, default
  14138. @item cbrt
  14139. cubic root
  14140. @item log
  14141. logarithmic
  14142. @item 4thrt
  14143. 4th root
  14144. @item 5thrt
  14145. 5th root
  14146. @end table
  14147. Default value is @samp{log}.
  14148. @item saturation
  14149. Set saturation modifier for displayed colors. Negative values provide
  14150. alternative color scheme. @code{0} is no saturation at all.
  14151. Saturation must be in [-10.0, 10.0] range.
  14152. Default value is @code{1}.
  14153. @item win_func
  14154. Set window function.
  14155. It accepts the following values:
  14156. @table @samp
  14157. @item rect
  14158. @item bartlett
  14159. @item hann
  14160. @item hanning
  14161. @item hamming
  14162. @item blackman
  14163. @item welch
  14164. @item flattop
  14165. @item bharris
  14166. @item bnuttall
  14167. @item bhann
  14168. @item sine
  14169. @item nuttall
  14170. @item lanczos
  14171. @item gauss
  14172. @item tukey
  14173. @item dolph
  14174. @item cauchy
  14175. @item parzen
  14176. @item poisson
  14177. @end table
  14178. Default value is @code{hann}.
  14179. @item orientation
  14180. Set orientation of time vs frequency axis. Can be @code{vertical} or
  14181. @code{horizontal}. Default is @code{vertical}.
  14182. @item gain
  14183. Set scale gain for calculating intensity color values.
  14184. Default value is @code{1}.
  14185. @item legend
  14186. Draw time and frequency axes and legends. Default is enabled.
  14187. @item rotation
  14188. Set color rotation, must be in [-1.0, 1.0] range.
  14189. Default value is @code{0}.
  14190. @end table
  14191. @subsection Examples
  14192. @itemize
  14193. @item
  14194. Extract an audio spectrogram of a whole audio track
  14195. in a 1024x1024 picture using @command{ffmpeg}:
  14196. @example
  14197. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  14198. @end example
  14199. @end itemize
  14200. @section showvolume
  14201. Convert input audio volume to a video output.
  14202. The filter accepts the following options:
  14203. @table @option
  14204. @item rate, r
  14205. Set video rate.
  14206. @item b
  14207. Set border width, allowed range is [0, 5]. Default is 1.
  14208. @item w
  14209. Set channel width, allowed range is [80, 8192]. Default is 400.
  14210. @item h
  14211. Set channel height, allowed range is [1, 900]. Default is 20.
  14212. @item f
  14213. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  14214. @item c
  14215. Set volume color expression.
  14216. The expression can use the following variables:
  14217. @table @option
  14218. @item VOLUME
  14219. Current max volume of channel in dB.
  14220. @item PEAK
  14221. Current peak.
  14222. @item CHANNEL
  14223. Current channel number, starting from 0.
  14224. @end table
  14225. @item t
  14226. If set, displays channel names. Default is enabled.
  14227. @item v
  14228. If set, displays volume values. Default is enabled.
  14229. @item o
  14230. Set orientation, can be @code{horizontal} or @code{vertical},
  14231. default is @code{horizontal}.
  14232. @item s
  14233. Set step size, allowed range s [0, 5]. Default is 0, which means
  14234. step is disabled.
  14235. @end table
  14236. @section showwaves
  14237. Convert input audio to a video output, representing the samples waves.
  14238. The filter accepts the following options:
  14239. @table @option
  14240. @item size, s
  14241. Specify the video size for the output. For the syntax of this option, check the
  14242. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14243. Default value is @code{600x240}.
  14244. @item mode
  14245. Set display mode.
  14246. Available values are:
  14247. @table @samp
  14248. @item point
  14249. Draw a point for each sample.
  14250. @item line
  14251. Draw a vertical line for each sample.
  14252. @item p2p
  14253. Draw a point for each sample and a line between them.
  14254. @item cline
  14255. Draw a centered vertical line for each sample.
  14256. @end table
  14257. Default value is @code{point}.
  14258. @item n
  14259. Set the number of samples which are printed on the same column. A
  14260. larger value will decrease the frame rate. Must be a positive
  14261. integer. This option can be set only if the value for @var{rate}
  14262. is not explicitly specified.
  14263. @item rate, r
  14264. Set the (approximate) output frame rate. This is done by setting the
  14265. option @var{n}. Default value is "25".
  14266. @item split_channels
  14267. Set if channels should be drawn separately or overlap. Default value is 0.
  14268. @item colors
  14269. Set colors separated by '|' which are going to be used for drawing of each channel.
  14270. @item scale
  14271. Set amplitude scale.
  14272. Available values are:
  14273. @table @samp
  14274. @item lin
  14275. Linear.
  14276. @item log
  14277. Logarithmic.
  14278. @item sqrt
  14279. Square root.
  14280. @item cbrt
  14281. Cubic root.
  14282. @end table
  14283. Default is linear.
  14284. @end table
  14285. @subsection Examples
  14286. @itemize
  14287. @item
  14288. Output the input file audio and the corresponding video representation
  14289. at the same time:
  14290. @example
  14291. amovie=a.mp3,asplit[out0],showwaves[out1]
  14292. @end example
  14293. @item
  14294. Create a synthetic signal and show it with showwaves, forcing a
  14295. frame rate of 30 frames per second:
  14296. @example
  14297. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  14298. @end example
  14299. @end itemize
  14300. @section showwavespic
  14301. Convert input audio to a single video frame, representing the samples waves.
  14302. The filter accepts the following options:
  14303. @table @option
  14304. @item size, s
  14305. Specify the video size for the output. For the syntax of this option, check the
  14306. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14307. Default value is @code{600x240}.
  14308. @item split_channels
  14309. Set if channels should be drawn separately or overlap. Default value is 0.
  14310. @item colors
  14311. Set colors separated by '|' which are going to be used for drawing of each channel.
  14312. @item scale
  14313. Set amplitude scale.
  14314. Available values are:
  14315. @table @samp
  14316. @item lin
  14317. Linear.
  14318. @item log
  14319. Logarithmic.
  14320. @item sqrt
  14321. Square root.
  14322. @item cbrt
  14323. Cubic root.
  14324. @end table
  14325. Default is linear.
  14326. @end table
  14327. @subsection Examples
  14328. @itemize
  14329. @item
  14330. Extract a channel split representation of the wave form of a whole audio track
  14331. in a 1024x800 picture using @command{ffmpeg}:
  14332. @example
  14333. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  14334. @end example
  14335. @end itemize
  14336. @section sidedata, asidedata
  14337. Delete frame side data, or select frames based on it.
  14338. This filter accepts the following options:
  14339. @table @option
  14340. @item mode
  14341. Set mode of operation of the filter.
  14342. Can be one of the following:
  14343. @table @samp
  14344. @item select
  14345. Select every frame with side data of @code{type}.
  14346. @item delete
  14347. Delete side data of @code{type}. If @code{type} is not set, delete all side
  14348. data in the frame.
  14349. @end table
  14350. @item type
  14351. Set side data type used with all modes. Must be set for @code{select} mode. For
  14352. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  14353. in @file{libavutil/frame.h}. For example, to choose
  14354. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  14355. @end table
  14356. @section spectrumsynth
  14357. Sythesize audio from 2 input video spectrums, first input stream represents
  14358. magnitude across time and second represents phase across time.
  14359. The filter will transform from frequency domain as displayed in videos back
  14360. to time domain as presented in audio output.
  14361. This filter is primarily created for reversing processed @ref{showspectrum}
  14362. filter outputs, but can synthesize sound from other spectrograms too.
  14363. But in such case results are going to be poor if the phase data is not
  14364. available, because in such cases phase data need to be recreated, usually
  14365. its just recreated from random noise.
  14366. For best results use gray only output (@code{channel} color mode in
  14367. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  14368. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  14369. @code{data} option. Inputs videos should generally use @code{fullframe}
  14370. slide mode as that saves resources needed for decoding video.
  14371. The filter accepts the following options:
  14372. @table @option
  14373. @item sample_rate
  14374. Specify sample rate of output audio, the sample rate of audio from which
  14375. spectrum was generated may differ.
  14376. @item channels
  14377. Set number of channels represented in input video spectrums.
  14378. @item scale
  14379. Set scale which was used when generating magnitude input spectrum.
  14380. Can be @code{lin} or @code{log}. Default is @code{log}.
  14381. @item slide
  14382. Set slide which was used when generating inputs spectrums.
  14383. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  14384. Default is @code{fullframe}.
  14385. @item win_func
  14386. Set window function used for resynthesis.
  14387. @item overlap
  14388. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  14389. which means optimal overlap for selected window function will be picked.
  14390. @item orientation
  14391. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  14392. Default is @code{vertical}.
  14393. @end table
  14394. @subsection Examples
  14395. @itemize
  14396. @item
  14397. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  14398. then resynthesize videos back to audio with spectrumsynth:
  14399. @example
  14400. 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
  14401. 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
  14402. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  14403. @end example
  14404. @end itemize
  14405. @section split, asplit
  14406. Split input into several identical outputs.
  14407. @code{asplit} works with audio input, @code{split} with video.
  14408. The filter accepts a single parameter which specifies the number of outputs. If
  14409. unspecified, it defaults to 2.
  14410. @subsection Examples
  14411. @itemize
  14412. @item
  14413. Create two separate outputs from the same input:
  14414. @example
  14415. [in] split [out0][out1]
  14416. @end example
  14417. @item
  14418. To create 3 or more outputs, you need to specify the number of
  14419. outputs, like in:
  14420. @example
  14421. [in] asplit=3 [out0][out1][out2]
  14422. @end example
  14423. @item
  14424. Create two separate outputs from the same input, one cropped and
  14425. one padded:
  14426. @example
  14427. [in] split [splitout1][splitout2];
  14428. [splitout1] crop=100:100:0:0 [cropout];
  14429. [splitout2] pad=200:200:100:100 [padout];
  14430. @end example
  14431. @item
  14432. Create 5 copies of the input audio with @command{ffmpeg}:
  14433. @example
  14434. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  14435. @end example
  14436. @end itemize
  14437. @section zmq, azmq
  14438. Receive commands sent through a libzmq client, and forward them to
  14439. filters in the filtergraph.
  14440. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  14441. must be inserted between two video filters, @code{azmq} between two
  14442. audio filters.
  14443. To enable these filters you need to install the libzmq library and
  14444. headers and configure FFmpeg with @code{--enable-libzmq}.
  14445. For more information about libzmq see:
  14446. @url{http://www.zeromq.org/}
  14447. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  14448. receives messages sent through a network interface defined by the
  14449. @option{bind_address} option.
  14450. The received message must be in the form:
  14451. @example
  14452. @var{TARGET} @var{COMMAND} [@var{ARG}]
  14453. @end example
  14454. @var{TARGET} specifies the target of the command, usually the name of
  14455. the filter class or a specific filter instance name.
  14456. @var{COMMAND} specifies the name of the command for the target filter.
  14457. @var{ARG} is optional and specifies the optional argument list for the
  14458. given @var{COMMAND}.
  14459. Upon reception, the message is processed and the corresponding command
  14460. is injected into the filtergraph. Depending on the result, the filter
  14461. will send a reply to the client, adopting the format:
  14462. @example
  14463. @var{ERROR_CODE} @var{ERROR_REASON}
  14464. @var{MESSAGE}
  14465. @end example
  14466. @var{MESSAGE} is optional.
  14467. @subsection Examples
  14468. Look at @file{tools/zmqsend} for an example of a zmq client which can
  14469. be used to send commands processed by these filters.
  14470. Consider the following filtergraph generated by @command{ffplay}
  14471. @example
  14472. ffplay -dumpgraph 1 -f lavfi "
  14473. color=s=100x100:c=red [l];
  14474. color=s=100x100:c=blue [r];
  14475. nullsrc=s=200x100, zmq [bg];
  14476. [bg][l] overlay [bg+l];
  14477. [bg+l][r] overlay=x=100 "
  14478. @end example
  14479. To change the color of the left side of the video, the following
  14480. command can be used:
  14481. @example
  14482. echo Parsed_color_0 c yellow | tools/zmqsend
  14483. @end example
  14484. To change the right side:
  14485. @example
  14486. echo Parsed_color_1 c pink | tools/zmqsend
  14487. @end example
  14488. @c man end MULTIMEDIA FILTERS
  14489. @chapter Multimedia Sources
  14490. @c man begin MULTIMEDIA SOURCES
  14491. Below is a description of the currently available multimedia sources.
  14492. @section amovie
  14493. This is the same as @ref{movie} source, except it selects an audio
  14494. stream by default.
  14495. @anchor{movie}
  14496. @section movie
  14497. Read audio and/or video stream(s) from a movie container.
  14498. It accepts the following parameters:
  14499. @table @option
  14500. @item filename
  14501. The name of the resource to read (not necessarily a file; it can also be a
  14502. device or a stream accessed through some protocol).
  14503. @item format_name, f
  14504. Specifies the format assumed for the movie to read, and can be either
  14505. the name of a container or an input device. If not specified, the
  14506. format is guessed from @var{movie_name} or by probing.
  14507. @item seek_point, sp
  14508. Specifies the seek point in seconds. The frames will be output
  14509. starting from this seek point. The parameter is evaluated with
  14510. @code{av_strtod}, so the numerical value may be suffixed by an IS
  14511. postfix. The default value is "0".
  14512. @item streams, s
  14513. Specifies the streams to read. Several streams can be specified,
  14514. separated by "+". The source will then have as many outputs, in the
  14515. same order. The syntax is explained in the ``Stream specifiers''
  14516. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  14517. respectively the default (best suited) video and audio stream. Default
  14518. is "dv", or "da" if the filter is called as "amovie".
  14519. @item stream_index, si
  14520. Specifies the index of the video stream to read. If the value is -1,
  14521. the most suitable video stream will be automatically selected. The default
  14522. value is "-1". Deprecated. If the filter is called "amovie", it will select
  14523. audio instead of video.
  14524. @item loop
  14525. Specifies how many times to read the stream in sequence.
  14526. If the value is 0, the stream will be looped infinitely.
  14527. Default value is "1".
  14528. Note that when the movie is looped the source timestamps are not
  14529. changed, so it will generate non monotonically increasing timestamps.
  14530. @item discontinuity
  14531. Specifies the time difference between frames above which the point is
  14532. considered a timestamp discontinuity which is removed by adjusting the later
  14533. timestamps.
  14534. @end table
  14535. It allows overlaying a second video on top of the main input of
  14536. a filtergraph, as shown in this graph:
  14537. @example
  14538. input -----------> deltapts0 --> overlay --> output
  14539. ^
  14540. |
  14541. movie --> scale--> deltapts1 -------+
  14542. @end example
  14543. @subsection Examples
  14544. @itemize
  14545. @item
  14546. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  14547. on top of the input labelled "in":
  14548. @example
  14549. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  14550. [in] setpts=PTS-STARTPTS [main];
  14551. [main][over] overlay=16:16 [out]
  14552. @end example
  14553. @item
  14554. Read from a video4linux2 device, and overlay it on top of the input
  14555. labelled "in":
  14556. @example
  14557. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  14558. [in] setpts=PTS-STARTPTS [main];
  14559. [main][over] overlay=16:16 [out]
  14560. @end example
  14561. @item
  14562. Read the first video stream and the audio stream with id 0x81 from
  14563. dvd.vob; the video is connected to the pad named "video" and the audio is
  14564. connected to the pad named "audio":
  14565. @example
  14566. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  14567. @end example
  14568. @end itemize
  14569. @subsection Commands
  14570. Both movie and amovie support the following commands:
  14571. @table @option
  14572. @item seek
  14573. Perform seek using "av_seek_frame".
  14574. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  14575. @itemize
  14576. @item
  14577. @var{stream_index}: If stream_index is -1, a default
  14578. stream is selected, and @var{timestamp} is automatically converted
  14579. from AV_TIME_BASE units to the stream specific time_base.
  14580. @item
  14581. @var{timestamp}: Timestamp in AVStream.time_base units
  14582. or, if no stream is specified, in AV_TIME_BASE units.
  14583. @item
  14584. @var{flags}: Flags which select direction and seeking mode.
  14585. @end itemize
  14586. @item get_duration
  14587. Get movie duration in AV_TIME_BASE units.
  14588. @end table
  14589. @c man end MULTIMEDIA SOURCES